summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-09-24 23:05:15 +0000
committerGerrit Code Review <review@openstack.org>2012-09-24 23:05:15 +0000
commitbd9767b1aa664e25ca905b40bd9de4ead2f6a959 (patch)
tree24a6f39e0f8a0c4c40d4be9381389c2ca88fb6f0
parentabec104a464356475bd6c57c1d26d7c2549291f1 (diff)
parent7090ef94372c9ed1da4b11664611da240d74a841 (diff)
Merge "Integration tests virtual interfaces API extension"
-rw-r--r--doc/api_samples/os-virtual-interfaces/server-post-req.json16
-rw-r--r--doc/api_samples/os-virtual-interfaces/server-post-req.xml19
-rw-r--r--doc/api_samples/os-virtual-interfaces/server-post-resp.json16
-rw-r--r--doc/api_samples/os-virtual-interfaces/server-post-resp.xml6
-rw-r--r--doc/api_samples/os-virtual-interfaces/vifs-list-resp.json8
-rw-r--r--doc/api_samples/os-virtual-interfaces/vifs-list-resp.xml4
-rw-r--r--nova/tests/integrated/api_samples/os-virtual-interfaces/server-post-req.json.tpl16
-rw-r--r--nova/tests/integrated/api_samples/os-virtual-interfaces/server-post-req.xml.tpl19
-rw-r--r--nova/tests/integrated/api_samples/os-virtual-interfaces/server-post-resp.json.tpl16
-rw-r--r--nova/tests/integrated/api_samples/os-virtual-interfaces/server-post-resp.xml.tpl6
-rw-r--r--nova/tests/integrated/api_samples/os-virtual-interfaces/vifs-list-resp.json.tpl8
-rw-r--r--nova/tests/integrated/api_samples/os-virtual-interfaces/vifs-list-resp.xml.tpl4
-rw-r--r--nova/tests/integrated/test_api_samples.py20
13 files changed, 158 insertions, 0 deletions
diff --git a/doc/api_samples/os-virtual-interfaces/server-post-req.json b/doc/api_samples/os-virtual-interfaces/server-post-req.json
new file mode 100644
index 000000000..d88eb4122
--- /dev/null
+++ b/doc/api_samples/os-virtual-interfaces/server-post-req.json
@@ -0,0 +1,16 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b",
+ "flavorRef" : "http://openstack.example.com/openstack/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ },
+ "personality" : [
+ {
+ "path" : "/etc/banner.txt",
+ "contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/doc/api_samples/os-virtual-interfaces/server-post-req.xml b/doc/api_samples/os-virtual-interfaces/server-post-req.xml
new file mode 100644
index 000000000..0a3c8bb53
--- /dev/null
+++ b/doc/api_samples/os-virtual-interfaces/server-post-req.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server xmlns="http://docs.openstack.org/compute/api/v1.1" imageRef="http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b" flavorRef="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> \ No newline at end of file
diff --git a/doc/api_samples/os-virtual-interfaces/server-post-resp.json b/doc/api_samples/os-virtual-interfaces/server-post-resp.json
new file mode 100644
index 000000000..f8379cbb3
--- /dev/null
+++ b/doc/api_samples/os-virtual-interfaces/server-post-resp.json
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "m62Pu3gkXXV2",
+ "id": "a98dd3ae-5feb-4b4b-afa4-25e830ad3305",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v2/openstack/servers/a98dd3ae-5feb-4b4b-afa4-25e830ad3305",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/openstack/servers/a98dd3ae-5feb-4b4b-afa4-25e830ad3305",
+ "rel": "bookmark"
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/doc/api_samples/os-virtual-interfaces/server-post-resp.xml b/doc/api_samples/os-virtual-interfaces/server-post-resp.xml
new file mode 100644
index 000000000..d620ed00b
--- /dev/null
+++ b/doc/api_samples/os-virtual-interfaces/server-post-resp.xml
@@ -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="37443b33-eb80-4eea-90d8-f90778f53dea" adminPass="ffV6E5gsNPpi">
+ <metadata/>
+ <atom:link href="http://openstack.example.com/v2/openstack/servers/37443b33-eb80-4eea-90d8-f90778f53dea" rel="self"/>
+ <atom:link href="http://openstack.example.com/openstack/servers/37443b33-eb80-4eea-90d8-f90778f53dea" rel="bookmark"/>
+</server> \ No newline at end of file
diff --git a/doc/api_samples/os-virtual-interfaces/vifs-list-resp.json b/doc/api_samples/os-virtual-interfaces/vifs-list-resp.json
new file mode 100644
index 000000000..c2e62b6eb
--- /dev/null
+++ b/doc/api_samples/os-virtual-interfaces/vifs-list-resp.json
@@ -0,0 +1,8 @@
+{
+ "virtual_interfaces": [
+ {
+ "id": "cec8b9bb-5d22-4104-b3c8-4c35db3210a6",
+ "mac_address": "fa:16:3e:3c:ce:6f"
+ }
+ ]
+} \ No newline at end of file
diff --git a/doc/api_samples/os-virtual-interfaces/vifs-list-resp.xml b/doc/api_samples/os-virtual-interfaces/vifs-list-resp.xml
new file mode 100644
index 000000000..73aafe09b
--- /dev/null
+++ b/doc/api_samples/os-virtual-interfaces/vifs-list-resp.xml
@@ -0,0 +1,4 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<virtual_interfaces xmlns="http://docs.openstack.org/compute/api/v1.1">
+ <virtual_interface id="94edf7aa-565a-469a-8f45-656b4acf8229" mac_address="fa:16:3e:7d:31:9a"/>
+</virtual_interfaces> \ No newline at end of file
diff --git a/nova/tests/integrated/api_samples/os-virtual-interfaces/server-post-req.json.tpl b/nova/tests/integrated/api_samples/os-virtual-interfaces/server-post-req.json.tpl
new file mode 100644
index 000000000..d3916d1aa
--- /dev/null
+++ b/nova/tests/integrated/api_samples/os-virtual-interfaces/server-post-req.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(host)s/openstack/images/%(image_id)s",
+ "flavorRef" : "%(host)s/openstack/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ },
+ "personality" : [
+ {
+ "path" : "/etc/banner.txt",
+ "contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
+ }
+ ]
+ }
+}
diff --git a/nova/tests/integrated/api_samples/os-virtual-interfaces/server-post-req.xml.tpl b/nova/tests/integrated/api_samples/os-virtual-interfaces/server-post-req.xml.tpl
new file mode 100644
index 000000000..f92614984
--- /dev/null
+++ b/nova/tests/integrated/api_samples/os-virtual-interfaces/server-post-req.xml.tpl
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server xmlns="http://docs.openstack.org/compute/api/v1.1" imageRef="%(host)s/openstack/images/%(image_id)s" flavorRef="%(host)s/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>
diff --git a/nova/tests/integrated/api_samples/os-virtual-interfaces/server-post-resp.json.tpl b/nova/tests/integrated/api_samples/os-virtual-interfaces/server-post-resp.json.tpl
new file mode 100644
index 000000000..d5f030c87
--- /dev/null
+++ b/nova/tests/integrated/api_samples/os-virtual-interfaces/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v2/openstack/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/openstack/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/integrated/api_samples/os-virtual-interfaces/server-post-resp.xml.tpl b/nova/tests/integrated/api_samples/os-virtual-interfaces/server-post-resp.xml.tpl
new file mode 100644
index 000000000..3bb13e69b
--- /dev/null
+++ b/nova/tests/integrated/api_samples/os-virtual-interfaces/server-post-resp.xml.tpl
@@ -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="%(id)s" adminPass="%(password)s">
+ <metadata/>
+ <atom:link href="%(host)s/v2/openstack/servers/%(uuid)s" rel="self"/>
+ <atom:link href="%(host)s/openstack/servers/%(uuid)s" rel="bookmark"/>
+</server>
diff --git a/nova/tests/integrated/api_samples/os-virtual-interfaces/vifs-list-resp.json.tpl b/nova/tests/integrated/api_samples/os-virtual-interfaces/vifs-list-resp.json.tpl
new file mode 100644
index 000000000..af0b7e05a
--- /dev/null
+++ b/nova/tests/integrated/api_samples/os-virtual-interfaces/vifs-list-resp.json.tpl
@@ -0,0 +1,8 @@
+{
+ "virtual_interfaces": [
+ {
+ "id": "%(id)s",
+ "mac_address": "%(mac_addr)s"
+ }
+ ]
+} \ No newline at end of file
diff --git a/nova/tests/integrated/api_samples/os-virtual-interfaces/vifs-list-resp.xml.tpl b/nova/tests/integrated/api_samples/os-virtual-interfaces/vifs-list-resp.xml.tpl
new file mode 100644
index 000000000..74d0c6f39
--- /dev/null
+++ b/nova/tests/integrated/api_samples/os-virtual-interfaces/vifs-list-resp.xml.tpl
@@ -0,0 +1,4 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<virtual_interfaces xmlns="http://docs.openstack.org/compute/api/v1.1">
+ <virtual_interface id="%(id)s" mac_address="%(mac_addr)s"/>
+</virtual_interfaces> \ No newline at end of file
diff --git a/nova/tests/integrated/test_api_samples.py b/nova/tests/integrated/test_api_samples.py
index fc6288c38..c9d0fddd7 100644
--- a/nova/tests/integrated/test_api_samples.py
+++ b/nova/tests/integrated/test_api_samples.py
@@ -964,3 +964,23 @@ class RescueJsonTest(ServersSampleBase):
class RescueXmlTest(RescueJsonTest):
ctype = 'xml'
+
+
+class VirtualInterfacesJsonTest(ServersSampleBase):
+ extension_name = ("nova.api.openstack.compute.contrib"
+ ".virtual_interfaces.Virtual_interfaces")
+
+ def test_vifs_list(self):
+ uuid = self._post_server()
+
+ response = self._do_get('servers/%s/os-virtual-interfaces' % uuid)
+ self.assertEqual(response.status, 200)
+
+ subs = self._get_regexes()
+ subs['mac_addr'] = '(?:[a-f0-9]{2}:){5}[a-f0-9]{2}'
+
+ self._verify_response('vifs-list-resp', subs, response)
+
+
+class VirtualInterfacesXmlTest(VirtualInterfacesJsonTest):
+ ctype = 'xml'