blob: 977d216c9101e45628a10dcb89b5c03f2a8eabed [file] [log] [blame]
Brian Freemanee02b312019-02-04 20:36:08 -05001import json
2import os.path
3
4
Jerry Floodd40619e2017-08-24 09:38:48 -04005'''
6This metadata identifies the folders to be zipped and uploaded to SDC for model distribution for a given VNF
7'''
Jerry Flood8c636292017-10-30 13:03:31 -04008GLOBAL_SERVICE_FOLDER_MAPPING = {"vFW" : ['vFW'], \
9 "vLB" : ['vLB'], \
10 "vVG" : ['vVG'], \
Jerry Flood3a169a32017-12-01 12:39:10 -050011 "vCPE" : ['vCPE/infra', 'vCPE/vbng', 'vCPE/vbrgemu', 'vCPE/vgmux', 'vCPE/vgw'],
12 "vFWCL" : ['vFWCL/vFWSNK', 'vFWCL/vPKG'],
Yang Xu2ec80382018-11-01 12:30:37 -040013 "vFWNG" : ['vFW_NextGen/templates'],
Brian Freemaneef7c6f2018-11-16 18:42:21 -050014 "vCPEInfra" : ['vCPE/infra'],
15 "vCPEvBNG" : ['vCPE/vbng'],
16 "vCPEvBRGEMU" : ['vCPE/vbrgemu'],
17 "vCPEvGMUX" : ['vCPE/vgmux'],
18 "vCPEvGW" : ['vCPE/vgw'],
bdfreeman1421b2a49512018-11-25 07:32:19 -050019 "vCPEResCust" : ['vCPE/vgw'],
Jerry Flood3a169a32017-12-01 12:39:10 -050020 }
21
22'''
23Map the service to the list of VNFs to be orchestrated
24'''
25GLOBAL_SERVICE_VNF_MAPPING = {
26 "vFW" : ['vFW'],
27 "vLB" : ['vLB'],
28 "vVG" : ['vVG'],
29 "vCPE" : ['vCPE'],
Brian Freeman12ff1842019-02-13 13:54:48 -050030 "vFWCL" : ['vFWCLvFWSNK', 'vFWCLvPKG'],
Yang Xu2ec80382018-11-01 12:30:37 -040031 "vFWNG" : ['vFWNG'],
Brian Freemaneef7c6f2018-11-16 18:42:21 -050032 "vCPEInfra" : ['vCPEInfra'],
33 "vCPEvBNG" : ['vCPEvBNG'],
34 "vCPEvBRGEMU" : ['vCPEvBRGEMU'],
35 "vCPEvGMUX" : ['vCPEvGMUX'],
36 "vCPEvGW" : ['vCPEvGW'],
bdfreeman1421b2a49512018-11-25 07:32:19 -050037 "vCPERestCust" : ['vCPEvGW'],
DR695Hccff30b2017-02-17 18:44:24 -050038 }
Jerry Floodd40619e2017-08-24 09:38:48 -040039
40'''
Brian Freemaneef7c6f2018-11-16 18:42:21 -050041
42Map the service to the list of Generic Neutron Networks to be orchestrated
43
44'''
45GLOBAL_SERVICE_GEN_NEUTRON_NETWORK_MAPPING = {
46 "vCPEInfra" : ['CPE_SIGNAL','CPE_PUBLIC'],
47 "vCPEvBNG" : ['BRG_BNG', 'BNG_MUX'],
48 "vCPEvGMUX" : ['MUX_GW'],
49 "vCPEvBRGEMU" :[],
50 "vCPEvGW" :[],
bdfreeman1421b2a49512018-11-25 07:32:19 -050051 "vCPERestCust" :[],
Brian Freemaneef7c6f2018-11-16 18:42:21 -050052 "vFW" :[],
53 "vLB" :[],
54 "vVG" :[],
55 "vFWCL" :[],
56 "vFWNG" :[],
57}
58'''
59
Brian Freeman2e1d0ff2019-01-23 09:38:13 -050060Map the service to the list of Deployment Artifacts for Closed Loop Control
61
62'''
63GLOBAL_SERVICE_DEPLOYMENT_ARTIFACT_MAPPING = {
64 "vCPEInfra" : [],
65 "vCPEvBNG" : [],
66 "vCPEvGMUX" : [],
67 "vCPEvBRGEMU" :[],
68 "vCPEvGW" :[],
69 "vCPERestCust" :[],
70 "vFW" :[],
71 "vLB" :['tca_docker_k8s_v4.yaml'],
72 "vVG" :[],
73 "vFWCL" :[],
74 "vFWNG" :[],
75}
76'''
77
Brian Freemaneef7c6f2018-11-16 18:42:21 -050078
79
Jerry Floodd40619e2017-08-24 09:38:48 -040080This metadata identifes the preloads that need to be done for a VNF as there may be more than one (vLB)
Jerry Flood3a169a32017-12-01 12:39:10 -050081"template" maps to the parameters in the preload_paramenters.py
Jerry Flood3fc36a32017-10-11 11:09:19 -040082 - GLOBAL_PRELOAD_PARAMETERS[<testcase>][<template>] -
83 i.e. GLOBAL_PRELOAD_PARAMETERS['Demo'][dnsscaling_preload.template']
Jerry Floodd40619e2017-08-24 09:38:48 -040084'''
Jerry Flood3fc36a32017-10-11 11:09:19 -040085GLOBAL_SERVICE_TEMPLATE_MAPPING = {
Brian Freeman2e1d0ff2019-01-23 09:38:13 -050086 "vFW" : [{"isBase" : "true", "template" : "vfw_preload.template", "name_pattern": "base_vfw"}],
Jerry Flood3fc36a32017-10-11 11:09:19 -040087 "vLB" : [{"isBase" : "true", "template" : "vlb_preload.template", "name_pattern": "base_vlb"},
88 {"isBase" : "false", "template" : "dnsscaling_preload.template", "name_pattern": "dnsscaling", "prefix" : "vDNS_"}],
Jerry Flood3a169a32017-12-01 12:39:10 -050089 "vVG" : [{"isBase" : "true", "template" : "vvg_preload.template", "name_pattern": "base_vvg"}],
90 "vCPE" : [{"isBase" : "true", "template" : "vcpe_preload.template", "name_pattern": "base_clearwater"}],
91 "vFWSNK" : [{"isBase" : "true", "template" : "vfwsnk_preload.template", "name_pattern": "base_vfw"}],
92 "vPKG" : [{"isBase" : "true", "template" : "vpkg_preload.template", "name_pattern": "base_vpkg"}],
Bin Yang326219a2018-05-31 05:35:33 +000093 "vFWCL" : [{"isBase" : "true", "template" : "vfwsnk_preload.template", "name_pattern": "base_vfw"},
94 {"isBase" : "true", "template" : "vpkg_preload.template", "name_pattern": "base_vpkg"}],
Brian Freeman12ff1842019-02-13 13:54:48 -050095 "vFWCLvFWSNK" : [{"isBase" : "true", "template" : "vfwsnk_preload.template", "vnf_index": "0", "name_pattern": "base_vfw"}],
96 "vFWCLvPKG" : [{"isBase" : "true", "template" : "vpkg_preload.template", "vnf_index": "1" , "name_pattern": "base_vpkg"}],
Brian Freemaneef7c6f2018-11-16 18:42:21 -050097 "vCPEInfra" : [{"isBase" : "true", "template" : "vcpe_infra_preload.template", "name_pattern": "base_infra"}],
98 "vCPEvBNG" : [{"isBase" : "true", "template" : "vcpe_vbng_preload.template", "name_pattern": "base_vbng"}],
99 "vCPEvBRGEMU" : [{"isBase" : "true", "template" : "vcpe_vbrgemu_preload.template", "name_pattern": "base_vbrgemu"}],
100 "vCPEvGMUX" : [{"isBase" : "true", "template" : "vcpe_vgmux_preload.template", "name_pattern": "base_vgmux"}],
101 "vCPEvGW" : [{"isBase" : "true", "template" : "vcpe_vgw_preload.template", "name_pattern": "base_vgw"}],
bdfreeman1421b2a49512018-11-25 07:32:19 -0500102 "vCPEResCust" : [{"isBase" : "true", "template" : "vcpe_vgw_preload.template", "name_pattern": "base_vgw"}],
Jerry Flood3fc36a32017-10-11 11:09:19 -0400103}
DR695Hccff30b2017-02-17 18:44:24 -0500104
Jerry Floodd40619e2017-08-24 09:38:48 -0400105'''
106Used by the Heatbridge Validate Query to A&AI to locate the vserver name
107'''
DR695Hccff30b2017-02-17 18:44:24 -0500108GLOBAL_VALIDATE_NAME_MAPPING = {"vFW" : 'vfw_name_0',
109 "vLB" : 'vlb_name_0',
Jerry Flood3fc36a32017-10-11 11:09:19 -0400110 "vVG" : '',
Brian Freemanabf7ac22018-05-20 19:49:34 -0500111 "vCPE" : 'vgw_name_0',
Brian Freeman108048b2018-05-22 13:13:05 -0500112 "vCPEvGW" : 'vgw_name_0',
bdfreeman1421b2a49512018-11-25 07:32:19 -0500113 "vCPEResCust" : 'vgw_name_0',
Brian Freeman108048b2018-05-22 13:13:05 -0500114 "vCPEvDNS" : 'vdns_name_0',
115 "vCPEvAAA" : 'vaaa_name_0',
116 "vCPEvWEB" : 'vweb_name_0',
117 "vCPEvDHCP" : 'vdhcp_name_0',
Yang Xu875ab322018-11-21 22:38:18 -0500118 "vCPEvGMUX" : 'vgmux_name_0',
Jerry Flood3a169a32017-12-01 12:39:10 -0500119 "vFWSNK" : 'vfw_name_0',
120 "vPKG" : 'vpg_name_0',
Brian Freeman12ff1842019-02-13 13:54:48 -0500121 "vFWCLvFWSNK" : 'vfw_name_0',
122 "vFWCLvPKG" : 'vpg_name_0',
DR695Hccff30b2017-02-17 18:44:24 -0500123 }
Brian Freemaneef7c6f2018-11-16 18:42:21 -0500124
Brian Freemanee02b312019-02-04 20:36:08 -0500125
126
127# Create dictionaries for new MAPPING data to join to original MAPPING data
128GLOBAL_SERVICE_FOLDER_MAPPING2 = {}
129GLOBAL_SERVICE_VNF_MAPPING2 = {}
130GLOBAL_SERVICE_GEN_NEUTRON_NETWORK_MAPPING2 = {}
131GLOBAL_SERVICE_DEPLOYMENT_ARTIFACT_MAPPING2 = {}
132GLOBAL_SERVICE_TEMPLATE_MAPPING2 = {}
133GLOBAL_VALIDATE_NAME_MAPPING2 = {}
134
135
136
137folder=os.path.join('./demo/service_mapping')
138subfolders = [d for d in os.listdir(folder) if os.path.isdir(os.path.join(folder, d))]
139
140for service in subfolders:
141 filepath=os.path.join('./demo/service_mapping', service, 'service_mapping.json')
142 with open(filepath, 'r') as f:
143 service_mappings = json.load(f)
144 for mapping in service_mappings:
145 if mapping == 'GLOBAL_SERVICE_FOLDER_MAPPING':
146 GLOBAL_SERVICE_FOLDER_MAPPING2[service]=service_mappings[mapping][service]
147 if mapping == 'GLOBAL_SERVICE_VNF_MAPPING':
148 GLOBAL_SERVICE_VNF_MAPPING2[service]=service_mappings[mapping][service]
149 if mapping == 'GLOBAL_SERVICE_GEN_NEUTRON_NETWORK_MAPPING':
150 GLOBAL_SERVICE_GEN_NEUTRON_NETWORK_MAPPING2[service]=service_mappings[mapping][service]
151 if mapping == 'GLOBAL_SERVICE_DEPLOYMENT_ARTIFACT_MAPPING':
Brian Freeman12ff1842019-02-13 13:54:48 -0500152 GLOBAL_SERVICE_DEPLOYMENT_ARTIFACT_MAPPING2[service]=service_mappings[mapping][service]
Brian Freemanee02b312019-02-04 20:36:08 -0500153 if mapping == 'GLOBAL_SERVICE_TEMPLATE_MAPPING':
Brian Freeman12ff1842019-02-13 13:54:48 -0500154 # service changes for complex vnf
155 #GLOBAL_SERVICE_TEMPLATE_MAPPING2[service]=service_mappings[mapping][service]
156 for vnftype in service_mappings[mapping]:
157 GLOBAL_SERVICE_TEMPLATE_MAPPING2[vnftype]=service_mappings[mapping][vnftype]
Brian Freemanee02b312019-02-04 20:36:08 -0500158 if mapping == 'GLOBAL_VALIDATE_NAME_MAPPING':
Brian Freeman12ff1842019-02-13 13:54:48 -0500159 # service changes for complex vnf
160 #GLOBAL_VALIDATE_NAME_MAPPING2[service]=service_mappings[mapping][service]
161 for vnftype in service_mappings[mapping]:
162 GLOBAL_VALIDATE_NAME_MAPPING2[vnftype]=service_mappings[mapping][vnftype]
Brian Freemanee02b312019-02-04 20:36:08 -0500163
164# Merge dictionaries
165GLOBAL_SERVICE_FOLDER_MAPPING = dict(GLOBAL_SERVICE_FOLDER_MAPPING.items() + GLOBAL_SERVICE_FOLDER_MAPPING2.items())
166GLOBAL_SERVICE_VNF_MAPPING = dict(GLOBAL_SERVICE_VNF_MAPPING.items() + GLOBAL_SERVICE_VNF_MAPPING2.items())
167GLOBAL_SERVICE_GEN_NEUTRON_NETWORK_MAPPING = dict(GLOBAL_SERVICE_GEN_NEUTRON_NETWORK_MAPPING.items() + GLOBAL_SERVICE_GEN_NEUTRON_NETWORK_MAPPING2.items())
168GLOBAL_SERVICE_DEPLOYMENT_ARTIFACT_MAPPING = dict(GLOBAL_SERVICE_DEPLOYMENT_ARTIFACT_MAPPING.items() + GLOBAL_SERVICE_DEPLOYMENT_ARTIFACT_MAPPING2.items())
169GLOBAL_SERVICE_TEMPLATE_MAPPING = dict(GLOBAL_SERVICE_TEMPLATE_MAPPING.items() + GLOBAL_SERVICE_TEMPLATE_MAPPING2.items())
170GLOBAL_VALIDATE_NAME_MAPPING = dict(GLOBAL_VALIDATE_NAME_MAPPING.items() + GLOBAL_VALIDATE_NAME_MAPPING2.items())