6 from sdcBePy.common import logger
7 from sdcBePy.common.logger import error_and_exit
8 from sdcBePy.common.normative.main import process_element_list, process_type_list
9 from sdcBePy.common.sdcBeProxy import SdcBeProxy
10 from sdcBePy.tosca.main import get_args, usage
11 from sdcBePy.tosca.models.normativeElementsList import get_normative_element_candidate_list, \
12 get_normative_element_with_metadata_list
13 from sdcBePy.tosca.models.normativeToUpdateList import TypesToUpdate, get_heat_and_normative_to_update_list, \
14 get_nfv_onap_sol_to_update_list
18 scheme, be_host, be_port, admin_user, _, debug = get_args()
21 update_onap_version = False
24 print('Disabling debug mode')
25 logger.debugFlag = debug
28 sdc_be_proxy = SdcBeProxy(be_host, be_port, scheme, admin_user, debug=debug)
29 except AttributeError:
33 # use to run script form this dir (not like the command)
34 # base_file_location = os.getcwd() + "/../../../../import/tosca/"
35 base_file_location = os.getcwd() + "/"
36 logger.debug("working directory =" + base_file_location)
37 process_element_list(get_normative_element_candidate_list(base_file_location), sdc_be_proxy)
38 process_element_list(get_normative_element_with_metadata_list(base_file_location), sdc_be_proxy)
40 all_types = get_all_types()
42 heat_and_normative_list = get_heat_and_normative_to_update_list(all_types, base_file_location)
43 process_type_list(heat_and_normative_list, sdc_be_proxy, update_version)
45 nfv_onap_sol_list = get_nfv_onap_sol_to_update_list(all_types, base_file_location)
46 process_type_list(nfv_onap_sol_list, sdc_be_proxy, update_onap_version)
48 logger.log("Updating end ->", "All normatives updated successfully!")
49 error_and_exit(0, None)
53 path = os.path.dirname(__file__)
54 return TypesToUpdate([path + "/../data/typesToUpgrade.json",
55 path + "/../data/onapTypesToUpgrade.json"])
58 if __name__ == "__main__":