Adds API Sample tests for FloatingIPDNS extension.

Partially implements blueprint nova-api-samples
Fixes bug 1070164

Change-Id: I4c3e5d406ce43c27bb49a651facaa831de646a66
This commit is contained in:
Tiago Mello 2012-12-17 11:24:10 -02:00
parent f262c435f4
commit 851ea98e4e
29 changed files with 260 additions and 1 deletions

View File

@ -0,0 +1,7 @@
{
'dns_entry' :
{
'ip': '192.168.53.11',
'dns_type': 'A'
}
}

View File

@ -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>

View File

@ -0,0 +1,9 @@
{
"dns_entry": {
"domain": "domain1.example.org",
"id": null,
"ip": "192.168.1.1",
"name": "instance1",
"type": "A"
}
}

View File

@ -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"/>

View File

@ -0,0 +1,8 @@
{
'domain_entry' :
{
'domain': 'domain1.example.org',
'scope': 'public',
'project': 'project1'
}
}

View File

@ -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>

View File

@ -0,0 +1,8 @@
{
"domain_entry": {
"availability_zone": null,
"domain": "domain1.example.org",
"project": "project1",
"scope": "public"
}
}

View File

@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<domain_entry project="project1" scope="public" domain="domain1.example.org" availability_zone="None"/>

View File

@ -0,0 +1,9 @@
{
"dns_entry": {
"domain": "domain1.example.org",
"id": null,
"ip": "192.168.1.1",
"name": "instance1",
"type": null
}
}

View File

@ -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"/>

View File

@ -0,0 +1,11 @@
{
"dns_entries": [
{
"domain": "domain1.example.org",
"id": null,
"ip": "192.168.1.1",
"name": "instance1",
"type": null
}
]
}

View File

@ -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>

View File

@ -0,0 +1,10 @@
{
"domain_entries": [
{
"availability_zone": null,
"domain": "domain1.example.org",
"project": "project1",
"scope": "public"
}
]
}

View File

@ -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>

View File

@ -0,0 +1,7 @@
{
"dns_entry" :
{
"ip": "%(ip)s",
"dns_type": "%(dns_type)s"
}
}

View File

@ -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>

View File

@ -0,0 +1,9 @@
{
"dns_entry": {
"domain": "%(domain)s",
"id": null,
"ip": "%(ip)s",
"name": "%(name)s",
"type": "%(dns_type)s"
}
}

View File

@ -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"/>

View File

@ -0,0 +1,8 @@
{
"domain_entry" :
{
"domain": "%(domain)s",
"scope": "%(scope)s",
"project": "%(project)s"
}
}

View File

@ -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>

View File

@ -0,0 +1,8 @@
{
"domain_entry": {
"availability_zone": null,
"domain": "%(domain)s",
"project": "%(project)s",
"scope": "%(scope)s"
}
}

View File

@ -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"/>

View File

@ -0,0 +1,9 @@
{
"dns_entry": {
"domain": "%(domain)s",
"id": null,
"ip": "%(ip)s",
"name": "%(name)s",
"type": null
}
}

View File

@ -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"/>

View File

@ -0,0 +1,11 @@
{
"dns_entries": [
{
"domain": "%(domain)s",
"id": null,
"ip": "%(ip)s",
"name": "%(name)s",
"type": null
}
]
}

View File

@ -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>

View File

@ -0,0 +1,10 @@
{
"domain_entries": [
{
"availability_zone": null,
"domain": "%(domain)s",
"project": "%(project)s",
"scope": "%(scope)s"
}
]
}

View File

@ -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>

View File

@ -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'