Adds more servers list and servers details samples
This moves the servers detail test into the base servers test so it runs with all_extensions as well. It also renames the results to be consistent with the other tests. Finally it adds test for servers-list both with and without extensions. Change-Id: I6eed3932fa594f1a39faa55453461680781e6a9f
This commit is contained in:
parent
e06d8bc8cd
commit
8c168dd4fd
69
doc/api_samples/all_extensions/servers-details-resp.json
Normal file
69
doc/api_samples/all_extensions/servers-details-resp.json
Normal file
@ -0,0 +1,69 @@
|
||||
{
|
||||
"servers": [
|
||||
{
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-SRV-ATTR:host": "1ed961df12f5434a8e54e0efd1049fa5",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": null,
|
||||
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
|
||||
"OS-EXT-STS:power_state": 1,
|
||||
"OS-EXT-STS:task_state": null,
|
||||
"OS-EXT-STS:vm_state": "active",
|
||||
"accessIPv4": "",
|
||||
"accessIPv6": "",
|
||||
"addresses": {
|
||||
"private": [
|
||||
{
|
||||
"addr": "192.168.0.3",
|
||||
"version": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
"config_drive": "",
|
||||
"created": "2012-09-12T17:16:15Z",
|
||||
"flavor": {
|
||||
"id": "1",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/openstack/flavors/1",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
},
|
||||
"hostId": "c161a6e3edcd047317a6cfbe599d7711850fd871210b62fdd2f6479e",
|
||||
"id": "1d0f60bc-8c90-425d-8c64-cdaa49cd2303",
|
||||
"image": {
|
||||
"id": "70a599e0-31e7-49b7-b260-868f441e862b",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
},
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/v2/openstack/servers/1d0f60bc-8c90-425d-8c64-cdaa49cd2303",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://openstack.example.com/openstack/servers/1d0f60bc-8c90-425d-8c64-cdaa49cd2303",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"My Server Name": "Apache1"
|
||||
},
|
||||
"name": "new-server-test",
|
||||
"progress": 0,
|
||||
"security_groups": [
|
||||
{
|
||||
"name": "default"
|
||||
}
|
||||
],
|
||||
"status": "ACTIVE",
|
||||
"tenant_id": "openstack",
|
||||
"updated": "2012-09-12T17:16:15Z",
|
||||
"user_id": "fake"
|
||||
}
|
||||
]
|
||||
}
|
24
doc/api_samples/all_extensions/servers-details-resp.xml
Normal file
24
doc/api_samples/all_extensions/servers-details-resp.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<servers xmlns:OS-DCF="http://docs.openstack.org/compute/ext/disk_config/api/v1.1" xmlns:OS-EXT-SRV-ATTR="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:OS-EXT-STS="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1">
|
||||
<server status="ACTIVE" updated="2012-09-12T17:16:23Z" hostId="95bc84e46706592751395e8651c7d28cb0c86722ae372fe97fb27f35" name="new-server-test" created="2012-09-12T17:16:23Z" userId="fake" tenantId="openstack" accessIPv4="" accessIPv6="" progress="0" id="2e6a40cf-4abb-44ba-8a1c-fdb666110b42" config_drive="" OS-EXT-SRV-ATTR:vm_state="active" OS-EXT-SRV-ATTR:task_state="None" OS-EXT-SRV-ATTR:power_state="1" OS-EXT-SRV-ATTR:instance_name="instance-00000001" OS-EXT-SRV-ATTR:host="530cfd748f4b4a24b3dc7015d5a0a02e" OS-EXT-SRV-ATTR:hypervisor_hostname="None" OS-DCF:diskConfig="AUTO">
|
||||
<image id="70a599e0-31e7-49b7-b260-868f441e862b">
|
||||
<atom:link href="http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b" rel="bookmark"/>
|
||||
</image>
|
||||
<flavor id="1">
|
||||
<atom:link href="http://openstack.example.com/openstack/flavors/1" rel="bookmark"/>
|
||||
</flavor>
|
||||
<metadata>
|
||||
<meta key="My Server Name">Apache1</meta>
|
||||
</metadata>
|
||||
<addresses>
|
||||
<network id="private">
|
||||
<ip version="4" addr="192.168.0.3"/>
|
||||
</network>
|
||||
</addresses>
|
||||
<atom:link href="http://openstack.example.com/v2/openstack/servers/2e6a40cf-4abb-44ba-8a1c-fdb666110b42" rel="self"/>
|
||||
<atom:link href="http://openstack.example.com/openstack/servers/2e6a40cf-4abb-44ba-8a1c-fdb666110b42" rel="bookmark"/>
|
||||
<security_groups>
|
||||
<security_group name="default"/>
|
||||
</security_groups>
|
||||
</server>
|
||||
</servers>
|
18
doc/api_samples/all_extensions/servers-list-resp.json
Normal file
18
doc/api_samples/all_extensions/servers-list-resp.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"servers": [
|
||||
{
|
||||
"id": "eb51f4a9-8192-4cd0-be78-d8e2c834dbc4",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/v2/openstack/servers/eb51f4a9-8192-4cd0-be78-d8e2c834dbc4",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://openstack.example.com/openstack/servers/eb51f4a9-8192-4cd0-be78-d8e2c834dbc4",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"name": "new-server-test"
|
||||
}
|
||||
]
|
||||
}
|
7
doc/api_samples/all_extensions/servers-list-resp.xml
Normal file
7
doc/api_samples/all_extensions/servers-list-resp.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<servers xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1">
|
||||
<server name="new-server-test" id="b28017c2-7909-4318-bc47-ba1419f17709">
|
||||
<atom:link href="http://openstack.example.com/v2/openstack/servers/b28017c2-7909-4318-bc47-ba1419f17709" rel="self"/>
|
||||
<atom:link href="http://openstack.example.com/openstack/servers/b28017c2-7909-4318-bc47-ba1419f17709" rel="bookmark"/>
|
||||
</server>
|
||||
</servers>
|
18
doc/api_samples/servers-list-resp.json
Normal file
18
doc/api_samples/servers-list-resp.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"servers": [
|
||||
{
|
||||
"id": "616fb98f-46ca-475e-917e-2563e5a8cd19",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/v2/openstack/servers/616fb98f-46ca-475e-917e-2563e5a8cd19",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://openstack.example.com/openstack/servers/616fb98f-46ca-475e-917e-2563e5a8cd19",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"name": "new-server-test"
|
||||
}
|
||||
]
|
||||
}
|
7
doc/api_samples/servers-list-resp.xml
Normal file
7
doc/api_samples/servers-list-resp.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<servers xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1">
|
||||
<server name="new-server-test" id="b626796d-d585-4874-b178-78c65289bba4">
|
||||
<atom:link href="http://openstack.example.com/v2/openstack/servers/b626796d-d585-4874-b178-78c65289bba4" rel="self"/>
|
||||
<atom:link href="http://openstack.example.com/openstack/servers/b626796d-d585-4874-b178-78c65289bba4" rel="bookmark"/>
|
||||
</server>
|
||||
</servers>
|
@ -29,7 +29,7 @@
|
||||
]
|
||||
},
|
||||
"hostId": "%(hostid)s",
|
||||
"id": "%(uuid)s",
|
||||
"id": "%(id)s",
|
||||
"image": {
|
||||
"id": "%(uuid)s",
|
||||
"links": [
|
||||
@ -42,11 +42,11 @@
|
||||
"key_name": null,
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/v2/openstack/servers/%(uuid)s",
|
||||
"href": "%(host)s/v2/openstack/servers/%(id)s",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "%(host)s/openstack/servers/%(uuid)s",
|
||||
"href": "%(host)s/openstack/servers/%(id)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
|
@ -14,8 +14,8 @@
|
||||
<ip version="4" addr="%(ip)s"/>
|
||||
</network>
|
||||
</addresses>
|
||||
<atom:link href="%(host)s/v2/openstack/servers/%(uuid)s" rel="self"/>
|
||||
<atom:link href="%(host)s/openstack/servers/%(uuid)s" rel="bookmark"/>
|
||||
<atom:link href="%(host)s/v2/openstack/servers/%(id)s" rel="self"/>
|
||||
<atom:link href="%(host)s/openstack/servers/%(id)s" rel="bookmark"/>
|
||||
<security_groups>
|
||||
<security_group name="default"/>
|
||||
</security_groups>
|
||||
|
@ -0,0 +1,70 @@
|
||||
{
|
||||
"servers": [
|
||||
{
|
||||
"OS-DCF:diskConfig": "AUTO",
|
||||
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
|
||||
"OS-EXT-SRV-ATTR:hypervisor_hostname": null,
|
||||
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
|
||||
"OS-EXT-STS:power_state": 1,
|
||||
"OS-EXT-STS:task_state": null,
|
||||
"OS-EXT-STS:vm_state": "active",
|
||||
"accessIPv4": "",
|
||||
"accessIPv6": "",
|
||||
"addresses": {
|
||||
"private": [
|
||||
{
|
||||
"addr": "%(ip)s",
|
||||
"version": 4
|
||||
}
|
||||
]
|
||||
},
|
||||
"config_drive": "",
|
||||
"created": "%(timestamp)s",
|
||||
"flavor": {
|
||||
"id": "1",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/openstack/flavors/1",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
},
|
||||
"hostId": "%(hostid)s",
|
||||
"id": "%(id)s",
|
||||
"image": {
|
||||
"id": "%(uuid)s",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/openstack/images/%(uuid)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
},
|
||||
"key_name": null,
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/v2/openstack/servers/%(id)s",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "%(host)s/openstack/servers/%(id)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"My Server Name": "Apache1"
|
||||
},
|
||||
"name": "new-server-test",
|
||||
"progress": 0,
|
||||
"security_groups": [
|
||||
{
|
||||
"name": "default"
|
||||
}
|
||||
],
|
||||
"status": "ACTIVE",
|
||||
"tenant_id": "openstack",
|
||||
"updated": "%(timestamp)s",
|
||||
"user_id": "fake"
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<servers xmlns:OS-DCF="http://docs.openstack.org/compute/ext/disk_config/api/v1.1" xmlns:OS-EXT-SRV-ATTR="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:OS-EXT-STS="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1">
|
||||
<server xmlns:OS-DCF="http://docs.openstack.org/compute/ext/disk_config/api/v1.1" xmlns:OS-EXT-SRV-ATTR="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:OS-EXT-STS="http://docs.openstack.org/compute/ext/extended_status/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" status="ACTIVE" updated="%(timestamp)s" hostId="%(hostid)s" name="new-server-test" created="%(timestamp)s" userId="fake" tenantId="openstack" accessIPv4="" accessIPv6="" progress="0" id="%(id)s" key_name="None" config_drive="" OS-EXT-SRV-ATTR:vm_state="active" OS-EXT-SRV-ATTR:task_state="None" OS-EXT-SRV-ATTR:power_state="1" OS-EXT-SRV-ATTR:instance_name="instance-00000001" OS-EXT-SRV-ATTR:host="%(compute_host)s" OS-EXT-SRV-ATTR:hypervisor_hostname="None" OS-DCF:diskConfig="AUTO">
|
||||
<image id="%(uuid)s">
|
||||
<atom:link href="%(host)s/openstack/images/%(uuid)s" rel="bookmark"/>
|
||||
</image>
|
||||
<flavor id="1">
|
||||
<atom:link href="%(host)s/openstack/flavors/1" rel="bookmark"/>
|
||||
</flavor>
|
||||
<metadata>
|
||||
<meta key="My Server Name">Apache1</meta>
|
||||
</metadata>
|
||||
<addresses>
|
||||
<network id="private">
|
||||
<ip version="4" addr="%(ip)s"/>
|
||||
</network>
|
||||
</addresses>
|
||||
<atom:link href="%(host)s/v2/openstack/servers/%(id)s" rel="self"/>
|
||||
<atom:link href="%(host)s/openstack/servers/%(id)s" rel="bookmark"/>
|
||||
<security_groups>
|
||||
<security_group name="default"/>
|
||||
</security_groups>
|
||||
</server>
|
||||
</servers>
|
@ -0,0 +1,18 @@
|
||||
{
|
||||
"servers": [
|
||||
{
|
||||
"id": "%(id)s",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/v2/openstack/servers/%(id)s",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "%(host)s/openstack/servers/%(id)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"name": "new-server-test"
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<servers xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1">
|
||||
<server name="new-server-test" id="%(id)s">
|
||||
<atom:link href="%(host)s/v2/openstack/servers/%(id)s" rel="self"/>
|
||||
<atom:link href="%(host)s/openstack/servers/%(id)s" rel="bookmark"/>
|
||||
</server>
|
||||
</servers>
|
@ -21,7 +21,7 @@
|
||||
]
|
||||
},
|
||||
"hostId": "%(hostid)s",
|
||||
"id": "%(uuid)s",
|
||||
"id": "%(id)s",
|
||||
"image": {
|
||||
"id": "%(uuid)s",
|
||||
"links": [
|
||||
@ -33,11 +33,11 @@
|
||||
},
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/v2/openstack/servers/%(uuid)s",
|
||||
"href": "%(host)s/v2/openstack/servers/%(id)s",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "%(host)s/openstack/servers/%(uuid)s",
|
||||
"href": "%(host)s/openstack/servers/%(id)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
|
@ -14,6 +14,6 @@
|
||||
<ip version="4" addr="%(ip)s"/>
|
||||
</network>
|
||||
</addresses>
|
||||
<atom:link href="%(host)s/v2/openstack/servers/%(uuid)s" rel="self"/>
|
||||
<atom:link href="%(host)s/openstack/servers/%(uuid)s" rel="bookmark"/>
|
||||
<atom:link href="%(host)s/v2/openstack/servers/%(id)s" rel="self"/>
|
||||
<atom:link href="%(host)s/openstack/servers/%(id)s" rel="bookmark"/>
|
||||
</server>
|
||||
|
@ -22,7 +22,7 @@
|
||||
]
|
||||
},
|
||||
"hostId": "%(hostid)s",
|
||||
"id": "%(uuid)s",
|
||||
"id": "%(id)s",
|
||||
"image": {
|
||||
"id": "%(uuid)s",
|
||||
"links": [
|
||||
@ -34,11 +34,11 @@
|
||||
},
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/v2/openstack/servers/%(uuid)s",
|
||||
"href": "%(host)s/v2/openstack/servers/%(id)s",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "%(host)s/openstack/servers/%(uuid)s",
|
||||
"href": "%(host)s/openstack/servers/%(id)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
@ -15,7 +15,7 @@
|
||||
<ip version="4" addr="%(ip)s"/>
|
||||
</network>
|
||||
</addresses>
|
||||
<atom:link href="%(host)s/v2/openstack/servers/%(uuid)s" rel="self"/>
|
||||
<atom:link href="%(host)s/openstack/servers/%(uuid)s" rel="bookmark"/>
|
||||
<atom:link href="%(host)s/v2/openstack/servers/%(id)s" rel="self"/>
|
||||
<atom:link href="%(host)s/openstack/servers/%(id)s" rel="bookmark"/>
|
||||
</server>
|
||||
</servers>
|
18
nova/tests/integrated/api_samples/servers-list-resp.json.tpl
Normal file
18
nova/tests/integrated/api_samples/servers-list-resp.json.tpl
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"servers": [
|
||||
{
|
||||
"id": "%(id)s",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/v2/openstack/servers/%(id)s",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "%(host)s/openstack/servers/%(id)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"name": "new-server-test"
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<servers xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1">
|
||||
<server name="new-server-test" id="%(id)s">
|
||||
<atom:link href="%(host)s/v2/openstack/servers/%(id)s" rel="self"/>
|
||||
<atom:link href="%(host)s/openstack/servers/%(id)s" rel="bookmark"/>
|
||||
</server>
|
||||
</servers>
|
@ -236,7 +236,7 @@ class ApiSampleTestBase(integrated_helpers._IntegratedTestBase):
|
||||
|
||||
|
||||
class VersionsSampleJsonTest(ApiSampleTestBase):
|
||||
def test_servers_get(self):
|
||||
def test_versions_get(self):
|
||||
response = self._do_get('', strip_version=True)
|
||||
subs = self._get_regexes()
|
||||
return self._verify_response('versions-get-resp', subs, response)
|
||||
@ -267,24 +267,28 @@ class ServersSampleJsonTest(ServersSampleBase):
|
||||
response = self._do_get('servers/%s' % uuid)
|
||||
subs = self._get_regexes()
|
||||
subs['hostid'] = '[a-f0-9]+'
|
||||
subs['id'] = uuid
|
||||
return self._verify_response('server-get-resp', subs, response)
|
||||
|
||||
def test_servers_list(self):
|
||||
uuid = self._post_server()
|
||||
response = self._do_get('servers')
|
||||
self.assertEqual(response.status, 200)
|
||||
subs = self._get_regexes()
|
||||
subs['id'] = uuid
|
||||
return self._verify_response('servers-list-resp', subs, response)
|
||||
|
||||
class ServersSampleXmlTest(ServersSampleJsonTest):
|
||||
ctype = 'xml'
|
||||
|
||||
|
||||
class ServersDetailJsonTest(ServersSampleBase):
|
||||
def test_servers_detail_get(self):
|
||||
def test_servers_details(self):
|
||||
uuid = self._post_server()
|
||||
response = self._do_get('servers/detail')
|
||||
self.assertEqual(response.status, 200)
|
||||
subs = self._get_regexes()
|
||||
subs['hostid'] = '[a-f0-9]+'
|
||||
return self._verify_response('server-detail-get-resp', subs, response)
|
||||
subs['id'] = uuid
|
||||
return self._verify_response('servers-details-resp', subs, response)
|
||||
|
||||
|
||||
class ServersDetailXmlTest(ServersDetailJsonTest):
|
||||
class ServersSampleXmlTest(ServersSampleJsonTest):
|
||||
ctype = 'xml'
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user