AllocationPool.builder().start("a3:bc00::50").end("a3:bc00::90").build()
);
ImmutableSet<HostRoute> hostRoutes = ImmutableSet.of(
HostRoute.builder().destinationCidr("a3:bc00::/48").nextHop("a3:bc00::0004").build()
);
Subnet subnet = subnetApi.create(Subnet.createOptions(networkId, "a3:bc00::/48").ipVersion(6).allocationPools(allocationPools).hostRoutes(hostRoutes).build());
assertNotNull(subnet);
/* Test list and get */
Subnet subnetList = api.getSubnetApi(region).list().concat().toSet().iterator().next();
assertNotNull(subnetList);
Subnet subnetGet = api.getSubnetApi(region).get(subnetList.getId());
assertEquals(subnetList, subnetGet);
/***/
Subnet retrievedSubnet = subnetApi.get(subnet.getId());
assertEquals(retrievedSubnet.getId(), subnet.getId());
assertEquals(retrievedSubnet.getCidr(), "a3:bc00::/48");
assertTrue(retrievedSubnet.getDnsNameservers().isEmpty());
assertEquals(retrievedSubnet.getAllocationPools().size(), 2);
assertEquals(retrievedSubnet.getHostRoutes().size(), 1);
assertNotNull(subnetApi.update(retrievedSubnet.getId(), Subnet.updateOptions().name("jclouds-live-test-update").build()));
retrievedSubnet = subnetApi.get(retrievedSubnet.getId());
assertEquals(retrievedSubnet.getId(), subnet.getId());
assertEquals(retrievedSubnet.getName(), "jclouds-live-test-update");
assertTrue(retrievedSubnet.getDnsNameservers().isEmpty());
Subnet subnet2 = subnetApi.create(Subnet.createOptions(networkId, "a3:bd01::/48").ipVersion(6).build());
assertNotNull(subnet2);
assertTrue(subnetApi.delete(subnet.getId()));
assertTrue(subnetApi.delete(subnet2.getId()));
assertTrue(networkApi.delete(networkId));
}
}