summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-06-27 02:22:31 +0000
committerGerrit Code Review <review@openstack.org>2018-06-27 02:22:31 +0000
commit50803cafd23a9a43755aceba6a52918600de6fb4 (patch)
tree287a243d0cf2280995db83984685c1142c8d15d2
parente49e63ed2c4b7d934983e46bb3ba903cc636db3e (diff)
parent1ef4cc8ade8a15a86efd08c0fbe9164f25710f07 (diff)
Merge "Add debug loging for Api requests and responses"
-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 0868273..ed0abdc 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):