aboutsummaryrefslogtreecommitdiffstats
path: root/test/vcpe/vcpecommon.py
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2019-12-17 13:16:43 +0100
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-01-10 08:42:03 +0000
commitc08278a4a1790461818c0c7905637268b57400a7 (patch)
tree984148a67b748fae236a44e5e5491a2f0ef8dfc6 /test/vcpe/vcpecommon.py
parent22e206080ef3c4503175948fdbeb1cd3cc8e240e (diff)
Support setting custom path to config file in vcpe.py
Change-Id: I9ec950413f323e6ed6dfb075f16b67d925ece047 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com> Issue-ID: INT-1399
Diffstat (limited to 'test/vcpe/vcpecommon.py')
-rwxr-xr-xtest/vcpe/vcpecommon.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/vcpe/vcpecommon.py b/test/vcpe/vcpecommon.py
index 9f7f57fb1..8ae81016c 100755
--- a/test/vcpe/vcpecommon.py
+++ b/test/vcpe/vcpecommon.py
@@ -19,13 +19,14 @@ from netaddr import IPAddress, IPNetwork
class VcpeCommon:
- def __init__(self, extra_host_names=None):
+ def __init__(self, extra_host_names=None, cfg_file=None):
self.logger = logging.getLogger(__name__)
self.logger.setLevel(logging.DEBUG)
self.logger.info('Initializing configuration')
+ self.default_config = 'vcpeconfig.yaml'
# Read configuration from config file
- self._load_config()
+ self._load_config(cfg_file)
self.sdnc_controller_pod = '-'.join([self.onap_environment, 'sdnc-sdnc-0'])
# OOM: this is the address that the brg and bng will nat for sdnc access - 10.0.0.x address of k8 host for sdnc-0 container
@@ -154,12 +155,15 @@ class VcpeCommon:
'Content-Type': 'application/json',
'X-FromAppId': 'postman', 'X-TransactionId': '9999'}
- def _load_config(self, cfg_file='vcpeconfig.yaml'):
+ def _load_config(self, cfg_file):
"""
Reads vcpe config file and injects settings as object's attributes
:param cfg_file: Configuration file path
"""
+ if cfg_file is None:
+ cfg_file = self.default_config
+
try:
with open(cfg_file, 'r') as cfg:
cfg_yml = yaml.full_load(cfg)