aboutsummaryrefslogtreecommitdiffstats
path: root/functest
diff options
context:
space:
mode:
Diffstat (limited to 'functest')
-rw-r--r--functest/tests/unit/utils/test_openstack_tacker.py10
-rw-r--r--functest/utils/openstack_tacker.py16
2 files changed, 13 insertions, 13 deletions
diff --git a/functest/tests/unit/utils/test_openstack_tacker.py b/functest/tests/unit/utils/test_openstack_tacker.py
index a8330c0e..dc717258 100644
--- a/functest/tests/unit/utils/test_openstack_tacker.py
+++ b/functest/tests/unit/utils/test_openstack_tacker.py
@@ -146,8 +146,7 @@ class OSTackerTesting(unittest.TestCase):
tosca_file=None)
self.assertEqual(resp, self.createvnfd)
- @mock.patch('functest.utils.openstack_tacker.logger.error')
- def test_create_vnfd_default(self, mock_logger_error):
+ def test_create_vnfd_default(self):
with mock.patch.object(self.tacker_client, 'create_vnfd',
return_value=self.createvnfd), \
mock.patch('__builtin__.open', mock.mock_open(read_data='1')) \
@@ -155,16 +154,15 @@ class OSTackerTesting(unittest.TestCase):
resp = openstack_tacker.create_vnfd(self.tacker_client,
tosca_file=self.tosca_file)
m.assert_called_once_with(self.tosca_file)
- mock_logger_error.assert_called_once_with('1')
self.assertEqual(resp, self.createvnfd)
- @mock.patch('functest.utils.openstack_tacker.logger.exception')
- def test_create_vnfd_exception(self, mock_logger_excep):
+ @mock.patch('functest.utils.openstack_tacker.logger.error')
+ def test_create_vnfd_exception(self, mock_logger_error):
with mock.patch.object(self.tacker_client, 'create_vnfd',
side_effect=Exception):
resp = openstack_tacker.create_vnfd(self.tacker_client,
tosca_file=self.tosca_file)
- mock_logger_excep.assert_called_once_with(test_utils.
+ mock_logger_error.assert_called_once_with(test_utils.
SubstrMatch("Error"
" [create"
"_vnfd("
diff --git a/functest/utils/openstack_tacker.py b/functest/utils/openstack_tacker.py
index d143ad6f..c7ac89af 100644
--- a/functest/utils/openstack_tacker.py
+++ b/functest/utils/openstack_tacker.py
@@ -74,12 +74,12 @@ def create_vnfd(tacker_client, tosca_file=None):
if tosca_file is not None:
with open(tosca_file) as tosca_fd:
vnfd_body = tosca_fd.read()
- logger.error(vnfd_body)
+ logger.info('VNFD template:\n{0}'.format(vnfd_body))
return tacker_client.create_vnfd(
body={"vnfd": {"attributes": {"vnfd": vnfd_body}}})
except Exception, e:
- logger.exception("Error [create_vnfd(tacker_client, '%s')]: %s"
- % (tosca_file, e))
+ logger.error("Error [create_vnfd(tacker_client, '%s')]: %s"
+ % (tosca_file, e))
return None
@@ -124,7 +124,8 @@ def create_vnf(tacker_client, vnf_name, vnfd_id=None, vnfd_name=None):
vnf_body['vnf']['vnfd_id'] = get_vnfd_id(tacker_client, vnfd_name)
return tacker_client.create_vnf(body=vnf_body)
except Exception, e:
- logger.error("error [create_vnf(tacker_client, '%s', '%s', '%s')]: %s"
+ logger.error("error [create_vnf(tacker_client,"
+ " '%s', '%s', '%s')]: %s"
% (vnf_name, vnfd_id, vnfd_name, e))
return None
@@ -206,7 +207,8 @@ def create_sfc(tacker_client, sfc_name,
for name in chain_vnf_names]
return tacker_client.create_sfc(body=sfc_body)
except Exception, e:
- logger.error("error [create_sfc(tacker_client, '%s', '%s', '%s')]: %s"
+ logger.error("error [create_sfc(tacker_client,"
+ " '%s', '%s', '%s')]: %s"
% (sfc_name, chain_vnf_ids, chain_vnf_names, e))
return None
@@ -263,8 +265,8 @@ def create_sfc_classifier(tacker_client, sfc_clf_name, sfc_id=None,
tacker_client, sfc_name)
return tacker_client.create_sfc_classifier(body=sfc_clf_body)
except Exception, e:
- logger.error("error [create_sfc_classifier(tacker_client, '%s', '%s',"
- " '%s', '%s')]: '%s'"
+ logger.error("error [create_sfc_classifier(tacker_client,"
+ " '%s', '%s','%s', '%s')]: '%s'"
% (sfc_clf_name, sfc_id, sfc_name, str(match), e))
return None