public T fromNetworkOffering(NetworkOffering in) { return this .id(in.getId()) .name(in.getName()) .displayText(in.getDisplayText()) .created(in.getCreated()) .availability(in.getAvailability()) .maxConnections(in.getMaxConnections()) .isDefault(in.isDefault()) .supportsVLAN(in.supportsVLAN()) .trafficType(in.getTrafficType()) .guestIPType(in.getGuestIPType()) .networkRate(in.getNetworkRate()) .tags(in.getTags()); } }
public NetworkOffering build() { return new NetworkOffering(id, name, displayText, created, availability, maxConnections, isDefault, supportsVLAN, trafficType, guestIPType, networkRate, tags.build()); }
@Override public boolean apply(NetworkOffering arg0) { return arg0.getTrafficType() == TrafficType.GUEST && arg0.getGuestIPType() == GuestIPType.VIRTUAL; }
public String getNetworkOfferingWithName(String name) { Set<NetworkOffering> offerings = getOfferingClient().listNetworkOfferings(ListNetworkOfferingsOptions.Builder.name(name)); // above match is _containment_ not exact, so do further filtering for (NetworkOffering n : offerings) if (name.equals(n.getName())) return n.getId(); return null; }
public void testListNetworkOfferings() throws Exception { Set<NetworkOffering> response = client.getOfferingClient().listNetworkOfferings(); assert null != response; long offeringCount = response.size(); assertTrue(offeringCount >= 0); for (NetworkOffering offering : response) { NetworkOffering newDetails = Iterables.getOnlyElement(client.getOfferingClient().listNetworkOfferings( ListNetworkOfferingsOptions.Builder.id(offering.getId()))); assertEquals(offering, newDetails); assertEquals(offering, client.getOfferingClient().getNetworkOffering(offering.getId())); assert offering.getId() != null : offering; assert offering.getName() != null : offering; assert offering.getDisplayText() != null : offering; assert offering.getMaxConnections() == null || offering.getMaxConnections() > 0 : offering; assert offering.getTrafficType() != null && TrafficType.UNRECOGNIZED != offering.getTrafficType() : offering; assert offering.getTags() != null : offering; } } }
@Test(groups = "live", enabled = true) public void testUpdateNetworkOffering() throws Exception { skipIfNotGlobalAdmin(); NetworkOffering offering = getFirst(globalAdminClient.getOfferingClient().listNetworkOfferings(), null); assertNotNull(offering, "Unable to test, no network offering found."); String name = offering.getName(); NetworkOfferingAvailabilityType availability = offering.getAvailability(); try { NetworkOfferingAvailabilityType newValue = OPTIONAL; if (availability == OPTIONAL) { newValue = REQUIRED; } NetworkOffering updated = globalAdminClient.getOfferingClient().updateNetworkOffering(offering.getId(), UpdateNetworkOfferingOptions.Builder.name(prefix + name).availability(newValue)); assertEquals(updated.getName(), prefix + name); assertEquals(updated.getAvailability(), newValue); } finally { globalAdminClient.getOfferingClient().updateNetworkOffering(offering.getId(), UpdateNetworkOfferingOptions.Builder.name(name).availability(availability)); } }
@Override public int compareTo(NetworkOffering o) { return id.compareTo(o.getId()); }
@Override @SelectJson("networkoffering") public Set<NetworkOffering> expected() { return ImmutableSet.<NetworkOffering>of( NetworkOffering.builder().id("7").name("DefaultDirectNetworkOffering").displayText("Direct") .trafficType(TrafficType.PUBLIC).isDefault(true).supportsVLAN(false).availability(REQUIRED) .networkRate(200).build(), NetworkOffering.builder().id("6").name("DefaultVirtualizedNetworkOffering") .displayText("Virtual Vlan").trafficType(TrafficType.GUEST).isDefault(true).supportsVLAN(false) .availability(REQUIRED).networkRate(200).build()); }
public void testListNetworkOfferings() throws Exception { Set<NetworkOffering> response = client.getOfferingApi().listNetworkOfferings(); assert null != response; long offeringCount = response.size(); assertTrue(offeringCount >= 0); for (NetworkOffering offering : response) { NetworkOffering newDetails = Iterables.getOnlyElement(client.getOfferingApi().listNetworkOfferings( ListNetworkOfferingsOptions.Builder.id(offering.getId()))); assertEquals(offering, newDetails); assertEquals(offering, client.getOfferingApi().getNetworkOffering(offering.getId())); assert offering.getId() != null : offering; assert offering.getName() != null : offering; assert offering.getDisplayText() != null : offering; assert offering.getMaxConnections() == null || offering.getMaxConnections() > 0 : offering; assert offering.getTrafficType() != null && TrafficType.UNRECOGNIZED != offering.getTrafficType() : offering; assert offering.getTags() != null : offering; } } }
@Test(groups = "live", enabled = true) public void testUpdateNetworkOffering() throws Exception { skipIfNotGlobalAdmin(); NetworkOffering offering = getFirst(globalAdminClient.getOfferingApi().listNetworkOfferings(), null); assertNotNull(offering, "Unable to test, no network offering found."); String name = offering.getName(); NetworkOfferingAvailabilityType availability = offering.getAvailability(); try { NetworkOfferingAvailabilityType newValue = OPTIONAL; if (availability == OPTIONAL) { newValue = REQUIRED; } NetworkOffering updated = globalAdminClient.getOfferingApi().updateNetworkOffering(offering.getId(), UpdateNetworkOfferingOptions.Builder.name(prefix + name).availability(newValue)); assertEquals(updated.getName(), prefix + name); assertEquals(updated.getAvailability(), newValue); } finally { globalAdminClient.getOfferingApi().updateNetworkOffering(offering.getId(), UpdateNetworkOfferingOptions.Builder.name(name).availability(availability)); } }
@Override public int compareTo(NetworkOffering o) { return id.compareTo(o.getId()); }
@Override public boolean apply(NetworkOffering arg0) { return arg0.getTrafficType() == TrafficType.GUEST && arg0.getGuestIPType() == GuestIPType.VIRTUAL; }
@Override @SelectJson("networkoffering") public Set<NetworkOffering> expected() { return ImmutableSet.<NetworkOffering>of( NetworkOffering.builder().id("7").name("DefaultDirectNetworkOffering").displayText("Direct") .trafficType(TrafficType.PUBLIC).isDefault(true).supportsVLAN(false).availability(REQUIRED) .networkRate(200).build(), NetworkOffering.builder().id("6").name("DefaultVirtualizedNetworkOffering") .displayText("Virtual Vlan").trafficType(TrafficType.GUEST).isDefault(true).supportsVLAN(false) .availability(REQUIRED).networkRate(200).build()); }
public T fromNetworkOffering(NetworkOffering in) { return this .id(in.getId()) .name(in.getName()) .displayText(in.getDisplayText()) .created(in.getCreated()) .availability(in.getAvailability()) .maxConnections(in.getMaxConnections()) .isDefault(in.isDefault()) .supportsVLAN(in.supportsVLAN()) .trafficType(in.getTrafficType()) .guestIPType(in.getGuestIPType()) .networkRate(in.getNetworkRate()) .tags(in.getTags()); } }
@Override public int compareTo(NetworkOffering o) { return id.compareTo(o.getId()); }
@Override public boolean apply(NetworkOffering arg0) { return arg0.getTrafficType() == TrafficType.GUEST && arg0.getGuestIPType() == GuestIPType.VIRTUAL; }
public NetworkOffering build() { return new NetworkOffering(id, name, displayText, created, availability, maxConnections, isDefault, supportsVLAN, trafficType, guestIPType, networkRate, tags.build()); }
public T fromNetworkOffering(NetworkOffering in) { return this .id(in.getId()) .name(in.getName()) .displayText(in.getDisplayText()) .created(in.getCreated()) .availability(in.getAvailability()) .maxConnections(in.getMaxConnections()) .isDefault(in.isDefault()) .supportsVLAN(in.supportsVLAN()) .trafficType(in.getTrafficType()) .guestIPType(in.getGuestIPType()) .networkRate(in.getNetworkRate()) .tags(in.getTags()); } }
@Override public boolean apply(Network network) { return network.getNetworkOfferingId().equals(offering.getId()); } });
public NetworkOffering build() { return new NetworkOffering(id, name, displayText, created, availability, maxConnections, isDefault, supportsVLAN, trafficType, guestIPType, networkRate, tags.build()); }