diff --git a/doc/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-req.json b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-req.json new file mode 100644 index 000000000000..934ed21b20ca --- /dev/null +++ b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-req.json @@ -0,0 +1,7 @@ +{ + 'dns_entry' : + { + 'ip': '192.168.53.11', + 'dns_type': 'A' + } +} \ No newline at end of file diff --git a/doc/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-req.xml b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-req.xml new file mode 100644 index 000000000000..36fa4112079d --- /dev/null +++ b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-req.xml @@ -0,0 +1,5 @@ + + + 192.168.53.11 + A + \ No newline at end of file diff --git a/doc/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-resp.json b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-resp.json new file mode 100644 index 000000000000..70c90388648c --- /dev/null +++ b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-resp.json @@ -0,0 +1,9 @@ +{ + "dns_entry": { + "domain": "domain1.example.org", + "id": null, + "ip": "192.168.1.1", + "name": "instance1", + "type": "A" + } +} \ No newline at end of file diff --git a/doc/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-resp.xml b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-resp.xml new file mode 100644 index 000000000000..25afe599a9f0 --- /dev/null +++ b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-resp.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/doc/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-req.json b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-req.json new file mode 100644 index 000000000000..05aac422daf2 --- /dev/null +++ b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-req.json @@ -0,0 +1,8 @@ +{ + 'domain_entry' : + { + 'domain': 'domain1.example.org', + 'scope': 'public', + 'project': 'project1' + } +} \ No newline at end of file diff --git a/doc/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-req.xml b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-req.xml new file mode 100644 index 000000000000..df12b61cf95b --- /dev/null +++ b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-req.xml @@ -0,0 +1,6 @@ + + + domain1.example.org + public + project1 + \ No newline at end of file diff --git a/doc/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-resp.json b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-resp.json new file mode 100644 index 000000000000..db43e92d3460 --- /dev/null +++ b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-resp.json @@ -0,0 +1,8 @@ +{ + "domain_entry": { + "availability_zone": null, + "domain": "domain1.example.org", + "project": "project1", + "scope": "public" + } +} \ No newline at end of file diff --git a/doc/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-resp.xml b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-resp.xml new file mode 100644 index 000000000000..8bdf42c41dc0 --- /dev/null +++ b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-resp.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/doc/api_samples/os-floating-ip-dns/floating-ip-dns-entry-get-resp.json b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-entry-get-resp.json new file mode 100644 index 000000000000..84ee3930a3f1 --- /dev/null +++ b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-entry-get-resp.json @@ -0,0 +1,9 @@ +{ + "dns_entry": { + "domain": "domain1.example.org", + "id": null, + "ip": "192.168.1.1", + "name": "instance1", + "type": null + } +} \ No newline at end of file diff --git a/doc/api_samples/os-floating-ip-dns/floating-ip-dns-entry-get-resp.xml b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-entry-get-resp.xml new file mode 100644 index 000000000000..441b977e6919 --- /dev/null +++ b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-entry-get-resp.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/doc/api_samples/os-floating-ip-dns/floating-ip-dns-entry-list-resp.json b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-entry-list-resp.json new file mode 100644 index 000000000000..3263de43ab5d --- /dev/null +++ b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-entry-list-resp.json @@ -0,0 +1,11 @@ +{ + "dns_entries": [ + { + "domain": "domain1.example.org", + "id": null, + "ip": "192.168.1.1", + "name": "instance1", + "type": null + } + ] +} \ No newline at end of file diff --git a/doc/api_samples/os-floating-ip-dns/floating-ip-dns-entry-list-resp.xml b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-entry-list-resp.xml new file mode 100644 index 000000000000..8d910e09bfce --- /dev/null +++ b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-entry-list-resp.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/doc/api_samples/os-floating-ip-dns/floating-ip-dns-list-resp.json b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-list-resp.json new file mode 100644 index 000000000000..8882c23a3d88 --- /dev/null +++ b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-list-resp.json @@ -0,0 +1,10 @@ +{ + "domain_entries": [ + { + "availability_zone": null, + "domain": "domain1.example.org", + "project": "project1", + "scope": "public" + } + ] +} \ No newline at end of file diff --git a/doc/api_samples/os-floating-ip-dns/floating-ip-dns-list-resp.xml b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-list-resp.xml new file mode 100644 index 000000000000..d874ef058f07 --- /dev/null +++ b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-list-resp.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-req.json.tpl b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-req.json.tpl new file mode 100644 index 000000000000..7dc33ddb10e4 --- /dev/null +++ b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-req.json.tpl @@ -0,0 +1,7 @@ +{ + "dns_entry" : + { + "ip": "%(ip)s", + "dns_type": "%(dns_type)s" + } +} diff --git a/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-req.xml.tpl b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-req.xml.tpl new file mode 100644 index 000000000000..bd62d34186b9 --- /dev/null +++ b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-req.xml.tpl @@ -0,0 +1,5 @@ + + + %(ip)s + %(dns_type)s + diff --git a/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-resp.json.tpl b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-resp.json.tpl new file mode 100644 index 000000000000..3ec0743ba714 --- /dev/null +++ b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-resp.json.tpl @@ -0,0 +1,9 @@ +{ + "dns_entry": { + "domain": "%(domain)s", + "id": null, + "ip": "%(ip)s", + "name": "%(name)s", + "type": "%(dns_type)s" + } +} diff --git a/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-resp.xml.tpl b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-resp.xml.tpl new file mode 100644 index 000000000000..38a659b78ef4 --- /dev/null +++ b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-resp.xml.tpl @@ -0,0 +1,2 @@ + + diff --git a/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-req.json.tpl b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-req.json.tpl new file mode 100644 index 000000000000..db73be14a838 --- /dev/null +++ b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-req.json.tpl @@ -0,0 +1,8 @@ +{ + "domain_entry" : + { + "domain": "%(domain)s", + "scope": "%(scope)s", + "project": "%(project)s" + } +} diff --git a/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-req.xml.tpl b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-req.xml.tpl new file mode 100644 index 000000000000..40866a5373d9 --- /dev/null +++ b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-req.xml.tpl @@ -0,0 +1,6 @@ + + + %(domain)s + %(scope)s + %(project)s + diff --git a/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-resp.json.tpl b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-resp.json.tpl new file mode 100644 index 000000000000..a14d395d23fe --- /dev/null +++ b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-resp.json.tpl @@ -0,0 +1,8 @@ +{ + "domain_entry": { + "availability_zone": null, + "domain": "%(domain)s", + "project": "%(project)s", + "scope": "%(scope)s" + } +} diff --git a/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-resp.xml.tpl b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-resp.xml.tpl new file mode 100644 index 000000000000..1759c403afc1 --- /dev/null +++ b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-resp.xml.tpl @@ -0,0 +1,2 @@ + + diff --git a/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-entry-get-resp.json.tpl b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-entry-get-resp.json.tpl new file mode 100644 index 000000000000..8edd0603f7eb --- /dev/null +++ b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-entry-get-resp.json.tpl @@ -0,0 +1,9 @@ +{ + "dns_entry": { + "domain": "%(domain)s", + "id": null, + "ip": "%(ip)s", + "name": "%(name)s", + "type": null + } +} diff --git a/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-entry-get-resp.xml.tpl b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-entry-get-resp.xml.tpl new file mode 100644 index 000000000000..a889ef6e2c6f --- /dev/null +++ b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-entry-get-resp.xml.tpl @@ -0,0 +1,2 @@ + + diff --git a/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-entry-list-resp.json.tpl b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-entry-list-resp.json.tpl new file mode 100644 index 000000000000..831cda7b55df --- /dev/null +++ b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-entry-list-resp.json.tpl @@ -0,0 +1,11 @@ +{ + "dns_entries": [ + { + "domain": "%(domain)s", + "id": null, + "ip": "%(ip)s", + "name": "%(name)s", + "type": null + } + ] +} diff --git a/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-entry-list-resp.xml.tpl b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-entry-list-resp.xml.tpl new file mode 100644 index 000000000000..bf7788f94d05 --- /dev/null +++ b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-entry-list-resp.xml.tpl @@ -0,0 +1,4 @@ + + + + diff --git a/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-list-resp.json.tpl b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-list-resp.json.tpl new file mode 100644 index 000000000000..a6055cfecca1 --- /dev/null +++ b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-list-resp.json.tpl @@ -0,0 +1,10 @@ +{ + "domain_entries": [ + { + "availability_zone": null, + "domain": "%(domain)s", + "project": "%(project)s", + "scope": "%(scope)s" + } + ] +} diff --git a/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-list-resp.xml.tpl b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-list-resp.xml.tpl new file mode 100644 index 000000000000..e57c290cb8a9 --- /dev/null +++ b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-list-resp.xml.tpl @@ -0,0 +1,4 @@ + + + + diff --git a/nova/tests/integrated/test_api_samples.py b/nova/tests/integrated/test_api_samples.py index f37b3ac5deef..aa3ba8efd231 100644 --- a/nova/tests/integrated/test_api_samples.py +++ b/nova/tests/integrated/test_api_samples.py @@ -380,7 +380,6 @@ class ApiSamplesTrap(ApiSampleTestBase): do_not_approve_additions.append('os-config-drive') do_not_approve_additions.append('os-create-server-ext') do_not_approve_additions.append('os-flavor-access') - do_not_approve_additions.append('os-floating-ip-dns') do_not_approve_additions.append('os-hypervisors') do_not_approve_additions.append('os-services') do_not_approve_additions.append('os-volumes') @@ -2938,3 +2937,89 @@ class EvacuateJsonTest(ServersSampleBase): class EvacuateXmlTest(EvacuateJsonTest): ctype = 'xml' + + +class FloatingIpDNSJsonTest(ApiSampleTestBase): + extension_name = ("nova.api.openstack.compute.contrib.floating_ip_dns." + "Floating_ip_dns") + + domain = 'domain1.example.org' + name = 'instance1' + scope = 'public' + project = 'project1' + dns_type = 'A' + ip = '192.168.1.1' + + def _create_or_update(self): + subs = {'domain': self.domain, + 'project': self.project, + 'scope': self.scope} + response = self._do_put('os-floating-ip-dns/%s' % self.domain, + 'floating-ip-dns-create-or-update-req', subs) + self.assertEqual(response.status, 200) + self._verify_response('floating-ip-dns-create-or-update-resp', subs, + response) + + def _create_or_update_entry(self): + subs = {'ip': self.ip, 'dns_type': self.dns_type} + response = self._do_put('os-floating-ip-dns/%s/entries/%s' + % (self.domain, self.name), + 'floating-ip-dns-create-or-update-entry-req', + subs) + self.assertEqual(response.status, 200) + subs.update({'name': self.name, 'domain': self.domain}) + self._verify_response('floating-ip-dns-create-or-update-entry-resp', + subs, response) + + def test_floating_ip_dns_list(self): + self._create_or_update() + response = self._do_get('os-floating-ip-dns') + self.assertEqual(response.status, 200) + subs = {'domain': self.domain, + 'project': self.project, + 'scope': self.scope} + return self._verify_response('floating-ip-dns-list-resp', subs, + response) + + def test_floating_ip_dns_create_or_update(self): + self._create_or_update() + + def test_floating_ip_dns_delete(self): + self._create_or_update() + response = self._do_delete('os-floating-ip-dns/%s' % self.domain) + self.assertEqual(response.status, 202) + + def test_floating_ip_dns_create_or_update_entry(self): + self._create_or_update_entry() + + def test_floating_ip_dns_entry_get(self): + self._create_or_update_entry() + response = self._do_get('os-floating-ip-dns/%s/entries/%s' + % (self.domain, self.name)) + self.assertEqual(response.status, 200) + subs = {'domain': self.domain, + 'ip': self.ip, + 'name': self.name} + return self._verify_response('floating-ip-dns-entry-get-resp', subs, + response) + + def test_floating_ip_dns_entry_delete(self): + self._create_or_update_entry() + response = self._do_delete('os-floating-ip-dns/%s/entries/%s' + % (self.domain, self.name)) + self.assertEqual(response.status, 202) + + def test_floating_ip_dns_entry_list(self): + self._create_or_update_entry() + response = self._do_get('os-floating-ip-dns/%s/entries/%s' + % (self.domain, self.ip)) + self.assertEqual(response.status, 200) + subs = {'domain': self.domain, + 'ip': self.ip, + 'name': self.name} + return self._verify_response('floating-ip-dns-entry-list-resp', subs, + response) + + +class FloatingIpDNSXmlTest(FloatingIpDNSJsonTest): + ctype = 'xml'