Merge "Verify "update a server" API response attributes"
This commit is contained in:
commit
38adb4b152
@ -31,3 +31,37 @@ mac_address = {
|
||||
'type': 'string',
|
||||
'pattern': '(?:[a-f0-9]{2}:){5}[a-f0-9]{2}'
|
||||
}
|
||||
|
||||
access_ip_v4 = {
|
||||
'type': 'string',
|
||||
'anyOf': [{'format': 'ipv4'}, {'enum': ['']}]
|
||||
}
|
||||
|
||||
access_ip_v6 = {
|
||||
'type': 'string',
|
||||
'anyOf': [{'format': 'ipv6'}, {'enum': ['']}]
|
||||
}
|
||||
|
||||
addresses = {
|
||||
'type': 'object',
|
||||
'patternProperties': {
|
||||
# NOTE: Here is for 'private' or something.
|
||||
'^[a-zA-Z0-9-_.]+$': {
|
||||
'type': 'array',
|
||||
'items': {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'version': {'type': 'integer'},
|
||||
'addr': {
|
||||
'type': 'string',
|
||||
'anyOf': [
|
||||
{'format': 'ipv4'},
|
||||
{'format': 'ipv6'}
|
||||
]
|
||||
}
|
||||
},
|
||||
'required': ['version', 'addr']
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,8 @@
|
||||
|
||||
import copy
|
||||
|
||||
from tempest.api_schema.compute import parameter_types
|
||||
|
||||
get_password = {
|
||||
'status_code': [200],
|
||||
'response_body': {
|
||||
@ -46,6 +48,50 @@ get_vnc_console = {
|
||||
}
|
||||
}
|
||||
|
||||
base_update_server = {
|
||||
'status_code': [200],
|
||||
'response_body': {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'server': {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'id': {'type': ['integer', 'string']},
|
||||
'name': {'type': 'string'},
|
||||
'status': {'type': 'string'},
|
||||
'image': {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'id': {'type': ['integer', 'string']},
|
||||
'links': parameter_types.links
|
||||
},
|
||||
'required': ['id', 'links']
|
||||
},
|
||||
'flavor': {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'id': {'type': ['integer', 'string']},
|
||||
'links': parameter_types.links
|
||||
},
|
||||
'required': ['id', 'links']
|
||||
},
|
||||
'user_id': {'type': 'string'},
|
||||
'tenant_id': {'type': 'string'},
|
||||
'created': {'type': 'string'},
|
||||
'updated': {'type': 'string'},
|
||||
'progress': {'type': 'integer'},
|
||||
'metadata': {'type': 'object'},
|
||||
'links': parameter_types.links,
|
||||
'addresses': parameter_types.addresses,
|
||||
},
|
||||
'required': ['id', 'name', 'status', 'image', 'flavor',
|
||||
'user_id', 'tenant_id', 'created', 'updated',
|
||||
'progress', 'metadata', 'links', 'addresses']
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delete_server = {
|
||||
'status_code': [204],
|
||||
}
|
||||
|
@ -12,7 +12,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import copy
|
||||
|
||||
from tempest.api_schema.compute import parameter_types
|
||||
from tempest.api_schema.compute import servers
|
||||
|
||||
create_server = {
|
||||
'status_code': [202],
|
||||
@ -43,6 +46,20 @@ create_server = {
|
||||
}
|
||||
}
|
||||
|
||||
update_server = copy.deepcopy(servers.base_update_server)
|
||||
update_server['response_body']['properties']['server']['properties'].update({
|
||||
'hostId': {'type': 'string'},
|
||||
'OS-DCF:diskConfig': {'type': 'string'},
|
||||
'accessIPv4': parameter_types.access_ip_v4,
|
||||
'accessIPv6': parameter_types.access_ip_v6
|
||||
})
|
||||
update_server['response_body']['properties']['server']['required'].append(
|
||||
# NOTE: OS-DCF:diskConfig and accessIPv4/v6 are API
|
||||
# extensions, and some environments return a response
|
||||
# without these attributes. So they are not 'required'.
|
||||
'hostId'
|
||||
)
|
||||
|
||||
list_virtual_interfaces = {
|
||||
'status_code': [200],
|
||||
'response_body': {
|
||||
|
@ -13,6 +13,7 @@
|
||||
# under the License.
|
||||
|
||||
import copy
|
||||
|
||||
from tempest.api_schema.compute import parameter_types
|
||||
from tempest.api_schema.compute import servers
|
||||
|
||||
@ -31,8 +32,8 @@ create_server = {
|
||||
'os-security-groups:security_groups': {'type': 'array'},
|
||||
'links': parameter_types.links,
|
||||
'admin_password': {'type': 'string'},
|
||||
'os-access-ips:access_ip_v4': {'type': 'string'},
|
||||
'os-access-ips:access_ip_v6': {'type': 'string'}
|
||||
'os-access-ips:access_ip_v4': parameter_types.access_ip_v4,
|
||||
'os-access-ips:access_ip_v6': parameter_types.access_ip_v6
|
||||
},
|
||||
# NOTE: os-access-ips:access_ip_v4/v6 are API extension,
|
||||
# and some environments return a response without these
|
||||
@ -45,6 +46,31 @@ create_server = {
|
||||
}
|
||||
}
|
||||
|
||||
addresses_v3 = copy.deepcopy(parameter_types.addresses)
|
||||
addresses_v3['patternProperties']['^[a-zA-Z0-9-_.]+$']['items'][
|
||||
'properties'].update({
|
||||
'type': {'type': 'string'},
|
||||
'mac_addr': {'type': 'string'}
|
||||
})
|
||||
addresses_v3['patternProperties']['^[a-zA-Z0-9-_.]+$']['items'][
|
||||
'required'].extend(
|
||||
['type', 'mac_addr']
|
||||
)
|
||||
|
||||
update_server = copy.deepcopy(servers.base_update_server)
|
||||
update_server['response_body']['properties']['server']['properties'].update({
|
||||
'addresses': addresses_v3,
|
||||
'host_id': {'type': 'string'},
|
||||
'os-access-ips:access_ip_v4': parameter_types.access_ip_v4,
|
||||
'os-access-ips:access_ip_v6': parameter_types.access_ip_v6
|
||||
})
|
||||
update_server['response_body']['properties']['server']['required'].append(
|
||||
# NOTE: os-access-ips:access_ip_v4/v6 are API extension,
|
||||
# and some environments return a response without these
|
||||
# attributes. So they are not 'required'.
|
||||
'host_id'
|
||||
)
|
||||
|
||||
attach_detach_volume = {
|
||||
'status_code': [202]
|
||||
}
|
||||
|
@ -126,6 +126,7 @@ class ServersClientJSON(rest_client.RestClient):
|
||||
post_body = json.dumps({'server': post_body})
|
||||
resp, body = self.put("servers/%s" % str(server_id), post_body)
|
||||
body = json.loads(body)
|
||||
self.validate_response(schema.update_server, resp, body)
|
||||
return resp, body['server']
|
||||
|
||||
def get_server(self, server_id):
|
||||
|
@ -126,6 +126,7 @@ class ServersV3ClientJSON(rest_client.RestClient):
|
||||
post_body = json.dumps({'server': post_body})
|
||||
resp, body = self.put("servers/%s" % str(server_id), post_body)
|
||||
body = json.loads(body)
|
||||
self.validate_response(schema.update_server, resp, body)
|
||||
return resp, body['server']
|
||||
|
||||
def get_server(self, server_id):
|
||||
|
Loading…
x
Reference in New Issue
Block a user