Refactoring the sdc-BE-init python scripts
[sdc.git] / catalog-be / src / main / resources / scripts / sdcBePy / tosca / imports / runNormativeType.py
1 #!/usr/bin/env python3
2
3 import sys
4
5 from sdcBePy.common.normative.toscaTypes import process_and_create_normative_types
6 from sdcBePy.tosca.main import get_args, usage
7 from sdcBePy.tosca.models.normativeTypesList import get_normative, get_heat, get_nfv, get_onap, get_sol
8
9
10 def run(candidate, exit_on_success=True):
11     scheme, be_host, be_port, admin_user, update_version, debug = get_args()
12     try:
13         process_and_create_normative_types(candidate,
14                                            scheme,
15                                            be_host,
16                                            be_port,
17                                            admin_user,
18                                            update_version=update_version,
19                                            debug=debug,
20                                            exit_on_success=exit_on_success)
21     except AttributeError:
22         usage()
23         sys.exit(3)
24
25
26 def run_import_normative():
27     normative_candidate = get_normative()
28     run(normative_candidate)
29
30
31 def run_import_heat():
32     heat_candidate = get_heat()
33     run(heat_candidate)
34
35
36 def run_import_nfv():
37     nfv_candidate = get_nfv()
38     run(nfv_candidate)
39
40
41 def run_import_onap():
42     onap_candidate = get_onap()
43     run(onap_candidate)
44
45
46 def run_import_sol():
47     sol_candidate = get_sol()
48     run(sol_candidate)
49
50
51 if __name__ == '__main__':
52     run_import_normative()
53     # run_import_heat()
54     # run_import_nfv()
55     # run_import_onap()
56     # run_import_sol()