Merge security groups tests between v2 and v2.1
Currently v2 and v2.1 have separate functional tests and their corresponding sample files. As v2 and v2.1 are supposed to be identical, there is overhead to maintain two set of functional tests and sample files. We can have one set of tests which can run for both v2 and v2.1. This commit merges security groups functional tests. In V2.1 os-access-ip is separate plugin where in v2 it was mixed in server plugin itself. So os-access-ip extension is enabled to run merged functional tests for both v2 and v2.1. Change-Id: I45bc8a6ab4b48bff6ed28b4c779b575252161ed1
This commit is contained in:
parent
5115a8d219
commit
54fb6a4628
@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"addSecurityGroup" : {
|
|
||||||
"name" : "test"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"security_group": {
|
|
||||||
"name": "test",
|
|
||||||
"description": "description"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"removeSecurityGroup" : {
|
|
||||||
"name" : "test"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"security_group": {
|
|
||||||
"description": "description",
|
|
||||||
"id": 2,
|
|
||||||
"name": "test",
|
|
||||||
"rules": [],
|
|
||||||
"tenant_id": "openstack"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"security_group": {
|
|
||||||
"description": "default",
|
|
||||||
"id": 1,
|
|
||||||
"name": "default",
|
|
||||||
"rules": [],
|
|
||||||
"tenant_id": "openstack"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"security_groups": [
|
|
||||||
{
|
|
||||||
"description": "default",
|
|
||||||
"id": 1,
|
|
||||||
"name": "default",
|
|
||||||
"rules": [],
|
|
||||||
"tenant_id": "openstack"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
{
|
|
||||||
"server" : {
|
|
||||||
"name" : "new-server-test",
|
|
||||||
"imageRef" : "http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b",
|
|
||||||
"flavorRef" : "http://openstack.example.com/openstack/flavors/1",
|
|
||||||
"metadata" : {
|
|
||||||
"My Server Name" : "Apache1"
|
|
||||||
},
|
|
||||||
"personality" : [
|
|
||||||
{
|
|
||||||
"path" : "/etc/banner.txt",
|
|
||||||
"contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
{
|
|
||||||
"server": {
|
|
||||||
"adminPass": "QmKpgBk7izBM",
|
|
||||||
"id": "3ad37a3a-d5c4-40ab-9bff-af5b66a0e35b",
|
|
||||||
"links": [
|
|
||||||
{
|
|
||||||
"href": "http://openstack.example.com/v2/openstack/servers/3ad37a3a-d5c4-40ab-9bff-af5b66a0e35b",
|
|
||||||
"rel": "self"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"href": "http://openstack.example.com/openstack/servers/3ad37a3a-d5c4-40ab-9bff-af5b66a0e35b",
|
|
||||||
"rel": "bookmark"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"security_groups": [
|
|
||||||
{
|
|
||||||
"name": "default"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"security_groups": [
|
|
||||||
{
|
|
||||||
"description": "default",
|
|
||||||
"id": 1,
|
|
||||||
"name": "default",
|
|
||||||
"rules": [],
|
|
||||||
"tenant_id": "openstack"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,5 +1,7 @@
|
|||||||
{
|
{
|
||||||
"server": {
|
"server": {
|
||||||
|
"accessIPv4": "1.2.3.4",
|
||||||
|
"accessIPv6": "80fe::",
|
||||||
"addresses": {
|
"addresses": {
|
||||||
"private": [
|
"private": [
|
||||||
{
|
{
|
||||||
@ -15,7 +17,7 @@
|
|||||||
"id": "1",
|
"id": "1",
|
||||||
"links": [
|
"links": [
|
||||||
{
|
{
|
||||||
"href": "http://openstack.example.com/flavors/1",
|
"href": "http://openstack.example.com/openstack/flavors/1",
|
||||||
"rel": "bookmark"
|
"rel": "bookmark"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -26,7 +28,7 @@
|
|||||||
"id": "70a599e0-31e7-49b7-b260-868f441e862b",
|
"id": "70a599e0-31e7-49b7-b260-868f441e862b",
|
||||||
"links": [
|
"links": [
|
||||||
{
|
{
|
||||||
"href": "http://openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b",
|
"href": "http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b",
|
||||||
"rel": "bookmark"
|
"rel": "bookmark"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -34,11 +36,11 @@
|
|||||||
"key_name": null,
|
"key_name": null,
|
||||||
"links": [
|
"links": [
|
||||||
{
|
{
|
||||||
"href": "http://openstack.example.com/v3/servers/b08eb8d8-db43-44fb-bd89-dfe3302b84ef",
|
"href": "http://openstack.example.com/v2/openstack/servers/b08eb8d8-db43-44fb-bd89-dfe3302b84ef",
|
||||||
"rel": "self"
|
"rel": "self"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"href": "http://openstack.example.com/servers/b08eb8d8-db43-44fb-bd89-dfe3302b84ef",
|
"href": "http://openstack.example.com/openstack/servers/b08eb8d8-db43-44fb-bd89-dfe3302b84ef",
|
||||||
"rel": "bookmark"
|
"rel": "bookmark"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
{
|
{
|
||||||
"server" : {
|
"server" : {
|
||||||
|
"accessIPv4": "1.2.3.4",
|
||||||
|
"accessIPv6": "80fe::",
|
||||||
"name" : "new-server-test",
|
"name" : "new-server-test",
|
||||||
"imageRef" : "http://glance.openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b",
|
"imageRef" : "http://glance.openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b",
|
||||||
"flavorRef" : "http://openstack.example.com/openstack/flavors/1",
|
"flavorRef" : "http://openstack.example.com/openstack/flavors/1",
|
||||||
|
@ -4,11 +4,11 @@
|
|||||||
"id": "60874907-c72b-4a01-805d-54c992510e47",
|
"id": "60874907-c72b-4a01-805d-54c992510e47",
|
||||||
"links": [
|
"links": [
|
||||||
{
|
{
|
||||||
"href": "http://openstack.example.com/v3/servers/60874907-c72b-4a01-805d-54c992510e47",
|
"href": "http://openstack.example.com/v2/openstack/servers/60874907-c72b-4a01-805d-54c992510e47",
|
||||||
"rel": "self"
|
"rel": "self"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"href": "http://openstack.example.com/servers/60874907-c72b-4a01-805d-54c992510e47",
|
"href": "http://openstack.example.com/openstack/servers/60874907-c72b-4a01-805d-54c992510e47",
|
||||||
"rel": "bookmark"
|
"rel": "bookmark"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
{
|
{
|
||||||
"servers": [
|
"servers": [
|
||||||
{
|
{
|
||||||
|
"accessIPv4": "1.2.3.4",
|
||||||
|
"accessIPv6": "80fe::",
|
||||||
"addresses": {
|
"addresses": {
|
||||||
"private": [
|
"private": [
|
||||||
{
|
{
|
||||||
@ -16,7 +18,7 @@
|
|||||||
"id": "1",
|
"id": "1",
|
||||||
"links": [
|
"links": [
|
||||||
{
|
{
|
||||||
"href": "http://openstack.example.com/flavors/1",
|
"href": "http://openstack.example.com/openstack/flavors/1",
|
||||||
"rel": "bookmark"
|
"rel": "bookmark"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -27,7 +29,7 @@
|
|||||||
"id": "70a599e0-31e7-49b7-b260-868f441e862b",
|
"id": "70a599e0-31e7-49b7-b260-868f441e862b",
|
||||||
"links": [
|
"links": [
|
||||||
{
|
{
|
||||||
"href": "http://openstack.example.com/images/70a599e0-31e7-49b7-b260-868f441e862b",
|
"href": "http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b",
|
||||||
"rel": "bookmark"
|
"rel": "bookmark"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -35,11 +37,11 @@
|
|||||||
"key_name": null,
|
"key_name": null,
|
||||||
"links": [
|
"links": [
|
||||||
{
|
{
|
||||||
"href": "http://openstack.example.com/v3/servers/d182742c-6f20-479c-8e32-f79f9c9df6e3",
|
"href": "http://openstack.example.com/v2/openstack/servers/d182742c-6f20-479c-8e32-f79f9c9df6e3",
|
||||||
"rel": "self"
|
"rel": "self"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"href": "http://openstack.example.com/servers/d182742c-6f20-479c-8e32-f79f9c9df6e3",
|
"href": "http://openstack.example.com/openstack/servers/d182742c-6f20-479c-8e32-f79f9c9df6e3",
|
||||||
"rel": "bookmark"
|
"rel": "bookmark"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"addSecurityGroup" : {
|
|
||||||
"name" : "%(group_name)s"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"security_group": {
|
|
||||||
"name": "%(group_name)s",
|
|
||||||
"description": "description"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"removeSecurityGroup" : {
|
|
||||||
"name" : "%(group_name)s"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"security_group": {
|
|
||||||
"description": "description",
|
|
||||||
"id": 2,
|
|
||||||
"name": "%(group_name)s",
|
|
||||||
"rules": [],
|
|
||||||
"tenant_id": "openstack"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"security_group": {
|
|
||||||
"description": "default",
|
|
||||||
"id": 1,
|
|
||||||
"name": "default",
|
|
||||||
"rules": [],
|
|
||||||
"tenant_id": "openstack"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"security_groups": [
|
|
||||||
{
|
|
||||||
"description": "default",
|
|
||||||
"id": 1,
|
|
||||||
"name": "default",
|
|
||||||
"rules": [],
|
|
||||||
"tenant_id": "openstack"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
{
|
|
||||||
"server" : {
|
|
||||||
"name" : "new-server-test",
|
|
||||||
"imageRef" : "%(host)s/openstack/images/%(image_id)s",
|
|
||||||
"flavorRef" : "%(host)s/openstack/flavors/1",
|
|
||||||
"metadata" : {
|
|
||||||
"My Server Name" : "Apache1"
|
|
||||||
},
|
|
||||||
"personality" : [
|
|
||||||
{
|
|
||||||
"path" : "/etc/banner.txt",
|
|
||||||
"contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
{
|
|
||||||
"server": {
|
|
||||||
"adminPass": "%(password)s",
|
|
||||||
"id": "%(id)s",
|
|
||||||
"links": [
|
|
||||||
{
|
|
||||||
"href": "%(host)s/v2/openstack/servers/%(uuid)s",
|
|
||||||
"rel": "self"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"href": "%(host)s/openstack/servers/%(uuid)s",
|
|
||||||
"rel": "bookmark"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"security_groups": [
|
|
||||||
{
|
|
||||||
"name": "default"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"security_groups": [
|
|
||||||
{
|
|
||||||
"description": "default",
|
|
||||||
"id": 1,
|
|
||||||
"name": "default",
|
|
||||||
"rules": [],
|
|
||||||
"tenant_id": "openstack"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
@ -208,76 +208,6 @@ class LimitsSampleJsonTest(ApiSampleTestBaseV2):
|
|||||||
self._verify_response('limit-get-resp', subs, response, 200)
|
self._verify_response('limit-get-resp', subs, response, 200)
|
||||||
|
|
||||||
|
|
||||||
class SecurityGroupsSampleJsonTest(ServersSampleBase):
|
|
||||||
extension_name = "nova.api.openstack.compute.contrib" + \
|
|
||||||
".security_groups.Security_groups"
|
|
||||||
|
|
||||||
def _get_create_subs(self):
|
|
||||||
return {
|
|
||||||
'group_name': 'test',
|
|
||||||
"description": "description",
|
|
||||||
}
|
|
||||||
|
|
||||||
def _create_security_group(self):
|
|
||||||
subs = self._get_create_subs()
|
|
||||||
return self._do_post('os-security-groups',
|
|
||||||
'security-group-post-req', subs)
|
|
||||||
|
|
||||||
def _add_group(self, uuid):
|
|
||||||
subs = {
|
|
||||||
'group_name': 'test'
|
|
||||||
}
|
|
||||||
return self._do_post('servers/%s/action' % uuid,
|
|
||||||
'security-group-add-post-req', subs)
|
|
||||||
|
|
||||||
def test_security_group_create(self):
|
|
||||||
response = self._create_security_group()
|
|
||||||
subs = self._get_create_subs()
|
|
||||||
self._verify_response('security-groups-create-resp', subs,
|
|
||||||
response, 200)
|
|
||||||
|
|
||||||
def test_security_groups_list(self):
|
|
||||||
# Get api sample of security groups get list request.
|
|
||||||
response = self._do_get('os-security-groups')
|
|
||||||
subs = self._get_regexes()
|
|
||||||
self._verify_response('security-groups-list-get-resp',
|
|
||||||
subs, response, 200)
|
|
||||||
|
|
||||||
def test_security_groups_get(self):
|
|
||||||
# Get api sample of security groups get request.
|
|
||||||
security_group_id = '1'
|
|
||||||
response = self._do_get('os-security-groups/%s' % security_group_id)
|
|
||||||
subs = self._get_regexes()
|
|
||||||
self._verify_response('security-groups-get-resp', subs, response, 200)
|
|
||||||
|
|
||||||
def test_security_groups_list_server(self):
|
|
||||||
# Get api sample of security groups for a specific server.
|
|
||||||
uuid = self._post_server(use_common_server_api_samples=False)
|
|
||||||
response = self._do_get('servers/%s/os-security-groups' % uuid)
|
|
||||||
subs = self._get_regexes()
|
|
||||||
self._verify_response('server-security-groups-list-resp',
|
|
||||||
subs, response, 200)
|
|
||||||
|
|
||||||
def test_security_groups_add(self):
|
|
||||||
self._create_security_group()
|
|
||||||
uuid = self._post_server(use_common_server_api_samples=False)
|
|
||||||
response = self._add_group(uuid)
|
|
||||||
self.assertEqual(response.status_code, 202)
|
|
||||||
self.assertEqual(response.content, '')
|
|
||||||
|
|
||||||
def test_security_groups_remove(self):
|
|
||||||
self._create_security_group()
|
|
||||||
uuid = self._post_server(use_common_server_api_samples=False)
|
|
||||||
self._add_group(uuid)
|
|
||||||
subs = {
|
|
||||||
'group_name': 'test'
|
|
||||||
}
|
|
||||||
response = self._do_post('servers/%s/action' % uuid,
|
|
||||||
'security-group-remove-post-req', subs)
|
|
||||||
self.assertEqual(response.status_code, 202)
|
|
||||||
self.assertEqual(response.content, '')
|
|
||||||
|
|
||||||
|
|
||||||
class SchedulerHintsJsonTest(ApiSampleTestBaseV2):
|
class SchedulerHintsJsonTest(ApiSampleTestBaseV2):
|
||||||
extension_name = ("nova.api.openstack.compute.contrib.scheduler_hints."
|
extension_name = ("nova.api.openstack.compute.contrib.scheduler_hints."
|
||||||
"Scheduler_hints")
|
"Scheduler_hints")
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
{
|
{
|
||||||
"server": {
|
"server": {
|
||||||
|
"accessIPv4": "%(access_ip_v4)s",
|
||||||
|
"accessIPv6": "%(access_ip_v6)s",
|
||||||
"addresses": {
|
"addresses": {
|
||||||
"private": [
|
"private": [
|
||||||
{
|
{
|
||||||
@ -15,7 +17,7 @@
|
|||||||
"id": "1",
|
"id": "1",
|
||||||
"links": [
|
"links": [
|
||||||
{
|
{
|
||||||
"href": "%(host)s/flavors/1",
|
"href": "%(host)s/openstack/flavors/1",
|
||||||
"rel": "bookmark"
|
"rel": "bookmark"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -26,18 +28,18 @@
|
|||||||
"id": "%(uuid)s",
|
"id": "%(uuid)s",
|
||||||
"links": [
|
"links": [
|
||||||
{
|
{
|
||||||
"href": "%(host)s/images/%(uuid)s",
|
"href": "%(host)s/openstack/images/%(uuid)s",
|
||||||
"rel": "bookmark"
|
"rel": "bookmark"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"links": [
|
"links": [
|
||||||
{
|
{
|
||||||
"href": "%(host)s/v3/servers/%(uuid)s",
|
"href": "%(host)s/v2/openstack/servers/%(uuid)s",
|
||||||
"rel": "self"
|
"rel": "self"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"href": "%(host)s/servers/%(uuid)s",
|
"href": "%(host)s/openstack/servers/%(uuid)s",
|
||||||
"rel": "bookmark"
|
"rel": "bookmark"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
{
|
{
|
||||||
"server" : {
|
"server" : {
|
||||||
|
"accessIPv4": "%(access_ip_v4)s",
|
||||||
|
"accessIPv6": "%(access_ip_v6)s",
|
||||||
"name" : "new-server-test",
|
"name" : "new-server-test",
|
||||||
"imageRef" : "%(glance_host)s/openstack/images/%(image_id)s",
|
"imageRef" : "%(glance_host)s/openstack/images/%(image_id)s",
|
||||||
"flavorRef" : "%(host)s/openstack/flavors/1",
|
"flavorRef" : "%(host)s/openstack/flavors/1",
|
||||||
|
@ -4,11 +4,11 @@
|
|||||||
"id": "%(id)s",
|
"id": "%(id)s",
|
||||||
"links": [
|
"links": [
|
||||||
{
|
{
|
||||||
"href": "http://openstack.example.com/v3/servers/%(uuid)s",
|
"href": "http://openstack.example.com/v2/openstack/servers/%(uuid)s",
|
||||||
"rel": "self"
|
"rel": "self"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"href": "http://openstack.example.com/servers/%(uuid)s",
|
"href": "http://openstack.example.com/openstack/servers/%(uuid)s",
|
||||||
"rel": "bookmark"
|
"rel": "bookmark"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
{
|
{
|
||||||
"updated": "%(isotime)s",
|
"updated": "%(isotime)s",
|
||||||
"created": "%(isotime)s",
|
"created": "%(isotime)s",
|
||||||
|
"accessIPv4": "%(access_ip_v4)s",
|
||||||
|
"accessIPv6": "%(access_ip_v6)s",
|
||||||
"addresses": {
|
"addresses": {
|
||||||
"private": [
|
"private": [
|
||||||
{
|
{
|
||||||
@ -17,7 +19,7 @@
|
|||||||
"id": "1",
|
"id": "1",
|
||||||
"links": [
|
"links": [
|
||||||
{
|
{
|
||||||
"href": "%(host)s/flavors/1",
|
"href": "%(host)s/openstack/flavors/1",
|
||||||
"rel": "bookmark"
|
"rel": "bookmark"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -28,18 +30,18 @@
|
|||||||
"id": "%(uuid)s",
|
"id": "%(uuid)s",
|
||||||
"links": [
|
"links": [
|
||||||
{
|
{
|
||||||
"href": "%(host)s/images/%(uuid)s",
|
"href": "%(host)s/openstack/images/%(uuid)s",
|
||||||
"rel": "bookmark"
|
"rel": "bookmark"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"links": [
|
"links": [
|
||||||
{
|
{
|
||||||
"href": "%(host)s/v3/servers/%(id)s",
|
"href": "%(host)s/v2/openstack/servers/%(id)s",
|
||||||
"rel": "self"
|
"rel": "self"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"href": "%(host)s/servers/%(id)s",
|
"href": "%(host)s/openstack/servers/%(id)s",
|
||||||
"rel": "bookmark"
|
"rel": "bookmark"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -13,9 +13,15 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from oslo_config import cfg
|
||||||
|
|
||||||
from nova.network.security_group import neutron_driver
|
from nova.network.security_group import neutron_driver
|
||||||
from nova.tests.functional.v3 import test_servers
|
from nova.tests.functional.v3 import test_servers
|
||||||
|
|
||||||
|
CONF = cfg.CONF
|
||||||
|
CONF.import_opt('osapi_compute_extension',
|
||||||
|
'nova.api.openstack.compute.extensions')
|
||||||
|
|
||||||
|
|
||||||
def fake_get(*args, **kwargs):
|
def fake_get(*args, **kwargs):
|
||||||
nova_group = {}
|
nova_group = {}
|
||||||
@ -59,6 +65,23 @@ def fake_create_security_group(self, context, name, description):
|
|||||||
|
|
||||||
class SecurityGroupsJsonTest(test_servers.ServersSampleBase):
|
class SecurityGroupsJsonTest(test_servers.ServersSampleBase):
|
||||||
extension_name = 'os-security-groups'
|
extension_name = 'os-security-groups'
|
||||||
|
extra_extensions_to_load = ["os-access-ips"]
|
||||||
|
_api_version = 'v2'
|
||||||
|
|
||||||
|
def _get_flags(self):
|
||||||
|
f = super(SecurityGroupsJsonTest, self)._get_flags()
|
||||||
|
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||||
|
f['osapi_compute_extension'].append(
|
||||||
|
'nova.api.openstack.compute.contrib.security_groups.'
|
||||||
|
'Security_groups')
|
||||||
|
f['osapi_compute_extension'].append(
|
||||||
|
'nova.api.openstack.compute.contrib.keypairs.Keypairs')
|
||||||
|
f['osapi_compute_extension'].append(
|
||||||
|
'nova.api.openstack.compute.contrib.extended_ips.Extended_ips')
|
||||||
|
f['osapi_compute_extension'].append(
|
||||||
|
'nova.api.openstack.compute.contrib.extended_ips_mac.'
|
||||||
|
'Extended_ips_mac')
|
||||||
|
return f
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.flags(security_group_api=('neutron'))
|
self.flags(security_group_api=('neutron'))
|
||||||
@ -91,6 +114,8 @@ class SecurityGroupsJsonTest(test_servers.ServersSampleBase):
|
|||||||
response = self._do_get('servers/%s' % uuid)
|
response = self._do_get('servers/%s' % uuid)
|
||||||
subs = self._get_regexes()
|
subs = self._get_regexes()
|
||||||
subs['hostid'] = '[a-f0-9]+'
|
subs['hostid'] = '[a-f0-9]+'
|
||||||
|
subs['access_ip_v4'] = '1.2.3.4'
|
||||||
|
subs['access_ip_v6'] = '80fe::'
|
||||||
self._verify_response('server-get-resp', subs, response, 200)
|
self._verify_response('server-get-resp', subs, response, 200)
|
||||||
|
|
||||||
def test_server_detail(self):
|
def test_server_detail(self):
|
||||||
@ -98,6 +123,8 @@ class SecurityGroupsJsonTest(test_servers.ServersSampleBase):
|
|||||||
response = self._do_get('servers/detail')
|
response = self._do_get('servers/detail')
|
||||||
subs = self._get_regexes()
|
subs = self._get_regexes()
|
||||||
subs['hostid'] = '[a-f0-9]+'
|
subs['hostid'] = '[a-f0-9]+'
|
||||||
|
subs['access_ip_v4'] = '1.2.3.4'
|
||||||
|
subs['access_ip_v6'] = '80fe::'
|
||||||
self._verify_response('servers-detail-resp', subs, response, 200)
|
self._verify_response('servers-detail-resp', subs, response, 200)
|
||||||
|
|
||||||
def _get_create_subs(self):
|
def _get_create_subs(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user