Neutron service client should not trim API response
Based on pagination, list APIs can return resources links in response.
In neutron service client, deserialize_list() function removes resources link
from response body of list APIs.
As neutron service client will be moved to tempest-lib, it should return
response as it is received from neutron. It's up to tests cases to fetch/trim
the required information.
This patch return all list API's response without any alteration.
Change-Id: Ifcfc9ec34cb0139549e975169fb6eba32e8e920f
diff --git a/tempest/services/network/json/network_client.py b/tempest/services/network/json/network_client.py
index cc9399e..f1e9824 100644
--- a/tempest/services/network/json/network_client.py
+++ b/tempest/services/network/json/network_client.py
@@ -79,9 +79,9 @@
if filters:
uri += '?' + urllib.urlencode(filters, doseq=1)
resp, body = self.get(uri)
- result = {plural_name: self.deserialize_list(body)}
+ body = self.deserialize_list(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, result)
+ return service_client.ResponseBody(resp, body)
return _list
@@ -268,7 +268,7 @@
body = self.serialize_list(post_data, "networks", "network")
uri = self.get_uri("networks")
resp, body = self.post(uri, body)
- body = {'networks': self.deserialize_list(body)}
+ body = self.deserialize_list(body)
self.expected_success(201, resp.status)
return service_client.ResponseBody(resp, body)
@@ -277,7 +277,7 @@
body = self.serialize_list(post_data, 'subnets', 'subnet')
uri = self.get_uri('subnets')
resp, body = self.post(uri, body)
- body = {'subnets': self.deserialize_list(body)}
+ body = self.deserialize_list(body)
self.expected_success(201, resp.status)
return service_client.ResponseBody(resp, body)
@@ -286,7 +286,7 @@
body = self.serialize_list(post_data, 'ports', 'port')
uri = self.get_uri('ports')
resp, body = self.post(uri, body)
- body = {'ports': self.deserialize_list(body)}
+ body = self.deserialize_list(body)
self.expected_success(201, resp.status)
return service_client.ResponseBody(resp, body)
@@ -351,14 +351,7 @@
return json.loads(body)
def deserialize_list(self, body):
- res = json.loads(body)
- # expecting response in form
- # {'resources': [ res1, res2] } => when pagination disabled
- # {'resources': [..], 'resources_links': {}} => if pagination enabled
- for k in res.keys():
- if k.endswith("_links"):
- continue
- return res[k]
+ return json.loads(body)
def serialize(self, data):
return json.dumps(data)