Package org.jclouds.openstack.neutron.v2_0.domain

Examples of org.jclouds.openstack.neutron.v2_0.domain.Subnet


         PortApi portApi = api.getPortApiForZone(zone);

         Network network = networkApi.create(CreateNetworkOptions.builder().name("jclouds-network-test").external(true).networkType(NetworkType.LOCAL).build());
         assertNotNull(network);

         Subnet subnet = subnetApi.create(network.getId(), 4, "192.168.0.0/16");
         assertNotNull(subnet);

         Network network2 = networkApi.create(CreateNetworkOptions.builder().name("jclouds-network-test2").external(true).networkType(NetworkType.LOCAL).build());
         assertNotNull(network2);

         Subnet subnet2 = subnetApi.create(network2.getId(), 4, "192.169.0.0/16");
         assertNotNull(subnet2);

         Port port = portApi.create(network.getId());
         assertNotNull(port);

         Port port2 = portApi.create(network2.getId());
         assertNotNull(port2);

         Router router = routerApi.create(CreateRouterOptions.builder().name("jclouds-router-test").build());
         assertNotNull(router);

         RouterInterface routerInterface = routerApi.addInterfaceForPort(router.getId(), port.getId());
         assertNotNull(routerInterface);

         RouterInterface routerInterface2 = routerApi.addInterfaceForPort(router.getId(), port2.getId());
         assertNotNull(routerInterface2);

         assertTrue(routerApi.removeInterfaceForPort(router.getId(), port.getId()));
         assertTrue(routerApi.removeInterfaceForPort(router.getId(), port2.getId()));
         assertTrue(routerApi.delete(router.getId()));
         assertTrue(subnetApi.delete(subnet.getId()));
         assertTrue(networkApi.delete(network.getId()));
         assertTrue(subnetApi.delete(subnet2.getId()));
         assertTrue(networkApi.delete(network2.getId()));

      }
   }
View Full Code Here


         keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess,
         authenticatedGET().endpoint(endpoint + "/subnets/624312ff-d14b-4ba3-9834-1c78d23d574d").build(),
         HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/subnet.json", APPLICATION_JSON)).build())
         .getSubnetApiForZone(ZONE);

      Subnet subnet = api.get("624312ff-d14b-4ba3-9834-1c78d23d574d");
      assertEquals(subnet, new ParseSubnetTest().expected());
   }
View Full Code Here

         authenticatedGET().endpoint(endpoint + "/subnets").method("POST")
            .payload(payloadFromStringWithContentType("{\"subnet\":{\"network_id\":\"1234567890\",\"ip_version\":4,\"cidr\":\"10.0.3.0/24\",\"name\":\"subnet-test\"}}", APPLICATION_JSON)).build(),
         HttpResponse.builder().statusCode(200).payload(payloadFromStringWithContentType("{\"subnet\":{\"id\":\"12345\",\"tenant_id\":\"6789\",\"network_id\":\"1234567890\",\"ip_version\":4,\"cidr\":\"10.0.3.0/24\",\"name\":\"subnet-test\"}}", APPLICATION_JSON)).build())
         .getSubnetApiForZone(ZONE);

      Subnet net = api.create("1234567890", 4, "10.0.3.0/24", CreateSubnetOptions.builder().name("subnet-test").build());
      assertEquals(net, Subnet.builder().id("12345").tenantId("6789").name("subnet-test").networkId("1234567890").ipVersion(4).cidr("10.0.3.0/24").build());
   }
View Full Code Here

      }

      @Override
      protected Function<Object, IterableWithMarker<ReferenceWithName>> markerToNextForArg0(Optional<Object> arg0) {
         String zone = arg0.isPresent() ? arg0.get().toString() : null;
         final RouterApi routerApi = api.getRouterExtensionForZone(zone).get();
         return new Function<Object, IterableWithMarker<ReferenceWithName>>() {

            @SuppressWarnings("unchecked")
            @Override
            public IterableWithMarker<ReferenceWithName> apply(Object input) {
               return IterableWithMarker.class.cast(routerApi.list(marker(input.toString())));
            }

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

      }

      @Override
      protected Function<Object, IterableWithMarker<Router>> markerToNextForArg0(Optional<Object> arg0) {
         String zone = arg0.isPresent() ? arg0.get().toString() : null;
         final RouterApi routerApi = api.getRouterExtensionForZone(zone).get();
         return new Function<Object, IterableWithMarker<Router>>() {

            @SuppressWarnings("unchecked")
            @Override
            public IterableWithMarker<Router> apply(Object input) {
               return IterableWithMarker.class.cast(routerApi.listInDetail(marker(input.toString())));
            }

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

      }

      @Override
      protected Function<Object, IterableWithMarker<ReferenceWithName>> markerToNextForArg0(Optional<Object> arg0) {
         String zone = arg0.isPresent() ? arg0.get().toString() : null;
         final RouterApi routerApi = api.getRouterExtensionForZone(zone).get();
         return new Function<Object, IterableWithMarker<ReferenceWithName>>() {

            @SuppressWarnings("unchecked")
            @Override
            public IterableWithMarker<ReferenceWithName> apply(Object input) {
               return IterableWithMarker.class.cast(routerApi.list(marker(input.toString())));
            }

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

      }

      @Override
      protected Function<Object, IterableWithMarker<Router>> markerToNextForArg0(Optional<Object> arg0) {
         String zone = arg0.isPresent() ? arg0.get().toString() : null;
         final RouterApi routerApi = api.getRouterExtensionForZone(zone).get();
         return new Function<Object, IterableWithMarker<Router>>() {

            @SuppressWarnings("unchecked")
            @Override
            public IterableWithMarker<Router> apply(Object input) {
               return IterableWithMarker.class.cast(routerApi.listInDetail(marker(input.toString())));
            }

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

      }

      @Override
      protected Function<Object, IterableWithMarker<Network>> markerToNextForArg0(Optional<Object> arg0) {
         String zone = arg0.isPresent() ? arg0.get().toString() : null;
         final NetworkApi networkApi = api.getNetworkApiForZone(zone);
         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.listInDetail(paginationOptions));
            }

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

      }

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

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

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

      }

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

            @SuppressWarnings("unchecked")
            @Override
            public IterableWithMarker<ReferenceWithName> 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

TOP

Related Classes of org.jclouds.openstack.neutron.v2_0.domain.Subnet

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.