Package org.jclouds.openstack.neutron.v2.domain

Examples of org.jclouds.openstack.neutron.v2.domain.Network


      server.enqueue(addCommonHeaders(
            new MockResponse().setResponseCode(201)));

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

         boolean result = api.removeInterfaceForPort("12345", "portid");

         /*
          * Check request
          */
         assertAuthentication(server);
View Full Code Here


      server.enqueue(addCommonHeaders(
            new MockResponse().setResponseCode(404)));

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

         boolean result = api.removeInterfaceForPort("12345", "portid");

         /*
          * Check request
          */
         assertAuthentication(server);
View Full Code Here

   }

   @Override
   protected Function<Object, IterableWithMarker<Network>> markerToNextForArg0(Optional<Object> arg0) {
      String region = arg0.isPresent() ? arg0.get().toString() : null;
      final NetworkApi networkApi = api.getNetworkApi(region);
      return new Function<Object, IterableWithMarker<Network>>() {

         @SuppressWarnings("unchecked")
         @Override
         public IterableWithMarker<Network> apply(Object input) {
            PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
            return IterableWithMarker.class.cast(networkApi.list(paginationOptions));
         }

         @Override
         public String toString() {
            return "listNetworks()";
View Full Code Here

   }

   @Override
   protected Function<Object, IterableWithMarker<Port>> markerToNextForArg0(Optional<Object> arg0) {
      String region = arg0.isPresent() ? arg0.get().toString() : null;
      final PortApi portApi = api.getPortApi(region);
      return new Function<Object, IterableWithMarker<Port>>() {

         @SuppressWarnings("unchecked")
         @Override
         public IterableWithMarker<Port> apply(Object input) {
            PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
            return IterableWithMarker.class.cast(portApi.list(paginationOptions));
         }

         @Override
         public String toString() {
            return "listPortsInDetail()";
View Full Code Here

   }

   @Override
   protected Function<Object, IterableWithMarker<Subnet>> markerToNextForArg0(Optional<Object> arg0) {
      String region = arg0.isPresent() ? arg0.get().toString() : null;
      final SubnetApi subnetApi = api.getSubnetApi(region);
      return new Function<Object, IterableWithMarker<Subnet>>() {

         @SuppressWarnings("unchecked")
         @Override
         public IterableWithMarker<Subnet> apply(Object input) {
            PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
            return IterableWithMarker.class.cast(subnetApi.list(paginationOptions));
         }

         @Override
         public String toString() {
            return "listSubnets()";
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

TOP

Related Classes of org.jclouds.openstack.neutron.v2.domain.Network

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.