Merge "Verify "list interfaces" Nova v2/v3 API response attributes"
This commit is contained in:
@@ -12,6 +12,36 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from tempest.api_schema.compute import parameter_types
|
||||
|
||||
delete_interface = {
|
||||
'status_code': [202]
|
||||
}
|
||||
|
||||
interface_common_info = {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'port_state': {'type': 'string'},
|
||||
'fixed_ips': {
|
||||
'type': 'array',
|
||||
'items': {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'subnet_id': {
|
||||
'type': 'string',
|
||||
'format': 'uuid'
|
||||
},
|
||||
'ip_address': {
|
||||
'type': 'string',
|
||||
'format': 'ipv4'
|
||||
}
|
||||
},
|
||||
'required': ['subnet_id', 'ip_address']
|
||||
}
|
||||
},
|
||||
'port_id': {'type': 'string', 'format': 'uuid'},
|
||||
'net_id': {'type': 'string', 'format': 'uuid'},
|
||||
'mac_addr': parameter_types.mac_address
|
||||
},
|
||||
'required': ['port_state', 'fixed_ips', 'port_id', 'net_id', 'mac_addr']
|
||||
}
|
||||
|
||||
29
tempest/api_schema/compute/v2/interfaces.py
Normal file
29
tempest/api_schema/compute/v2/interfaces.py
Normal file
@@ -0,0 +1,29 @@
|
||||
# Copyright 2014 NEC Corporation. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from tempest.api_schema.compute import interfaces as common_schema
|
||||
|
||||
list_interfaces = {
|
||||
'status_code': [200],
|
||||
'response_body': {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'interfaceAttachments': {
|
||||
'type': 'array',
|
||||
'items': common_schema.interface_common_info
|
||||
}
|
||||
},
|
||||
'required': ['interfaceAttachments']
|
||||
}
|
||||
}
|
||||
29
tempest/api_schema/compute/v3/interfaces.py
Normal file
29
tempest/api_schema/compute/v3/interfaces.py
Normal file
@@ -0,0 +1,29 @@
|
||||
# Copyright 2014 NEC Corporation. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from tempest.api_schema.compute import interfaces as common_schema
|
||||
|
||||
list_interfaces = {
|
||||
'status_code': [200],
|
||||
'response_body': {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'interface_attachments': {
|
||||
'type': 'array',
|
||||
'items': common_schema.interface_common_info
|
||||
}
|
||||
},
|
||||
'required': ['interface_attachments']
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import json
|
||||
import time
|
||||
|
||||
from tempest.api_schema.compute import interfaces as common_schema
|
||||
from tempest.api_schema.compute.v2 import interfaces as schema
|
||||
from tempest.common import rest_client
|
||||
from tempest import config
|
||||
from tempest import exceptions
|
||||
@@ -33,6 +34,7 @@ class InterfacesClientJSON(rest_client.RestClient):
|
||||
def list_interfaces(self, server):
|
||||
resp, body = self.get('servers/%s/os-interface' % server)
|
||||
body = json.loads(body)
|
||||
self.validate_response(schema.list_interfaces, resp, body)
|
||||
return resp, body['interfaceAttachments']
|
||||
|
||||
def create_interface(self, server, port_id=None, network_id=None,
|
||||
|
||||
@@ -17,6 +17,7 @@ import json
|
||||
import time
|
||||
|
||||
from tempest.api_schema.compute import interfaces as common_schema
|
||||
from tempest.api_schema.compute.v3 import interfaces as schema
|
||||
from tempest.common import rest_client
|
||||
from tempest import config
|
||||
from tempest import exceptions
|
||||
@@ -33,6 +34,7 @@ class InterfacesV3ClientJSON(rest_client.RestClient):
|
||||
def list_interfaces(self, server):
|
||||
resp, body = self.get('servers/%s/os-attach-interfaces' % server)
|
||||
body = json.loads(body)
|
||||
self.validate_response(schema.list_interfaces, resp, body)
|
||||
return resp, body['interface_attachments']
|
||||
|
||||
def create_interface(self, server, port_id=None, network_id=None,
|
||||
|
||||
Reference in New Issue
Block a user