diff options
author | valentin boucher <valentin.boucher@kontron.com> | 2018-04-24 13:53:15 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2018-04-24 13:53:16 +0000 |
commit | 454a3e3152d90ea0f64fc64ccabc1e305f1c2f9d (patch) | |
tree | ced909eb6ce20310f02044f7915030429996997b | |
parent | 0911abc82403066af66d285db739cff03772b06c (diff) | |
parent | e5abdcc0d867f293dd89c9ba1a398071ef2cedd0 (diff) |
Merge "Add debug logs in cloudify_ims"
-rw-r--r-- | functest/opnfv_tests/vnf/ims/clearwater_ims_base.py | 35 | ||||
-rw-r--r-- | functest/opnfv_tests/vnf/ims/cloudify_ims.py | 1 |
2 files changed, 21 insertions, 15 deletions
diff --git a/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py b/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py index f35e281dd..94915c839 100644 --- a/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py +++ b/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py @@ -52,11 +52,14 @@ class ClearwaterOnBoardingBase(vnf.VnfOnBoarding): "full_name": "opnfv functest user", "email": "functest@opnfv.org", "signup_code": signup_code} - rq = requests.post(account_url, data=params) + req = requests.post(account_url, data=params) output_dict['login'] = params - if rq.status_code != 201 and rq.status_code != 409: - raise Exception("Unable to create an account for number provision") - self.logger.debug('Account is created on Ellis: %s', params) + if req.status_code != 201 and req.status_code != 409: + raise Exception( + "Unable to create an account {}\n{}".format( + params, req.text)) + self.logger.debug( + 'Account %s is created on Ellis\n%s', params, req.json()) session_url = 'http://{0}/session'.format(ellis_ip) session_data = { @@ -64,22 +67,24 @@ class ClearwaterOnBoardingBase(vnf.VnfOnBoarding): 'password': params['password'], 'email': params['email'] } - rq = requests.post(session_url, data=session_data) - if rq.status_code != 201: - raise Exception('Failed to get cookie for Ellis') - cookies = rq.cookies + req = requests.post(session_url, data=session_data) + if req.status_code != 201: + raise Exception('Failed to get cookie for Ellis\n{}'.format( + req.text)) + cookies = req.cookies self.logger.debug('Cookies: %s', cookies) number_url = 'http://{0}/accounts/{1}/numbers'.format( ellis_ip, params['email']) self.logger.debug('Create 1st calling number on Ellis') i = 30 - while rq.status_code != 200 and i > 0: + while req.status_code != 200 and i > 0: try: number_res = self.create_ellis_number(number_url, cookies) break except Exception: # pylint: disable=broad-except if i == 1: + self.logger.exception("Unable to create a number") raise Exception("Unable to create a number") self.logger.info("Unable to create a number. Retry ..") time.sleep(25) @@ -94,15 +99,15 @@ class ClearwaterOnBoardingBase(vnf.VnfOnBoarding): return output_dict def create_ellis_number(self, number_url, cookies): - rq = requests.post(number_url, cookies=cookies) + req = requests.post(number_url, cookies=cookies) - if rq.status_code != 200: - if rq and rq.json(): - reason = rq.json()['reason'] + if req.status_code != 200: + if req and req.json(): + reason = req.json()['reason'] else: - reason = rq + reason = req raise Exception("Unable to create a number: %s" % reason) - number_res = rq.json() + number_res = req.json() self.logger.info('Calling number is created: %s', number_res) return number_res diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims.py b/functest/opnfv_tests/vnf/ims/cloudify_ims.py index c2fda6888..6180e2c8f 100644 --- a/functest/opnfv_tests/vnf/ims/cloudify_ims.py +++ b/functest/opnfv_tests/vnf/ims/cloudify_ims.py @@ -126,6 +126,7 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase): self.created_object.append(image_creator) def deploy_orchestrator(self): + # pylint: disable=too-many-locals,too-many-statements """ Deploy Cloudify Manager. |