mirror of https://github.com/apache/jclouds.git
Support Rackspace Cloud Networks UK
This commit is contained in:
parent
4e61d52291
commit
e36cf4233f
|
@ -0,0 +1,4 @@
|
||||||
|
Rackspace Networks UK
|
||||||
|
========================
|
||||||
|
|
||||||
|
Beta
|
|
@ -0,0 +1,125 @@
|
||||||
|
<?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>2.0.0-SNAPSHOT</version>
|
||||||
|
<relativePath />
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<!-- TODO: when out of labs, switch to org.jclouds.provider -->
|
||||||
|
<groupId>org.apache.jclouds.labs</groupId>
|
||||||
|
<artifactId>rackspace-cloudnetworks-uk</artifactId>
|
||||||
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
|
<name>jclouds Rackspace Cloud Networks UK provider</name>
|
||||||
|
<description>OpenStack Neutron implementation targeted to Rackspace Cloud Networks UK</description>
|
||||||
|
<packaging>bundle</packaging>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<!-- identity endpoint -->
|
||||||
|
<test.rackspace-cloudnetworks-uk.endpoint>https://lon.identity.api.rackspacecloud.com/v2.0/</test.rackspace-cloudnetworks-uk.endpoint>
|
||||||
|
<test.rackspace-cloudnetworks-uk.api-version>2.0</test.rackspace-cloudnetworks-uk.api-version>
|
||||||
|
<test.rackspace-cloudnetworks-uk.build-version />
|
||||||
|
<test.rackspace-cloudnetworks-uk.identity>${test.rackspace-uk.identity}</test.rackspace-cloudnetworks-uk.identity>
|
||||||
|
<test.rackspace-cloudnetworks-uk.credential>${test.rackspace-uk.credential}</test.rackspace-cloudnetworks-uk.credential>
|
||||||
|
<jclouds.osgi.export>org.jclouds.rackspace.cloudnetworks.uk*;version="${project.version}"</jclouds.osgi.export>
|
||||||
|
<jclouds.osgi.import>org.jclouds*;version="${project.version}",*</jclouds.osgi.import>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.jclouds.labs</groupId>
|
||||||
|
<artifactId>openstack-neutron</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.jclouds.api</groupId>
|
||||||
|
<artifactId>rackspace-cloudidentity</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Test Dependencies -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.jclouds.labs</groupId>
|
||||||
|
<artifactId>openstack-neutron</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
<type>test-jar</type>
|
||||||
|
<scope>test</scope>
|
||||||
|
</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.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>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.auto.service</groupId>
|
||||||
|
<artifactId>auto-service</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</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.rackspace-cloudnetworks-uk.endpoint>${test.rackspace-cloudnetworks-uk.endpoint}</test.rackspace-cloudnetworks-uk.endpoint>
|
||||||
|
<test.rackspace-cloudnetworks-uk.api-version>${test.rackspace-cloudnetworks-uk.api-version}</test.rackspace-cloudnetworks-uk.api-version>
|
||||||
|
<test.rackspace-cloudnetworks-uk.build-version>${test.rackspace-cloudnetworks-uk.build-version}</test.rackspace-cloudnetworks-uk.build-version>
|
||||||
|
<test.rackspace-cloudnetworks-uk.identity>${test.rackspace-cloudnetworks-uk.identity}</test.rackspace-cloudnetworks-uk.identity>
|
||||||
|
<test.rackspace-cloudnetworks-uk.credential>${test.rackspace-cloudnetworks-uk.credential}</test.rackspace-cloudnetworks-uk.credential>
|
||||||
|
</systemPropertyVariables>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,118 @@
|
||||||
|
/*
|
||||||
|
* 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.rackspace.cloudnetworks.uk;
|
||||||
|
|
||||||
|
import static org.jclouds.location.reference.LocationConstants.ISO3166_CODES;
|
||||||
|
import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGION;
|
||||||
|
import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS;
|
||||||
|
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.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.RegionModule;
|
||||||
|
import org.jclouds.openstack.neutron.v2.NeutronApiMetadata;
|
||||||
|
import org.jclouds.openstack.neutron.v2.config.NeutronHttpApiModule;
|
||||||
|
import org.jclouds.openstack.v2_0.ServiceType;
|
||||||
|
import org.jclouds.providers.ProviderMetadata;
|
||||||
|
import org.jclouds.providers.internal.BaseProviderMetadata;
|
||||||
|
import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityAuthenticationApiModule;
|
||||||
|
import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityAuthenticationModule;
|
||||||
|
import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityCredentialTypes;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import com.google.inject.Module;
|
||||||
|
|
||||||
|
@AutoService(ProviderMetadata.class)
|
||||||
|
public class CloudNetworksUKProviderMetadata extends BaseProviderMetadata {
|
||||||
|
|
||||||
|
public static Builder builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Builder toBuilder() {
|
||||||
|
return builder().fromProviderMetadata(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CloudNetworksUKProviderMetadata() {
|
||||||
|
this(new Builder());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected CloudNetworksUKProviderMetadata(Builder builder) {
|
||||||
|
super(builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a {@link Properties} object containing the default provider properties.
|
||||||
|
* This returns the credential type, service type, and configured regions.
|
||||||
|
*/
|
||||||
|
public static Properties defaultProperties() {
|
||||||
|
Properties properties = new Properties();
|
||||||
|
properties.setProperty(CREDENTIAL_TYPE, CloudIdentityCredentialTypes.API_KEY_CREDENTIALS);
|
||||||
|
properties.setProperty(SERVICE_TYPE, ServiceType.NETWORK);
|
||||||
|
|
||||||
|
properties.setProperty(PROPERTY_REGIONS, "LON");
|
||||||
|
properties.setProperty(PROPERTY_REGION + ".LON." + ISO3166_CODES, "GB-SLG");
|
||||||
|
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder extends BaseProviderMetadata.Builder {
|
||||||
|
|
||||||
|
protected Builder() {
|
||||||
|
id("rackspace-cloudnetworks-uk")
|
||||||
|
.name("Rackspace Cloud Networks UK")
|
||||||
|
.apiMetadata(new NeutronApiMetadata().toBuilder()
|
||||||
|
.identityName("${userName}")
|
||||||
|
.credentialName("${apiKey}")
|
||||||
|
.defaultEndpoint("https://lon.identity.api.rackspacecloud.com/v2.0/")
|
||||||
|
.documentation(URI.create("http://docs.rackspace.com/networks/api/v1/cf-devguide/content/index.html"))
|
||||||
|
.endpointName("Rackspace Cloud Identity service URL ending in /v2.0/")
|
||||||
|
.version("2.0")
|
||||||
|
.defaultModules(ImmutableSet.<Class<? extends Module>>builder()
|
||||||
|
.add(CloudIdentityAuthenticationApiModule.class)
|
||||||
|
.add(CloudIdentityAuthenticationModule.class)
|
||||||
|
.add(RegionModule.class)
|
||||||
|
.add(NeutronHttpApiModule.class)
|
||||||
|
.build())
|
||||||
|
.build())
|
||||||
|
.homepage(URI.create("http://www.rackspace.com/cloud/networks"))
|
||||||
|
.console(URI.create("https://mycloud.rackspace.co.uk"))
|
||||||
|
.linkedServices("rackspace-autoscale-uk", "rackspace-cloudblockstorage-uk",
|
||||||
|
"rackspace-clouddatabases-uk", "rackspace-clouddns-uk", "rackspace-cloudidentity",
|
||||||
|
"rackspace-cloudloadbalancers-uk", "rackspace-cloudqueues-uk",
|
||||||
|
"rackspace-cloudservers-uk")
|
||||||
|
.iso3166Codes("GB-SLG")
|
||||||
|
.defaultProperties(CloudNetworksUKProviderMetadata.defaultProperties());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CloudNetworksUKProviderMetadata build() {
|
||||||
|
return new CloudNetworksUKProviderMetadata(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Builder fromProviderMetadata(ProviderMetadata in) {
|
||||||
|
super.fromProviderMetadata(in);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
/*
|
||||||
|
* 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.rackspace.cloudnetworks.uk;
|
||||||
|
|
||||||
|
import static org.testng.Assert.assertEquals;
|
||||||
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
import static org.testng.Assert.assertTrue;
|
||||||
|
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.Network;
|
||||||
|
import org.jclouds.openstack.neutron.v2.features.NetworkApi;
|
||||||
|
import org.jclouds.openstack.neutron.v2.features.NetworkApiLiveTest;
|
||||||
|
import org.testng.SkipException;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@Test(groups = "live", testName = "CloudNetworksUKNetworkApiLiveTest", singleThreaded = true)
|
||||||
|
public class CloudNetworksUKNetworkApiLiveTest extends NetworkApiLiveTest {
|
||||||
|
public CloudNetworksUKNetworkApiLiveTest() {
|
||||||
|
provider = "rackspace-cloudnetworks-uk";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void testCreateUpdateAndDeleteNetwork() {
|
||||||
|
for (String region : api.getConfiguredRegions()) {
|
||||||
|
NetworkApi networkApi = api.getNetworkApi(region);
|
||||||
|
Network net = networkApi.create(Network.createBuilder("jclouds-test").build());
|
||||||
|
Network test = networkApi.create(Network.createBuilder("jclouds-test").build());
|
||||||
|
assertNotNull(net);
|
||||||
|
|
||||||
|
/* List and get tests */
|
||||||
|
Network networkList = api.getNetworkApi(region).list().concat().toSet().iterator().next();
|
||||||
|
assertNotNull(networkList);
|
||||||
|
Network networkGet = api.getNetworkApi(region).get(networkList.getId());
|
||||||
|
assertEquals(networkList, networkGet);
|
||||||
|
/****/
|
||||||
|
|
||||||
|
Network network = networkApi.get(net.getId());
|
||||||
|
|
||||||
|
assertEquals(network.getId(), net.getId());
|
||||||
|
assertEquals(network.getName(), "jclouds-test");
|
||||||
|
assertTrue(network.getSubnets().isEmpty());
|
||||||
|
assertNotNull(networkApi.update(net.getId(), Network.updateBuilder().name("jclouds-live-test").build()));
|
||||||
|
|
||||||
|
network = networkApi.get(net.getId());
|
||||||
|
|
||||||
|
assertEquals(network.getId(), net.getId());
|
||||||
|
assertEquals(network.getName(), "jclouds-live-test");
|
||||||
|
assertTrue(network.getSubnets().isEmpty());
|
||||||
|
|
||||||
|
Network net2 = networkApi.create(Network.createBuilder("jclouds-test2").build());
|
||||||
|
assertNotNull(net2);
|
||||||
|
|
||||||
|
assertTrue(networkApi.delete(net.getId()));
|
||||||
|
assertTrue(networkApi.delete(net2.getId()));
|
||||||
|
assertTrue(networkApi.delete(test.getId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void testBulkCreateNetwork() {
|
||||||
|
throw new SkipException("unsupported functionality");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,85 @@
|
||||||
|
/*
|
||||||
|
* 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.rackspace.cloudnetworks.uk;
|
||||||
|
|
||||||
|
import static org.testng.Assert.assertEquals;
|
||||||
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
import static org.testng.Assert.assertTrue;
|
||||||
|
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.Network;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.Port;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.Subnet;
|
||||||
|
import org.jclouds.openstack.neutron.v2.features.NetworkApi;
|
||||||
|
import org.jclouds.openstack.neutron.v2.features.PortApi;
|
||||||
|
import org.jclouds.openstack.neutron.v2.features.PortApiLiveTest;
|
||||||
|
import org.jclouds.openstack.neutron.v2.features.SubnetApi;
|
||||||
|
import org.testng.SkipException;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
|
@Test(groups = "live", testName = "CloudNetworksUKPortApiLiveTest", singleThreaded = true)
|
||||||
|
public class CloudNetworksUKPortApiLiveTest extends PortApiLiveTest {
|
||||||
|
public CloudNetworksUKPortApiLiveTest() {
|
||||||
|
provider = "rackspace-cloudnetworks-uk";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCreateUpdateAndDeletePort() {
|
||||||
|
for (String region : api.getConfiguredRegions()) {
|
||||||
|
NetworkApi networkApi = api.getNetworkApi(region);
|
||||||
|
SubnetApi subnetApi = api.getSubnetApi(region);
|
||||||
|
PortApi portApi = api.getPortApi(region);
|
||||||
|
String networkId = networkApi.create(
|
||||||
|
Network.createBuilder("JClouds-Live-Network").build()).getId();
|
||||||
|
String ipv4SubnetId = subnetApi.create(Subnet.createBuilder(networkId, "192.168.0.0/30").ipVersion(4)
|
||||||
|
.name("JClouds-Live-IPv4-Subnet").build()).getId();
|
||||||
|
|
||||||
|
assertNotNull(networkId);
|
||||||
|
assertNotNull(ipv4SubnetId);
|
||||||
|
|
||||||
|
String ipv4PortId = portApi.create(Port.createBuilder(networkId).name("JClouds-Live-IPv4-Port")
|
||||||
|
.fixedIps(ImmutableSet.copyOf(getFixedAddresses(ipv4SubnetId))).build()).getId();
|
||||||
|
|
||||||
|
/* List and get test */
|
||||||
|
Port portList = api.getPortApi(region).list().concat().toSet().iterator().next();
|
||||||
|
assertNotNull(portList);
|
||||||
|
Port portGet = api.getPortApi(region).get(portList.getId());
|
||||||
|
assertEquals(portList, portGet);
|
||||||
|
/****/
|
||||||
|
|
||||||
|
assertNotNull(ipv4PortId);
|
||||||
|
|
||||||
|
Port ipv4Port = portApi.get(ipv4PortId);
|
||||||
|
assertNotNull(ipv4Port);
|
||||||
|
assertEquals(ipv4Port.getId(), ipv4PortId);
|
||||||
|
assertEquals(ipv4Port.getName(), "JClouds-Live-IPv4-Port");
|
||||||
|
|
||||||
|
assertNotNull(portApi.update(ipv4PortId, Port.updateBuilder().name("Updated").build()));
|
||||||
|
Port updatedIpv4Port = portApi.get(ipv4PortId);
|
||||||
|
assertEquals(updatedIpv4Port.getName(), "Updated");
|
||||||
|
|
||||||
|
assertTrue(portApi.delete(ipv4PortId));
|
||||||
|
assertTrue(subnetApi.delete(ipv4SubnetId));
|
||||||
|
assertTrue(networkApi.delete(networkId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void testBulkCreatePort() {
|
||||||
|
throw new SkipException("unsupported functionality");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* 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.rackspace.cloudnetworks.uk;
|
||||||
|
|
||||||
|
import org.jclouds.openstack.neutron.v2.NeutronApiMetadata;
|
||||||
|
import org.jclouds.providers.internal.BaseProviderMetadataTest;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@Test(groups = "unit", testName = "CloudNetworksUKProviderTest", singleThreaded = true)
|
||||||
|
public class CloudNetworksUKProviderTest extends BaseProviderMetadataTest {
|
||||||
|
public CloudNetworksUKProviderTest() {
|
||||||
|
super(new CloudNetworksUKProviderMetadata(), new NeutronApiMetadata());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,89 @@
|
||||||
|
/*
|
||||||
|
* 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.rackspace.cloudnetworks.uk;
|
||||||
|
|
||||||
|
import static org.testng.Assert.assertEquals;
|
||||||
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
import static org.testng.Assert.assertTrue;
|
||||||
|
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.AllocationPool;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.HostRoute;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.Network;
|
||||||
|
import org.jclouds.openstack.neutron.v2.domain.Subnet;
|
||||||
|
import org.jclouds.openstack.neutron.v2.features.NetworkApi;
|
||||||
|
import org.jclouds.openstack.neutron.v2.features.SubnetApi;
|
||||||
|
import org.jclouds.openstack.neutron.v2.features.SubnetApiLiveTest;
|
||||||
|
import org.testng.SkipException;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
|
@Test(groups = "live", testName = "CloudNetworksUKSubnetApiLiveTest", singleThreaded = true)
|
||||||
|
public class CloudNetworksUKSubnetApiLiveTest extends SubnetApiLiveTest {
|
||||||
|
public CloudNetworksUKSubnetApiLiveTest() {
|
||||||
|
provider = "rackspace-cloudnetworks-uk";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void testCreateUpdateAndDeleteSubnet() {
|
||||||
|
for (String region : api.getConfiguredRegions()) {
|
||||||
|
NetworkApi networkApi = api.getNetworkApi(region);
|
||||||
|
String networkId = networkApi.create(
|
||||||
|
Network.createBuilder("jclouds-live-test").build()).getId();
|
||||||
|
|
||||||
|
SubnetApi subnetApi = api.getSubnetApi(region);
|
||||||
|
ImmutableSet<AllocationPool> allocationPools = ImmutableSet.of(
|
||||||
|
AllocationPool.builder().start("192.168.100.0").end("192.168.100.2").build()
|
||||||
|
);
|
||||||
|
ImmutableSet<HostRoute> hostRoutes = ImmutableSet.of(
|
||||||
|
HostRoute.builder().destinationCidr("192.168.100.0/30").nextHop("192.168.100.4").build()
|
||||||
|
);
|
||||||
|
Subnet subnet = subnetApi.create(Subnet.createBuilder(networkId, "192.168.100.0/30").ipVersion(4).allocationPools(allocationPools).hostRoutes(hostRoutes).build());
|
||||||
|
assertNotNull(subnet);
|
||||||
|
|
||||||
|
/* Test list and get */
|
||||||
|
Subnet subnetList = api.getSubnetApi(region).list().concat().toSet().iterator().next();
|
||||||
|
assertNotNull(subnetList);
|
||||||
|
Subnet subnetGet = api.getSubnetApi(region).get(subnetList.getId());
|
||||||
|
assertEquals(subnetList, subnetGet);
|
||||||
|
/***/
|
||||||
|
|
||||||
|
Subnet retrievedSubnet = subnetApi.get(subnet.getId());
|
||||||
|
|
||||||
|
assertEquals(retrievedSubnet.getId(), subnet.getId());
|
||||||
|
assertEquals(retrievedSubnet.getCidr(), "192.168.100.0/30");
|
||||||
|
assertTrue(retrievedSubnet.getDnsNameservers().isEmpty());
|
||||||
|
assertEquals(retrievedSubnet.getAllocationPools().size(), 1);
|
||||||
|
assertEquals(retrievedSubnet.getHostRoutes().size(), 1);
|
||||||
|
assertNotNull(subnetApi.update(retrievedSubnet.getId(), Subnet.updateBuilder().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());
|
||||||
|
|
||||||
|
assertTrue(subnetApi.delete(subnet.getId()));
|
||||||
|
assertTrue(networkApi.delete(networkId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void testBulkCreateSubnet() {
|
||||||
|
throw new SkipException("unsupported functionality");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
<?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>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
</configuration>
|
Loading…
Reference in New Issue