You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ev...@apache.org on 2013/09/12 22:52:31 UTC
[2/5] OpenStack Neutron v2.0 implementation
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/895476f1/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/features/SubnetApiExpectTest.java
----------------------------------------------------------------------
diff --git a/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/features/SubnetApiExpectTest.java b/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/features/SubnetApiExpectTest.java
new file mode 100644
index 0000000..72d3ce9
--- /dev/null
+++ b/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/features/SubnetApiExpectTest.java
@@ -0,0 +1,251 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.openstack.neutron.v2_0.features;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.neutron.v2_0.domain.BulkSubnet;
+import org.jclouds.openstack.neutron.v2_0.domain.ReferenceWithName;
+import org.jclouds.openstack.neutron.v2_0.domain.Subnet;
+import org.jclouds.openstack.neutron.v2_0.internal.BaseNeutronApiExpectTest;
+import org.jclouds.openstack.neutron.v2_0.options.CreateSubnetBulkOptions;
+import org.jclouds.openstack.neutron.v2_0.options.CreateSubnetOptions;
+import org.jclouds.openstack.neutron.v2_0.options.UpdateSubnetOptions;
+import org.jclouds.openstack.neutron.v2_0.parse.ParseSubnetTest;
+import org.jclouds.rest.AuthorizationException;
+import org.testng.annotations.Test;
+
+import java.util.Set;
+
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+import static org.testng.Assert.*;
+
+/**
+ * Tests parsing and Guice wiring of SubnetApi
+ *
+ * @author Nick Livens
+ */
+@Test(groups = "unit", testName = "SubnetApiExpectTest")
+public class SubnetApiExpectTest extends BaseNeutronApiExpectTest {
+
+ private static final String ZONE = "region-a.geo-1";
+
+ public void testListReferencesReturns2xx() {
+ SubnetApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess,
+ authenticatedGET().endpoint(endpoint + "/subnets").addQueryParam("fields", "id", "tenant_id", "name").build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/list_subnets.json", APPLICATION_JSON)).build())
+ .getSubnetApiForZone(ZONE);
+
+ Set<? extends ReferenceWithName> references = api.list().concat().toSet();
+ assertEquals(references, listOfReferencesWithNames());
+ }
+
+ public void testListReferencesReturns4xx() {
+ SubnetApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess,
+ authenticatedGET().endpoint(endpoint + "/subnets").addQueryParam("fields", "id", "tenant_id", "name").build(),
+ HttpResponse.builder().statusCode(404).build())
+ .getSubnetApiForZone(ZONE);
+
+ assertTrue(api.list().concat().isEmpty());
+ }
+
+ public void testListReturns2xx() {
+ SubnetApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess,
+ authenticatedGET().endpoint(endpoint + "/subnets").build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/list_subnets.json", APPLICATION_JSON)).build())
+ .getSubnetApiForZone(ZONE);
+
+ Set<? extends Subnet> subnets = api.listInDetail().concat().toSet();
+ assertEquals(subnets, listOfSubnets());
+ }
+
+ public void testListReturns4xx() {
+ SubnetApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess,
+ authenticatedGET().endpoint(endpoint + "/subnets").build(),
+ HttpResponse.builder().statusCode(404).build())
+ .getSubnetApiForZone(ZONE);
+
+ assertTrue(api.listInDetail().concat().isEmpty());
+ }
+
+ public void testGetReturns2xx() {
+ SubnetApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess,
+ authenticatedGET().endpoint(endpoint + "/subnets/624312ff-d14b-4ba3-9834-1c78d23d574d").build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/subnet.json", APPLICATION_JSON)).build())
+ .getSubnetApiForZone(ZONE);
+
+ Subnet subnet = api.get("624312ff-d14b-4ba3-9834-1c78d23d574d");
+ assertEquals(subnet, new ParseSubnetTest().expected());
+ }
+
+ public void testGetReturns4xx() {
+ SubnetApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess,
+ authenticatedGET().endpoint(endpoint + "/subnets/624312ff-d14b-4ba3-9834-1c78d23d574d").build(),
+ HttpResponse.builder().statusCode(404).build())
+ .getSubnetApiForZone(ZONE);
+
+ assertNull(api.get("624312ff-d14b-4ba3-9834-1c78d23d574d"));
+ }
+
+ public void testCreateReturns2xx() {
+ SubnetApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess,
+ authenticatedGET().endpoint(endpoint + "/subnets").method("POST")
+ .payload(payloadFromStringWithContentType("{\"subnet\":{\"network_id\":\"1234567890\",\"ip_version\":4,\"cidr\":\"10.0.3.0/24\",\"name\":\"subnet-test\"}}", APPLICATION_JSON)).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromStringWithContentType("{\"subnet\":{\"id\":\"12345\",\"tenant_id\":\"6789\",\"network_id\":\"1234567890\",\"ip_version\":4,\"cidr\":\"10.0.3.0/24\",\"name\":\"subnet-test\"}}", APPLICATION_JSON)).build())
+ .getSubnetApiForZone(ZONE);
+
+ Subnet net = api.create("1234567890", 4, "10.0.3.0/24", CreateSubnetOptions.builder().name("subnet-test").build());
+ assertEquals(net, Subnet.builder().id("12345").tenantId("6789").name("subnet-test").networkId("1234567890").ipVersion(4).cidr("10.0.3.0/24").build());
+ }
+
+ @Test(expectedExceptions = AuthorizationException.class)
+ public void testCreateReturns4xx() {
+ SubnetApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess,
+ authenticatedGET().endpoint(endpoint + "/subnets").method("POST")
+ .payload(payloadFromStringWithContentType("{\"subnet\":{\"network_id\":\"1234567890\",\"ip_version\":4,\"cidr\":\"10.0.3.0/24\",\"name\":\"subnet-test\"}}", APPLICATION_JSON)).build(),
+ HttpResponse.builder().statusCode(401).build())
+ .getSubnetApiForZone(ZONE);
+
+ api.create("1234567890", 4, "10.0.3.0/24", CreateSubnetOptions.builder().name("subnet-test").build());
+ }
+
+ public void testCreateBulkReturns2xx() {
+ SubnetApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess,
+ authenticatedGET().endpoint(endpoint + "/subnets").method("POST")
+ .payload(payloadFromStringWithContentType(
+ "{\"subnets\":[" +
+ "{\"network_id\":\"1234567890\",\"ip_version\":4,\"cidr\":\"10.0.3.0/24\",\"name\":\"subnet-test\"}," +
+ "{\"network_id\":\"9876543210\",\"ip_version\":4,\"cidr\":\"192.168.3.0/24\",\"name\":\"subnet-test-2\"}" +
+ "]}", APPLICATION_JSON)).build(),
+ HttpResponse.builder().statusCode(200).payload(payloadFromStringWithContentType(
+ "{\"subnets\":[" +
+ "{\"id\":\"1\",\"tenant_id\":\"1\",\"network_id\":\"1234567890\",\"ip_version\":4,\"cidr\":\"10.0.3.0/24\",\"name\":\"subnet-test\"}," +
+ "{\"id\":\"2\",\"tenant_id\":\"1\",\"network_id\":\"9876543210\",\"ip_version\":4,\"cidr\":\"192.168.3.0/24\",\"name\":\"subnet-test-2\"}" +
+ "]}", APPLICATION_JSON)).build())
+ .getSubnetApiForZone(ZONE);
+
+ Set<? extends Subnet> nets = api.createBulk(
+ CreateSubnetBulkOptions.builder().subnets(
+ ImmutableList.of(
+ BulkSubnet.builder().networkId("1234567890").ipVersion(4).cidr("10.0.3.0/24").name("subnet-test").build(),
+ BulkSubnet.builder().networkId("9876543210").ipVersion(4).cidr("192.168.3.0/24").name("subnet-test-2").build()
+ )
+ ).build()
+ ).toSet();
+ assertEquals(nets, createBulkReturns2xxResponse());
+ }
+
+ @Test(expectedExceptions = AuthorizationException.class)
+ public void testCreateBulkReturns4xx() {
+ SubnetApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess,
+ authenticatedGET().endpoint(endpoint + "/subnets").method("POST")
+ .payload(payloadFromStringWithContentType(
+ "{\"subnets\":[" +
+ "{\"network_id\":\"1234567890\",\"ip_version\":4,\"cidr\":\"10.0.3.0/24\",\"name\":\"subnet-test\"}," +
+ "{\"network_id\":\"9876543210\",\"ip_version\":4,\"cidr\":\"192.168.3.0/24\",\"name\":\"subnet-test-2\"}" +
+ "]}", APPLICATION_JSON)).build(),
+ HttpResponse.builder().statusCode(401).build())
+ .getSubnetApiForZone(ZONE);
+
+ api.createBulk(
+ CreateSubnetBulkOptions.builder().subnets(
+ ImmutableList.of(
+ BulkSubnet.builder().networkId("1234567890").ipVersion(4).cidr("10.0.3.0/24").name("subnet-test").build(),
+ BulkSubnet.builder().networkId("9876543210").ipVersion(4).cidr("192.168.3.0/24").name("subnet-test-2").build()
+ )
+ ).build()
+ );
+ }
+
+ public void testUpdateReturns2xx() {
+ SubnetApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess,
+ authenticatedGET().endpoint(endpoint + "/subnets/12345").method("PUT")
+ .payload(payloadFromStringWithContentType("{\"subnet\":{\"name\":\"another-test\",\"gateway_ip\":\"13.13.13.13\"}}", APPLICATION_JSON)).build(),
+ HttpResponse.builder().statusCode(200).build())
+ .getSubnetApiForZone(ZONE);
+
+ assertTrue(api.update("12345", UpdateSubnetOptions.builder().name("another-test").gatewayIp("13.13.13.13").build()));
+ }
+
+ public void testUpdateReturns4xx() {
+ SubnetApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess,
+ authenticatedGET().endpoint(endpoint + "/subnets/12345").method("PUT")
+ .payload(payloadFromStringWithContentType("{\"subnet\":{\"name\":\"another-test\",\"gateway_ip\":\"13.13.13.13\"}}", APPLICATION_JSON)).build(),
+ HttpResponse.builder().statusCode(404).build())
+ .getSubnetApiForZone(ZONE);
+
+ assertFalse(api.update("12345", UpdateSubnetOptions.builder().name("another-test").gatewayIp("13.13.13.13").build()));
+ }
+
+ public void testDeleteReturns2xx() {
+ SubnetApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess,
+ authenticatedGET().endpoint(endpoint + "/subnets/12345").method("DELETE").build(),
+ HttpResponse.builder().statusCode(200).build())
+ .getSubnetApiForZone(ZONE);
+
+ assertTrue(api.delete("12345"));
+ }
+
+ @Test(expectedExceptions = AuthorizationException.class)
+ public void testDeleteReturns4xx() {
+ SubnetApi api = requestsSendResponses(
+ keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess,
+ authenticatedGET().endpoint(endpoint + "/subnets/12345").method("DELETE").build(),
+ HttpResponse.builder().statusCode(403).build())
+ .getSubnetApiForZone(ZONE);
+
+ api.delete("12345");
+ }
+
+ protected Set<Subnet> listOfSubnets() {
+ return ImmutableSet.of(
+ Subnet.builder().ipVersion(4).cidr("10.0.3.0/24").networkId("1234567890").name("jclouds-test").tenantId("1234567890").id("16dba3bc-f3fa-4775-afdc-237e12c72f6a").build(),
+ Subnet.builder().ipVersion(4).cidr("10.0.3.0/24").networkId("1234567890").name("wibble").tenantId("1234567890").id("1a104cf5-cb18-4d35-9407-2fd2646d9d0b").build(),
+ Subnet.builder().ipVersion(4).cidr("10.0.3.0/24").networkId("1234567890").name("jclouds-test").tenantId("1234567890").id("31083ae2-420d-48b2-ac98-9f7a4fd8dbdc").build(),
+ Subnet.builder().ipVersion(4).cidr("10.0.3.0/24").networkId("1234567890").name("jclouds-test").tenantId("1234567890").id("49c6d6fa-ff2a-459d-b975-75a8d31c9a89").build(),
+ Subnet.builder().ipVersion(4).cidr("10.0.3.0/24").networkId("1234567890").name("wibble").tenantId("1234567890").id("5cb3d6f4-62cb-41c9-b964-ba7d9df79e4e").build(),
+ Subnet.builder().ipVersion(4).cidr("10.0.3.0/24").networkId("1234567890").name("jclouds-test").tenantId("1234567890").id("5d51d012-3491-4db7-b1b5-6f254015015d").build(),
+ Subnet.builder().ipVersion(4).cidr("10.0.3.0/24").networkId("1234567890").name("wibble").tenantId("1234567890").id("5f9cf7dc-22ca-4097-8e49-1cc8b23faf17").build(),
+ Subnet.builder().ipVersion(4).cidr("10.0.3.0/24").networkId("1234567890").name("jclouds-test").tenantId("1234567890").id("6319ecad-6bff-48b2-9b53-02ede8cb7588").build(),
+ Subnet.builder().ipVersion(4).cidr("10.0.3.0/24").networkId("1234567890").name("jclouds-test").tenantId("1234567890").id("6ba4c788-661f-49ab-9bf8-5f10cbbb2f57").build(),
+ Subnet.builder().ipVersion(4).cidr("10.0.3.0/24").networkId("1234567890").name("jclouds-test").tenantId("1234567890").id("74ed170b-5069-4353-ab38-9719766dc57e").build(),
+ Subnet.builder().ipVersion(4).cidr("10.0.3.0/24").networkId("1234567890").name("wibble").tenantId("1234567890").id("b71fcac1-e864-4031-8c5b-edbecd9ece36").build(),
+ Subnet.builder().ipVersion(4).cidr("10.0.3.0/24").networkId("1234567890").name("jclouds-test").tenantId("1234567890").id("c7681895-d84d-4650-9ca0-82c72036b855").build()
+ );
+ }
+
+ protected Set<Subnet> createBulkReturns2xxResponse() {
+ return ImmutableSet.of(
+ Subnet.builder().id("1").tenantId("1").name("subnet-test").networkId("1234567890").ipVersion(4).cidr("10.0.3.0/24").build(),
+ Subnet.builder().id("2").tenantId("1").name("subnet-test-2").networkId("9876543210").ipVersion(4).cidr("192.168.3.0/24").build()
+ );
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/895476f1/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/features/SubnetApiLiveTest.java
----------------------------------------------------------------------
diff --git a/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/features/SubnetApiLiveTest.java b/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/features/SubnetApiLiveTest.java
new file mode 100644
index 0000000..181686b
--- /dev/null
+++ b/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/features/SubnetApiLiveTest.java
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.openstack.neutron.v2_0.features;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import org.jclouds.openstack.neutron.v2_0.domain.*;
+import org.jclouds.openstack.neutron.v2_0.internal.BaseNeutronApiLiveTest;
+import org.jclouds.openstack.neutron.v2_0.options.CreateNetworkOptions;
+import org.jclouds.openstack.neutron.v2_0.options.CreateSubnetBulkOptions;
+import org.jclouds.openstack.neutron.v2_0.options.CreateSubnetOptions;
+import org.jclouds.openstack.neutron.v2_0.options.UpdateSubnetOptions;
+
+import java.util.Set;
+
+import static org.testng.Assert.*;
+
+/**
+ * Tests subnet api in combination with the network api
+ *
+ * @author Nick Livens
+ */
+public class SubnetApiLiveTest extends BaseNeutronApiLiveTest {
+
+ public void testGetAndListSubnets() {
+ for (String zone : api.getConfiguredZones()) {
+ Set<? extends ReferenceWithName> references = api.getSubnetApiForZone(zone).list().concat().toSet();
+ Set<? extends Subnet> subnets = api.getSubnetApiForZone(zone).listInDetail().concat().toSet();
+
+ assertNotNull(references);
+ assertNotNull(subnets);
+ assertEquals(references.size(), subnets.size());
+
+ for (Subnet subnet : subnets) {
+ assertNotNull(subnet.getNetworkId());
+ assertTrue(references.contains(ReferenceWithName.builder().id(subnet.getId()).tenantId(subnet.getTenantId()).name(subnet.getName()).build()));
+
+ Subnet retrievedSubnet = api.getSubnetApiForZone(zone).get(subnet.getId());
+ assertEquals(retrievedSubnet, subnet);
+ }
+ }
+ }
+
+ public void testCreateUpdateAndDeleteSubnet() {
+ for (String zone : api.getConfiguredZones()) {
+ NetworkApi networkApi = api.getNetworkApiForZone(zone);
+ String networkId = networkApi.create(CreateNetworkOptions.builder().name("jclouds-live-test").networkType(NetworkType.LOCAL).build()).getId();
+
+ SubnetApi subnetApi = api.getSubnetApiForZone(zone);
+ Set<AllocationPool> allocationPools = ImmutableSet.of(
+ AllocationPool.builder().start("a3:bc00::10").end("a3:bc00::20").build(),
+ AllocationPool.builder().start("a3:bc00::50").end("a3:bc00::90").build()
+ );
+ Set<HostRoute> hostRoutes = ImmutableSet.of(
+ HostRoute.builder().destinationCidr("a3:bc00::/48").nextHop("a3:bc00::0004").build()
+ );
+ Subnet subnet = subnetApi.create(networkId, 6, "a3:bc00::/48", CreateSubnetOptions.builder().allocationPools(allocationPools).hostRoutes(hostRoutes).build());
+ assertNotNull(subnet);
+
+ Subnet retrievedSubnet = subnetApi.get(subnet.getId());
+
+ assertEquals(retrievedSubnet.getId(), subnet.getId());
+ assertEquals(retrievedSubnet.getCidr(), "a3:bc00::/48");
+ assertTrue(retrievedSubnet.getDnsNameServers().isEmpty());
+ assertEquals(retrievedSubnet.getAllocationPools().size(), 2);
+ assertEquals(retrievedSubnet.getHostRoutes().size(), 1);
+ assertTrue(subnetApi.update(retrievedSubnet.getId(), UpdateSubnetOptions.builder().name("jclouds-live-test-update").build()));
+
+ retrievedSubnet = subnetApi.get(retrievedSubnet.getId());
+
+ assertEquals(retrievedSubnet.getId(), subnet.getId());
+ assertEquals(retrievedSubnet.getName(), "jclouds-live-test-update");
+ assertTrue(retrievedSubnet.getDnsNameServers().isEmpty());
+
+ Subnet subnet2 = subnetApi.create(networkId, 6, "a3:bd01::/48");
+ assertNotNull(subnet2);
+
+ assertTrue(subnetApi.delete(subnet.getId()));
+ assertTrue(subnetApi.delete(subnet2.getId()));
+ assertTrue(networkApi.delete(networkId));
+ }
+ }
+
+ public void testBulkCreateSubnet() {
+ for (String zone : api.getConfiguredZones()) {
+ NetworkApi networkApi = api.getNetworkApiForZone(zone);
+ String networkId = networkApi.create(CreateNetworkOptions.builder().name("jclouds-live-test").networkType(NetworkType.LOCAL).build()).getId();
+
+ SubnetApi subnetApi = api.getSubnetApiForZone(zone);
+ Set<? extends Subnet> subnets = subnetApi.createBulk(
+ CreateSubnetBulkOptions.builder().subnets(
+ ImmutableList.of(
+ BulkSubnet.builder().name("jclouds-live-test-1").cidr("a3:bd01::/48").ipVersion(6).networkId(networkId).build(),
+ BulkSubnet.builder().name("jclouds-live-test-2").cidr("a3:bd02::/48").ipVersion(6).networkId(networkId).build(),
+ BulkSubnet.builder().name("jclouds-live-test-3").cidr("a3:bd03::/48").ipVersion(6).networkId(networkId).build()
+ )
+ ).build()
+ ).toSet();
+ Set<? extends Subnet> existingSubnets = subnetApi.listInDetail().concat().toSet();
+
+ assertNotNull(subnets);
+ assertTrue(!subnets.isEmpty());
+ assertEquals(subnets.size(), 3);
+
+ for (Subnet net : subnets) {
+ assertTrue(existingSubnets.contains(net));
+ assertTrue(subnetApi.delete(net.getId()));
+ }
+ assertTrue(networkApi.delete(networkId));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/895476f1/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/internal/BaseNeutronApiExpectTest.java
----------------------------------------------------------------------
diff --git a/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/internal/BaseNeutronApiExpectTest.java b/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/internal/BaseNeutronApiExpectTest.java
new file mode 100644
index 0000000..897cac8
--- /dev/null
+++ b/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/internal/BaseNeutronApiExpectTest.java
@@ -0,0 +1,69 @@
+/**
+ * Licensed to jclouds, Inc. (jclouds) under one or more
+ * contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. jclouds licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jclouds.openstack.neutron.v2_0.internal;
+
+import com.google.common.collect.ImmutableSet;
+import org.jclouds.openstack.neutron.v2_0.NeutronApi;
+import org.jclouds.openstack.neutron.v2_0.domain.Reference;
+import org.jclouds.openstack.neutron.v2_0.domain.ReferenceWithName;
+
+import java.util.Set;
+
+/**
+ * Base class for writing Neutron Rest Api Expect tests
+ *
+ * @author Nick Livens
+ */
+public class BaseNeutronApiExpectTest extends BaseNeutronExpectTest<NeutronApi> {
+
+ protected Set<Reference> listOfReferences() {
+ return ImmutableSet.of(
+ Reference.builder().tenantId("1234567890").id("16dba3bc-f3fa-4775-afdc-237e12c72f6a").build(),
+ Reference.builder().tenantId("1234567890").id("1a104cf5-cb18-4d35-9407-2fd2646d9d0b").build(),
+ Reference.builder().tenantId("1234567890").id("31083ae2-420d-48b2-ac98-9f7a4fd8dbdc").build(),
+ Reference.builder().tenantId("1234567890").id("49c6d6fa-ff2a-459d-b975-75a8d31c9a89").build(),
+ Reference.builder().tenantId("1234567890").id("5cb3d6f4-62cb-41c9-b964-ba7d9df79e4e").build(),
+ Reference.builder().tenantId("1234567890").id("5d51d012-3491-4db7-b1b5-6f254015015d").build(),
+ Reference.builder().tenantId("1234567890").id("5f9cf7dc-22ca-4097-8e49-1cc8b23faf17").build(),
+ Reference.builder().tenantId("1234567890").id("6319ecad-6bff-48b2-9b53-02ede8cb7588").build(),
+ Reference.builder().tenantId("1234567890").id("6ba4c788-661f-49ab-9bf8-5f10cbbb2f57").build(),
+ Reference.builder().tenantId("1234567890").id("74ed170b-5069-4353-ab38-9719766dc57e").build(),
+ Reference.builder().tenantId("1234567890").id("b71fcac1-e864-4031-8c5b-edbecd9ece36").build(),
+ Reference.builder().tenantId("1234567890").id("c7681895-d84d-4650-9ca0-82c72036b855").build()
+ );
+ }
+
+ protected Set<ReferenceWithName> listOfReferencesWithNames() {
+ return ImmutableSet.of(
+ ReferenceWithName.builder().name("jclouds-test").tenantId("1234567890").id("16dba3bc-f3fa-4775-afdc-237e12c72f6a").build(),
+ ReferenceWithName.builder().name("wibble").tenantId("1234567890").id("1a104cf5-cb18-4d35-9407-2fd2646d9d0b").build(),
+ ReferenceWithName.builder().name("jclouds-test").tenantId("1234567890").id("31083ae2-420d-48b2-ac98-9f7a4fd8dbdc").build(),
+ ReferenceWithName.builder().name("jclouds-test").tenantId("1234567890").id("49c6d6fa-ff2a-459d-b975-75a8d31c9a89").build(),
+ ReferenceWithName.builder().name("wibble").tenantId("1234567890").id("5cb3d6f4-62cb-41c9-b964-ba7d9df79e4e").build(),
+ ReferenceWithName.builder().name("jclouds-test").tenantId("1234567890").id("5d51d012-3491-4db7-b1b5-6f254015015d").build(),
+ ReferenceWithName.builder().name("wibble").tenantId("1234567890").id("5f9cf7dc-22ca-4097-8e49-1cc8b23faf17").build(),
+ ReferenceWithName.builder().name("jclouds-test").tenantId("1234567890").id("6319ecad-6bff-48b2-9b53-02ede8cb7588").build(),
+ ReferenceWithName.builder().name("jclouds-test").tenantId("1234567890").id("6ba4c788-661f-49ab-9bf8-5f10cbbb2f57").build(),
+ ReferenceWithName.builder().name("jclouds-test").tenantId("1234567890").id("74ed170b-5069-4353-ab38-9719766dc57e").build(),
+ ReferenceWithName.builder().name("wibble").tenantId("1234567890").id("b71fcac1-e864-4031-8c5b-edbecd9ece36").build(),
+ ReferenceWithName.builder().name("jclouds-test").tenantId("1234567890").id("c7681895-d84d-4650-9ca0-82c72036b855").build()
+ );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/895476f1/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/internal/BaseNeutronApiLiveTest.java
----------------------------------------------------------------------
diff --git a/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/internal/BaseNeutronApiLiveTest.java b/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/internal/BaseNeutronApiLiveTest.java
new file mode 100644
index 0000000..8511106
--- /dev/null
+++ b/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/internal/BaseNeutronApiLiveTest.java
@@ -0,0 +1,47 @@
+/**
+ * Licensed to jclouds, Inc. (jclouds) under one or more
+ * contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. jclouds licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jclouds.openstack.neutron.v2_0.internal;
+
+import org.jclouds.apis.BaseApiLiveTest;
+import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties;
+import org.jclouds.openstack.neutron.v2_0.NeutronApi;
+import org.testng.annotations.Test;
+
+import java.util.Properties;
+
+/**
+ * Tests behavior of {@code NeutronApi}
+ *
+ * @author Nick Livens
+ */
+@Test(groups = "live")
+public class BaseNeutronApiLiveTest extends BaseApiLiveTest<NeutronApi> {
+
+ public BaseNeutronApiLiveTest() {
+ provider = "openstack-neutron";
+ }
+
+ @Override
+ protected Properties setupProperties() {
+ Properties props = super.setupProperties();
+ setIfTestSystemPropertyPresent(props, KeystoneProperties.CREDENTIAL_TYPE);
+ return props;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/895476f1/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/internal/BaseNeutronExpectTest.java
----------------------------------------------------------------------
diff --git a/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/internal/BaseNeutronExpectTest.java b/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/internal/BaseNeutronExpectTest.java
new file mode 100644
index 0000000..2af275b
--- /dev/null
+++ b/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/internal/BaseNeutronExpectTest.java
@@ -0,0 +1,67 @@
+/**
+ * Licensed to jclouds, Inc. (jclouds) under one or more
+ * contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. jclouds licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jclouds.openstack.neutron.v2_0.internal;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.keystone.v2_0.internal.KeystoneFixture;
+import org.jclouds.rest.internal.BaseRestApiExpectTest;
+
+import javax.ws.rs.core.MediaType;
+
+/**
+ * Base class for writing Neutron Expect tests
+ *
+ * @author Nick Livens
+ */
+public class BaseNeutronExpectTest<T> extends BaseRestApiExpectTest<T> {
+ protected HttpRequest keystoneAuthWithUsernameAndPassword;
+ protected HttpRequest keystoneAuthWithUsernameAndPasswordAndTenantName;
+ protected HttpRequest keystoneAuthWithAccessKeyAndSecretKeyAndTenantName;
+ protected String authToken;
+ protected HttpResponse responseWithKeystoneAccess;
+ protected HttpRequest keystoneAuthWithAccessKeyAndSecretKeyAndTenantId;
+ protected String identityWithTenantId;
+ protected String endpoint = "https://csnode.jclouds.org:9696/v2.0";
+
+ public BaseNeutronExpectTest() {
+ provider = "openstack-neutron";
+ keystoneAuthWithUsernameAndPassword = KeystoneFixture.INSTANCE.initialAuthWithUsernameAndPassword(identity,
+ credential);
+ keystoneAuthWithUsernameAndPasswordAndTenantName = KeystoneFixture.INSTANCE.initialAuthWithUsernameAndPasswordAndTenantName(identity,
+ credential);
+ keystoneAuthWithAccessKeyAndSecretKeyAndTenantName = KeystoneFixture.INSTANCE.initialAuthWithAccessKeyAndSecretKeyAndTenantName(identity,
+ credential);
+ keystoneAuthWithAccessKeyAndSecretKeyAndTenantId = KeystoneFixture.INSTANCE.initialAuthWithAccessKeyAndSecretKeyAndTenantId(identity,
+ credential);
+
+ authToken = KeystoneFixture.INSTANCE.getAuthToken();
+ responseWithKeystoneAccess = KeystoneFixture.INSTANCE.responseWithAccess();
+ // now, createContext arg will need tenant prefix
+ identityWithTenantId = KeystoneFixture.INSTANCE.getTenantId() + ":" + identity;
+ identity = KeystoneFixture.INSTANCE.getTenantName() + ":" + identity;
+ }
+
+ protected HttpRequest.Builder<?> authenticatedGET() {
+ return HttpRequest.builder()
+ .method("GET")
+ .addHeader("Accept", MediaType.APPLICATION_JSON)
+ .addHeader("X-Auth-Token", authToken);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/895476f1/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/parse/ParseNetworkTest.java
----------------------------------------------------------------------
diff --git a/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/parse/ParseNetworkTest.java b/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/parse/ParseNetworkTest.java
new file mode 100644
index 0000000..2381604
--- /dev/null
+++ b/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/parse/ParseNetworkTest.java
@@ -0,0 +1,54 @@
+/**
+ * Licensed to jclouds, Inc. (jclouds) under one or more
+ * contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. jclouds licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jclouds.openstack.neutron.v2_0.parse;
+
+import org.jclouds.json.BaseItemParserTest;
+import org.jclouds.openstack.neutron.v2_0.domain.Network;
+import org.jclouds.openstack.neutron.v2_0.domain.NetworkType;
+import org.jclouds.openstack.neutron.v2_0.domain.State;
+import org.jclouds.rest.annotations.SelectJson;
+import org.testng.annotations.Test;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+/**
+ * @author Nick Livens
+ */
+@Test(groups = "unit", testName = "ParseNetworkTest")
+public class ParseNetworkTest extends BaseItemParserTest<Network> {
+
+ @Override
+ public String resource() {
+ return "/network.json";
+ }
+
+ @Override
+ @SelectJson("network")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Network expected() {
+ return Network.builder()
+ .networkType(NetworkType.LOCAL)
+ .state(State.ACTIVE)
+ .name("jclouds-wibble")
+ .tenantId("1234567890")
+ .id("624312ff-d14b-4ba3-9834-1c78d23d574d")
+ .build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/895476f1/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/parse/ParsePortTest.java
----------------------------------------------------------------------
diff --git a/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/parse/ParsePortTest.java b/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/parse/ParsePortTest.java
new file mode 100644
index 0000000..7a6f47b
--- /dev/null
+++ b/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/parse/ParsePortTest.java
@@ -0,0 +1,53 @@
+/**
+ * Licensed to jclouds, Inc. (jclouds) under one or more
+ * contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. jclouds licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jclouds.openstack.neutron.v2_0.parse;
+
+import org.jclouds.json.BaseItemParserTest;
+import org.jclouds.openstack.neutron.v2_0.domain.Port;
+import org.jclouds.openstack.neutron.v2_0.domain.State;
+import org.jclouds.rest.annotations.SelectJson;
+import org.testng.annotations.Test;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+/**
+ * @author Nick Livens
+ */
+@Test(groups = "unit", testName = "ParsePortTest")
+public class ParsePortTest extends BaseItemParserTest<Port> {
+
+ @Override
+ public String resource() {
+ return "/port.json";
+ }
+
+ @Override
+ @SelectJson("port")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Port expected() {
+ return Port.builder()
+ .state(State.ACTIVE)
+ .networkId("1234567890")
+ .name("jclouds-wibble")
+ .tenantId("1234567890")
+ .id("624312ff-d14b-4ba3-9834-1c78d23d574d")
+ .build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/895476f1/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/parse/ParseSubnetTest.java
----------------------------------------------------------------------
diff --git a/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/parse/ParseSubnetTest.java b/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/parse/ParseSubnetTest.java
new file mode 100644
index 0000000..d8e2dd3
--- /dev/null
+++ b/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2_0/parse/ParseSubnetTest.java
@@ -0,0 +1,53 @@
+/**
+ * Licensed to jclouds, Inc. (jclouds) under one or more
+ * contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. jclouds licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jclouds.openstack.neutron.v2_0.parse;
+
+import org.jclouds.json.BaseItemParserTest;
+import org.jclouds.openstack.neutron.v2_0.domain.Subnet;
+import org.jclouds.rest.annotations.SelectJson;
+import org.testng.annotations.Test;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+/**
+ * @author Nick Livens
+ */
+@Test(groups = "unit", testName = "ParseSubnetTest")
+public class ParseSubnetTest extends BaseItemParserTest<Subnet> {
+
+ @Override
+ public String resource() {
+ return "/subnet.json";
+ }
+
+ @Override
+ @SelectJson("subnet")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Subnet expected() {
+ return Subnet.builder()
+ .ipVersion(4)
+ .cidr("10.0.3.0/24")
+ .networkId("1234567890")
+ .name("jclouds-wibble")
+ .tenantId("1234567890")
+ .id("624312ff-d14b-4ba3-9834-1c78d23d574d")
+ .build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/895476f1/openstack-neutron/src/test/resources/list_networks.json
----------------------------------------------------------------------
diff --git a/openstack-neutron/src/test/resources/list_networks.json b/openstack-neutron/src/test/resources/list_networks.json
new file mode 100644
index 0000000..8fa99d4
--- /dev/null
+++ b/openstack-neutron/src/test/resources/list_networks.json
@@ -0,0 +1,62 @@
+{"networks":[
+ {
+ "name":"jclouds-test",
+ "tenant_id":"1234567890",
+ "id":"16dba3bc-f3fa-4775-afdc-237e12c72f6a"
+ },
+ {
+ "name":"wibble",
+ "tenant_id":"1234567890",
+ "id":"1a104cf5-cb18-4d35-9407-2fd2646d9d0b"
+ },
+ {
+ "name":"jclouds-test",
+ "tenant_id":"1234567890",
+ "id":"31083ae2-420d-48b2-ac98-9f7a4fd8dbdc"
+ },
+ {
+ "name":"jclouds-test",
+ "tenant_id":"1234567890",
+ "id":"49c6d6fa-ff2a-459d-b975-75a8d31c9a89"
+ },
+ {
+ "name":"wibble",
+ "tenant_id":"1234567890",
+ "id":"5cb3d6f4-62cb-41c9-b964-ba7d9df79e4e"
+ },
+ {
+ "name":"jclouds-test",
+ "tenant_id":"1234567890",
+ "id":"5d51d012-3491-4db7-b1b5-6f254015015d"
+ },
+ {
+ "name":"wibble",
+ "tenant_id":"1234567890",
+ "id":"5f9cf7dc-22ca-4097-8e49-1cc8b23faf17"
+ },
+ {
+ "name":"jclouds-test",
+ "tenant_id":"1234567890",
+ "id":"6319ecad-6bff-48b2-9b53-02ede8cb7588"
+ },
+ {
+ "name":"jclouds-test",
+ "tenant_id":"1234567890",
+ "id":"6ba4c788-661f-49ab-9bf8-5f10cbbb2f57"
+ },
+ {
+ "name":"jclouds-test",
+ "tenant_id":"1234567890",
+ "id":"74ed170b-5069-4353-ab38-9719766dc57e"
+ },
+ {
+ "name":"wibble",
+ "tenant_id":"1234567890",
+ "id":"b71fcac1-e864-4031-8c5b-edbecd9ece36"
+ },
+ {
+ "name":"jclouds-test",
+ "tenant_id":"1234567890",
+ "id":"c7681895-d84d-4650-9ca0-82c72036b855"
+ }
+]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/895476f1/openstack-neutron/src/test/resources/list_ports.json
----------------------------------------------------------------------
diff --git a/openstack-neutron/src/test/resources/list_ports.json b/openstack-neutron/src/test/resources/list_ports.json
new file mode 100644
index 0000000..392ef89
--- /dev/null
+++ b/openstack-neutron/src/test/resources/list_ports.json
@@ -0,0 +1,86 @@
+{"ports":[
+ {
+ "status":"ACTIVE",
+ "network_id":"1234567890",
+ "name":"jclouds-test",
+ "tenant_id":"1234567890",
+ "id":"16dba3bc-f3fa-4775-afdc-237e12c72f6a"
+ },
+ {
+ "status":"ACTIVE",
+ "network_id":"1234567890",
+ "name":"wibble",
+ "tenant_id":"1234567890",
+ "id":"1a104cf5-cb18-4d35-9407-2fd2646d9d0b"
+ },
+ {
+ "status":"ACTIVE",
+ "network_id":"1234567890",
+ "name":"jclouds-test",
+ "tenant_id":"1234567890",
+ "id":"31083ae2-420d-48b2-ac98-9f7a4fd8dbdc"
+ },
+ {
+ "status":"ACTIVE",
+ "network_id":"1234567890",
+ "name":"jclouds-test",
+ "tenant_id":"1234567890",
+ "id":"49c6d6fa-ff2a-459d-b975-75a8d31c9a89"
+ },
+ {
+ "status":"ACTIVE",
+ "network_id":"1234567890",
+ "name":"wibble",
+ "tenant_id":"1234567890",
+ "id":"5cb3d6f4-62cb-41c9-b964-ba7d9df79e4e"
+ },
+ {
+ "status":"ACTIVE",
+ "network_id":"1234567890",
+ "name":"jclouds-test",
+ "tenant_id":"1234567890",
+ "id":"5d51d012-3491-4db7-b1b5-6f254015015d"
+ },
+ {
+ "status":"ACTIVE",
+ "network_id":"1234567890",
+ "name":"wibble",
+ "tenant_id":"1234567890",
+ "id":"5f9cf7dc-22ca-4097-8e49-1cc8b23faf17"
+ },
+ {
+ "status":"ACTIVE",
+ "network_id":"1234567890",
+ "name":"jclouds-test",
+ "tenant_id":"1234567890",
+ "id":"6319ecad-6bff-48b2-9b53-02ede8cb7588"
+ },
+ {
+ "status":"ACTIVE",
+ "network_id":"1234567890",
+ "name":"jclouds-test",
+ "tenant_id":"1234567890",
+ "id":"6ba4c788-661f-49ab-9bf8-5f10cbbb2f57"
+ },
+ {
+ "status":"ACTIVE",
+ "network_id":"1234567890",
+ "name":"jclouds-test",
+ "tenant_id":"1234567890",
+ "id":"74ed170b-5069-4353-ab38-9719766dc57e"
+ },
+ {
+ "status":"ACTIVE",
+ "network_id":"1234567890",
+ "name":"wibble",
+ "tenant_id":"1234567890",
+ "id":"b71fcac1-e864-4031-8c5b-edbecd9ece36"
+ },
+ {
+ "status":"ACTIVE",
+ "network_id":"1234567890",
+ "name":"jclouds-test",
+ "tenant_id":"1234567890",
+ "id":"c7681895-d84d-4650-9ca0-82c72036b855"
+ }
+]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/895476f1/openstack-neutron/src/test/resources/list_subnets.json
----------------------------------------------------------------------
diff --git a/openstack-neutron/src/test/resources/list_subnets.json b/openstack-neutron/src/test/resources/list_subnets.json
new file mode 100644
index 0000000..dc59bd5
--- /dev/null
+++ b/openstack-neutron/src/test/resources/list_subnets.json
@@ -0,0 +1,98 @@
+{"subnets":[
+ {
+ "ip_version":4,
+ "cidr":"10.0.3.0/24",
+ "network_id":"1234567890",
+ "name":"jclouds-test",
+ "tenant_id":"1234567890",
+ "id":"16dba3bc-f3fa-4775-afdc-237e12c72f6a"
+ },
+ {
+ "ip_version":4,
+ "cidr":"10.0.3.0/24",
+ "network_id":"1234567890",
+ "name":"wibble",
+ "tenant_id":"1234567890",
+ "id":"1a104cf5-cb18-4d35-9407-2fd2646d9d0b"
+ },
+ {
+ "ip_version":4,
+ "cidr":"10.0.3.0/24",
+ "network_id":"1234567890",
+ "name":"jclouds-test",
+ "tenant_id":"1234567890",
+ "id":"31083ae2-420d-48b2-ac98-9f7a4fd8dbdc"
+ },
+ {
+ "ip_version":4,
+ "cidr":"10.0.3.0/24",
+ "network_id":"1234567890",
+ "name":"jclouds-test",
+ "tenant_id":"1234567890",
+ "id":"49c6d6fa-ff2a-459d-b975-75a8d31c9a89"
+ },
+ {
+ "ip_version":4,
+ "cidr":"10.0.3.0/24",
+ "network_id":"1234567890",
+ "name":"wibble",
+ "tenant_id":"1234567890",
+ "id":"5cb3d6f4-62cb-41c9-b964-ba7d9df79e4e"
+ },
+ {
+ "ip_version":4,
+ "cidr":"10.0.3.0/24",
+ "network_id":"1234567890",
+ "name":"jclouds-test",
+ "tenant_id":"1234567890",
+ "id":"5d51d012-3491-4db7-b1b5-6f254015015d"
+ },
+ {
+ "ip_version":4,
+ "cidr":"10.0.3.0/24",
+ "network_id":"1234567890",
+ "name":"wibble",
+ "tenant_id":"1234567890",
+ "id":"5f9cf7dc-22ca-4097-8e49-1cc8b23faf17"
+ },
+ {
+ "ip_version":4,
+ "cidr":"10.0.3.0/24",
+ "network_id":"1234567890",
+ "name":"jclouds-test",
+ "tenant_id":"1234567890",
+ "id":"6319ecad-6bff-48b2-9b53-02ede8cb7588"
+ },
+ {
+ "ip_version":4,
+ "cidr":"10.0.3.0/24",
+ "network_id":"1234567890",
+ "name":"jclouds-test",
+ "tenant_id":"1234567890",
+ "id":"6ba4c788-661f-49ab-9bf8-5f10cbbb2f57"
+ },
+ {
+ "ip_version":4,
+ "cidr":"10.0.3.0/24",
+ "network_id":"1234567890",
+ "name":"jclouds-test",
+ "tenant_id":"1234567890",
+ "id":"74ed170b-5069-4353-ab38-9719766dc57e"
+ },
+ {
+ "ip_version":4,
+ "cidr":"10.0.3.0/24",
+ "network_id":"1234567890",
+ "name":"wibble",
+ "tenant_id":"1234567890",
+ "id":"b71fcac1-e864-4031-8c5b-edbecd9ece36"
+ },
+ {
+ "ip_version":4,
+ "cidr":"10.0.3.0/24",
+ "network_id":"1234567890",
+ "name":"jclouds-test",
+ "tenant_id":"1234567890",
+ "id":"c7681895-d84d-4650-9ca0-82c72036b855"
+ }
+]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/895476f1/openstack-neutron/src/test/resources/logback.xml
----------------------------------------------------------------------
diff --git a/openstack-neutron/src/test/resources/logback.xml b/openstack-neutron/src/test/resources/logback.xml
new file mode 100644
index 0000000..6559c23
--- /dev/null
+++ b/openstack-neutron/src/test/resources/logback.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<configuration scan="false">
+ <appender name="FILE" class="ch.qos.logback.core.FileAppender">
+ <file>target/test-data/jclouds.log</file>
+
+ <encoder>
+ <Pattern>%d %-5p [%c] [%thread] %m%n</Pattern>
+ </encoder>
+ </appender>
+
+ <appender name="WIREFILE" class="ch.qos.logback.core.FileAppender">
+ <file>target/test-data/jclouds-wire.log</file>
+
+ <encoder>
+ <Pattern>%d %-5p [%c] [%thread] %m%n</Pattern>
+ </encoder>
+ </appender>
+
+ <appender name="BLOBSTOREFILE" class="ch.qos.logback.core.FileAppender">
+ <file>target/test-data/jclouds-blobstore.log</file>
+
+ <encoder>
+ <Pattern>%d %-5p [%c] [%thread] %m%n</Pattern>
+ </encoder>
+ </appender>
+
+ <root>
+ <level value="warn" />
+ </root>
+
+ <logger name="org.jclouds">
+ <level value="DEBUG" />
+ <appender-ref ref="FILE" />
+ </logger>
+
+ <logger name="jclouds.wire">
+ <level value="DEBUG" />
+ <appender-ref ref="WIREFILE" />
+ </logger>
+
+ <logger name="jclouds.headers">
+ <level value="DEBUG" />
+ <appender-ref ref="WIREFILE" />
+ </logger>
+
+ <logger name="jclouds.blobstore">
+ <level value="DEBUG" />
+ <appender-ref ref="BLOBSTOREFILE" />
+ </logger>
+
+</configuration>
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/895476f1/openstack-neutron/src/test/resources/network.json
----------------------------------------------------------------------
diff --git a/openstack-neutron/src/test/resources/network.json b/openstack-neutron/src/test/resources/network.json
new file mode 100644
index 0000000..e2d5395
--- /dev/null
+++ b/openstack-neutron/src/test/resources/network.json
@@ -0,0 +1,7 @@
+{"network":{
+ "provider:network_type":"local",
+ "status":"ACTIVE",
+ "name":"jclouds-wibble",
+ "tenant_id":"1234567890",
+ "id":"624312ff-d14b-4ba3-9834-1c78d23d574d"
+}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/895476f1/openstack-neutron/src/test/resources/port.json
----------------------------------------------------------------------
diff --git a/openstack-neutron/src/test/resources/port.json b/openstack-neutron/src/test/resources/port.json
new file mode 100644
index 0000000..386303f
--- /dev/null
+++ b/openstack-neutron/src/test/resources/port.json
@@ -0,0 +1,7 @@
+{"port":{
+ "status":"ACTIVE",
+ "network_id":"1234567890",
+ "name":"jclouds-wibble",
+ "tenant_id":"1234567890",
+ "id":"624312ff-d14b-4ba3-9834-1c78d23d574d"
+}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/895476f1/openstack-neutron/src/test/resources/subnet.json
----------------------------------------------------------------------
diff --git a/openstack-neutron/src/test/resources/subnet.json b/openstack-neutron/src/test/resources/subnet.json
new file mode 100644
index 0000000..abc5ceb
--- /dev/null
+++ b/openstack-neutron/src/test/resources/subnet.json
@@ -0,0 +1,8 @@
+{"subnet":{
+ "ip_version":4,
+ "cidr":"10.0.3.0/24",
+ "network_id":"1234567890",
+ "name":"jclouds-wibble",
+ "tenant_id":"1234567890",
+ "id":"624312ff-d14b-4ba3-9834-1c78d23d574d"
+}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/895476f1/openstack-quantum/pom.xml
----------------------------------------------------------------------
diff --git a/openstack-quantum/pom.xml b/openstack-quantum/pom.xml
deleted file mode 100644
index c8db6ee..0000000
--- a/openstack-quantum/pom.xml
+++ /dev/null
@@ -1,125 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-project</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- </parent>
-
- <!-- TODO: when out of labs, switch to org.jclouds.api -->
- <groupId>org.apache.jclouds.labs</groupId>
- <artifactId>openstack-quantum</artifactId>
- <version>1.7.0-SNAPSHOT</version>
- <name>jclouds openstack-quantum api</name>
- <description>jclouds components to access an implementation of OpenStack Quantum</description>
- <packaging>bundle</packaging>
-
- <properties>
- <!-- keystone endpoint -->
- <test.openstack-quantum.endpoint>http://localhost:5000/v2.0/</test.openstack-quantum.endpoint>
- <!-- keystone version -->
- <test.openstack-quantum.api-version>1.0</test.openstack-quantum.api-version>
- <test.openstack-quantum.build-version />
- <test.openstack-quantum.identity>FIXME_IDENTITY</test.openstack-quantum.identity>
- <test.openstack-quantum.credential>FIXME_CREDENTIALS</test.openstack-quantum.credential>
- <test.jclouds.keystone.credential-type>passwordCredentials</test.jclouds.keystone.credential-type>
- <jclouds.osgi.export>org.jclouds.openstack.quantum.v1_0*;version="${project.version}"</jclouds.osgi.export>
- <jclouds.osgi.import>
- org.jclouds.rest.internal;version="${jclouds.version}",
- org.jclouds.labs*;version="${project.version}",
- org.jclouds*;version="${jclouds.version}",
- *
- </jclouds.osgi.import>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.jclouds.api</groupId>
- <artifactId>openstack-keystone</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-core</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-core</artifactId>
- <version>${project.parent.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.api</groupId>
- <artifactId>openstack-keystone</artifactId>
- <version>${project.parent.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.driver</groupId>
- <artifactId>jclouds-slf4j</artifactId>
- <version>${project.parent.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <profiles>
- <profile>
- <id>live</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <executions>
- <execution>
- <id>integration</id>
- <phase>integration-test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <systemPropertyVariables>
- <test.openstack-quantum.endpoint>${test.openstack-quantum.endpoint}</test.openstack-quantum.endpoint>
- <test.openstack-quantum.api-version>${test.openstack-quantum.api-version}</test.openstack-quantum.api-version>
- <test.openstack-quantum.build-version>${test.openstack-quantum.build-version}</test.openstack-quantum.build-version>
- <test.openstack-quantum.identity>${test.openstack-quantum.identity}</test.openstack-quantum.identity>
- <test.openstack-quantum.credential>${test.openstack-quantum.credential}</test.openstack-quantum.credential>
- <test.jclouds.keystone.credential-type>${test.jclouds.keystone.credential-type}</test.jclouds.keystone.credential-type>
- </systemPropertyVariables>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/895476f1/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/QuantumApi.java
----------------------------------------------------------------------
diff --git a/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/QuantumApi.java b/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/QuantumApi.java
deleted file mode 100644
index 02ac8d3..0000000
--- a/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/QuantumApi.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.quantum.v1_0;
-
-import java.util.Set;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.location.Zone;
-import org.jclouds.location.functions.ZoneToEndpoint;
-import org.jclouds.openstack.quantum.v1_0.features.NetworkApi;
-import org.jclouds.openstack.quantum.v1_0.features.PortApi;
-import org.jclouds.openstack.v2_0.features.ExtensionApi;
-import org.jclouds.rest.annotations.Delegate;
-import org.jclouds.rest.annotations.EndpointParam;
-
-import com.google.inject.Provides;
-
-import java.io.Closeable;
-
-/**
- * Provides access to Quantum.
- * <p/>
- *
- * @author Adam Lowe
- * @author Zack Shoylev
- * @see <a href="http://docs.openstack.org/api/openstack-network/1.0/content">api doc</a>
- */
-public interface QuantumApi extends Closeable {
- /**
- * @return the Zone codes configured
- */
- @Provides
- @Zone
- Set<String> getConfiguredZones();
-
- /**
- * Provides access to Extension features.
- */
- @Delegate
- ExtensionApi getExtensionApiForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides access to Network features.
- */
- @Delegate
- NetworkApi getNetworkApiForZone(@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides access to Port features.
- */
- @Delegate
- @Path("/networks/{net}")
- PortApi getPortApiForZoneAndNetwork(@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone,
- @PathParam("net") String networkId);
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/895476f1/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/QuantumApiMetadata.java
----------------------------------------------------------------------
diff --git a/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/QuantumApiMetadata.java b/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/QuantumApiMetadata.java
deleted file mode 100644
index de79814..0000000
--- a/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/QuantumApiMetadata.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.quantum.v1_0;
-
-import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE;
-import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.SERVICE_TYPE;
-import java.net.URI;
-import java.util.Properties;
-import org.jclouds.apis.ApiMetadata;
-import org.jclouds.openstack.keystone.v2_0.config.AuthenticationApiModule;
-import org.jclouds.openstack.keystone.v2_0.config.CredentialTypes;
-import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule;
-import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.ZoneModule;
-import org.jclouds.openstack.quantum.v1_0.config.QuantumHttpApiModule;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.rest.internal.BaseHttpApiMetadata;
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Module;
-
-/**
- * Implementation of {@link ApiMetadata} for Quantum 1.0 API
- *
- * @author Adam Lowe
- * @author Zack Shoylev
- */
-public class QuantumApiMetadata extends BaseHttpApiMetadata<QuantumApi> {
-
- @Override
- public Builder toBuilder() {
- return new Builder().fromApiMetadata(this);
- }
-
- public QuantumApiMetadata() {
- this(new Builder());
- }
-
- protected QuantumApiMetadata(Builder builder) {
- super(builder);
- }
-
- public static Properties defaultProperties() {
- Properties properties = BaseHttpApiMetadata.defaultProperties();
- properties.setProperty(SERVICE_TYPE, ServiceType.NETWORK);
- properties.setProperty(CREDENTIAL_TYPE, CredentialTypes.PASSWORD_CREDENTIALS);
- return properties;
- }
-
- public static class Builder extends BaseHttpApiMetadata.Builder<QuantumApi, Builder> {
-
- protected Builder() {
- id("openstack-quantum")
- .name("OpenStack Quantum API")
- .identityName("${tenantName}:${userName} or ${userName}, if your keystone supports a default tenant")
- .credentialName("${password}")
- .endpointName("KeyStone base url ending in /v2.0/")
- .documentation(URI.create("http://docs.openstack.org/api/openstack-network/1.0/content/"))
- .version("1.0")
- .defaultEndpoint("http://localhost:5000/v2.0/")
- .defaultProperties(QuantumApiMetadata.defaultProperties())
- .defaultModules(ImmutableSet.<Class<? extends Module>>builder()
- .add(AuthenticationApiModule.class)
- .add(KeystoneAuthenticationModule.class)
- .add(ZoneModule.class)
- .add(QuantumHttpApiModule.class).build());
- }
-
- @Override
- public QuantumApiMetadata build() {
- return new QuantumApiMetadata(this);
- }
-
- @Override
- protected Builder self() {
- return this;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/895476f1/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/config/QuantumHttpApiModule.java
----------------------------------------------------------------------
diff --git a/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/config/QuantumHttpApiModule.java b/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/config/QuantumHttpApiModule.java
deleted file mode 100644
index 384f6b2..0000000
--- a/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/config/QuantumHttpApiModule.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.quantum.v1_0.config;
-
-import java.net.URI;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.annotation.ClientError;
-import org.jclouds.http.annotation.Redirection;
-import org.jclouds.http.annotation.ServerError;
-import org.jclouds.json.config.GsonModule.DateAdapter;
-import org.jclouds.json.config.GsonModule.Iso8601DateAdapter;
-import org.jclouds.openstack.quantum.v1_0.QuantumApi;
-import org.jclouds.openstack.quantum.v1_0.handlers.QuantumErrorHandler;
-import org.jclouds.openstack.v2_0.domain.Extension;
-import org.jclouds.openstack.v2_0.functions.PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet;
-import org.jclouds.rest.ConfiguresHttpApi;
-import org.jclouds.rest.config.HttpApiModule;
-import org.jclouds.rest.functions.ImplicitOptionalConverter;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.ImmutableMultimap;
-import com.google.common.collect.Multimap;
-import com.google.inject.Provides;
-
-/**
- * Configures the Quantum connection.
- *
- * @author Adam Lowe
- * @author Zack Shoylev
- */
-@ConfiguresHttpApi
-public class QuantumHttpApiModule extends HttpApiModule<QuantumApi> {
-
- @Override
- protected void configure() {
- bind(DateAdapter.class).to(Iso8601DateAdapter.class);
- bind(ImplicitOptionalConverter.class).to(PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet.class);
- super.configure();
- }
-
- @Provides
- @Singleton
- public Multimap<URI, URI> aliases() {
- return ImmutableMultimap.<URI, URI>builder()
- .build();
- }
-
- @Provides
- @Singleton
- public LoadingCache<String, Set<? extends Extension>> provideExtensionsByZone(final Provider<QuantumApi> quantumApi) {
- return CacheBuilder.newBuilder().expireAfterWrite(23, TimeUnit.HOURS)
- .build(new CacheLoader<String, Set<? extends Extension>>() {
- @Override
- public Set<? extends Extension> load(String key) throws Exception {
- return quantumApi.get().getExtensionApiForZone(key).list();
- }
- });
- }
-
- @Override
- protected void bindErrorHandlers() {
- bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(QuantumErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(QuantumErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(QuantumErrorHandler.class);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/895476f1/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/config/QuantumProperties.java
----------------------------------------------------------------------
diff --git a/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/config/QuantumProperties.java b/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/config/QuantumProperties.java
deleted file mode 100644
index 48e7dec..0000000
--- a/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/config/QuantumProperties.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.quantum.v1_0.config;
-
-/**
- * Configuration properties and constants used in openstack Quantum connections.
- *
- * @author Adam Lowe
- */
-public class QuantumProperties {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/895476f1/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/Attachment.java
----------------------------------------------------------------------
diff --git a/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/Attachment.java b/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/Attachment.java
deleted file mode 100644
index 42d41b5..0000000
--- a/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/Attachment.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.quantum.v1_0.domain;
-
-import java.beans.ConstructorProperties;
-
-/**
- * A Quantum attachment
- *
- * @author Adam Lowe
- * @see <a href="http://docs.openstack.org/api/openstack-network/1.0/content/Attachments.html">api doc</a>
-*/
-public class Attachment extends Reference {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromAttachment(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> extends Reference.Builder<T> {
-
- public Attachment build() {
- return new Attachment(id);
- }
-
- public T fromAttachment(Attachment in) {
- return super.fromReference(in);
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
-
- @ConstructorProperties({
- "id"
- })
- protected Attachment(String id) {
- super(id);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/895476f1/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/Network.java
----------------------------------------------------------------------
diff --git a/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/Network.java b/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/Network.java
deleted file mode 100644
index 6012b09..0000000
--- a/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/Network.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.quantum.v1_0.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * A Quantum network
- *
- * @author Adam Lowe
- * @see <a href="http://docs.openstack.org/api/openstack-network/1.0/content/Networks.html">api doc</a>
-*/
-public class Network extends Reference {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromNetwork(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> extends Reference.Builder<T> {
- protected String name;
-
- /**
- * @see Network#getName()
- */
- public T name(String name) {
- this.name = name;
- return self();
- }
-
- public Network build() {
- return new Network(id, name);
- }
-
- public T fromNetwork(Network in) {
- return super.fromReference(in)
- .name(in.getName());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final String name;
-
- @ConstructorProperties({
- "id", "name"
- })
- protected Network(String id, String name) {
- super(id);
- this.name = checkNotNull(name, "name");
- }
-
- public String getName() {
- return this.name;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(super.hashCode(), name);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- Network that = Network.class.cast(obj);
- return super.equals(that) && Objects.equal(this.name, that.name);
- }
-
- protected ToStringHelper string() {
- return super.string()
- .add("name", name);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/895476f1/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/NetworkDetails.java
----------------------------------------------------------------------
diff --git a/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/NetworkDetails.java b/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/NetworkDetails.java
deleted file mode 100644
index 54808d0..0000000
--- a/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/NetworkDetails.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.quantum.v1_0.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-import java.util.Set;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Details of a Quantum network
- *
- * @author Adam Lowe
- * @see <a href="http://docs.openstack.org/api/openstack-network/1.0/content/Networks.html">api doc</a>
-*/
-public class NetworkDetails extends Network {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromNetworkDetails(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> extends Network.Builder<T> {
- protected Set<Port> ports = ImmutableSet.of();
-
- /**
- * @see NetworkDetails#getPorts()
- */
- public T ports(Set<Port> ports) {
- this.ports = ImmutableSet.copyOf(checkNotNull(ports, "ports"));
- return self();
- }
-
- public T ports(Port... in) {
- return ports(ImmutableSet.copyOf(in));
- }
-
- public NetworkDetails build() {
- return new NetworkDetails(id, name, ports);
- }
-
- public T fromNetworkDetails(NetworkDetails in) {
- return super.fromNetwork(in)
- .ports(in.getPorts());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final Set<Port> ports;
-
- @ConstructorProperties({
- "id", "name", "ports"
- })
- protected NetworkDetails(String id, String name, Set<Port> ports) {
- super(id, name);
- this.ports = ImmutableSet.copyOf(checkNotNull(ports, "ports"));
- }
-
- public Set<Port> getPorts() {
- return this.ports;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(ports);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- NetworkDetails that = NetworkDetails.class.cast(obj);
- return super.equals(that) && Objects.equal(this.ports, that.ports);
- }
-
- protected ToStringHelper string() {
- return super.string()
- .add("ports", ports);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/895476f1/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/Port.java
----------------------------------------------------------------------
diff --git a/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/Port.java b/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/Port.java
deleted file mode 100644
index 53c5fc4..0000000
--- a/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/Port.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.quantum.v1_0.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * A Quantum port
- *
- * @author Adam Lowe
- * @see <a href="http://docs.openstack.org/api/openstack-network/1.0/content/Ports.html">api doc</a>
-*/
-public class Port extends Reference {
-
- /**
- */
- public static enum State {
- ACTIVE, DOWN
- }
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromPort(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> extends Reference.Builder<T> {
- protected Port.State state;
-
- /**
- * @see Port#getState()
- */
- public T state(Port.State state) {
- this.state = state;
- return self();
- }
-
- public Port build() {
- return new Port(id, state);
- }
-
- public T fromPort(Port in) {
- return super.fromReference(in)
- .state(in.getState());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final Port.State state;
-
- @ConstructorProperties({
- "id", "state"
- })
- protected Port(String id, Port.State state) {
- super(id);
- this.state = checkNotNull(state, "state");
- }
-
- public Port.State getState() {
- return this.state;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(state);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- Port that = Port.class.cast(obj);
- return super.equals(that) && Objects.equal(this.state, that.state);
- }
-
- protected ToStringHelper string() {
- return super.string()
- .add("state", state);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/895476f1/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/PortDetails.java
----------------------------------------------------------------------
diff --git a/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/PortDetails.java b/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/PortDetails.java
deleted file mode 100644
index d02275e..0000000
--- a/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/PortDetails.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.quantum.v1_0.domain;
-
-import java.beans.ConstructorProperties;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * Details of a Quantum Port
- *
- * @author Adam Lowe
- * @see <a href="http://docs.openstack.org/api/openstack-network/1.0/content/Ports.html">api doc</a>
-*/
-public class PortDetails extends Port {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromPortDetails(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> extends Port.Builder<T> {
- protected Attachment attachment;
-
- /**
- * @see PortDetails#getAttachment()
- */
- public T attachment(Attachment attachment) {
- this.attachment = attachment;
- return self();
- }
-
- public PortDetails build() {
- return new PortDetails(id, state, attachment);
- }
-
- public T fromPortDetails(PortDetails in) {
- return super.fromPort(in)
- .attachment(in.getAttachment());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final Attachment attachment;
-
- @ConstructorProperties({
- "id", "state", "attachment"
- })
- protected PortDetails(String id, Port.State state, @Nullable Attachment attachment) {
- super(id, state);
- this.attachment = attachment;
- }
-
- @Nullable
- public Attachment getAttachment() {
- return this.attachment;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(attachment);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- PortDetails that = PortDetails.class.cast(obj);
- return super.equals(that) && Objects.equal(this.attachment, that.attachment);
- }
-
- protected ToStringHelper string() {
- return super.string()
- .add("attachment", attachment);
- }
-
-}