http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/features/SubnetApiExpectTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/features/SubnetApiExpectTest.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/features/SubnetApiExpectTest.java new file mode 100644 index 0000000..0cab1dd --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/features/SubnetApiExpectTest.java @@ -0,0 +1,252 @@ +/* + * 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.assertEquals; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertNull; +import static org.testng.Assert.assertTrue; + +/** + * Tests parsing and Guice wiring of SubnetApi + */ +@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/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/features/SubnetApiLiveTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/features/SubnetApiLiveTest.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/features/SubnetApiLiveTest.java new file mode 100644 index 0000000..b463339 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/features/SubnetApiLiveTest.java @@ -0,0 +1,139 @@ +/* + * 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 static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertTrue; + +import java.util.Set; + +import org.jclouds.openstack.neutron.v2_0.domain.AllocationPool; +import org.jclouds.openstack.neutron.v2_0.domain.BulkSubnet; +import org.jclouds.openstack.neutron.v2_0.domain.HostRoute; +import org.jclouds.openstack.neutron.v2_0.domain.NetworkType; +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.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 org.jclouds.openstack.neutron.v2_0.util.PredicateUtil; +import org.testng.annotations.Test; + +import com.google.common.base.Predicate; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; + +/** + * Tests subnet api in combination with the network api + * + */ +@Test(groups = "live", testName = "SubnetApiLiveTest") +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) { + Predicate<Subnet> idEqualsPredicate = PredicateUtil.createIdEqualsPredicate(net.getId()); + assertEquals(1, Sets.filter(existingSubnets, idEqualsPredicate).size()); + assertTrue(subnetApi.delete(net.getId())); + } + assertTrue(networkApi.delete(networkId)); + } + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/internal/BaseNeutronApiExpectTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/internal/BaseNeutronApiExpectTest.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/internal/BaseNeutronApiExpectTest.java new file mode 100644 index 0000000..ff9ffa7 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/internal/BaseNeutronApiExpectTest.java @@ -0,0 +1,66 @@ +/* + * 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.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 + */ +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/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/internal/BaseNeutronApiLiveTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/internal/BaseNeutronApiLiveTest.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/internal/BaseNeutronApiLiveTest.java new file mode 100644 index 0000000..de5755e --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/internal/BaseNeutronApiLiveTest.java @@ -0,0 +1,44 @@ +/* + * 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.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} + */ +@Test(groups = "live") +public class BaseNeutronApiLiveTest extends BaseApiLiveTest<NeutronApi> { + + public BaseNeutronApiLiveTest() { + provider = "openstack-neutron-legacy"; + } + + @Override + protected Properties setupProperties() { + Properties props = super.setupProperties(); + setIfTestSystemPropertyPresent(props, KeystoneProperties.CREDENTIAL_TYPE); + return props; + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/internal/BaseNeutronExpectTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/internal/BaseNeutronExpectTest.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/internal/BaseNeutronExpectTest.java new file mode 100644 index 0000000..d8c024c --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/internal/BaseNeutronExpectTest.java @@ -0,0 +1,64 @@ +/* + * 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.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 + */ +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-legacy"; + 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/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/parse/ParseNetworkTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/parse/ParseNetworkTest.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/parse/ParseNetworkTest.java new file mode 100644 index 0000000..9509ba3 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/parse/ParseNetworkTest.java @@ -0,0 +1,50 @@ +/* + * 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.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; + +@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/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/parse/ParsePortTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/parse/ParsePortTest.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/parse/ParsePortTest.java new file mode 100644 index 0000000..b029299 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/parse/ParsePortTest.java @@ -0,0 +1,49 @@ +/* + * 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.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; + +@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/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/parse/ParseRouterTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/parse/ParseRouterTest.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/parse/ParseRouterTest.java new file mode 100644 index 0000000..1787129 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/parse/ParseRouterTest.java @@ -0,0 +1,51 @@ +/* + * 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.parse; + +import org.jclouds.json.BaseItemParserTest; +import org.jclouds.openstack.neutron.v2_0.domain.ExternalGatewayInfo; +import org.jclouds.openstack.neutron.v2_0.domain.Router; +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; + +@Test(groups = "unit", testName = "ParseRouterTest") +public class ParseRouterTest extends BaseItemParserTest<Router> { + + @Override + public String resource() { + return "/router.json"; + } + + @Override + @SelectJson("router") + @Consumes(MediaType.APPLICATION_JSON) + public Router expected() { + return Router.builder() + .externalGatewayInfo(ExternalGatewayInfo.builder().networkId("624312ff-d14b-4ba3-9834-1c78d23d574d").build()) + .state(State.ACTIVE) + .name("jclouds-wibble") + .tenantId("1234567890") + .id("16dba3bc-f3fa-4775-afdc-237e12c72f6a") + .build(); + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/parse/ParseSubnetTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/parse/ParseSubnetTest.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/parse/ParseSubnetTest.java new file mode 100644 index 0000000..afe84b4 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/parse/ParseSubnetTest.java @@ -0,0 +1,49 @@ +/* + * 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.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; + +@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/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/util/ClassUtil.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/util/ClassUtil.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/util/ClassUtil.java new file mode 100644 index 0000000..1797fb3 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/util/ClassUtil.java @@ -0,0 +1,39 @@ +/* + * 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.util; + +import java.lang.reflect.Field; + +public class ClassUtil { + + public static Field findField(Class clazz, String fieldName) { + Field fieldToFind = null; + if (clazz.getSuperclass() != null) + fieldToFind = findField(clazz.getSuperclass(), fieldName); + + if (fieldToFind != null) + return fieldToFind; + + for (Field field : clazz.getDeclaredFields()) { + if (field.getName().equals(fieldName)) + return field; + } + return null; + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/util/PredicateUtil.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/util/PredicateUtil.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/util/PredicateUtil.java new file mode 100644 index 0000000..95ede8f --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/java/org/jclouds/openstack/neutron/v2_0/util/PredicateUtil.java @@ -0,0 +1,47 @@ +/* + * 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.util; + +import com.google.common.base.Predicate; +import org.jclouds.javax.annotation.Nullable; + +import java.lang.reflect.Field; + +public class PredicateUtil { + + public static <T> Predicate<T> createIdEqualsPredicate(final String id) { + return new Predicate<T>() { + @Override + public boolean apply(@Nullable T input) { + if (input == null) return false; + + try { + Class clazz = input.getClass(); + Field field = ClassUtil.findField(clazz, "id"); + field.setAccessible(true); + String value = (String) field.get(input); + field.setAccessible(false); + return value != null && value.equals(id); + } catch (IllegalAccessException iae) { + return false; + } + } + }; + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/access.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/access.json b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/access.json new file mode 100644 index 0000000..fab1645 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/access.json @@ -0,0 +1,228 @@ +{ + "access": { + "metadata": { + "roles": [ + "9fe2ff9ee4384b1894a90878d3e92bab", + "b926cb0f4e2642678735f86c2b06205e", + "33484487e73d4da0918a19b9c7e1f8ae", + "f2e54c2105fb49e29479af047115cebc" + ], + "is_admin": 0 + }, + "user": { + "name": "joe", + "roles": [ + { + "name": "_member_" + }, + { + "name": "anotherrole" + }, + { + "name": "heat_stack_owner" + }, + { + "name": "Member" + } + ], + "id": "8fbf8e68d36e4ac7bcf912a26213bd49", + "roles_links": [], + "username": "joe" + }, + "serviceCatalog": [ + { + "name": "nova", + "type": "compute", + "endpoints_links": [], + "endpoints": [ + { + "publicURL": "URL/v2/da0d12be20394afb851716e10a49e4a7", + "id": "2122bcaa704343c19ad2578410d4961d", + "internalURL": "URL/v2/da0d12be20394afb851716e10a49e4a7", + "region": "RegionOne", + "adminURL": "URL/v2/da0d12be20394afb851716e10a49e4a7" + } + ] + }, + { + "name": "neutron", + "type": "network", + "endpoints_links": [], + "endpoints": [ + { + "publicURL": "URL/", + "id": "65a4d3f13cfb49a6a57a04e205cc2158", + "internalURL": "URL/", + "region": "RegionOne", + "adminURL": "URL/" + } + ] + }, + { + "name": "cinderv2", + "type": "volumev2", + "endpoints_links": [], + "endpoints": [ + { + "publicURL": "URL/v2/da0d12be20394afb851716e10a49e4a7", + "id": "31fe4d92eac44044b05be21c6f44cebc", + "internalURL": "URL/v2/da0d12be20394afb851716e10a49e4a7", + "region": "RegionOne", + "adminURL": "URL/v2/da0d12be20394afb851716e10a49e4a7" + } + ] + }, + { + "name": "trove", + "type": "database", + "endpoints_links": [], + "endpoints": [ + { + "publicURL": "URL/v1.0/da0d12be20394afb851716e10a49e4a7", + "id": "06b7a7dbd25c4a01819c879700a9712a", + "internalURL": "URL/v1.0/da0d12be20394afb851716e10a49e4a7", + "region": "RegionOne", + "adminURL": "URL/v1.0/da0d12be20394afb851716e10a49e4a7" + } + ] + }, + { + "name": "s3", + "type": "s3", + "endpoints_links": [], + "endpoints": [ + { + "publicURL": "URL", + "id": "93b0b67091324e8ba01b62ee0584994c", + "internalURL": "URL", + "region": "RegionOne", + "adminURL": "URL" + } + ] + }, + { + "name": "glance", + "type": "image", + "endpoints_links": [], + "endpoints": [ + { + "publicURL": "URL", + "id": "a542e91bcfa046bfa1bf2397356d1414", + "internalURL": "URL", + "region": "RegionOne", + "adminURL": "URL" + } + ] + }, + { + "name": "novav3", + "type": "computev3", + "endpoints_links": [], + "endpoints": [ + { + "publicURL": "URL/v3", + "id": "9c3e8abb576d483db93bcef70c67bc1d", + "internalURL": "URL/v3", + "region": "RegionOne", + "adminURL": "URL/v3" + } + ] + }, + { + "name": "heat", + "type": "cloudformation", + "endpoints_links": [], + "endpoints": [ + { + "publicURL": "URL/v1", + "id": "6f4ca5ca9698425b85c300b3fc176c39", + "internalURL": "URL/v1", + "region": "RegionOne", + "adminURL": "URL/v1" + } + ] + }, + { + "name": "cinder", + "type": "volume", + "endpoints_links": [], + "endpoints": [ + { + "publicURL": "URL/v1/da0d12be20394afb851716e10a49e4a7", + "id": "037039c676694a35aa28d34fce09e51d", + "internalURL": "URL/v1/da0d12be20394afb851716e10a49e4a7", + "region": "RegionOne", + "adminURL": "URL/v1/da0d12be20394afb851716e10a49e4a7" + } + ] + }, + { + "name": "ec2", + "type": "ec2", + "endpoints_links": [], + "endpoints": [ + { + "publicURL": "URL/services/Cloud", + "id": "1d242631bccb4ff4ba7a395dbcb51648", + "internalURL": "URL/services/Cloud", + "region": "RegionOne", + "adminURL": "URL/services/Admin" + } + ] + }, + { + "name": "heat", + "type": "orchestration", + "endpoints_links": [], + "endpoints": [ + { + "publicURL": "URL/v1/da0d12be20394afb851716e10a49e4a7", + "id": "199d00075e4a40308a6ad2aa8980d0cd", + "internalURL": "URL/v1/da0d12be20394afb851716e10a49e4a7", + "region": "RegionOne", + "adminURL": "URL/v1/da0d12be20394afb851716e10a49e4a7" + } + ] + }, + { + "name": "swift", + "type": "object-store", + "endpoints_links": [], + "endpoints": [ + { + "publicURL": "URL/v1/AUTH_da0d12be20394afb851716e10a49e4a7", + "id": "26b2cb1efb044193b847fc3f2fb12e82", + "internalURL": "URL/v1/AUTH_da0d12be20394afb851716e10a49e4a7", + "region": "RegionOne", + "adminURL": "URL" + } + ] + }, + { + "name": "keystone", + "type": "identity", + "endpoints_links": [], + "endpoints": [ + { + "publicURL": "URL/v2.0", + "id": "1bbfe80b50df4c4a84040aa782e42140", + "internalURL": "URL/v2.0", + "region": "RegionOne", + "adminURL": "URL/v2.0" + } + ] + } + ], + "token": { + "tenant": { + "name": "jclouds", + "id": "da0d12be20394afb851716e10a49e4a7", + "enabled": true, + "description": null + }, + "id": "TOKEN", + "expires": "2014-04-28T22:48:24Z", + "issued_at": "2014-04-28T21:48:24.972896" + } + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/extension_details.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/extension_details.json b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/extension_details.json new file mode 100644 index 0000000..9e10fef --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/extension_details.json @@ -0,0 +1,10 @@ +{ + "extension": { + "name": "Neutron L3 Router", + "namespace": "http://docs.openstack.org/ext/neutron/router/api/v1.0", + "alias": "router", + "updated": "2012-07-20T10:00:00-00:00", + "description": "Router abstraction for basic L3 forwarding between L2 Neutron networks and access to external networks via a NAT gateway.", + "links": [] + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/extension_list.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/extension_list.json b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/extension_list.json new file mode 100644 index 0000000..9f85e1e --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/extension_list.json @@ -0,0 +1,140 @@ +{ + "extensions": [ + { + "updated": "2013-01-20T00:00:00-00:00", + "name": "Neutron Service Type Management", + "links": [], + "namespace": "http://docs.openstack.org/ext/neutron/service-type/api/v1.0", + "alias": "service-type", + "description": "API for retrieving service providers for Neutron advanced services" + }, + { + "updated": "2012-10-05T10:00:00-00:00", + "name": "security-group", + "links": [], + "namespace": "http://docs.openstack.org/ext/securitygroups/api/v2.0", + "alias": "security-group", + "description": "The security groups extension." + }, + { + "updated": "2013-02-07T10:00:00-00:00", + "name": "L3 Agent Scheduler", + "links": [], + "namespace": "http://docs.openstack.org/ext/l3_agent_scheduler/api/v1.0", + "alias": "l3_agent_scheduler", + "description": "Schedule routers among l3 agents" + }, + { + "updated": "2013-02-07T10:00:00-00:00", + "name": "Loadbalancer Agent Scheduler", + "links": [], + "namespace": "http://docs.openstack.org/ext/lbaas_agent_scheduler/api/v1.0", + "alias": "lbaas_agent_scheduler", + "description": "Schedule pools among lbaas agents" + }, + { + "updated": "2013-03-28T10:00:00-00:00", + "name": "Neutron L3 Configurable external gateway mode", + "links": [], + "namespace": "http://docs.openstack.org/ext/neutron/ext-gw-mode/api/v1.0", + "alias": "ext-gw-mode", + "description": "Extension of the router abstraction for specifying whether SNAT should occur on the external gateway" + }, + { + "updated": "2014-02-03T10:00:00-00:00", + "name": "Port Binding", + "links": [], + "namespace": "http://docs.openstack.org/ext/binding/api/v1.0", + "alias": "binding", + "description": "Expose port bindings of a virtual port to external application" + }, + { + "updated": "2012-09-07T10:00:00-00:00", + "name": "Provider Network", + "links": [], + "namespace": "http://docs.openstack.org/ext/provider/api/v1.0", + "alias": "provider", + "description": "Expose mapping of virtual networks to physical networks" + }, + { + "updated": "2013-02-03T10:00:00-00:00", + "name": "agent", + "links": [], + "namespace": "http://docs.openstack.org/ext/agent/api/v2.0", + "alias": "agent", + "description": "The agent management extension." + }, + { + "updated": "2012-07-29T10:00:00-00:00", + "name": "Quota management support", + "links": [], + "namespace": "http://docs.openstack.org/network/ext/quotas-sets/api/v2.0", + "alias": "quotas", + "description": "Expose functions for quotas management per tenant" + }, + { + "updated": "2013-02-07T10:00:00-00:00", + "name": "DHCP Agent Scheduler", + "links": [], + "namespace": "http://docs.openstack.org/ext/dhcp_agent_scheduler/api/v1.0", + "alias": "dhcp_agent_scheduler", + "description": "Schedule networks among dhcp agents" + }, + { + "updated": "2013-06-27T10:00:00-00:00", + "name": "Multi Provider Network", + "links": [], + "namespace": "http://docs.openstack.org/ext/multi-provider/api/v1.0", + "alias": "multi-provider", + "description": "Expose mapping of virtual networks to multiple physical networks" + }, + { + "updated": "2013-01-14T10:00:00-00:00", + "name": "Neutron external network", + "links": [], + "namespace": "http://docs.openstack.org/ext/neutron/external_net/api/v1.0", + "alias": "external-net", + "description": "Adds external network attribute to network resource." + }, + { + "updated": "2012-07-20T10:00:00-00:00", + "name": "Neutron L3 Router", + "links": [], + "namespace": "http://docs.openstack.org/ext/neutron/router/api/v1.0", + "alias": "router", + "description": "Router abstraction for basic L3 forwarding between L2 Neutron networks and access to external networks via a NAT gateway." + }, + { + "updated": "2013-07-23T10:00:00-00:00", + "name": "Allowed Address Pairs", + "links": [], + "namespace": "http://docs.openstack.org/ext/allowedaddresspairs/api/v2.0", + "alias": "allowed-address-pairs", + "description": "Provides allowed address pairs" + }, + { + "updated": "2013-03-17T12:00:00-00:00", + "name": "Neutron Extra DHCP opts", + "links": [], + "namespace": "http://docs.openstack.org/ext/neutron/extra_dhcp_opt/api/v1.0", + "alias": "extra_dhcp_opt", + "description": "Extra options configuration for DHCP. For example PXE boot options to DHCP clients can be specified (e.g. tftp-server, server-ip-address, bootfile-name)" + }, + { + "updated": "2012-10-07T10:00:00-00:00", + "name": "LoadBalancing service", + "links": [], + "namespace": "http://wiki.openstack.org/neutron/LBaaS/API_1.0", + "alias": "lbaas", + "description": "Extension for LoadBalancing service" + }, + { + "updated": "2013-02-01T10:00:00-00:00", + "name": "Neutron Extra Route", + "links": [], + "namespace": "http://docs.openstack.org/ext/neutron/extraroutes/api/v1.0", + "alias": "extraroute", + "description": "Extra routes configuration for L3 router" + } + ] +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/extension_list_with_lbaas_v1_response.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/extension_list_with_lbaas_v1_response.json b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/extension_list_with_lbaas_v1_response.json new file mode 100644 index 0000000..9f85e1e --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/extension_list_with_lbaas_v1_response.json @@ -0,0 +1,140 @@ +{ + "extensions": [ + { + "updated": "2013-01-20T00:00:00-00:00", + "name": "Neutron Service Type Management", + "links": [], + "namespace": "http://docs.openstack.org/ext/neutron/service-type/api/v1.0", + "alias": "service-type", + "description": "API for retrieving service providers for Neutron advanced services" + }, + { + "updated": "2012-10-05T10:00:00-00:00", + "name": "security-group", + "links": [], + "namespace": "http://docs.openstack.org/ext/securitygroups/api/v2.0", + "alias": "security-group", + "description": "The security groups extension." + }, + { + "updated": "2013-02-07T10:00:00-00:00", + "name": "L3 Agent Scheduler", + "links": [], + "namespace": "http://docs.openstack.org/ext/l3_agent_scheduler/api/v1.0", + "alias": "l3_agent_scheduler", + "description": "Schedule routers among l3 agents" + }, + { + "updated": "2013-02-07T10:00:00-00:00", + "name": "Loadbalancer Agent Scheduler", + "links": [], + "namespace": "http://docs.openstack.org/ext/lbaas_agent_scheduler/api/v1.0", + "alias": "lbaas_agent_scheduler", + "description": "Schedule pools among lbaas agents" + }, + { + "updated": "2013-03-28T10:00:00-00:00", + "name": "Neutron L3 Configurable external gateway mode", + "links": [], + "namespace": "http://docs.openstack.org/ext/neutron/ext-gw-mode/api/v1.0", + "alias": "ext-gw-mode", + "description": "Extension of the router abstraction for specifying whether SNAT should occur on the external gateway" + }, + { + "updated": "2014-02-03T10:00:00-00:00", + "name": "Port Binding", + "links": [], + "namespace": "http://docs.openstack.org/ext/binding/api/v1.0", + "alias": "binding", + "description": "Expose port bindings of a virtual port to external application" + }, + { + "updated": "2012-09-07T10:00:00-00:00", + "name": "Provider Network", + "links": [], + "namespace": "http://docs.openstack.org/ext/provider/api/v1.0", + "alias": "provider", + "description": "Expose mapping of virtual networks to physical networks" + }, + { + "updated": "2013-02-03T10:00:00-00:00", + "name": "agent", + "links": [], + "namespace": "http://docs.openstack.org/ext/agent/api/v2.0", + "alias": "agent", + "description": "The agent management extension." + }, + { + "updated": "2012-07-29T10:00:00-00:00", + "name": "Quota management support", + "links": [], + "namespace": "http://docs.openstack.org/network/ext/quotas-sets/api/v2.0", + "alias": "quotas", + "description": "Expose functions for quotas management per tenant" + }, + { + "updated": "2013-02-07T10:00:00-00:00", + "name": "DHCP Agent Scheduler", + "links": [], + "namespace": "http://docs.openstack.org/ext/dhcp_agent_scheduler/api/v1.0", + "alias": "dhcp_agent_scheduler", + "description": "Schedule networks among dhcp agents" + }, + { + "updated": "2013-06-27T10:00:00-00:00", + "name": "Multi Provider Network", + "links": [], + "namespace": "http://docs.openstack.org/ext/multi-provider/api/v1.0", + "alias": "multi-provider", + "description": "Expose mapping of virtual networks to multiple physical networks" + }, + { + "updated": "2013-01-14T10:00:00-00:00", + "name": "Neutron external network", + "links": [], + "namespace": "http://docs.openstack.org/ext/neutron/external_net/api/v1.0", + "alias": "external-net", + "description": "Adds external network attribute to network resource." + }, + { + "updated": "2012-07-20T10:00:00-00:00", + "name": "Neutron L3 Router", + "links": [], + "namespace": "http://docs.openstack.org/ext/neutron/router/api/v1.0", + "alias": "router", + "description": "Router abstraction for basic L3 forwarding between L2 Neutron networks and access to external networks via a NAT gateway." + }, + { + "updated": "2013-07-23T10:00:00-00:00", + "name": "Allowed Address Pairs", + "links": [], + "namespace": "http://docs.openstack.org/ext/allowedaddresspairs/api/v2.0", + "alias": "allowed-address-pairs", + "description": "Provides allowed address pairs" + }, + { + "updated": "2013-03-17T12:00:00-00:00", + "name": "Neutron Extra DHCP opts", + "links": [], + "namespace": "http://docs.openstack.org/ext/neutron/extra_dhcp_opt/api/v1.0", + "alias": "extra_dhcp_opt", + "description": "Extra options configuration for DHCP. For example PXE boot options to DHCP clients can be specified (e.g. tftp-server, server-ip-address, bootfile-name)" + }, + { + "updated": "2012-10-07T10:00:00-00:00", + "name": "LoadBalancing service", + "links": [], + "namespace": "http://wiki.openstack.org/neutron/LBaaS/API_1.0", + "alias": "lbaas", + "description": "Extension for LoadBalancing service" + }, + { + "updated": "2013-02-01T10:00:00-00:00", + "name": "Neutron Extra Route", + "links": [], + "namespace": "http://docs.openstack.org/ext/neutron/extraroutes/api/v1.0", + "alias": "extraroute", + "description": "Extra routes configuration for L3 router" + } + ] +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/extension_list_without_lbaas_v1_response.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/extension_list_without_lbaas_v1_response.json b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/extension_list_without_lbaas_v1_response.json new file mode 100644 index 0000000..7f4a7c1 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/extension_list_without_lbaas_v1_response.json @@ -0,0 +1,132 @@ +{ + "extensions": [ + { + "updated": "2013-01-20T00:00:00-00:00", + "name": "Neutron Service Type Management", + "links": [], + "namespace": "http://docs.openstack.org/ext/neutron/service-type/api/v1.0", + "alias": "service-type", + "description": "API for retrieving service providers for Neutron advanced services" + }, + { + "updated": "2012-10-05T10:00:00-00:00", + "name": "security-group", + "links": [], + "namespace": "http://docs.openstack.org/ext/securitygroups/api/v2.0", + "alias": "security-group", + "description": "The security groups extension." + }, + { + "updated": "2013-02-07T10:00:00-00:00", + "name": "L3 Agent Scheduler", + "links": [], + "namespace": "http://docs.openstack.org/ext/l3_agent_scheduler/api/v1.0", + "alias": "l3_agent_scheduler", + "description": "Schedule routers among l3 agents" + }, + { + "updated": "2013-02-07T10:00:00-00:00", + "name": "Loadbalancer Agent Scheduler", + "links": [], + "namespace": "http://docs.openstack.org/ext/lbaas_agent_scheduler/api/v1.0", + "alias": "lbaas_agent_scheduler", + "description": "Schedule pools among lbaas agents" + }, + { + "updated": "2013-03-28T10:00:00-00:00", + "name": "Neutron L3 Configurable external gateway mode", + "links": [], + "namespace": "http://docs.openstack.org/ext/neutron/ext-gw-mode/api/v1.0", + "alias": "ext-gw-mode", + "description": "Extension of the router abstraction for specifying whether SNAT should occur on the external gateway" + }, + { + "updated": "2014-02-03T10:00:00-00:00", + "name": "Port Binding", + "links": [], + "namespace": "http://docs.openstack.org/ext/binding/api/v1.0", + "alias": "binding", + "description": "Expose port bindings of a virtual port to external application" + }, + { + "updated": "2012-09-07T10:00:00-00:00", + "name": "Provider Network", + "links": [], + "namespace": "http://docs.openstack.org/ext/provider/api/v1.0", + "alias": "provider", + "description": "Expose mapping of virtual networks to physical networks" + }, + { + "updated": "2013-02-03T10:00:00-00:00", + "name": "agent", + "links": [], + "namespace": "http://docs.openstack.org/ext/agent/api/v2.0", + "alias": "agent", + "description": "The agent management extension." + }, + { + "updated": "2012-07-29T10:00:00-00:00", + "name": "Quota management support", + "links": [], + "namespace": "http://docs.openstack.org/network/ext/quotas-sets/api/v2.0", + "alias": "quotas", + "description": "Expose functions for quotas management per tenant" + }, + { + "updated": "2013-02-07T10:00:00-00:00", + "name": "DHCP Agent Scheduler", + "links": [], + "namespace": "http://docs.openstack.org/ext/dhcp_agent_scheduler/api/v1.0", + "alias": "dhcp_agent_scheduler", + "description": "Schedule networks among dhcp agents" + }, + { + "updated": "2013-06-27T10:00:00-00:00", + "name": "Multi Provider Network", + "links": [], + "namespace": "http://docs.openstack.org/ext/multi-provider/api/v1.0", + "alias": "multi-provider", + "description": "Expose mapping of virtual networks to multiple physical networks" + }, + { + "updated": "2013-01-14T10:00:00-00:00", + "name": "Neutron external network", + "links": [], + "namespace": "http://docs.openstack.org/ext/neutron/external_net/api/v1.0", + "alias": "external-net", + "description": "Adds external network attribute to network resource." + }, + { + "updated": "2012-07-20T10:00:00-00:00", + "name": "Neutron L3 Router", + "links": [], + "namespace": "http://docs.openstack.org/ext/neutron/router/api/v1.0", + "alias": "router", + "description": "Router abstraction for basic L3 forwarding between L2 Neutron networks and access to external networks via a NAT gateway." + }, + { + "updated": "2013-07-23T10:00:00-00:00", + "name": "Allowed Address Pairs", + "links": [], + "namespace": "http://docs.openstack.org/ext/allowedaddresspairs/api/v2.0", + "alias": "allowed-address-pairs", + "description": "Provides allowed address pairs" + }, + { + "updated": "2013-03-17T12:00:00-00:00", + "name": "Neutron Extra DHCP opts", + "links": [], + "namespace": "http://docs.openstack.org/ext/neutron/extra_dhcp_opt/api/v1.0", + "alias": "extra_dhcp_opt", + "description": "Extra options configuration for DHCP. For example PXE boot options to DHCP clients can be specified (e.g. tftp-server, server-ip-address, bootfile-name)" + }, + { + "updated": "2013-02-01T10:00:00-00:00", + "name": "Neutron Extra Route", + "links": [], + "namespace": "http://docs.openstack.org/ext/neutron/extraroutes/api/v1.0", + "alias": "extraroute", + "description": "Extra routes configuration for L3 router" + } + ] +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_create_request.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_create_request.json b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_create_request.json new file mode 100644 index 0000000..72ed72f --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_create_request.json @@ -0,0 +1,6 @@ +{ + "floatingip": { + "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57", + "port_id": "ce705c24-c1ef-408a-bda3-7bbd946164ab" + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_create_response.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_create_response.json b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_create_response.json new file mode 100644 index 0000000..4dbb82c --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_create_response.json @@ -0,0 +1,11 @@ +{ + "floatingip": { + "router_id": "d23abc8d-2991-4a55-ba98-2aaea84cc72f", + "tenant_id": "4969c491a3c74ee4af974e6d800c62de", + "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57", + "fixed_ip_address": "10.0.0.3", + "floating_ip_address": "172.24.4.228", + "port_id": "ce705c24-c1ef-408a-bda3-7bbd946164ab", + "id": "2f245a7b-796b-4f26-9cf9-9e82d248fda7" + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_get_response.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_get_response.json b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_get_response.json new file mode 100644 index 0000000..4dbb82c --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_get_response.json @@ -0,0 +1,11 @@ +{ + "floatingip": { + "router_id": "d23abc8d-2991-4a55-ba98-2aaea84cc72f", + "tenant_id": "4969c491a3c74ee4af974e6d800c62de", + "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57", + "fixed_ip_address": "10.0.0.3", + "floating_ip_address": "172.24.4.228", + "port_id": "ce705c24-c1ef-408a-bda3-7bbd946164ab", + "id": "2f245a7b-796b-4f26-9cf9-9e82d248fda7" + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_list_response.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_list_response.json b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_list_response.json new file mode 100644 index 0000000..6b41bf9 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_list_response.json @@ -0,0 +1,22 @@ +{ + "floatingips": [ + { + "router_id": "d23abc8d-2991-4a55-ba98-2aaea84cc72f", + "tenant_id": "4969c491a3c74ee4af974e6d800c62de", + "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57", + "fixed_ip_address": "10.0.0.3", + "floating_ip_address": "172.24.4.228", + "port_id": "ce705c24-c1ef-408a-bda3-7bbd946164ab", + "id": "2f245a7b-796b-4f26-9cf9-9e82d248fda7" + }, + { + "router_id": null, + "tenant_id": "4969c491a3c74ee4af974e6d800c62de", + "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57", + "fixed_ip_address": null, + "floating_ip_address": "172.24.4.227", + "port_id": null, + "id": "61cea855-49cb-4846-997d-801b70c71bdd" + } + ] +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_list_response_paged1.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_list_response_paged1.json b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_list_response_paged1.json new file mode 100644 index 0000000..7b809f8 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_list_response_paged1.json @@ -0,0 +1,32 @@ +{ + "floatingips": [ + { + "router_id": "d23abc8d-2991-4a55-ba98-2aaea84cc72f", + "tenant_id": "4969c491a3c74ee4af974e6d800c62de", + "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57", + "fixed_ip_address": "10.0.0.3", + "floating_ip_address": "172.24.4.228", + "port_id": "ce705c24-c1ef-408a-bda3-7bbd946164ab", + "id": "2f245a7b-796b-4f26-9cf9-9e82d248fda7" + }, + { + "router_id": null, + "tenant_id": "4969c491a3c74ee4af974e6d800c62de", + "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57", + "fixed_ip_address": null, + "floating_ip_address": "172.24.4.227", + "port_id": null, + "id": "61cea855-49cb-4846-997d-801b70c71bdd" + } + ], + "floatingips_links": [ + { + "href": "/v2.0/floatingips.json?marker=71c1e68c-171a-4aa2-aca5-50ea153a3718", + "rel": "next" + }, + { + "href": "/v2.0/floatingips.json?marker=396f12f8-521e-4b91-8e21-2e003500433a&page_reverse=True", + "rel": "previous" + } + ] +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_list_response_paged2.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_list_response_paged2.json b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_list_response_paged2.json new file mode 100644 index 0000000..9ca8cd2 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_list_response_paged2.json @@ -0,0 +1,28 @@ +{ + "floatingips": [ + { + "router_id": "d23abc8d-2991-4a55-ba98-2aaea84cc72f2", + "tenant_id": "4969c491a3c74ee4af974e6d800c62de2", + "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf572", + "fixed_ip_address": "10.0.0.3", + "floating_ip_address": "172.24.4.228", + "port_id": "ce705c24-c1ef-408a-bda3-7bbd946164ab2", + "id": "2f245a7b-796b-4f26-9cf9-9e82d248fda72" + }, + { + "router_id": null, + "tenant_id": "4969c491a3c74ee4af974e6d800c62de2", + "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf572", + "fixed_ip_address": null, + "floating_ip_address": "172.24.4.227", + "port_id": null, + "id": "61cea855-49cb-4846-997d-801b70c71bdd2" + } + ], + "floatingips_links": [ + { + "href": "/v2.0/floatingips.json?marker=396f12f8-521e-4b91-8e21-2e003500433a&page_reverse=True", + "rel": "previous" + } + ] +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_update_dissociate_request.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_update_dissociate_request.json b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_update_dissociate_request.json new file mode 100644 index 0000000..a45f500 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_update_dissociate_request.json @@ -0,0 +1,5 @@ +{ + "floatingip": { + + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_update_dissociate_response.json ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_update_dissociate_response.json b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_update_dissociate_response.json new file mode 100644 index 0000000..5515a22 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/test/resources/floatingip_update_dissociate_response.json @@ -0,0 +1,11 @@ +{ + "floatingip": { + "router_id": "d23abc8d-2991-4a55-ba98-2aaea84cc72f", + "tenant_id": "4969c491a3c74ee4af974e6d800c62de", + "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57", + "fixed_ip_address": null, + "floating_ip_address": "172.24.4.228", + "port_id": null, + "id": "2f245a7b-796b-4f26-9cf9-9e82d248fda7" + } +}
