mirror of https://github.com/apache/jclouds.git
Changed jsons to parser tests. Removed unnecessary catches.
This commit is contained in:
parent
f66e27c2ca
commit
5e2bae24e8
|
@ -37,7 +37,6 @@ import org.jclouds.predicates.RetryablePredicate;
|
|||
import org.jclouds.predicates.SocketOpen;
|
||||
import org.jclouds.rest.RestContextFactory;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.ssh.SshException;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.util.Strings2;
|
||||
import org.testng.annotations.AfterTest;
|
||||
|
@ -45,8 +44,6 @@ import org.testng.annotations.BeforeGroups;
|
|||
import org.testng.annotations.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.UndeclaredThrowableException;
|
||||
import java.net.URI;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
@ -55,7 +52,6 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.jclouds.openstack.nova.options.CreateServerOptions.Builder.withFile;
|
||||
import static org.jclouds.openstack.nova.options.CreateSharedIpGroupOptions.Builder.withServer;
|
||||
import static org.jclouds.openstack.nova.options.ListOptions.Builder.withDetails;
|
||||
import static org.testng.Assert.*;
|
||||
|
||||
|
@ -274,19 +270,10 @@ public class NovaClientLiveTest {
|
|||
public void testCreateServer() throws Exception {
|
||||
String imageRef = "14362";
|
||||
String flavorRef = "1";
|
||||
Server server = null;
|
||||
while (server == null) {
|
||||
String serverName = serverPrefix + "createserver" + new SecureRandom().nextInt();
|
||||
try {
|
||||
server = client.createServer(serverName, imageRef, flavorRef, withFile("/etc/jclouds.txt",
|
||||
"rackspace".getBytes()).withMetadata(metadata));
|
||||
} catch (UndeclaredThrowableException e) {
|
||||
HttpResponseException htpe = (HttpResponseException) e.getCause().getCause();
|
||||
if (htpe.getResponse().getStatusCode() == 400)
|
||||
continue;
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
String serverName = serverPrefix + "createserver" + new SecureRandom().nextInt();
|
||||
Server server = client.createServer(serverName, imageRef, flavorRef, withFile("/etc/jclouds.txt",
|
||||
"rackspace".getBytes()).withMetadata(metadata));
|
||||
|
||||
assertNotNull(server.getAdminPass());
|
||||
serverId = server.getId();
|
||||
adminPass = server.getAdminPass();
|
||||
|
@ -296,7 +283,7 @@ public class NovaClientLiveTest {
|
|||
}
|
||||
|
||||
private void blockUntilServerActive(int serverId) throws InterruptedException {
|
||||
Server currentDetails = null;
|
||||
Server currentDetails;
|
||||
for (currentDetails = client.getServer(serverId); currentDetails.getStatus() != ServerStatus.ACTIVE; currentDetails = client
|
||||
.getServer(serverId)) {
|
||||
System.out.printf("blocking on status active%n%s%n", currentDetails);
|
||||
|
@ -305,7 +292,7 @@ public class NovaClientLiveTest {
|
|||
}
|
||||
|
||||
private void blockUntilServerVerifyResize(int serverId) throws InterruptedException {
|
||||
Server currentDetails = null;
|
||||
Server currentDetails;
|
||||
for (currentDetails = client.getServer(serverId); currentDetails.getStatus() != ServerStatus.VERIFY_RESIZE; currentDetails = client
|
||||
.getServer(serverId)) {
|
||||
System.out.printf("blocking on status verify resize%n%s%n", currentDetails);
|
||||
|
@ -314,7 +301,7 @@ public class NovaClientLiveTest {
|
|||
}
|
||||
|
||||
private void blockUntilImageActive(int imageId) throws InterruptedException {
|
||||
Image currentDetails = null;
|
||||
Image currentDetails;
|
||||
for (currentDetails = client.getImage(imageId); currentDetails.getStatus() != ImageStatus.ACTIVE; currentDetails = client
|
||||
.getImage(imageId)) {
|
||||
System.out.printf("blocking on status active%n%s%n", currentDetails);
|
||||
|
@ -350,17 +337,10 @@ public class NovaClientLiveTest {
|
|||
*/
|
||||
|
||||
private void checkPassOk(Server newDetails, String pass) throws IOException {
|
||||
try {
|
||||
doCheckPass(newDetails, pass);
|
||||
} catch (SshException e) {// try twice in case there is a network timeout
|
||||
try {
|
||||
Thread.sleep(10 * 1000);
|
||||
} catch (InterruptedException e1) {
|
||||
}
|
||||
doCheckPass(newDetails, pass);
|
||||
}
|
||||
doCheckPass(newDetails, pass);
|
||||
}
|
||||
|
||||
|
||||
private void doCheckPass(Server newDetails, String pass) throws IOException {
|
||||
IPSocket socket = new IPSocket(Iterables.get(newDetails.getAddresses().getPublicAddresses(), 0), 22);
|
||||
socketTester.apply(socket);
|
||||
|
@ -419,18 +399,13 @@ public class NovaClientLiveTest {
|
|||
}
|
||||
}
|
||||
|
||||
private void assertIpNotConfigured(Server server, String password) {
|
||||
try {
|
||||
ExecResponse response = exec(server, password, "ifconfig -a");
|
||||
assert response.getOutput().indexOf(ip) == -1 : String.format("server %s still has get ip %s%n%s", server, ip,
|
||||
response);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} catch (AssertionError e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
private void assertIpNotConfigured(Server server, String password) throws IOException {
|
||||
ExecResponse response = exec(server, password, "ifconfig -a");
|
||||
assert response.getOutput().indexOf(ip) == -1 : String.format("server %s still has get ip %s%n%s", server, ip,
|
||||
response);
|
||||
}
|
||||
|
||||
|
||||
@Test(enabled = false, timeOut = 10 * 60 * 1000, dependsOnMethods = "testBackup")
|
||||
public void testCreateImage() throws Exception {
|
||||
Image image = client.createImageFromServer("hoofie", serverId);
|
||||
|
@ -445,7 +420,7 @@ public class NovaClientLiveTest {
|
|||
client.rebuildServer(serverId, new RebuildServerOptions().withImage(imageId));
|
||||
blockUntilServerActive(serverId);
|
||||
// issue Web Hosting #119580 imageId comes back incorrect after rebuild
|
||||
// assertEquals(new Integer(imageId), client.getServer(serverId).getImageId());
|
||||
assertEquals(new Integer(imageId), client.getServer(serverId).getImageId());
|
||||
}
|
||||
|
||||
@Test(enabled = false, timeOut = 10 * 60 * 1000, dependsOnMethods = "testRebuildServer")
|
||||
|
|
|
@ -18,14 +18,11 @@
|
|||
*/
|
||||
package org.jclouds.openstack.nova.compute.functions;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import org.jclouds.compute.config.BaseComputeServiceContextModule;
|
||||
import org.jclouds.compute.domain.Image;
|
||||
import org.jclouds.compute.domain.ImageBuilder;
|
||||
import org.jclouds.compute.domain.OperatingSystemBuilder;
|
||||
import org.jclouds.compute.domain.OperatingSystem;
|
||||
import org.jclouds.compute.domain.OsFamily;
|
||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||
import org.jclouds.domain.Credentials;
|
||||
|
@ -34,7 +31,9 @@ import org.jclouds.json.config.GsonModule;
|
|||
import org.jclouds.openstack.nova.functions.ParseImageFromJsonResponseTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
|
@ -42,25 +41,25 @@ import com.google.inject.Guice;
|
|||
@Test(groups = "unit")
|
||||
public class NovaImageToImageTest {
|
||||
|
||||
@Test
|
||||
public void testApplyWhereImageNotFound() throws UnknownHostException {
|
||||
assertEquals(
|
||||
convertImage(),
|
||||
new ImageBuilder()
|
||||
.name("CentOS 5.2")
|
||||
.operatingSystem(
|
||||
new OperatingSystemBuilder().family(OsFamily.CENTOS).version("5.2").description("CentOS 5.2").is64Bit(true)
|
||||
.build()).description("CentOS 5.2").defaultCredentials(new Credentials("root", null))
|
||||
.ids("2").version("1286712000000").build());
|
||||
}
|
||||
@Test
|
||||
public void testApplyWhereImageNotFound() throws UnknownHostException {
|
||||
assertEquals(
|
||||
convertImage(),
|
||||
new ImageBuilder()
|
||||
.name("CentOS 5.2")
|
||||
.operatingSystem(
|
||||
new OperatingSystem.Builder().family(OsFamily.CENTOS).version("5.2").description("CentOS 5.2").is64Bit(true)
|
||||
.build()).description("CentOS 5.2").defaultCredentials(new Credentials("root", null))
|
||||
.ids("2").version("1286712000000").build());
|
||||
}
|
||||
|
||||
public static Image convertImage() {
|
||||
org.jclouds.openstack.nova.domain.Image image = ParseImageFromJsonResponseTest.parseImage();
|
||||
public static Image convertImage() {
|
||||
org.jclouds.openstack.nova.domain.Image image = ParseImageFromJsonResponseTest.parseImage();
|
||||
|
||||
NovaImageToImage parser = new NovaImageToImage(new NovaImageToOperatingSystem(new BaseComputeServiceContextModule() {
|
||||
}.provideOsVersionMap(new ComputeServiceConstants.ReferenceData(), Guice.createInjector(new GsonModule())
|
||||
.getInstance(Json.class))));
|
||||
NovaImageToImage parser = new NovaImageToImage(new NovaImageToOperatingSystem(new BaseComputeServiceContextModule() {
|
||||
}.provideOsVersionMap(new ComputeServiceConstants.ReferenceData(), Guice.createInjector(new GsonModule())
|
||||
.getInstance(Json.class))));
|
||||
|
||||
return parser.apply(image);
|
||||
}
|
||||
return parser.apply(image);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,45 +18,45 @@
|
|||
*/
|
||||
package org.jclouds.openstack.nova.functions;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.List;
|
||||
|
||||
import org.jclouds.openstack.nova.domain.Addresses;
|
||||
import org.jclouds.http.HttpResponse;
|
||||
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
|
||||
import org.jclouds.io.Payloads;
|
||||
import org.jclouds.json.config.GsonModule;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Key;
|
||||
import com.google.inject.TypeLiteral;
|
||||
import org.jclouds.http.HttpResponse;
|
||||
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
|
||||
import org.jclouds.io.Payloads;
|
||||
import org.jclouds.json.config.GsonModule;
|
||||
import org.jclouds.openstack.nova.domain.Addresses;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.List;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code ParseAddressesFromJsonResponse}
|
||||
*
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit")
|
||||
public class ParseAddressesFromJsonResponseTest {
|
||||
Injector i = Guice.createInjector(new GsonModule());
|
||||
Injector i = Guice.createInjector(new GsonModule());
|
||||
|
||||
public void testApplyInputStreamDetails() throws UnknownHostException {
|
||||
InputStream is = getClass().getResourceAsStream("/test_list_addresses.json");
|
||||
public void testApplyInputStreamDetails() throws UnknownHostException {
|
||||
InputStream is = getClass().getResourceAsStream("/test_list_addresses.json");
|
||||
|
||||
UnwrapOnlyJsonValue<Addresses> parser = i.getInstance(Key.get(new TypeLiteral<UnwrapOnlyJsonValue<Addresses>>() {
|
||||
}));
|
||||
Addresses response = parser.apply(new HttpResponse(200, "ok", Payloads.newInputStreamPayload(is)));
|
||||
List<String> publicAddresses = ImmutableList.of("67.23.10.132", "67.23.10.131");
|
||||
UnwrapOnlyJsonValue<Addresses> parser = i.getInstance(Key.get(new TypeLiteral<UnwrapOnlyJsonValue<Addresses>>() {
|
||||
}));
|
||||
Addresses response = parser.apply(new HttpResponse(200, "ok", Payloads.newInputStreamPayload(is)));
|
||||
|
||||
List<String> privateAddresses = ImmutableList.of("10.176.42.16");
|
||||
List<String> publicAddresses = ImmutableList.of("67.23.10.132", "::babe:67.23.10.132", "67.23.10.131", "::babe:4317:0A83");
|
||||
|
||||
assertEquals(response.getPublicAddresses(), publicAddresses);
|
||||
assertEquals(response.getPrivateAddresses(), privateAddresses);
|
||||
}
|
||||
List<String> privateAddresses = ImmutableList.of("10.176.42.16", "::babe:10.176.42.16");
|
||||
|
||||
assertEquals(response.getPublicAddresses(), publicAddresses);
|
||||
assertEquals(response.getPrivateAddresses(), privateAddresses);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,47 +18,51 @@
|
|||
*/
|
||||
package org.jclouds.openstack.nova.functions;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.jclouds.openstack.nova.domain.Flavor;
|
||||
import org.jclouds.http.HttpResponse;
|
||||
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
|
||||
import org.jclouds.io.Payloads;
|
||||
import org.jclouds.json.config.GsonModule;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Key;
|
||||
import com.google.inject.TypeLiteral;
|
||||
import org.jclouds.http.HttpResponse;
|
||||
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
|
||||
import org.jclouds.io.Payloads;
|
||||
import org.jclouds.json.config.GsonModule;
|
||||
import org.jclouds.openstack.nova.domain.Flavor;
|
||||
import org.jclouds.util.Strings2;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code ParseFlavorFromJsonResponse}
|
||||
*
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit")
|
||||
public class ParseFlavorFromJsonResponseTest {
|
||||
public void test() {
|
||||
Flavor response = parseFlavor();
|
||||
public void test() throws IOException {
|
||||
Flavor response = parseFlavor();
|
||||
|
||||
String json = new Gson().toJson(response);
|
||||
String json = new Gson().toJson(response);
|
||||
|
||||
assertEquals(json, "{\"id\":1,\"name\":\"256 MB Server\",\"disk\":10,\"ram\":256}");
|
||||
}
|
||||
String expectedJson = Strings2.toStringAndClose(
|
||||
ParseFlavorFromJsonResponseTest.class.getResourceAsStream("/test_get_flavor_details.json"))
|
||||
.replace("\n", "").replace("\t", "").replace("\r", "").replace(" ", "");
|
||||
|
||||
public static Flavor parseFlavor() {
|
||||
Injector i = Guice.createInjector(new GsonModule());
|
||||
assertEquals(json, expectedJson);
|
||||
}
|
||||
|
||||
InputStream is = ParseFlavorFromJsonResponseTest.class.getResourceAsStream("/test_get_flavor_details.json");
|
||||
public static Flavor parseFlavor() {
|
||||
Injector i = Guice.createInjector(new GsonModule());
|
||||
|
||||
UnwrapOnlyJsonValue<Flavor> parser = i.getInstance(Key.get(new TypeLiteral<UnwrapOnlyJsonValue<Flavor>>() {
|
||||
}));
|
||||
Flavor response = parser.apply(new HttpResponse(200, "ok", Payloads.newInputStreamPayload(is)));
|
||||
return response;
|
||||
}
|
||||
InputStream is = ParseFlavorFromJsonResponseTest.class.getResourceAsStream("/test_get_flavor_details.json");
|
||||
|
||||
UnwrapOnlyJsonValue<Flavor> parser = i.getInstance(Key.get(new TypeLiteral<UnwrapOnlyJsonValue<Flavor>>() {
|
||||
}));
|
||||
return parser.apply(new HttpResponse(200, "ok", Payloads.newInputStreamPayload(is)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,24 @@
|
|||
{
|
||||
"flavor" : {
|
||||
"id" : 1,
|
||||
"name" : "256 MB Server",
|
||||
"ram" : 256,
|
||||
"disk" : 10
|
||||
}
|
||||
}
|
||||
{
|
||||
"flavor" : {
|
||||
"id" : 1,
|
||||
"name" : "256 MB Server",
|
||||
"ram" : 256,
|
||||
"disk" : 10,
|
||||
"links": [
|
||||
{
|
||||
"rel" : "self",
|
||||
"href" : "http://servers.api.openstack.org/v1.1/1234/flavors/1"
|
||||
},
|
||||
{
|
||||
"rel" : "bookmark",
|
||||
"type" : "application/vnd.openstack.computev1.1+xml",
|
||||
"href" : "http://servers.api.openstack.org/1234/flavors/1"
|
||||
},
|
||||
{
|
||||
"rel" : "bookmark",
|
||||
"type" : "application/vnd.openstack.computev1.1+json",
|
||||
"href" : "http://servers.api.openstack.org/1234/flavors/1"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -1,11 +1,33 @@
|
|||
{
|
||||
"image" : {
|
||||
"id" : 2,
|
||||
"name" : "CentOS 5.2",
|
||||
"serverId" : 12,
|
||||
"updated" : "2010-10-10T12:00:00Z",
|
||||
"created" : "2010-08-10T12:00:00Z",
|
||||
"status" : "SAVING",
|
||||
"progress" : 80
|
||||
}
|
||||
{
|
||||
"image" : {
|
||||
"id" : 1,
|
||||
"name" : "CentOS 5.2",
|
||||
"serverRef" : "http://servers.api.openstack.org/v1.1/1234/servers/12",
|
||||
"updated" : "2010-10-10T12:00:00Z",
|
||||
"created" : "2010-08-10T12:00:00Z",
|
||||
"status" : "SAVING",
|
||||
"progress" : 80,
|
||||
"metadata" : {
|
||||
"values" : {
|
||||
"ImageVersion" : "1.5",
|
||||
"ImageType" : "Gold"
|
||||
}
|
||||
},
|
||||
"links": [
|
||||
{
|
||||
"rel" : "self",
|
||||
"href" : "http://servers.api.openstack.org/v1.1/1234/images/1"
|
||||
},
|
||||
{
|
||||
"rel" : "bookmark",
|
||||
"type" : "application/vnd.openstack.computev1.1+xml",
|
||||
"href" : "http://servers.api.openstack.org/1234/images/1"
|
||||
},
|
||||
{
|
||||
"rel" : "bookmark",
|
||||
"type" : "application/vnd.openstack.computev1.1+json",
|
||||
"href" : "http://servers.api.openstack.org/1234/images/1"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -1,25 +1,56 @@
|
|||
{
|
||||
"server" : {
|
||||
"id" : 1234,
|
||||
"name" : "sample-server",
|
||||
"imageId" : 2,
|
||||
"flavorId" : 1,
|
||||
"hostId" : "e4d909c290d0fb1ca068ffaddf22cbd0",
|
||||
"status" : "BUILD",
|
||||
"progress" : 60,
|
||||
"addresses" : {
|
||||
"public" : [
|
||||
"67.23.10.132",
|
||||
"67.23.10.131"
|
||||
],
|
||||
"private" : [
|
||||
"10.176.42.16"
|
||||
]
|
||||
},
|
||||
"metadata" : {
|
||||
"Server Label" : "Web Head 1",
|
||||
"Image Version" : "2.1"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
{
|
||||
"server" : {
|
||||
"id" : 1234,
|
||||
"name" : "sample-server",
|
||||
"imageRef" : "https://servers.api.rackspacecloud.com/v1.1/32278/images/1234",
|
||||
"flavorRef" : "https://servers.api.rackspacecloud.com/v1.1/32278/flavors/1",
|
||||
"updated" : "2010-10-10T12:00:00Z",
|
||||
"created" : "2010-08-10T12:00:00Z",
|
||||
"hostId" : "e4d909c290d0fb1ca068ffaddf22cbd0",
|
||||
"affinityId" : "fc88bcf8394db9c8d0564e08ca6a9724188a84d1",
|
||||
"status" : "BUILD",
|
||||
"progress" : 60,
|
||||
"addresses" : {
|
||||
"values" : [
|
||||
{
|
||||
"id" : "public",
|
||||
"values" : [
|
||||
{"version" : 4, "addr" : "67.23.10.132"},
|
||||
{"version" : 6, "addr" : "::babe:67.23.10.132"},
|
||||
{"version" : 4, "addr" : "67.23.10.131"},
|
||||
{"version" : 6, "addr" : "::babe:4317:0A83"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id" : "private",
|
||||
"values" : [
|
||||
{"version" : 4, "addr" : "10.176.42.16"},
|
||||
{"version" : 6, "addr" : "::babe:10.176.42.16"}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"metadata" : {
|
||||
"values" : {
|
||||
"Server Label" : "Web Head 1",
|
||||
"Image Version" : "2.1"
|
||||
}
|
||||
},
|
||||
"links": [
|
||||
{
|
||||
"rel" : "self",
|
||||
"href" : "http://servers.api.openstack.org/v1.1/1234/servers/1234"
|
||||
},
|
||||
{
|
||||
"rel" : "bookmark",
|
||||
"type" : "application/vnd.openstack.compute-v1.1+xml",
|
||||
"href" : "http://servers.api.openstack.org/1234/servers/1234"
|
||||
},
|
||||
{
|
||||
"rel" : "bookmark",
|
||||
"type" : "application/vnd.openstack.compute-v1.1+json",
|
||||
"href" : "http://servers.api.openstack.org/1234/servers/1234"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,23 @@
|
|||
{
|
||||
"addresses" : {
|
||||
"public" : [
|
||||
"67.23.10.132",
|
||||
"67.23.10.131"
|
||||
],
|
||||
"private" : [
|
||||
"10.176.42.16"
|
||||
]
|
||||
}
|
||||
{
|
||||
"addresses" : {
|
||||
"values" : [
|
||||
{
|
||||
"id" : "public",
|
||||
"values" : [
|
||||
{"version" : 4, "addr" : "67.23.10.132"},
|
||||
{"version" : 6, "addr" : "::babe:67.23.10.132"},
|
||||
{"version" : 4, "addr" : "67.23.10.131"},
|
||||
{"version" : 6, "addr" : "::babe:4317:0A83"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id" : "private",
|
||||
"values" : [
|
||||
{"version" : 4, "addr" : "10.176.42.16"},
|
||||
{"version" : 6, "addr" : "::babe:10.176.42.16"}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,46 @@
|
|||
{
|
||||
"flavors" : [
|
||||
{
|
||||
"id" : 1,
|
||||
"name" : "256 MB Server"
|
||||
},
|
||||
{
|
||||
"id" : 2,
|
||||
"name" : "512 MB Server"
|
||||
}
|
||||
]
|
||||
}
|
||||
{
|
||||
"flavors" : {
|
||||
"values" : [
|
||||
{
|
||||
"id" : 1,
|
||||
"name" : "256 MB Server",
|
||||
"links": [
|
||||
{
|
||||
"rel" : "self",
|
||||
"href" : "http://servers.api.openstack.org/v1.1/1234/flavors/1"
|
||||
},
|
||||
{
|
||||
"rel" : "bookmark",
|
||||
"type" : "application/vnd.openstack.compute-v1.1+xml",
|
||||
"href" : "http://servers.api.openstack.org/1234/flavors/1"
|
||||
},
|
||||
{
|
||||
"rel" : "bookmark",
|
||||
"type" : "application/vnd.openstack.compute-v1.1+json",
|
||||
"href" : "http://servers.api.openstack.org/1234/flavors/1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id" : 2,
|
||||
"name" : "512 MB Server",
|
||||
"links": [
|
||||
{
|
||||
"rel" : "self",
|
||||
"href" : "http://servers.api.openstack.org/v1.1/1234/flavors/2"
|
||||
},
|
||||
{
|
||||
"rel" : "bookmark",
|
||||
"type" : "application/vnd.openstack.compute-v1.1+xml",
|
||||
"href" : "http://servers.api.openstack.org/1234/flavors/2"
|
||||
},
|
||||
{
|
||||
"rel" : "bookmark",
|
||||
"type" : "application/vnd.openstack.compute-v1.1+json",
|
||||
"href" : "http://servers.api.openstack.org/1234/flavors/2"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,50 @@
|
|||
{
|
||||
"flavors" : [
|
||||
{
|
||||
"id" : 1,
|
||||
"name" : "256 MB Server",
|
||||
"ram" : 256,
|
||||
"disk" : 10
|
||||
},
|
||||
{
|
||||
"id" : 2,
|
||||
"name" : "512 MB Server",
|
||||
"ram" : 512,
|
||||
"disk" : 20
|
||||
}
|
||||
]
|
||||
}
|
||||
{
|
||||
"flavors" : {
|
||||
"values" : [
|
||||
{
|
||||
"id" : 1,
|
||||
"name" : "256 MB Server",
|
||||
"ram" : 256,
|
||||
"disk" : 10,
|
||||
"links": [
|
||||
{
|
||||
"rel" : "self",
|
||||
"href" : "http://servers.api.openstack.org/v1.1/1234/flavors/1"
|
||||
},
|
||||
{
|
||||
"rel" : "bookmark",
|
||||
"type" : "application/vnd.openstack.compute-v1.1+xml",
|
||||
"href" : "http://servers.api.openstack.org/1234/flavors/1"
|
||||
},
|
||||
{
|
||||
"rel" : "bookmark",
|
||||
"type" : "application/vnd.openstack.compute-v1.1+json",
|
||||
"href" : "http://servers.api.openstack.org/1234/flavors/1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id" : 2,
|
||||
"name" : "512 MB Server",
|
||||
"ram" : 512,
|
||||
"disk" : 20,
|
||||
"links": [
|
||||
{
|
||||
"rel" : "self",
|
||||
"href" : "http://servers.api.openstack.org/v1.1/1234/flavors/2"
|
||||
},
|
||||
{
|
||||
"rel" : "bookmark",
|
||||
"type" : "application/vnd.openstack.compute-v1.1+xml",
|
||||
"href" : "http://servers.api.openstack.org/1234/flavors/2"
|
||||
},
|
||||
{
|
||||
"rel" : "bookmark",
|
||||
"type" : "application/vnd.openstack.compute-v1.1+json",
|
||||
"href" : "http://servers.api.openstack.org/1234/flavors/2"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
{
|
||||
"id" : 1,
|
||||
"name" : "CentOS 5.2",
|
||||
},
|
||||
"links": [
|
||||
{
|
||||
"rel" : "self",
|
||||
|
|
|
@ -1,12 +1,47 @@
|
|||
{
|
||||
"servers" : [
|
||||
{
|
||||
"id" : 1234,
|
||||
"name" : "sample-server"
|
||||
},
|
||||
{
|
||||
"id" : 5678,
|
||||
"name" : "sample-server2"
|
||||
}
|
||||
]
|
||||
}
|
||||
{
|
||||
"servers" : {
|
||||
"values" : [
|
||||
{
|
||||
"id" : 1234,
|
||||
"name" : "sample-server",
|
||||
"links": [
|
||||
{
|
||||
"rel" : "self",
|
||||
"href" : "http://servers.api.openstack.org/v1.1/1234/servers/1234"
|
||||
},
|
||||
{
|
||||
"rel" : "bookmark",
|
||||
"type" : "application/vnd.openstack.compute-v1.1+xml",
|
||||
"href" : "http://servers.api.openstack.org/1234/servers/1234"
|
||||
},
|
||||
{
|
||||
"rel" : "bookmark",
|
||||
"type" : "application/vnd.openstack.compute-v1.1+json",
|
||||
"href" : "http://servers.api.openstack.org/1234/servers/1234"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id" : 5678,
|
||||
"name" : "sample-server2",
|
||||
"links": [
|
||||
{
|
||||
"rel" : "self",
|
||||
"href" : "http://servers.api.openstack.org/v1.1/1234/servers/5678"
|
||||
},
|
||||
{
|
||||
"rel" : "bookmark",
|
||||
"type" : "application/vnd.openstack.compute-v1.1+xml",
|
||||
"href" : "http://servers.api.openstack.org/1234/servers/5678"
|
||||
},
|
||||
{
|
||||
"rel" : "bookmark",
|
||||
"type" : "application/vnd.openstack.compute-v1.1+json",
|
||||
"href" : "http://servers.api.openstack.org/1234/servers/5678"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,45 +1,111 @@
|
|||
{
|
||||
"servers" : [
|
||||
{
|
||||
"id" : 1234,
|
||||
"name" : "sample-server",
|
||||
"imageId" : 2,
|
||||
"flavorId" : 1,
|
||||
"hostId" : "e4d909c290d0fb1ca068ffaddf22cbd0",
|
||||
"status" : "BUILD",
|
||||
"progress" : 60,
|
||||
"addresses" : {
|
||||
"public" : [
|
||||
"67.23.10.132",
|
||||
"67.23.10.131"
|
||||
],
|
||||
"private" : [
|
||||
"10.176.42.16"
|
||||
]
|
||||
},
|
||||
"metadata" : {
|
||||
"Server Label" : "Web Head 1",
|
||||
"Image Version" : "2.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id" : 5678,
|
||||
"name" : "sample-server2",
|
||||
"imageId" : 2,
|
||||
"flavorId" : 1,
|
||||
"hostId" : "9e107d9d372bb6826bd81d3542a419d6",
|
||||
"status" : "ACTIVE",
|
||||
"addresses" : {
|
||||
"public" : [
|
||||
"67.23.10.133"
|
||||
],
|
||||
"private" : [
|
||||
"10.176.42.17"
|
||||
]
|
||||
},
|
||||
"metadata" : {
|
||||
"Server Label" : "DB 1"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
{
|
||||
"servers" : {
|
||||
"values" : [
|
||||
{
|
||||
"id" : 1234,
|
||||
"name" : "sample-server",
|
||||
"imageRef" : "https://servers.api.rackspacecloud.com/v1.1/32278/images/1234",
|
||||
"flavorRef" : "https://servers.api.rackspacecloud.com/v1.1/32278/flavors/1",
|
||||
"updated" : "2010-10-10T12:00:00Z",
|
||||
"created" : "2010-08-10T12:00:00Z",
|
||||
"hostId" : "e4d909c290d0fb1ca068ffaddf22cbd0",
|
||||
"affinityId" : "fc88bcf8394db9c8d0564e08ca6a9724188a84d1",
|
||||
"status" : "BUILD",
|
||||
"progress" : 60,
|
||||
"addresses" : {
|
||||
"values" : [
|
||||
{
|
||||
"id" : "public",
|
||||
"values" : [
|
||||
{"version" : 4, "addr" : "67.23.10.132"},
|
||||
{"version" : 6, "addr" : "::babe:67.23.10.132"},
|
||||
{"version" : 4, "addr" : "67.23.10.131"},
|
||||
{"version" : 6, "addr" : "::babe:4317:0A83"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id" : "private",
|
||||
"values" : [
|
||||
{"version" : 4, "addr" : "10.176.42.16"},
|
||||
{"version" : 6, "addr" : "::babe:10.176.42.16"}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"metadata" : {
|
||||
"values" : {
|
||||
"Server Label" : "Web Head 1",
|
||||
"Image Version" : "2.1"
|
||||
}
|
||||
},
|
||||
"links": [
|
||||
{
|
||||
"rel" : "self",
|
||||
"href" : "http://servers.api.openstack.org/v1.1/1234/servers/1234"
|
||||
},
|
||||
{
|
||||
"rel" : "bookmark",
|
||||
"type" : "application/vnd.openstack.compute-v1.1+xml",
|
||||
"href" : "http://servers.api.openstack.org/1234/servers/1234"
|
||||
},
|
||||
{
|
||||
"rel" : "bookmark",
|
||||
"type" : "application/vnd.openstack.compute-v1.1+json",
|
||||
"href" : "http://servers.api.openstack.org/1234/servers/1234"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id" : 5678,
|
||||
"name" : "sample-server2",
|
||||
"imageRef" : "https://servers.api.rackspacecloud.com/v1.1/32278/images/1",
|
||||
"flavorRef" : "https://servers.api.rackspacecloud.com/v1.1/32278/flavors/1",
|
||||
"updated" : "2010-10-10T12:00:00Z",
|
||||
"created" : "2010-08-10T12:00:00Z",
|
||||
"hostId" : "9e107d9d372bb6826bd81d3542a419d6",
|
||||
"affinityId" : "b414fa41cb37b97dcb58d6c76112af1258e9eae2",
|
||||
"status" : "ACTIVE",
|
||||
"addresses" : {
|
||||
"values" : [
|
||||
{
|
||||
"id" : "public",
|
||||
"values" : [
|
||||
{"version" : 4, "addr" : "67.23.10.133"},
|
||||
{"version" : 6, "addr" : "::babe:67.23.10.133"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id" : "private",
|
||||
"values" : [
|
||||
{"version" : 4, "addr" : "10.176.42.17"},
|
||||
{"version" : 6, "addr" : "::babe:10.176.42.17"}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"metadata" : {
|
||||
"values" : {
|
||||
"Server Label" : "DB 1"
|
||||
}
|
||||
},
|
||||
"links": [
|
||||
{
|
||||
"rel" : "self",
|
||||
"href" : "http://servers.api.openstack.org/v1.1/1234/servers/5678"
|
||||
},
|
||||
{
|
||||
"rel" : "bookmark",
|
||||
"type" : "application/vnd.openstack.compute-v1.1+xml",
|
||||
"href" : "http://servers.api.openstack.org/1234/servers/5678"
|
||||
},
|
||||
{
|
||||
"rel" : "bookmark",
|
||||
"type" : "application/vnd.openstack.compute-v1.1+json",
|
||||
"href" : "http://servers.api.openstack.org/1234/servers/5678"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue