Move remaining schema files into v2_1 directory

After removing v3 schemas, we have only 1 set of schemas for v2 (/v2.1)
APIs but those end up in scattered structure.

Schema files needs to be re arranged into a clean structure. Any
resource schema should be defined in single file for better readability.

This patch move remaining schema files into v2_1 directory and rename
some schemas according to their API.

Partially implements blueprint rearrange-nova-response-schemas

Change-Id: If07f0a929c7085090bcefd4d2d565b896bf438f3
This commit is contained in:
ghanshyam 2015-04-22 17:23:08 +09:00
parent f27769e302
commit 59869d02d0
19 changed files with 31 additions and 27 deletions

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest.api_schema.response.compute import parameter_types
from tempest.api_schema.response.compute.v2_1 import parameter_types
list_flavors = {
'status_code': [200],

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
flavor_extra_specs = {
set_get_flavor_extra_specs = {
'status_code': [200],
'response_body': {
'type': 'object',
@ -28,7 +28,7 @@ flavor_extra_specs = {
}
}
flavor_extra_specs_key = {
set_get_flavor_extra_specs_key = {
'status_code': [200],
'response_body': {
'type': 'object',

View File

@ -48,7 +48,7 @@ list_floating_ips = {
}
}
floating_ip = {
create_get_floating_ip = {
'status_code': [200],
'response_body': {
'type': 'object',
@ -59,7 +59,7 @@ floating_ip = {
}
}
floating_ip_pools = {
list_floating_ip_pools = {
'status_code': [200],
'response_body': {
'type': 'object',

View File

@ -14,7 +14,7 @@
import copy
from tempest.api_schema.response.compute import parameter_types
from tempest.api_schema.response.compute.v2_1 import parameter_types
image_links = copy.deepcopy(parameter_types.links)
image_links['items']['properties'].update({'type': {'type': 'string'}})

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest.api_schema.response.compute import parameter_types
from tempest.api_schema.response.compute.v2_1 import parameter_types
interface_common_info = {
'type': 'object',

View File

@ -14,7 +14,7 @@
import copy
from tempest.api_schema.response.compute import parameter_types
from tempest.api_schema.response.compute.v2_1 import parameter_types
create_server = {
'status_code': [202],

View File

@ -66,7 +66,7 @@ _tenant_usage_get['required'] = ['server_usages', 'start', 'stop', 'tenant_id',
'total_hours', 'total_local_gb_usage',
'total_memory_mb_usage', 'total_vcpus_usage']
list_tenant = {
list_tenant_usage = {
'status_code': [200],
'response_body': {
'type': 'object',
@ -80,7 +80,7 @@ list_tenant = {
}
}
get_tenant = {
get_tenant_usage = {
'status_code': [200],
'response_body': {
'type': 'object',

View File

@ -16,7 +16,8 @@ import json
from six.moves.urllib import parse as urllib
from tempest.api_schema.response.compute import baremetal_nodes as schema
from tempest.api_schema.response.compute.v2_1 import baremetal_nodes \
as schema
from tempest.common import service_client

View File

@ -17,10 +17,11 @@ import json
from six.moves.urllib import parse as urllib
from tempest.api_schema.response.compute import flavors_access as schema_access
from tempest.api_schema.response.compute import flavors_extra_specs \
as schema_extra_specs
from tempest.api_schema.response.compute.v2_1 import flavors as schema
from tempest.api_schema.response.compute.v2_1 import flavors_access \
as schema_access
from tempest.api_schema.response.compute.v2_1 import flavors_extra_specs \
as schema_extra_specs
from tempest.common import service_client
@ -103,7 +104,7 @@ class FlavorsClientJSON(service_client.ServiceClient):
resp, body = self.post('flavors/%s/os-extra_specs' % flavor_id,
post_body)
body = json.loads(body)
self.validate_response(schema_extra_specs.flavor_extra_specs,
self.validate_response(schema_extra_specs.set_get_flavor_extra_specs,
resp, body)
return service_client.ResponseBody(resp, body['extra_specs'])
@ -111,7 +112,7 @@ class FlavorsClientJSON(service_client.ServiceClient):
"""Gets extra Specs details of the mentioned flavor."""
resp, body = self.get('flavors/%s/os-extra_specs' % flavor_id)
body = json.loads(body)
self.validate_response(schema_extra_specs.flavor_extra_specs,
self.validate_response(schema_extra_specs.set_get_flavor_extra_specs,
resp, body)
return service_client.ResponseBody(resp, body['extra_specs'])
@ -120,7 +121,8 @@ class FlavorsClientJSON(service_client.ServiceClient):
resp, body = self.get('flavors/%s/os-extra_specs/%s' % (str(flavor_id),
key))
body = json.loads(body)
self.validate_response(schema_extra_specs.flavor_extra_specs_key,
self.validate_response(
schema_extra_specs.set_get_flavor_extra_specs_key,
resp, body)
return service_client.ResponseBody(resp, body)
@ -129,7 +131,8 @@ class FlavorsClientJSON(service_client.ServiceClient):
resp, body = self.put('flavors/%s/os-extra_specs/%s' %
(flavor_id, key), json.dumps(kwargs))
body = json.loads(body)
self.validate_response(schema_extra_specs.flavor_extra_specs_key,
self.validate_response(
schema_extra_specs.set_get_flavor_extra_specs_key,
resp, body)
return service_client.ResponseBody(resp, body)

View File

@ -40,7 +40,7 @@ class FloatingIPsClientJSON(service_client.ServiceClient):
url = "os-floating-ips/%s" % str(floating_ip_id)
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.floating_ip, resp, body)
self.validate_response(schema.create_get_floating_ip, resp, body)
return service_client.ResponseBody(resp, body['floating_ip'])
def create_floating_ip(self, pool_name=None):
@ -50,7 +50,7 @@ class FloatingIPsClientJSON(service_client.ServiceClient):
post_body = json.dumps(post_body)
resp, body = self.post(url, post_body)
body = json.loads(body)
self.validate_response(schema.floating_ip, resp, body)
self.validate_response(schema.create_get_floating_ip, resp, body)
return service_client.ResponseBody(resp, body['floating_ip'])
def delete_floating_ip(self, floating_ip_id):
@ -108,7 +108,7 @@ class FloatingIPsClientJSON(service_client.ServiceClient):
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.floating_ip_pools, resp, body)
self.validate_response(schema.list_floating_ip_pools, resp, body)
return service_client.ResponseBodyList(resp, body['floating_ip_pools'])
def create_floating_ips_bulk(self, ip_range, pool, interface):

View File

@ -16,7 +16,7 @@ import json
from six.moves.urllib import parse as urllib
from tempest.api_schema.response.compute import migrations as schema
from tempest.api_schema.response.compute.v2_1 import migrations as schema
from tempest.common import service_client

View File

@ -18,7 +18,7 @@ import json
from six.moves.urllib import parse as urllib
from tempest.api_schema.response.compute import services as schema
from tempest.api_schema.response.compute.v2_1 import services as schema
from tempest.common import service_client

View File

@ -30,7 +30,7 @@ class TenantUsagesClientJSON(service_client.ServiceClient):
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_tenant, resp, body)
self.validate_response(schema.list_tenant_usage, resp, body)
return service_client.ResponseBodyList(resp, body['tenant_usages'][0])
def get_tenant_usage(self, tenant_id, params=None):
@ -40,5 +40,5 @@ class TenantUsagesClientJSON(service_client.ServiceClient):
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.get_tenant, resp, body)
self.validate_response(schema.get_tenant_usage, resp, body)
return service_client.ResponseBodyList(resp, body['tenant_usage'])