Files
deb-tempest/tempest/services/compute/json/tenant_networks_client.py
ghanshyam 0b84c3cf0e Return complete response from tenant_networks_client
Currently compute tenant_networks_client returns Response by
removing top key from Response.
For example-
 return service_client.ResponseBody(resp, body['network'])

As service clients are in direction to move to Tempest-lib, all
service clients should return Response without any truncation.
One good example is Resource pagination links which are lost with current
way of return value. Resource pagination links are present in parallel
(not inside) to top key of Response.

This patch makes compute tenant_networks_client to return
complete Response body.

Change-Id: Ie0f6e709cbb3a215752344cb39f2f7a6f5a7a91b
Implements: blueprint method-return-value-and-move-service-clients-to-lib
2015-08-24 17:52:36 +09:00

34 lines
1.3 KiB
Python

# Copyright 2015 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 oslo_serialization import jsonutils as json
from tempest.api_schema.response.compute.v2_1 import tenant_networks as schema
from tempest.common import service_client
class TenantNetworksClient(service_client.ServiceClient):
def list_tenant_networks(self):
resp, body = self.get("os-tenant-networks")
body = json.loads(body)
self.validate_response(schema.list_tenant_networks, resp, body)
return service_client.ResponseBody(resp, body)
def show_tenant_network(self, network_id):
resp, body = self.get("os-tenant-networks/%s" % network_id)
body = json.loads(body)
self.validate_response(schema.get_tenant_network, resp, body)
return service_client.ResponseBody(resp, body)