diff options
author | 2019-02-04 20:36:08 -0500 | |
---|---|---|
committer | 2019-02-04 20:36:17 -0500 | |
commit | ee02b31d7cf9f52b09b78095f26f2f05241cc6b0 (patch) | |
tree | 742aa617c8cf0dd55850a02ff4ca2e6890042ba7 /robot/assets/service_mappings.py | |
parent | 4dda2603994b846e5d697210f53138a274ab142d (diff) |
Dynamic Service Mapping & vFW ip port references
Issue-ID: INT-829
Change-Id: I10f229996cdeb049840fdefe78b35187186a5517
Signed-off-by: Brian Freeman <bf1936@att.com>
Diffstat (limited to 'robot/assets/service_mappings.py')
-rw-r--r-- | robot/assets/service_mappings.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/robot/assets/service_mappings.py b/robot/assets/service_mappings.py index fb06b448..1aa9ca58 100644 --- a/robot/assets/service_mappings.py +++ b/robot/assets/service_mappings.py @@ -1,3 +1,7 @@ +import json +import os.path + + ''' This metadata identifies the folders to be zipped and uploaded to SDC for model distribution for a given VNF ''' @@ -114,3 +118,43 @@ GLOBAL_VALIDATE_NAME_MAPPING = {"vFW" : 'vfw_name_0', "vPKG" : 'vpg_name_0', } + + +# Create dictionaries for new MAPPING data to join to original MAPPING data +GLOBAL_SERVICE_FOLDER_MAPPING2 = {} +GLOBAL_SERVICE_VNF_MAPPING2 = {} +GLOBAL_SERVICE_GEN_NEUTRON_NETWORK_MAPPING2 = {} +GLOBAL_SERVICE_DEPLOYMENT_ARTIFACT_MAPPING2 = {} +GLOBAL_SERVICE_TEMPLATE_MAPPING2 = {} +GLOBAL_VALIDATE_NAME_MAPPING2 = {} + + + +folder=os.path.join('./demo/service_mapping') +subfolders = [d for d in os.listdir(folder) if os.path.isdir(os.path.join(folder, d))] + +for service in subfolders: + filepath=os.path.join('./demo/service_mapping', service, 'service_mapping.json') + with open(filepath, 'r') as f: + service_mappings = json.load(f) + for mapping in service_mappings: + if mapping == 'GLOBAL_SERVICE_FOLDER_MAPPING': + GLOBAL_SERVICE_FOLDER_MAPPING2[service]=service_mappings[mapping][service] + if mapping == 'GLOBAL_SERVICE_VNF_MAPPING': + GLOBAL_SERVICE_VNF_MAPPING2[service]=service_mappings[mapping][service] + if mapping == 'GLOBAL_SERVICE_GEN_NEUTRON_NETWORK_MAPPING': + GLOBAL_SERVICE_GEN_NEUTRON_NETWORK_MAPPING2[service]=service_mappings[mapping][service] + if mapping == 'GLOBAL_SERVICE_DEPLOYMENT_ARTIFACT_MAPPING': + GLOBAL_SERVICE_DEPLOYMENT_ARTIFACT_MAPPING2[service]=service_mappings[mapping][service] + if mapping == 'GLOBAL_SERVICE_TEMPLATE_MAPPING': + GLOBAL_SERVICE_TEMPLATE_MAPPING2[service]=service_mappings[mapping][service] + if mapping == 'GLOBAL_VALIDATE_NAME_MAPPING': + GLOBAL_VALIDATE_NAME_MAPPING2[service]=service_mappings[mapping][service] + +# Merge dictionaries +GLOBAL_SERVICE_FOLDER_MAPPING = dict(GLOBAL_SERVICE_FOLDER_MAPPING.items() + GLOBAL_SERVICE_FOLDER_MAPPING2.items()) +GLOBAL_SERVICE_VNF_MAPPING = dict(GLOBAL_SERVICE_VNF_MAPPING.items() + GLOBAL_SERVICE_VNF_MAPPING2.items()) +GLOBAL_SERVICE_GEN_NEUTRON_NETWORK_MAPPING = dict(GLOBAL_SERVICE_GEN_NEUTRON_NETWORK_MAPPING.items() + GLOBAL_SERVICE_GEN_NEUTRON_NETWORK_MAPPING2.items()) +GLOBAL_SERVICE_DEPLOYMENT_ARTIFACT_MAPPING = dict(GLOBAL_SERVICE_DEPLOYMENT_ARTIFACT_MAPPING.items() + GLOBAL_SERVICE_DEPLOYMENT_ARTIFACT_MAPPING2.items()) +GLOBAL_SERVICE_TEMPLATE_MAPPING = dict(GLOBAL_SERVICE_TEMPLATE_MAPPING.items() + GLOBAL_SERVICE_TEMPLATE_MAPPING2.items()) +GLOBAL_VALIDATE_NAME_MAPPING = dict(GLOBAL_VALIDATE_NAME_MAPPING.items() + GLOBAL_VALIDATE_NAME_MAPPING2.items()) |