diff --git a/blazar_tempest_plugin/services/reservation/reservation_client.py b/blazar_tempest_plugin/services/reservation/reservation_client.py index 32c355c..ba89129 100644 --- a/blazar_tempest_plugin/services/reservation/reservation_client.py +++ b/blazar_tempest_plugin/services/reservation/reservation_client.py @@ -14,6 +14,7 @@ # under the License. from oslo_serialization import jsonutils as json +from oslo_utils import uuidutils as uuids from tempest.lib.common import rest_client @@ -31,8 +32,16 @@ class ResourceReservationV1Client(rest_client.RestClient): body = json.loads(body) return rest_client.ResponseBody(resp, body) + def _get_headers(self): + headers = { + 'Content-Type': 'application/json', + 'Accept': 'application/json', + 'X-Openstack-Request-Id': 'req-' + str(uuids.generate_uuid()) + } + return headers + def list_lease(self): - resp, body = self.get(self.lease) + resp, body = self.get(self.lease, headers=self._get_headers()) return self._response_helper(resp, body) def get_lease(self, lease): @@ -41,36 +50,43 @@ class ResourceReservationV1Client(rest_client.RestClient): def create_lease(self, body): body = json.dump_as_bytes(body) - resp, body = self.post(self.lease, body=body) + resp, body = self.post( + self.lease, body=body, headers=self._get_headers()) return self._response_helper(resp, body) def update_lease(self, lease, body): body = json.dump_as_bytes(body) - resp, body = self.put(self.lease_path % lease, body=body) + resp, body = self.put( + self.lease_path % lease, body=body, headers=self._get_headers()) return self._response_helper(resp, body) def delete_lease(self, lease): - resp, body = self.delete(self.lease_path % lease) + resp, body = self.delete( + self.lease_path % lease, headers=self._get_headers()) return self._response_helper(resp, body) def list_host(self): - resp, body = self.get(self.host) + resp, body = self.get(self.host, headers=self._get_headers()) return self._response_helper(resp, body) def get_host(self, host): - resp, body = self.get(self.host_path % host) + resp, body = self.get( + self.host_path % host, headers=self._get_headers()) return self._response_helper(resp, body) def create_host(self, body): body = json.dump_as_bytes(body) - resp, body = self.post(self.host, body=body) + resp, body = self.post( + self.host, body=body, headers=self._get_headers()) return self._response_helper(resp, body) def update_host(self, host, body): body = json.dump_as_bytes(body) - resp, body = self.put(self.host_path % host, body=body) + resp, body = self.put( + self.host_path % host, body=body, headers=self._get_headers()) return self._response_helper(resp, body) def delete_host(self, host): - resp, body = self.delete(self.host_path % host) + resp, body = self.delete( + self.host_path % host, headers=self._get_headers()) return self._response_helper(resp, body) diff --git a/requirements.txt b/requirements.txt index ae74d89..72b1b33 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,5 +7,6 @@ six>=1.10.0 # MIT oslo.config>=5.2.0 # Apache-2.0 oslo.log>=3.36.0 # Apache-2.0 oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0 +oslo.utils>=3.37.0 # Apache-2.0 tempest>=17.1.0 # Apache-2.0 gabbi>=1.42.1 # Apache-2.0