diff options
author | k.kedron <k.kedron@partner.samsung.com> | 2020-03-05 13:12:27 +0100 |
---|---|---|
committer | Ofir Sonsino <ofir.sonsino@intl.att.com> | 2020-06-24 06:01:11 +0000 |
commit | cb30f3a566b73c78c3ea666acfcd3f288098684a (patch) | |
tree | 38cd1acb83ddde2b927485611d130bbeec3c1a4b /catalog-be/src/main/resources/scripts/sdcBePy/tosca/imports/runNormativeElement.py | |
parent | bdbfc2e460ccb561c3e174260b2908b974996d4f (diff) |
Refactoring the sdc-BE-init python scripts
Deeper refactoring of python script:
- create the python package with init script
- support for python 3.x
- reuse code
- new design
- support for .json conf file
- update the docker chef script
Issue-ID: SDC-2784
Signed-off-by: Krystian Kedron <k.kedron@partner.samsung.com>
Change-Id: I02169eb7d0e3e90851ba1811536d1712c3b4145f
Diffstat (limited to 'catalog-be/src/main/resources/scripts/sdcBePy/tosca/imports/runNormativeElement.py')
-rw-r--r-- | catalog-be/src/main/resources/scripts/sdcBePy/tosca/imports/runNormativeElement.py | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/catalog-be/src/main/resources/scripts/sdcBePy/tosca/imports/runNormativeElement.py b/catalog-be/src/main/resources/scripts/sdcBePy/tosca/imports/runNormativeElement.py new file mode 100644 index 0000000000..1bdb1504b2 --- /dev/null +++ b/catalog-be/src/main/resources/scripts/sdcBePy/tosca/imports/runNormativeElement.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python3 + +import sys + +from sdcBePy.common.normative.toscaElements import process_and_create_normative_element +from sdcBePy.tosca.main import get_args, usage +from sdcBePy.tosca.models.normativeElementsList import get_capability, get_data, get_relationship, \ + get_interface_lifecycle, get_categories, get_group, get_policy, get_annotation + + +def run(candidate): + scheme, be_host, be_port, admin_user, _, debug = get_args() + try: + process_and_create_normative_element(candidate, + scheme, be_host, be_port, admin_user, + debug=debug, + exit_on_success=True) + except AttributeError: + usage() + sys.exit(3) + + +def run_import_data(): + data_candidate = get_data() + run(data_candidate) + + +def run_import_capabilities(): + capability_candidate = get_capability() + run(capability_candidate) + + +def run_import_relationship(): + relationship_candidate = get_relationship() + run(relationship_candidate) + + +def run_import_interface_lifecycle(): + interface_lifecycle_candidate = get_interface_lifecycle() + run(interface_lifecycle_candidate) + + +def run_import_categories(): + categories_candidate = get_categories() + run(categories_candidate) + + +def run_import_group(): + group_candidate = get_group() + run(group_candidate) + + +def run_import_policy(): + policy_candidate = get_policy() + run(policy_candidate) + + +def run_import_annotation(): + annotation_candidate = get_annotation() + run(annotation_candidate) + + +if __name__ == '__main__': + run_import_data() + # run_import_capabilities() + # run_import_relationship() + # run_import_interface_lifecycle() + # run_import_categories() + # run_import_group() + # run_import_policy() + # run_import_annotation() |