c2493b522d36b54807f6ad03dd30859aae0e5ff1
[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_nfv_2_7_1, get_nfv_3_3_1, get_nfv_4_1_1, 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 def run_import_nfv_2_7_1():
41     nfv_candidate = get_nfv_2_7_1()
42     run(nfv_candidate)
43
44 def run_import_nfv_3_3_1():
45     nfv_candidate = get_nfv_3_3_1()
46     run(nfv_candidate)
47
48 def run_import_nfv_4_1_1():
49     nfv_candidate = get_nfv_4_1_1()
50     run(nfv_candidate)
51
52 def run_import_onap():
53     onap_candidate = get_onap()
54     run(onap_candidate)
55
56
57 def run_import_sol():
58     sol_candidate = get_sol()
59     run(sol_candidate)
60
61
62 if __name__ == '__main__':
63     run_import_normative()
64     # run_import_heat()
65     # run_import_nfv()
66     # run_import_onap()
67     # run_import_sol()