diff options
author | Tiago Mello <tmello@linux.vnet.ibm.com> | 2012-12-17 11:24:10 -0200 |
---|---|---|
committer | Tiago Mello <tmello@linux.vnet.ibm.com> | 2013-02-11 10:53:36 -0200 |
commit | 851ea98e4ee7cd2ca74d2e98e72fb720092d050c (patch) | |
tree | ac5c3a6a54d86474bd35f31f93dc9f4690be1db5 | |
parent | f262c435f4785ee18d7c3609767e5344915001b9 (diff) | |
download | nova-851ea98e4ee7cd2ca74d2e98e72fb720092d050c.tar.gz nova-851ea98e4ee7cd2ca74d2e98e72fb720092d050c.tar.xz nova-851ea98e4ee7cd2ca74d2e98e72fb720092d050c.zip |
Adds API Sample tests for FloatingIPDNS extension.
Partially implements blueprint nova-api-samples
Fixes bug 1070164
Change-Id: I4c3e5d406ce43c27bb49a651facaa831de646a66
29 files changed, 260 insertions, 1 deletions
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 000000000..934ed21b2 --- /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 000000000..36fa41120 --- /dev/null +++ b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-req.xml @@ -0,0 +1,5 @@ +<?xml version='1.0' encoding='UTF-8'?> +<dns_entry> + <ip>192.168.53.11</ip> + <dns_type>A</dns_type> +</dns_entry>
\ 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 000000000..70c903886 --- /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 000000000..25afe599a --- /dev/null +++ b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-entry-resp.xml @@ -0,0 +1,2 @@ +<?xml version='1.0' encoding='UTF-8'?> +<dns_entry ip="192.168.1.1" domain="domain1.example.org" type="A" id="None" name="instance1"/>
\ 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 000000000..05aac422d --- /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 000000000..df12b61cf --- /dev/null +++ b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-req.xml @@ -0,0 +1,6 @@ +<?xml version='1.0' encoding='UTF-8'?> +<domain_entry> + <domain>domain1.example.org</domain> + <scope>public</scope> + <project>project1</project> +</domain_entry>
\ 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 000000000..db43e92d3 --- /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 000000000..8bdf42c41 --- /dev/null +++ b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-create-or-update-resp.xml @@ -0,0 +1,2 @@ +<?xml version='1.0' encoding='UTF-8'?> +<domain_entry project="project1" scope="public" domain="domain1.example.org" availability_zone="None"/>
\ 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 000000000..84ee3930a --- /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 000000000..441b977e6 --- /dev/null +++ b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-entry-get-resp.xml @@ -0,0 +1,2 @@ +<?xml version='1.0' encoding='UTF-8'?> +<dns_entry ip="192.168.1.1" domain="domain1.example.org" type="None" id="None" name="instance1"/>
\ 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 000000000..3263de43a --- /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 000000000..8d910e09b --- /dev/null +++ b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-entry-list-resp.xml @@ -0,0 +1,4 @@ +<?xml version='1.0' encoding='UTF-8'?> +<dns_entries> + <dns_entry ip="192.168.1.1" domain="domain1.example.org" type="None" id="None" name="instance1"/> +</dns_entries>
\ 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 000000000..8882c23a3 --- /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 000000000..d874ef058 --- /dev/null +++ b/doc/api_samples/os-floating-ip-dns/floating-ip-dns-list-resp.xml @@ -0,0 +1,4 @@ +<?xml version='1.0' encoding='UTF-8'?> +<domain_entries> + <domain_entry project="project1" scope="public" domain="domain1.example.org" availability_zone="None"/> +</domain_entries>
\ 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 000000000..7dc33ddb1 --- /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 000000000..bd62d3418 --- /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 @@ +<?xml version='1.0' encoding='UTF-8'?> +<dns_entry> + <ip>%(ip)s</ip> + <dns_type>%(dns_type)s</dns_type> +</dns_entry> 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 000000000..3ec0743ba --- /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 000000000..38a659b78 --- /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 @@ +<?xml version='1.0' encoding='UTF-8'?> +<dns_entry ip="%(ip)s" domain="%(domain)s" type="%(dns_type)s" id="None" name="%(name)s"/> 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 000000000..db73be14a --- /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 000000000..40866a537 --- /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 @@ +<?xml version='1.0' encoding='UTF-8'?> +<domain_entry> + <domain>%(domain)s</domain> + <scope>%(scope)s</scope> + <project>%(project)s</project> +</domain_entry> 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 000000000..a14d395d2 --- /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 000000000..1759c403a --- /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 @@ +<?xml version='1.0' encoding='UTF-8'?> +<domain_entry project="%(project)s" scope="%(scope)s" domain="%(domain)s" availability_zone="None"/> 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 000000000..8edd0603f --- /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 000000000..a889ef6e2 --- /dev/null +++ b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-entry-get-resp.xml.tpl @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<dns_entry ip="%(ip)s" domain="%(domain)s" type="None" id="None" name="%(name)s"/> 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 000000000..831cda7b5 --- /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 000000000..bf7788f94 --- /dev/null +++ b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-entry-list-resp.xml.tpl @@ -0,0 +1,4 @@ +<?xml version='1.0' encoding='UTF-8'?> +<dns_entries> + <dns_entry ip="%(ip)s" domain="%(domain)s" type="None" id="None" name="%(name)s"/> +</dns_entries> 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 000000000..a6055cfec --- /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 000000000..e57c290cb --- /dev/null +++ b/nova/tests/integrated/api_samples/os-floating-ip-dns/floating-ip-dns-list-resp.xml.tpl @@ -0,0 +1,4 @@ +<?xml version='1.0' encoding='UTF-8'?> +<domain_entries> + <domain_entry project="%(project)s" scope="%(scope)s" domain="%(domain)s" availability_zone="None"/> +</domain_entries> diff --git a/nova/tests/integrated/test_api_samples.py b/nova/tests/integrated/test_api_samples.py index f37b3ac5d..aa3ba8efd 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' |