Adds infra for v3 API sample creation

Adds the required infrastructure for the v3 API sample creation.
- v3 API samples and the test cases are in their own v3 directory
- API samples from "core" are now put in their own (per plugin)
  directory rather than in the root directory
- Testcases to create api samples are now placed in individual
  files rather than one giant one. I think it makes it clearer what
  testcases we do have and avoids merge conflict pain

Adds API samples for basic servers interaction

Fix for bug in servers.py where if no extension was loaded which
extends create xml deserialization an exception would occur (fixed
here because it causes the api sample tests ported to fail).

Partially implements blueprint v3-api-unittests

Change-Id: I653af49dcc499c18f14b6e1764711a9922354069
This commit is contained in:
Chris Yeoh
2013-07-26 13:12:26 +09:30
parent 41a9bbc751
commit 3bbac4b749
10 changed files with 236 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
{
"server": {
"access_ip_v4": "",
"access_ip_v6": "",
"addresses": {
"private": [
{
"addr": "192.168.0.3",
"mac_addr": "aa:bb:cc:dd:ee:ff",
"type": "fixed",
"version": 4
}
]
},
"created": "2013-08-09T05:47:55Z",
"flavor": {
"id": "1",
"links": [
{
"href": "http://openstack.example.com/flavors/1",
"rel": "bookmark"
}
]
},
"host_id": "9bc5b8424de645fd39f9edd242992c6be364eddefc936296fad0c582",
"id": "4fc3ceca-91ec-47e7-85ee-ce9834e8ddbb",
"image": {
"id": "70a599e0-31e7-49b7-b260-868f441e862b",
"links": [
{
"href": "http://openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b",
"rel": "bookmark"
}
]
},
"links": [
{
"href": "http://openstack.example.com/v3/servers/4fc3ceca-91ec-47e7-85ee-ce9834e8ddbb",
"rel": "self"
},
{
"href": "http://openstack.example.com/servers/4fc3ceca-91ec-47e7-85ee-ce9834e8ddbb",
"rel": "bookmark"
}
],
"metadata": {
"My Server Name": "Apache1"
},
"name": "new-server-test",
"progress": 0,
"status": "ACTIVE",
"tenant_id": "openstack",
"updated": "2013-08-09T05:47:55Z",
"user_id": "fake"
}
}

View File

@@ -0,0 +1,19 @@
<?xml version='1.0' encoding='UTF-8'?>
<server xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" status="ACTIVE" updated="2013-08-09T06:37:11Z" user_id="fake" name="new-server-test" created="2013-08-09T06:37:11Z" tenant_id="openstack" access_ip_v4="" progress="0" host_id="46dd159c89cba6409878c77977eed49bdf0a76be50885bf4a2010706" id="c20ab09b-1e56-47b4-9195-1ce8f9d40f2d" access_ip_v6="">
<image id="70a599e0-31e7-49b7-b260-868f441e862b">
<atom:link href="http://openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b" rel="bookmark"/>
</image>
<flavor id="1">
<atom:link href="http://openstack.example.com/flavors/1" rel="bookmark"/>
</flavor>
<metadata>
<meta key="My Server Name">Apache1</meta>
</metadata>
<addresses>
<network id="private">
<ip version="4" type="fixed" addr="192.168.0.3" mac_addr="aa:bb:cc:dd:ee:ff"/>
</network>
</addresses>
<atom:link href="http://openstack.example.com/v3/servers/c20ab09b-1e56-47b4-9195-1ce8f9d40f2d" rel="self"/>
<atom:link href="http://openstack.example.com/servers/c20ab09b-1e56-47b4-9195-1ce8f9d40f2d" rel="bookmark"/>
</server>

View File

@@ -0,0 +1,16 @@
{
"server" : {
"name" : "new-server-test",
"image_ref" : "http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b",
"flavor_ref" : "http://openstack.example.com/openstack/flavors/1",
"metadata" : {
"My Server Name" : "Apache1"
},
"personality" : [
{
"path" : "/etc/banner.txt",
"contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
}
]
}
}

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<server xmlns="http://docs.openstack.org/compute/api/v1.1" image_ref="http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b" flavor_ref="http://openstack.example.com/openstack/flavors/1" name="new-server-test">
<metadata>
<meta key="My Server Name">Apache1</meta>
</metadata>
<personality>
<file path="/etc/banner.txt">
ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBp
dCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5k
IGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVs
c2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4g
QnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRo
ZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlv
dSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vy
c2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6
b25zLiINCg0KLVJpY2hhcmQgQmFjaA==
</file>
</personality>
</server>

View File

