Package org.jclouds.openstack.neutron.v2

Examples of org.jclouds.openstack.neutron.v2.NeutronApiMetadata


      for (String region : api.getConfiguredRegions()) {
         RouterApi routerApi = api.getRouterExtensionApi(region).get();
         NetworkApi networkApi = api.getNetworkApi(region);
         SubnetApi subnetApi = api.getSubnetApi(region);

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

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

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

         /* List and Get test */
         Set<Router> routers = api.getRouterExtensionApi(region).get().list().concat().toSet();
         Router routerList = routers.iterator().next();
         Router routerGet = api.getRouterExtensionApi(region).get().get(routerList.getId());

         assertNotNull(routerGet);
         assertEquals(routerGet, routerList);
         /***/

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

         assertEquals(routerGet.getName(), router.getName());
         assertEquals(routerGet.getId(), router.getId());
         assertEquals(routerGet.getExternalGatewayInfo(), router.getExternalGatewayInfo());

         Router routerUpdate = routerApi.update(router.getId(), Router.updateOptions().name("jclouds-router-test-rename").build());
         assertNotNull(routerUpdate);
         assertEquals(routerUpdate.getName(), "jclouds-router-test-rename");

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

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

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


      for (String region : api.getConfiguredRegions()) {
         RouterApi routerApi = api.getRouterExtensionApi(region).get();
         NetworkApi networkApi = api.getNetworkApi(region);
         SubnetApi subnetApi = api.getSubnetApi(region);

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

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

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

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

         Router router = routerApi.create(Router.createOptions().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.getRouterExtensionApi(region).get();
         NetworkApi networkApi = api.getNetworkApi(region);
         SubnetApi subnetApi = api.getSubnetApi(region);
         PortApi portApi = api.getPortApi(region);

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

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

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

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

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

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

         Router router = routerApi.create(Router.createOptions().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

               .fixedIps(ImmutableSet.copyOf(getFixedAddresses(ipv4SubnetId))).build()).getId();
         String ipv6PortId = portApi.create(Port.createOptions(networkId).name("JClouds-Live-IPv6-Port")
               .fixedIps(ImmutableSet.copyOf(getFixedAddresses(ipv6SubnetId))).build()).getId();

         /* List and get test */
         Port portList = api.getPortApi(region).list().concat().toSet().iterator().next();
         assertNotNull(portList);
         Port portGet = api.getPortApi(region).get(portList.getId());
         assertEquals(portList, portGet);
         /****/

         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");

         assertNotNull(portApi.update(ipv4PortId, Port.updateOptions().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

         assertNotNull(network2);

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

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

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

         Router router = routerApi.create(Router.createOptions().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

         Router.CreateOptions createRouter = Router.createOptions().name("another_router").adminStateUp(true)
               .externalGatewayInfo(ExternalGatewayInfo.builder().networkId("8ca37218-28ff-41cb-9b10-039601ea7e6b").build())
               .build();

         Router router = api.create(createRouter);

         /*
          * Check request
          */
         assertAuthentication(server);
         assertRequest(server.takeRequest(), "POST", "/v2.0/routers", "/router_create_request.json");

         /*
          * Check response
          */
         assertNotNull(router);
         assertEquals(router.getName(), "another_router");
         assertEquals(router.getExternalGatewayInfo().getNetworkId(), "8ca37218-28ff-41cb-9b10-039601ea7e6b");
         assertEquals(router.getStatus(), NetworkStatus.ACTIVE);
         assertEquals(router.isAdminStateUp().booleanValue(), true);
         assertEquals(router.getId(), "8604a0de-7f6b-409a-a47c-a1cc7bc77b2e");
         assertEquals(router.getTenantId(), "6b96ff0cb17a4b859e1e575d221683d3");
      } finally {
         server.shutdown();
      }
   }
View Full Code Here

         Router.CreateOptions createRouter = Router.createOptions().name("another_router").adminStateUp(true)
               .externalGatewayInfo(ExternalGatewayInfo.builder().networkId("8ca37218-28ff-41cb-9b10-039601ea7e6b").build())
               .build();

         Router router = api.create(createRouter);
         fail("Should have failed with not found exception");

      } finally {
         server.shutdown();
      }
View Full Code Here

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

         Router router = api.get("12345");

         /*
          * Check request
          */
         assertAuthentication(server);
         assertRequest(server.takeRequest(), "GET", "/v2.0/routers/12345");

         /*
          * Check response
          */
         assertNotNull(router);
         assertEquals(router.getName(), "router1");
         assertEquals(router.getExternalGatewayInfo().getNetworkId(), "3c5bcddd-6af9-4e6b-9c3e-c153e521cab8");
         assertEquals(router.getStatus(), NetworkStatus.ACTIVE);
         assertEquals(router.isAdminStateUp().booleanValue(), true);
         assertEquals(router.getId(), "a9254bdb-2613-4a13-ac4c-adc581fba50d");
         assertEquals(router.getTenantId(), "33a40233088643acb66ff6eb0ebea679");
      } finally {
         server.shutdown();
      }
   }
View Full Code Here

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

         Router router = api.get("12345");

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

         Router.UpdateOptions updateOptions = Router.updateOptions()
               .externalGatewayInfo(
                     ExternalGatewayInfo.builder().networkId("8ca37218-28ff-41cb-9b10-039601ea7e6b").build())
               .build();

         Router router = api.update("12345", updateOptions);

         /*
          * Check request
          */
         assertAuthentication(server);
         assertRequest(server.takeRequest(), "PUT", "/v2.0/routers/12345", "/router_update_request.json");

         /*
          * Check response
          */
         assertNotNull(router);
         assertEquals(router.getName(), "another_router");
         assertEquals(router.getExternalGatewayInfo().getNetworkId(), "8ca37218-28ff-41cb-9b10-039601ea7e6b");
         assertEquals(router.getStatus(), NetworkStatus.ACTIVE);
         assertEquals(router.isAdminStateUp().booleanValue(), true);
         assertEquals(router.getId(), "8604a0de-7f6b-409a-a47c-a1cc7bc77b2e");
         assertEquals(router.getTenantId(), "6b96ff0cb17a4b859e1e575d221683d3");
      } finally {
         server.shutdown();
      }
   }
View Full Code Here

TOP

Related Classes of org.jclouds.openstack.neutron.v2.NeutronApiMetadata

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.