summaryrefslogtreecommitdiffstats
path: root/deploy/utils.py
diff options
context:
space:
mode:
authorzhongjun <zhong.jun@zte.com.cn>2017-06-22 10:31:14 +0800
committerzhongjun <zhong.jun@zte.com.cn>2017-06-23 13:54:56 +0800
commitccd2fe6cd04ed5e9a622a51d37bb1f0d97fc633b (patch)
tree0a3f3353d244d8f3441230975d1348b289c3f764 /deploy/utils.py
parent420e2a340d66c481353683210f02ba06ba056433 (diff)
add the scenarios option
Add the scenarios option and yaml configuration files, currently only support three scenarios as below. os-nosdn-nofeature-noha/os-odl_l3-nofeature-noha/ os-odl_l2-nofeature-noha. we will support more secnarios such as os-odl_l3-nofeature-ha in future. Change-Id: I24d7875208e277f6ee1b794c0033d5fee6b5e371 Signed-off-by: zhongjun <zhong.jun@zte.com.cn>
Diffstat (limited to 'deploy/utils.py')
-rw-r--r--deploy/utils.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/deploy/utils.py b/deploy/utils.py
index 0c5b1370..102ae1f3 100644
--- a/deploy/utils.py
+++ b/deploy/utils.py
@@ -19,6 +19,9 @@ path_join = os.path.join
CWD = os.getcwd()
WORKSPACE = os.path.normpath(path_join(os.path.dirname(__file__), '..'))
BASE = CWD
+valid_scenario_list = ['os-nosdn-nofeature-noha',
+ 'os-odl_l3-nofeature-noha',
+ 'os-odl_l2-nofeature-noha']
def get_logger():
@@ -136,3 +139,23 @@ def run_shell(cmd, check=False):
LI('Successful command: ' + str(cmd))
return return_code
+
+
+def merge_dicts(dict1, dict2):
+ for k in set(dict1).union(dict2):
+ if k in dict1 and k in dict2:
+ if isinstance(dict1[k], dict) and isinstance(dict2[k], dict):
+ yield (k, dict(merge_dicts(dict1[k], dict2[k])))
+ continue
+ # If one of the values is not a dict nor a list,
+ # you can't continue merging it.
+ # Value from second dict overrides one in first if exists.
+ if k in dict2:
+ yield (k, dict2[k])
+ else:
+ yield (k, dict1[k])
+
+
+def check_scenario_valid(scenario):
+ if not (scenario in valid_scenario_list):
+ err_exit('Invald scenario:%s' % scenario)