summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sfc/lib/config.py29
-rw-r--r--sfc/tests/functest/run_sfc_tests.py2
-rw-r--r--sfc/tests/functest/sfc_chain_deletion.py2
-rw-r--r--sfc/tests/functest/sfc_symmetric_chain.py2
-rw-r--r--sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py2
5 files changed, 20 insertions, 17 deletions
diff --git a/sfc/lib/config.py b/sfc/lib/config.py
index 7fb42e3e..49cebc7d 100644
--- a/sfc/lib/config.py
+++ b/sfc/lib/config.py
@@ -8,16 +8,18 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
+import logging
import os
import yaml
-import sfc
import functest
-import sfc.lib.test_utils as test_utils
from functest.utils.constants import CONST
-import logging
+from functest.utils import env
import functest.utils.functest_utils as ft_utils
+import sfc
+import sfc.lib.test_utils as test_utils
+
logger = logging.getLogger(__name__)
@@ -41,16 +43,16 @@ class CommonConfig(object):
self.sfc_test_dir, "vnfd-default-params-file")
self.vnffgd_dir = os.path.join(self.sfc_test_dir, "vnffgd-templates")
self.functest_results_dir = os.path.join(
- CONST.dir_results, "odl-sfc")
- self.config_file = os.path.join(self.sfc_test_dir, "config.yaml")
+ getattr(CONST, 'dir_results'), "odl-sfc")
+ self.config_file = os.path.join(self.sfc_test_dir, "config.yaml")
self.vim_file = os.path.join(self.sfc_test_dir, "register-vim.json")
- self.installer_type = CONST.__getattribute__('INSTALLER_TYPE')
+ self.installer_type = env.get('INSTALLER_TYPE')
self.installer_fields = test_utils.fill_installer_dict(
- self.installer_type)
+ self.installer_type)
- self.installer_ip = CONST.__getattribute__('INSTALLER_IP')
+ self.installer_ip = env.get('INSTALLER_IP')
self.installer_user = ft_utils.get_parameter_from_yaml(
self.installer_fields['user'], self.config_file)
@@ -58,19 +60,19 @@ class CommonConfig(object):
try:
self.installer_password = ft_utils.get_parameter_from_yaml(
self.installer_fields['password'], self.config_file)
- except:
+ except Exception:
self.installer_password = None
try:
self.installer_key_file = ft_utils.get_parameter_from_yaml(
self.installer_fields['pkey_file'], self.config_file)
- except:
+ except Exception:
self.installer_key_file = None
try:
self.installer_cluster = ft_utils.get_parameter_from_yaml(
self.installer_fields['cluster'], self.config_file)
- except:
+ except Exception:
self.installer_cluster = None
self.flavor = ft_utils.get_parameter_from_yaml(
@@ -104,7 +106,8 @@ class TestcaseConfig(object):
testcases_yaml = yaml.safe_load(f)
test_config = testcases_yaml['testcases'].get(testcase, None)
if test_config is None:
- logger.error('Test {0} configuration is not present in {1}'
- .format(testcase, common_config.config_file))
+ logger.error(
+ 'Test %s configuration is not present in %s',
+ testcase, common_config.config_file)
# Update class fields with configuration variables dynamically
self.__dict__.update(**test_config)
diff --git a/sfc/tests/functest/run_sfc_tests.py b/sfc/tests/functest/run_sfc_tests.py
index a1e73040..e818e10b 100644
--- a/sfc/tests/functest/run_sfc_tests.py
+++ b/sfc/tests/functest/run_sfc_tests.py
@@ -1,4 +1,4 @@
-#!/bin/python
+#!/usr/bin/env python
#
# Copyright (c) 2015 All rights reserved
# This program and the accompanying materials
diff --git a/sfc/tests/functest/sfc_chain_deletion.py b/sfc/tests/functest/sfc_chain_deletion.py
index 22d634e0..3962a3a6 100644
--- a/sfc/tests/functest/sfc_chain_deletion.py
+++ b/sfc/tests/functest/sfc_chain_deletion.py
@@ -1,4 +1,4 @@
-#!/bin/python
+#!/usr/bin/env python
#
# Copyright (c) 2015 All rights reserved
# This program and the accompanying materials
diff --git a/sfc/tests/functest/sfc_symmetric_chain.py b/sfc/tests/functest/sfc_symmetric_chain.py
index b8d35514..e3b1d57e 100644
--- a/sfc/tests/functest/sfc_symmetric_chain.py
+++ b/sfc/tests/functest/sfc_symmetric_chain.py
@@ -1,4 +1,4 @@
-#!/bin/python
+#!/usr/bin/env python
#
# Copyright (c) 2017 Ericsson AB and others. All rights reserved
#
diff --git a/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py b/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py
index 9d4c68c8..4e63ecfd 100644
--- a/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py
+++ b/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py
@@ -1,4 +1,4 @@
-#!/bin/python
+#!/usr/bin/env python
#
# Copyright (c) 2015 All rights reserved
# This program and the accompanying materials