summaryrefslogtreecommitdiffstats
path: root/nova
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 /nova
parentabec104a464356475bd6c57c1d26d7c2549291f1 (diff)
parent7090ef94372c9ed1da4b11664611da240d74a841 (diff)
Merge "Integration tests virtual interfaces API extension"
Diffstat (limited to 'nova')
-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
7 files changed, 89 insertions, 0 deletions
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'