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