# See the License for the specific language governing permissions and
# limitations under the License.
+import json
+import os.path
+from itertools import chain
+from collections import defaultdict
+
+
GLOBAL_PRELOAD_PARAMETERS = {
# heat template parameter values common to all heat template continaing these parameters
"defaults" : {
"vsn_flavor_name" : "${GLOBAL_INJECTED_VM_FLAVOR}",
},
"vpkg_preload.template": {
- "unprotected_private_net_id" : "vofwlsnk_unprotected${hostid}",
- "unprotected_private_subnet_id" : "vofwlsnk_unprotected_sub${hostid}",
+ # vFWSNK_ prepended to vpkg since the default behoir for vFWSNK tempalte is to concatenate vnf_name and network_name
+ "unprotected_private_net_id" : "vFWSNK_vofwlsnk_unprotected${hostid}",
+ "unprotected_private_subnet_id" : "vFWSNK_vofwlsnk_unprotected_sub${hostid}",
"unprotected_private_net_cidr" : "192.168.10.0/24",
"protected_private_net_cidr" : "192.168.20.0/24",
"vfw_private_ip_0" : "192.168.10.100",
}
}
}
+
+
+# Create dictionaries for new MAPPING data to join to original MAPPING data
+GLOBAL_PRELOAD_PARAMETERS2 = {}
+
+
+folder=os.path.join('/var/opt/ONAP/demo/preload_data')
+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('/var/opt/ONAP/demo/preload_data', service, 'preload_data.json')
+ with open(filepath, 'r') as f:
+ preload_data = json.load(f)
+ GLOBAL_PRELOAD_PARAMETERS2['Demo']=preload_data
+
+
+# Merge dictionaries
+# preload_data.json is for Demo key in GLOBAL_PRELOAD_PARAMETERS
+
+
+GLOBAL_PRELOAD_PARAMETERS3 = {'Demo':{}}
+
+for k, v in chain(GLOBAL_PRELOAD_PARAMETERS['Demo'].items(), GLOBAL_PRELOAD_PARAMETERS2['Demo'].items()):
+ GLOBAL_PRELOAD_PARAMETERS3['Demo'][k] = v
+# print(k, v)
+
+GLOBAL_PRELOAD_PARAMETERS = dict(GLOBAL_PRELOAD_PARAMETERS.items() + GLOBAL_PRELOAD_PARAMETERS3.items())
+
+#print GLOBAL_PRELOAD_PARAMETERS
+