public class NetworkApiLiveTest extends BaseNeutronApiLiveTest {
public void testCreateUpdateAndDeleteNetwork() {
for (String region : api.getConfiguredRegions()) {
NetworkApi networkApi = api.getNetworkApi(region);
Network net = networkApi.create(Network.createOptions("jclouds-test").networkType(NetworkType.LOCAL).build());
Network test = networkApi.create(Network.createOptions("jclouds-test").build());
assertNotNull(net);
/* List and get tests */
Network networkList = api.getNetworkApi(region).list().concat().toSet().iterator().next();
assertNotNull(networkList);
Network networkGet = api.getNetworkApi(region).get(networkList.getId());
assertEquals(networkList, networkGet);
/****/
Network network = networkApi.get(net.getId());
assertEquals(network.getId(), net.getId());
assertEquals(network.getName(), "jclouds-test");
assertEquals(network.getNetworkType(), NetworkType.LOCAL);
assertTrue(network.getSubnets().isEmpty());
assertNotNull(networkApi.update(net.getId(), Network.updateOptions().name("jclouds-live-test").build()));
network = networkApi.get(net.getId());
assertEquals(network.getId(), net.getId());
assertEquals(network.getName(), "jclouds-live-test");
assertTrue(network.getSubnets().isEmpty());
Network net2 = networkApi.create(Network.createOptions("jclouds-test2").networkType(NetworkType.LOCAL).build());
assertNotNull(net2);
assertTrue(networkApi.delete(net.getId()));
assertTrue(networkApi.delete(net2.getId()));
assertTrue(networkApi.delete(test.getId()));
}
}