summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Zadrożny <pawel.zadrozny@codilime.com>2018-04-25 13:28:02 +0200
committerPaweł Zadrożny <pawel.zadrozny@codilime.com>2018-04-26 14:38:13 +0200
commit1ef4cc8ade8a15a86efd08c0fbe9164f25710f07 (patch)
treecf2149d91c8573799680f1e9c1b396bef2f8d05c
parent29a6dd665b1dcb7d88dd3833a17b096d4c890b55 (diff)
Add debug loging for Api requests and responses
Notes
Notes (review): Code-Review+1: Pawel Zadrozny <pawel.zadrozny@codilime.com> Code-Review+2: Sukhdev Kapur <sukhdevkapur@gmail.com> Workflow+1: Sukhdev Kapur <sukhdevkapur@gmail.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Wed, 27 Jun 2018 02:22:31 +0000 Reviewed-on: https://review.openstack.org/564166 Project: openstack/networking-opencontrail Branch: refs/heads/master
-rw-r--r--networking_opencontrail/drivers/drv_opencontrail.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/networking_opencontrail/drivers/drv_opencontrail.py b/networking_opencontrail/drivers/drv_opencontrail.py
index 465d40c..7804396 100644
--- a/networking_opencontrail/drivers/drv_opencontrail.py
+++ b/networking_opencontrail/drivers/drv_opencontrail.py
@@ -111,6 +111,10 @@ class OpenContrailDrivers(driver_base.OpenContrailDriversBase):
111 self._use_api_certs = True 111 self._use_api_certs = True
112 112
113 def _request_api_server(self, url, data=None, headers=None): 113 def _request_api_server(self, url, data=None, headers=None):
114 LOG.debug("Api-Server request:\n"
115 "URL: %(url)s\nHeaders: %(heads)s\nPayload: %(payload)s\n",
116 {'url': url, 'heads': headers, 'payload': data})
117
114 # Attempt to post to Api-Server 118 # Attempt to post to Api-Server
115 if self._apiinsecure: 119 if self._apiinsecure:
116 response = requests.post(url, data=data, 120 response = requests.post(url, data=data,
@@ -150,6 +154,13 @@ class OpenContrailDrivers(driver_base.OpenContrailDriversBase):
150 response = self._request_api_server(url, data, auth_headers) 154 response = self._request_api_server(url, data, auth_headers)
151 else: 155 else:
152 raise RuntimeError('Authentication Failure') 156 raise RuntimeError('Authentication Failure')
157
158 if response.status_code != requests.codes.ok:
159 LOG.error("Api-Server response:\n"
160 "Status: %(status)s\nPayload: %(payload)s\n",
161 {'status': response.status_code,
162 'payload': response.content})
163
153 return response 164 return response
154 165
155 def _request_api_server_authn(self, url, data=None, headers=None): 166 def _request_api_server_authn(self, url, data=None, headers=None):