diff --git a/doc/api_samples/server-ips-network-resp.json b/doc/api_samples/server-ips-network-resp.json new file mode 100644 index 000000000000..8669202e745a --- /dev/null +++ b/doc/api_samples/server-ips-network-resp.json @@ -0,0 +1,8 @@ +{ + "private": [ + { + "addr": "192.168.0.3", + "version": 4 + } + ] +} \ No newline at end of file diff --git a/doc/api_samples/server-ips-network-resp.xml b/doc/api_samples/server-ips-network-resp.xml new file mode 100644 index 000000000000..30c7678c4fe7 --- /dev/null +++ b/doc/api_samples/server-ips-network-resp.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/doc/api_samples/server-ips-resp.json b/doc/api_samples/server-ips-resp.json new file mode 100644 index 000000000000..8a3500561399 --- /dev/null +++ b/doc/api_samples/server-ips-resp.json @@ -0,0 +1,10 @@ +{ + "addresses": { + "private": [ + { + "addr": "192.168.0.3", + "version": 4 + } + ] + } +} \ No newline at end of file diff --git a/doc/api_samples/server-ips-resp.xml b/doc/api_samples/server-ips-resp.xml new file mode 100644 index 000000000000..2679457ff487 --- /dev/null +++ b/doc/api_samples/server-ips-resp.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/nova/tests/integrated/api_samples/server-ips-network-resp.json.tpl b/nova/tests/integrated/api_samples/server-ips-network-resp.json.tpl new file mode 100644 index 000000000000..29d2370a7441 --- /dev/null +++ b/nova/tests/integrated/api_samples/server-ips-network-resp.json.tpl @@ -0,0 +1,8 @@ +{ + "private": [ + { + "addr": "%(ip)s", + "version": 4 + } + ] +} diff --git a/nova/tests/integrated/api_samples/server-ips-network-resp.xml.tpl b/nova/tests/integrated/api_samples/server-ips-network-resp.xml.tpl new file mode 100644 index 000000000000..153dca9b549c --- /dev/null +++ b/nova/tests/integrated/api_samples/server-ips-network-resp.xml.tpl @@ -0,0 +1,4 @@ + + + + diff --git a/nova/tests/integrated/api_samples/server-ips-resp.json.tpl b/nova/tests/integrated/api_samples/server-ips-resp.json.tpl new file mode 100644 index 000000000000..259eabea7291 --- /dev/null +++ b/nova/tests/integrated/api_samples/server-ips-resp.json.tpl @@ -0,0 +1,10 @@ +{ + "addresses": { + "private": [ + { + "addr": "%(ip)s", + "version": 4 + } + ] + } +} diff --git a/nova/tests/integrated/api_samples/server-ips-resp.xml.tpl b/nova/tests/integrated/api_samples/server-ips-resp.xml.tpl new file mode 100644 index 000000000000..62d804b2af21 --- /dev/null +++ b/nova/tests/integrated/api_samples/server-ips-resp.xml.tpl @@ -0,0 +1,6 @@ + + + + + + diff --git a/nova/tests/integrated/test_api_samples.py b/nova/tests/integrated/test_api_samples.py index c9d0fddd72de..81604ed9ba3d 100644 --- a/nova/tests/integrated/test_api_samples.py +++ b/nova/tests/integrated/test_api_samples.py @@ -377,6 +377,26 @@ class ServersMetadataXmlTest(ServersMetadataJsonTest): ctype = 'xml' +class ServersIpsJsonTest(ServersSampleBase): + def test_get(self): + """Test getting a server's IP information""" + uuid = self._post_server() + response = self._do_get('servers/%s/ips' % uuid) + subs = self._get_regexes() + return self._verify_response('server-ips-resp', subs, response) + + def test_get_by_network(self): + """Test getting a server's IP information by network id""" + uuid = self._post_server() + response = self._do_get('servers/%s/ips/private' % uuid) + subs = self._get_regexes() + return self._verify_response('server-ips-network-resp', subs, response) + + +class ServersIpsXmlTest(ServersIpsJsonTest): + ctype = 'xml' + + class ExtensionsSampleJsonTest(ApiSampleTestBase): all_extensions = True