1)
Patch to debug client request Url, Method and body
git diff neutronclient/client.py neutronclient/v2_0/client.py
diff --git a/neutronclient/client.py b/neutronclient/client.py
index e41511f..c6ef62c 100644
--- a/neutronclient/client.py
+++ b/neutronclient/client.py
@@ -102,6 +102,8 @@ class HTTPClient(object):
utils.http_log_req(_logger, args, log_kargs)
try:
+ raise Exception(args)
+ #raise Exception(kargs)
resp, body = self.request(*args, **kargs)
except requests.exceptions.SSLError as e:
raise exceptions.SslCertificateValidationError(reason=e)
diff --git a/neutronclient/v2_0/client.py b/neutronclient/v2_0/client.py
index 9664520..bc555ae 100644
--- a/neutronclient/v2_0/client.py
+++ b/neutronclient/v2_0/client.py
@@ -1336,11 +1336,12 @@ class Client(object):
try:
return self.do_request(method, action, body=body,
headers=headers, params=params)
- except exceptions.ConnectionFailed:
+ except exceptions.ConnectionFailed as ex:
# Exception has already been logged by do_request()
if i < self.retries:
_logger.debug('Retrying connection to Neutron service')
time.sleep(self.retry_interval)
+ raise ex
raise exceptions.ConnectionFailed(reason=_("Maximum attempts reached"))
2)
Run following test and check the mocked client request Url, Method and body and compare with the original API request.
#cd python-neutronclient
a)
#.tox/py27/bin/python -m testtools.run neutronclient.tests.unit.test_cli20_ipam.CLITestV20Ipam.test_create_ipam
Url and Method : ConnectionFailed: Connection to neutron failed: ['localurl/v2.0/ipams.json', 'POST']
Body : ConnectionFailed: Connection to neutron failed: {'body': '{"ipam": {"name": "myname", "mgmt": {"method": "fixed"}}}', 'headers': {'X-Auth-Token': 'testtoken', 'Content-Type': 'application/json', 'Accept': 'application/json', 'User-Agent': 'python-neutronclient'}}
b)
#.tox/py27/bin/python -m testtools.run neutronclient.tests.unit.test_cli20_ipam.CLITestV20Ipam.test_list_ipams_detail
Url and Method : ConnectionFailed: Connection to neutron failed: ['localurl/v2.0/ipams.json?verbose=True', 'GET']
Body : ConnectionFailed: Connection to neutron failed: {'body': None, 'headers': {'X-Auth-Token': 'testtoken', 'Content-Type': 'application/json', 'Accept': 'application/json', 'User-Agent': 'python-neutronclient'}}
c)
#.tox/py27/bin/python -m testtools.run neutronclient.tests.unit.test_cli20_ipam.CLITestV20Ipam.test_show_ipam
Url and Method : ConnectionFailed: Connection to neutron failed: ['localurl/v2.0/ipams/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa.json?fields=id&fields=name', 'GET']
Body : ConnectionFailed: Connection to neutron failed: {'body': None, 'headers': {'X-Auth-Token': 'testtoken', 'Content-Type': 'application/json', 'Accept': 'application/json', 'User-Agent': 'python-neutronclient'}}
d)
#.tox/py27/bin/python -m testtools.run neutronclient.tests.unit.test_cli20_ipam.CLITestV20Ipam.test_delete_ipam
Url and Method : ConnectionFailed: Connection to neutron failed: ['localurl/v2.0/ipams/myid.json', 'DELETE']
Body : ConnectionFailed: Connection to neutron failed: {'body': None, 'headers': {'X-Auth-Token': 'testtoken', 'Content-Type': 'application/json', 'Accept': 'application/json', 'User-Agent': 'python-neutronclient'}}