Package org.jclouds.openstack.neutron.v2_0.extensions

Examples of org.jclouds.openstack.neutron.v2_0.extensions.RouterApi


         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

      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

      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

         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

         for (Port port : ports) {
            assertNotNull(port.getName());
            assertTrue(references.contains(ReferenceWithName.builder().id(port.getId()).tenantId(port.getTenantId()).name(port.getName()).build()));

            Port retrievedPort = api.getPortApiForZone(zone).get(port.getId());
            assertEquals(port, retrievedPort);
         }
      }
   }
View Full Code Here

         String ipv6PortId = portApi.create(networkId, CreatePortOptions.builder().name("JClouds-Live-IPv6-Port").fixedIps(getFixedAddresses(ipv6SubnetId)).build()).getId();

         assertNotNull(ipv4PortId);
         assertNotNull(ipv6PortId);

         Port ipv4Port = portApi.get(ipv4PortId);
         assertNotNull(ipv4Port);
         assertEquals(ipv4Port.getId(), ipv4PortId);
         assertEquals(ipv4Port.getName(), "JClouds-Live-IPv4-Port");

         Port ipv6Port = portApi.get(ipv6PortId);
         assertNotNull(ipv6Port);
         assertEquals(ipv6Port.getId(), ipv6PortId);
         assertEquals(ipv6Port.getName(), "JClouds-Live-IPv6-Port");

         assertTrue(portApi.update(ipv4PortId, UpdatePortOptions.builder().name("Updated").build()));
         Port updatedIpv4Port = portApi.get(ipv4PortId);
         assertEquals(updatedIpv4Port.getName(), "Updated");

         assertTrue(portApi.delete(ipv4PortId));
         assertTrue(portApi.delete(ipv6PortId));
         assertTrue(subnetApi.delete(ipv4SubnetId));
         assertTrue(subnetApi.delete(ipv6SubnetId));
View Full Code Here

         for (Port port : ports) {
            assertNotNull(port.getName());
            assertTrue(references.contains(ReferenceWithName.builder().id(port.getId()).tenantId(port.getTenantId()).name(port.getName()).build()));

            Port retrievedPort = api.getPortApiForZone(zone).get(port.getId());
            assertEquals(port, retrievedPort);
         }
      }
   }
View Full Code Here

         String ipv6PortId = portApi.create(networkId, CreatePortOptions.builder().name("JClouds-Live-IPv6-Port").fixedIps(getFixedAddresses(ipv6SubnetId)).build()).getId();

         assertNotNull(ipv4PortId);
         assertNotNull(ipv6PortId);

         Port ipv4Port = portApi.get(ipv4PortId);
         assertNotNull(ipv4Port);
         assertEquals(ipv4Port.getId(), ipv4PortId);
         assertEquals(ipv4Port.getName(), "JClouds-Live-IPv4-Port");

         Port ipv6Port = portApi.get(ipv6PortId);
         assertNotNull(ipv6Port);
         assertEquals(ipv6Port.getId(), ipv6PortId);
         assertEquals(ipv6Port.getName(), "JClouds-Live-IPv6-Port");

         assertTrue(portApi.update(ipv4PortId, UpdatePortOptions.builder().name("Updated").build()));
         Port updatedIpv4Port = portApi.get(ipv4PortId);
         assertEquals(updatedIpv4Port.getName(), "Updated");

         assertTrue(portApi.delete(ipv4PortId));
         assertTrue(portApi.delete(ipv6PortId));
         assertTrue(subnetApi.delete(ipv4SubnetId));
         assertTrue(subnetApi.delete(ipv6SubnetId));
View Full Code Here

         for (Port port : ports) {
            assertNotNull(port.getName());
            assertTrue(references.contains(ReferenceWithName.builder().id(port.getId()).tenantId(port.getTenantId()).name(port.getName()).build()));

            Port retrievedPort = api.getPortApiForZone(zone).get(port.getId());
            assertEquals(port, retrievedPort);
         }
      }
   }
View Full Code Here

TOP

Related Classes of org.jclouds.openstack.neutron.v2_0.extensions.RouterApi

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.