Package org.jclouds.openstack.neutron.v2

Examples of org.jclouds.openstack.neutron.v2.NeutronApiMetadata$Builder


      MockWebServer server = mockOpenStackServer();
      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(200).setBody(stringFromResource("/subnet_update_response.json"))));

      try {
         NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
         SubnetApi api = neutronApi.getSubnetApi("RegionOne");

         Subnet.UpdateOptions updateSubnet = Subnet.updateOptions()
               .name("new_name")
               .gatewayIp("10.0.3.254")
               .build();
View Full Code Here


      MockWebServer server = mockOpenStackServer();
      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(404)));

      try {
         NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
         SubnetApi api = neutronApi.getSubnetApi("RegionOne");

         Subnet.UpdateOptions updateSubnet = Subnet.updateOptions()
               .name("new_name")
               .gatewayIp("10.0.3.254")
               .build();
View Full Code Here

      MockWebServer server = mockOpenStackServer();
      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(200)));

      try {
         NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
         SubnetApi api = neutronApi.getSubnetApi("RegionOne");

         boolean result = api.delete("12345");

         /*
          * Check request
View Full Code Here

      MockWebServer server = mockOpenStackServer();
      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(404)));

      try {
         NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
         SubnetApi api = neutronApi.getSubnetApi("RegionOne");

         boolean result = api.delete("12345");

         /*
          * Check request
View Full Code Here

      MockWebServer server = mockOpenStackServer();
      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(201).setBody(stringFromResource("/network_create_response.json"))));

      try {
         NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
         NetworkApi api = neutronApi.getNetworkApi("RegionOne");

         Network.CreateOptions createNetwork = Network.createOptions("jclouds-wibble")
               .networkType(NetworkType.LOCAL)
               .build();
View Full Code Here

      MockWebServer server = mockOpenStackServer();
      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(404).setBody(stringFromResource("/network_create_response.json"))));

      try {
         NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
         NetworkApi api = neutronApi.getNetworkApi("RegionOne");

         Network.CreateOptions createNetwork = Network.createOptions("jclouds-wibble")
               .networkType(NetworkType.LOCAL)
               .build();
View Full Code Here

      MockWebServer server = mockOpenStackServer();
      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(200).setBody(stringFromResource("/network_list_response_paged1.json"))));

      try {
         NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
         NetworkApi api = neutronApi.getNetworkApi("RegionOne");

         Networks networks = api.list(PaginationOptions.Builder.limit(2).marker("abcdefg"));

         /*
          * Check request
View Full Code Here

      MockWebServer server = mockOpenStackServer();
      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(404).setBody(stringFromResource("/network_list_response_paged1.json"))));

      try {
         NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
         NetworkApi api = neutronApi.getNetworkApi("RegionOne");

         Networks networks = api.list(PaginationOptions.Builder.limit(2).marker("abcdefg"));

         /*
          * Check request
View Full Code Here

      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(200).setBody(stringFromResource("/network_list_response_paged1.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(200).setBody(stringFromResource("/network_list_response_paged2.json"))));

      try {
         NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
         NetworkApi api = neutronApi.getNetworkApi("RegionOne");

         // Note: Lazy! Have to actually look at the collection.
         List<Network> networks = api.list().concat().toList();
         assertEquals(networks.size(), 4);
         // look at last element
View Full Code Here

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()));
      }
   }
View Full Code Here

TOP

Related Classes of org.jclouds.openstack.neutron.v2.NeutronApiMetadata$Builder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.