@@ -0,0 +1,16 @@
{
"server": {
"admin_pass": "2pXrV3mMFkxH",
"id": "f85df75c-cf69-4723-b861-deff54b7cf70",
"links": [
{
"href": "http://openstack.example.com/v3/servers/f85df75c-cf69-4723-b861-deff54b7cf70",
"rel": "self"
},
{
"href": "http://openstack.example.com/servers/f85df75c-cf69-4723-b861-deff54b7cf70",
"rel": "bookmark"
}
]
}
}

View File

@@ -0,0 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<server xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" id="6d896124-8af0-4f2b-a033-e8ca22f83810" admin_pass="JqCn8mtbDnj3">
<metadata/>
<atom:link href="http://openstack.example.com/v3/servers/6d896124-8af0-4f2b-a033-e8ca22f83810" rel="self"/>
<atom:link href="http://openstack.example.com/servers/6d896124-8af0-4f2b-a033-e8ca22f83810" rel="bookmark"/>
</server>

View File

@@ -0,0 +1,58 @@
{
"servers": [
{
"access_ip_v4": "",
"access_ip_v6": "",
"addresses": {
"private": [
{
"addr": "192.168.0.3",
"mac_addr": "aa:bb:cc:dd:ee:ff",
"type": "fixed",
"version": 4
}
]
},
"created": "2013-08-09T05:47:55Z",
"flavor": {
"id": "1",
"links": [
{
"href": "http://openstack.example.com/flavors/1",
"rel": "bookmark"
}
]
},
"host_id": "c977254e8fbf1c2dd83f283dce24dfdba6f1388d05c9972342472a6f",
"id": "b327644d-d61d-49f9-86fd-d56f166e98a8",
"image": {
"id": "70a599e0-31e7-49b7-b260-868f441e862b",
"links": [
{
"href": "http://openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b",
"rel": "bookmark"
}
]
},
"links": [
{
"href": "http://openstack.example.com/v3/servers/b327644d-d61d-49f9-86fd-d56f166e98a8",
"rel": "self"
},
{
"href": "http://openstack.example.com/servers/b327644d-d61d-49f9-86fd-d56f166e98a8",
"rel": "bookmark"
}
],
"metadata": {
"My Server Name": "Apache1"
},
"name": "new-server-test",
"progress": 0,
"status": "ACTIVE",
"tenant_id": "openstack",
"updated": "2013-08-09T05:47:55Z",
"user_id": "fake"
}
]
}

View File

@@ -0,0 +1,21 @@
<?xml version='1.0' encoding='UTF-8'?>
<servers xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1">
<server status="ACTIVE" updated="2013-08-09T06:37:11Z" user_id="fake" name="new-server-test" created="2013-08-09T06:37:11Z" tenant_id="openstack" access_ip_v4="" progress="0" host_id="5b894fe4cf74b3847753a3aaee4a543a813ef6a23558737c1812c81a" id="b83bb663-0744-4ec1-a982-d928472f0e5d" access_ip_v6="">
<image id="70a599e0-31e7-49b7-b260-868f441e862b">
<atom:link href="http://openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b" rel="bookmark"/>
</image>
<flavor id="1">
<atom:link href="http://openstack.example.com/flavors/1" rel="bookmark"/>
</flavor>
<metadata>
<meta key="My Server Name">Apache1</meta>
</metadata>
<addresses>
<network id="private">
<ip version="4" type="fixed" addr="192.168.0.3" mac_addr="aa:bb:cc:dd:ee:ff"/>
</network>
</addresses>
<atom:link href="http://openstack.example.com/v3/servers/b83bb663-0744-4ec1-a982-d928472f0e5d" rel="self"/>
<atom:link href="http://openstack.example.com/servers/b83bb663-0744-4ec1-a982-d928472f0e5d" rel="bookmark"/>
</server>
</servers>

View File

@@ -0,0 +1,18 @@
{
"servers": [
{
"id": "204da46b-4fc9-4761-9bab-aa28add417e6",
"links": [
{
"href": "http://openstack.example.com/v3/servers/204da46b-4fc9-4761-9bab-aa28add417e6",
"rel": "self"
},
{
"href": "http://openstack.example.com/servers/204da46b-4fc9-4761-9bab-aa28add417e6",
"rel": "bookmark"
}
],
"name": "new-server-test"
}
]
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<servers xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1">
<server name="new-server-test" id="6d896124-8af0-4f2b-a033-e8ca22f83810">
<atom:link href="http://openstack.example.com/v3/servers/6d896124-8af0-4f2b-a033-e8ca22f83810" rel="self"/>
<atom:link href="http://openstack.example.com/servers/6d896124-8af0-4f2b-a033-e8ca22f83810" rel="bookmark"/>
</server>
</servers>