Package org.jclouds.openstack.neutron.v2_0

Examples of org.jclouds.openstack.neutron.v2_0.NeutronApi


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

      try {
         NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides);
         PortApi api = neutronApi.getPortApi("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);
         PortApi api = neutronApi.getPortApi("RegionOne");

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

         /*
          * Check request
View Full Code Here

         for (Network network : networks) {
            assertNotNull(network.getName());
            assertTrue(references.contains(ReferenceWithName.builder().id(network.getId()).tenantId(network.getTenantId()).name(network.getName()).build()));

            Network retrievedNetwork = api.getNetworkApiForZone(zone).get(network.getId());
            assertEquals(network, retrievedNetwork);
         }
      }
   }
View Full Code Here

   }

   public void testCreateUpdateAndDeleteNetwork() {
      for (String zone : api.getConfiguredZones()) {
         NetworkApi networkApi = api.getNetworkApiForZone(zone);
         Network net = networkApi.create(CreateNetworkOptions.builder().name("jclouds-test").networkType(NetworkType.LOCAL).build());
         Network test = networkApi.create();
         assertNotNull(net);

         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());
         assertTrue(networkApi.update(net.getId(), UpdateNetworkOptions.builder().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(CreateNetworkOptions.builder().name("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

         keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess,
         authenticatedGET().endpoint(endpoint + "/networks/16dba3bc-f3fa-4775-afdc-237e12c72f6a").build(),
         HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/network.json", APPLICATION_JSON)).build())
         .getNetworkApiForZone(ZONE);

      Network net = api.get("16dba3bc-f3fa-4775-afdc-237e12c72f6a");
      assertEquals(net, new ParseNetworkTest().expected());
   }
View Full Code Here

         authenticatedGET().endpoint(endpoint + "/networks").method("POST")
            .payload(payloadFromStringWithContentType("{\"network\":{\"name\":\"another-test\",\"router:external\":true,\"provider:network_type\":\"local\"}}", MediaType.APPLICATION_JSON)).build(),
         HttpResponse.builder().statusCode(200).payload(payloadFromStringWithContentType("{\"network\":{\"id\":\"12345\",\"tenant_id\":\"6789\",\"router:external\":true,\"provider:network_type\":\"local\"}}", APPLICATION_JSON)).build())
         .getNetworkApiForZone(ZONE);

      Network net = api.create(CreateNetworkOptions.builder().name("another-test").external(true).networkType(NetworkType.LOCAL).build());
      assertEquals(net, Network.builder().id("12345").tenantId("6789").external(true).networkType(NetworkType.LOCAL).build());
   }
View Full Code Here

         keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess,
         authenticatedGET().endpoint(endpoint + "/networks/16dba3bc-f3fa-4775-afdc-237e12c72f6a").build(),
         HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/network.json", APPLICATION_JSON)).build())
         .getNetworkApiForZone(ZONE);

      Network net = api.get("16dba3bc-f3fa-4775-afdc-237e12c72f6a");
      assertEquals(net, new ParseNetworkTest().expected());
   }
View Full Code Here

         authenticatedGET().endpoint(endpoint + "/networks").method("POST")
            .payload(payloadFromStringWithContentType("{\"network\":{\"name\":\"another-test\",\"router:external\":true,\"provider:network_type\":\"local\"}}", MediaType.APPLICATION_JSON)).build(),
         HttpResponse.builder().statusCode(200).payload(payloadFromStringWithContentType("{\"network\":{\"id\":\"12345\",\"tenant_id\":\"6789\",\"router:external\":true,\"provider:network_type\":\"local\"}}", APPLICATION_JSON)).build())
         .getNetworkApiForZone(ZONE);

      Network net = api.create(CreateNetworkOptions.builder().name("another-test").external(true).networkType(NetworkType.LOCAL).build());
      assertEquals(net, Network.builder().id("12345").tenantId("6789").external(true).networkType(NetworkType.LOCAL).build());
   }
View Full Code Here

         for (Network network : networks) {
            assertNotNull(network.getName());
            assertTrue(references.contains(ReferenceWithName.builder().id(network.getId()).tenantId(network.getTenantId()).name(network.getName()).build()));

            Network retrievedNetwork = api.getNetworkApiForZone(zone).get(network.getId());
            assertEquals(network, retrievedNetwork);
         }
      }
   }
View Full Code Here

   }

   public void testCreateUpdateAndDeleteNetwork() {
      for (String zone : api.getConfiguredZones()) {
         NetworkApi networkApi = api.getNetworkApiForZone(zone);
         Network net = networkApi.create(CreateNetworkOptions.builder().name("jclouds-test").networkType(NetworkType.LOCAL).build());
         Network test = networkApi.create();
         assertNotNull(net);

         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());
         assertTrue(networkApi.update(net.getId(), UpdateNetworkOptions.builder().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(CreateNetworkOptions.builder().name("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_0.NeutronApi

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.