Package org.jclouds.openstack.neutron.v2_0.features

Examples of org.jclouds.openstack.neutron.v2_0.features.PortApi


   }

   public void testCreateAndDeleteRouterInterfaceForSubnet() {
      for (String zone : api.getConfiguredZones()) {
         RouterApi routerApi = api.getRouterExtensionForZone(zone).get();
         NetworkApi networkApi = api.getNetworkApiForZone(zone);
         SubnetApi subnetApi = api.getSubnetApiForZone(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);

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

         RouterInterface routerInterface = routerApi.addInterfaceForSubnet(router.getId(), subnet.getId());
         assertNotNull(routerInterface);

         RouterInterface routerInterface2 = routerApi.addInterfaceForSubnet(router.getId(), subnet2.getId());
         assertNotNull(routerInterface2);

         assertTrue(routerApi.removeInterfaceForSubnet(router.getId(), subnet.getId()));
         assertTrue(routerApi.removeInterfaceForSubnet(router.getId(), subnet2.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


   }

   public void testCreateAndDeleteRouterInterfaceForPort() {
      for (String zone : api.getConfiguredZones()) {
         RouterApi routerApi = api.getRouterExtensionForZone(zone).get();
         NetworkApi networkApi = api.getNetworkApiForZone(zone);
         SubnetApi subnetApi = api.getSubnetApiForZone(zone);
         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

      }

      @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 "listNetworksInDetail()";
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

   }

   public void testCreateUpdateAndDeleteRouter() {
      for (String zone : api.getConfiguredZones()) {
         RouterApi routerApi = api.getRouterExtensionForZone(zone).get();
         NetworkApi networkApi = api.getNetworkApiForZone(zone);
         SubnetApi subnetApi = api.getSubnetApiForZone(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);

         Router ref = routerApi.create(CreateRouterOptions.builder().name("jclouds-router-test")
            .externalGatewayInfo(ExternalGatewayInfo.builder().networkId(network.getId()).build()).build());
         assertNotNull(ref);

         Router router = routerApi.get(ref.getId());

         assertEquals(router.getId(), ref.getId());
         assertEquals(router.getName(), "jclouds-router-test");
         assertEquals(router.getExternalGatewayInfo().getNetworkId(), network.getId());
         assertTrue(routerApi.update(router.getId(), UpdateRouterOptions.builder().name("jclouds-router-test-rename").build()));

         router = routerApi.get(ref.getId());

         assertEquals(router.getId(), ref.getId());
         assertEquals(router.getName(), "jclouds-router-test-rename");

         ReferenceWithName ref2 = routerApi.create(CreateRouterOptions.builder().name("jclouds-router-test2")
            .externalGatewayInfo(ExternalGatewayInfo.builder().networkId(network.getId()).build()).build());
         assertNotNull(ref2);

         assertTrue(routerApi.delete(ref.getId()));
         assertTrue(routerApi.delete(ref2.getId()));
         assertTrue(subnetApi.delete(subnet.getId()));
         assertTrue(networkApi.delete(network.getId()));
      }
   }
View Full Code Here

      }

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

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

      }

      @Override
      protected Function<Object, IterableWithMarker<ReferenceWithName>> markerToNextForArg0(Optional<Object> arg0) {
         String zone = arg0.isPresent() ? arg0.get().toString() : null;
         final PortApi portApi = api.getPortApiForZone(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(portApi.list(paginationOptions));
            }

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

   public void testCreateAndDeleteRouterInterfaceForPort() {
      for (String zone : api.getConfiguredZones()) {
         RouterApi routerApi = api.getRouterExtensionForZone(zone).get();
         NetworkApi networkApi = api.getNetworkApiForZone(zone);
         SubnetApi subnetApi = api.getSubnetApiForZone(zone);
         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);
View Full Code Here

TOP

Related Classes of org.jclouds.openstack.neutron.v2_0.features.PortApi

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.