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

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


      MockWebServer server = mockOpenStackServer();
      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(200).setBody(stringFromResource("/subnet_update_response.json"))));

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

         Subnet.UpdateOptions updateSubnet = Subnet.updateOptions()
               .name("new_name")
               .gatewayIp("10.0.3.254")
               .build();
View Full Code Here


      MockWebServer server = mockOpenStackServer();
      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(404)));

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

         Subnet.UpdateOptions updateSubnet = Subnet.updateOptions()
               .name("new_name")
               .gatewayIp("10.0.3.254")
               .build();
View Full Code Here

      MockWebServer server = mockOpenStackServer();
      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(200)));

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

         boolean result = api.delete("12345");

         /*
          * Check request
View Full Code Here

      MockWebServer server = mockOpenStackServer();
      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(404)));

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

         boolean result = api.delete("12345");

         /*
          * Check request
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

               .adminStateUp(true)
               .deviceId("d6b4d3a5-c700-476f-b609-1493dd9dadc0")
               .allowedAddressPairs(ImmutableSet.of(AddressPair.createOptions("12", "111.222.333.444").build()))
               .build();

         Port port = api.create(createPort);

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

         /*
          * Check response
          */
         assertNotNull(port);
         assertEquals(port.getAllowedAddressPairs().iterator().next().getIpAddress(), "192.168.1.1");
         assertEquals(port.getAllowedAddressPairs().iterator().next().getMacAddress(), "12:12");
         assertEquals(port.getName(), "port1");
         assertEquals(port.getStatus(), NetworkStatus.ACTIVE);
         assertEquals(port.getId(), "ebe69f1e-bc26-4db5-bed0-c0afb4afe3db");
         assertEquals(port.getDeviceId(), "d6b4d3a5-c700-476f-b609-1493dd9dadc0");
         assertEquals(port.getDeviceOwner(), "");
         assertEquals(port.getMacAddress(), "fa:16:3e:a6:50:c1");
         assertEquals(port.getNetworkId(), "6aeaf34a-c482-4bd3-9dc3-7faf36412f12");
         assertEquals(port.getFixedIps().iterator().next().getIpAddress(), "192.168.111.4");
         assertEquals(port.getFixedIps().iterator().next().getSubnetId(), "22b44fc2-4ffb-4de4-b0f9-69d58b37ae27");
         assertEquals(port.getTenantId(), "cf1a5775e766426cb1968766d0191908");
      } finally {
         server.shutdown();
      }
   }
View Full Code Here

               .adminStateUp(true)
               .deviceId("d6b4d3a5-c700-476f-b609-1493dd9dadc0")
               .allowedAddressPairs(ImmutableSet.of(AddressPair.createOptions("12", "111.222.333.444").build()))
               .build();

         Port port = api.create(createPort);
      } finally {
         server.shutdown();
      }
   }
View Full Code Here

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

         Port port = api.get("12345");

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

         /*
          * Check response
          */
         assertNotNull(port);
         assertEquals(port.getName(), "jclouds-wibble");
         assertEquals(port.getStatus(), NetworkStatus.ACTIVE);
         assertEquals(port.getId(), "624312ff-d14b-4ba3-9834-1c78d23d574d");
         assertEquals(port.getTenantId(), "1234567890");
         assertEquals(port.getNetworkId(), "1234567890");
         assertEquals(port.getVnicType(), VNICType.NORMAL);
         assertEquals(port.getVifType(), VIFType.HYPERV);
         assertEquals(port.getVifDetails().get("name1"), "value1");
         assertEquals(((Map<String, Double>)port.getVifDetails().get("name2")).get("mapname2").intValue(), 3);
      } finally {
         server.shutdown();
      }
   }
View Full Code Here

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

         Port port = api.get("12345");

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

TOP

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

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.