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

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


         Subnet.CreateOptions createSubnet = Subnet.createOptions("1234567890", "10.0.3.0/24")
               .name("jclouds-wibble")
               .ipVersion(4)
               .build();

         Subnet subnet = api.create(createSubnet);

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

         /*
          * Check response
          */
         assertNotNull(subnet);
         assertEquals(subnet.getName(), "jclouds-wibble");
         assertEquals(subnet.getIpVersion().intValue(), 4);
         assertEquals(subnet.getCidr(), "10.0.3.0/24");
         assertEquals(subnet.getTenantId(), "1234567890");
         assertEquals(subnet.getId(), "624312ff-d14b-4ba3-9834-1c78d23d574d");
      } finally {
         server.shutdown();
      }
   }
View Full Code Here


         Subnet.CreateOptions createSubnet = Subnet.createOptions("1234567890", "cidr")
               .name("jclouds-wibble")
               .ipVersion(4)
               .build();

         Subnet subnet = api.create(createSubnet);
      } finally {
         server.shutdown();
      }
   }
View Full Code Here

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

         Subnet subnet = api.get("12345");

         /*
          * Check request
          */
         assertEquals(server.getRequestCount(), 2);
         assertAuthentication(server);
         assertRequest(server.takeRequest(), "GET", "/v2.0/subnets/12345");

         /*
          * Check response
          */
         assertNotNull(subnet);
         assertEquals(subnet.getName(), "jclouds-wibble");
         assertEquals(subnet.getId(), "624312ff-d14b-4ba3-9834-1c78d23d574d");
         assertEquals(subnet.getTenantId(), "1234567890");
         assertEquals(subnet.getIPv6AddressMode(), IPv6DHCPMode.SLAAC);
      } finally {
         server.shutdown();
      }
   }
View Full Code Here

         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

         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

         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

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

         Subnets subnets = api.list(PaginationOptions.Builder.limit(2).marker("abcdefg"));

         /*
          * Check request
          */
         assertAuthentication(server);
         assertRequest(server.takeRequest(), "GET", "/v2.0/subnets?limit=2&marker=abcdefg");

         /*
          * Check response
          */
         assertNotNull(subnets);
         assertEquals(subnets.first().get().getId(), "16dba3bc-f3fa-4775-afdc-237e12c72f6a");
      } finally {
         server.shutdown();
      }
   }
View Full Code Here

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

         Subnets subnets = api.list(PaginationOptions.Builder.limit(2).marker("abcdefg"));

         /*
          * Check request
          */
         assertAuthentication(server);
         assertRequest(server.takeRequest(), "GET", "/v2.0/subnets?limit=2&marker=abcdefg");

         /*
          * Check response
          */
         assertTrue(subnets.isEmpty());
      } finally {
         server.shutdown();
      }
   }
View Full Code Here

   }

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

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

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

      server.enqueue(addCommonHeaders(
            new MockResponse().setResponseCode(201).setBody(stringFromResource("/router_create_response.json"))));

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

         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);
View Full Code Here

TOP

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

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.