@Test
public void testCreateVlanIPRange() {
skipIfNotGlobalAdmin();
final Zone zone = Iterables.find(client.getZoneClient().listZones(), ZonePredicates.supportsAdvancedNetworks());
final NetworkOffering offering = find(client.getOfferingClient().listNetworkOfferings(),
NetworkOfferingPredicates.supportsGuestVirtualNetworks());
if (offering != null) {
Set<Network> suitableNetworks = Sets.filter(client.getNetworkClient().listNetworks(
zoneId(zone.getId()).isSystem(false).trafficType(TrafficType.GUEST)),
new Predicate<Network>() {
@Override
public boolean apply(Network network) {
return network.getNetworkOfferingId().equals(offering.getId());
}
});
if (suitableNetworks.size() > 0) {
network = Iterables.get(suitableNetworks, 0);
usingExistingNetwork = true;
} else if (network == null) {
network = client.getNetworkClient().createNetworkInZone(zone.getId(),
offering.getId(), "net-" + prefix, "jclouds test " + prefix);
usingExistingNetwork = false;
}
range = globalAdminClient.getVlanClient().createVlanIPRange("172.19.1.1", "172.19.1.199", CreateVlanIPRangeOptions.Builder
.accountInDomain(user.getAccount(), user.getDomainId())