def main(): # empty databases empty_nsd_collection() empty_vnfd_collection() empty_ns_collection() empty_operation_collection() empty_resources_collection() empty_nsir_collection() empty_notification_collection() empty_osm_collection() # path to descriptors folders path = "../../descriptors/" # list of file names that contain ns and vnf descriptors ns_descriptors = ["CDN_all_NSD_0_4.json"] vnf_descriptors = [ "CDN_SPR1_VNFD_0_2.json", "CDN_SPR21_VNFD_0_2.json", "CDN_SPR22_VNFD_0_2.json", "CDN_WEBSERVER_VNFD_0_2.json" ] # NSD SECTION # correspondance of nsdId and nsdCloudifyId nsdCloudifyId = {"vCDN_v02": "unknown"} # for each nsd create record to be inserted nsd_json = {} # load json file here for nsd_file in ns_descriptors: with open(path + nsd_file) as nsd_json: nsd_json = load(nsd_json) nsd_record = { "nsdId": nsd_json["nsd"]["nsdIdentifier"], "nsdCloudifyId": nsdCloudifyId[nsd_json["nsd"]["nsdIdentifier"]], "version": nsd_json["nsd"]["version"], "nsdName": nsd_json["nsd"]["nsdName"], "nsdJson": nsd_json } insert_nsd(nsd_record) # VNFD SECTION # for each nsd create record to be inserted vnfd_json = {} # load json file here for vnfd_file in vnf_descriptors: with open(path + vnfd_file) as vnfd_json: vnfd_json = load(vnfd_json) vnfd_record = { "vnfdId": vnfd_json["vnfdId"], "vnfdVersion": vnfd_json["vnfdVersion"], "vnfdName": vnfd_json["vnfProductName"], "vnfdJson": vnfd_json } insert_vnfd(vnfd_record) log_process.terminate()
def main(): # empty database empty_user_collection() # insert the the admin user (password 'admin' and role 'Admin') default_user = '******' default_password = '******' default_role = 'Admin' user_record = { "username": default_user, "password": hashlib.md5(default_password.encode()).hexdigest(), "role": default_role } insert_user(user_record) log_process.terminate()