summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/resources/scripts/sdcBePy/tosca/models/normativeElementsList.py
diff options
context:
space:
mode:
authork.kedron <k.kedron@partner.samsung.com>2020-03-05 13:12:27 +0100
committerOfir Sonsino <ofir.sonsino@intl.att.com>2020-06-24 06:01:11 +0000
commitcb30f3a566b73c78c3ea666acfcd3f288098684a (patch)
tree38cd1acb83ddde2b927485611d130bbeec3c1a4b /catalog-be/src/main/resources/scripts/sdcBePy/tosca/models/normativeElementsList.py
parentbdbfc2e460ccb561c3e174260b2908b974996d4f (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/models/normativeElementsList.py')
-rw-r--r--catalog-be/src/main/resources/scripts/sdcBePy/tosca/models/normativeElementsList.py76
1 files changed, 76 insertions, 0 deletions
diff --git a/catalog-be/src/main/resources/scripts/sdcBePy/tosca/models/normativeElementsList.py b/catalog-be/src/main/resources/scripts/sdcBePy/tosca/models/normativeElementsList.py
new file mode 100644
index 0000000000..cfef95d427
--- /dev/null
+++ b/catalog-be/src/main/resources/scripts/sdcBePy/tosca/models/normativeElementsList.py
@@ -0,0 +1,76 @@
+from sdcBePy.tosca.models.normativeElementCandidate import NormativeElementCandidate
+
+
+def get_normative_element_candidate_list(base_file_location):
+ return [
+ get_data(base_file_location),
+ get_capability(base_file_location),
+ get_relationship(base_file_location),
+ get_interface_lifecycle(base_file_location),
+ get_categories(base_file_location)
+ ]
+
+
+def get_normative_element_with_metadata_list(base_file_location):
+ return [
+ get_group(base_file_location),
+ get_policy(base_file_location)
+ ]
+
+
+def get_data(base_file_location="/"):
+ return NormativeElementCandidate(base_file_location + "data-types/",
+ "/sdc2/rest/v1/catalog/uploadType/datatypes",
+ "dataTypes",
+ "dataTypesZip")
+
+
+def get_capability(base_file_location="/"):
+ return NormativeElementCandidate(base_file_location + "capability-types/",
+ "/sdc2/rest/v1/catalog/uploadType/capability",
+ "capabilityTypes",
+ "capabilityTypeZip")
+
+
+def get_relationship(base_file_location="/"):
+ return NormativeElementCandidate(base_file_location + "relationship-types/",
+ "/sdc2/rest/v1/catalog/uploadType/relationship",
+ "relationshipTypes",
+ "relationshipTypeZip")
+
+
+def get_interface_lifecycle(base_file_location="../../../import/tosca/"):
+ return NormativeElementCandidate(base_file_location + "interface-lifecycle-types/",
+ "/sdc2/rest/v1/catalog/uploadType/interfaceLifecycle",
+ "interfaceLifecycleTypes",
+ "interfaceLifecycleTypeZip")
+
+
+def get_categories(base_file_location="/"):
+ return NormativeElementCandidate(base_file_location + "categories/",
+ "/sdc2/rest/v1/catalog/uploadType/categories",
+ "categoryTypes",
+ "categoriesZip")
+
+
+def get_group(base_file_location="/"):
+ return NormativeElementCandidate(base_file_location + "group-types/",
+ "/sdc2/rest/v1/catalog/uploadType/grouptypes",
+ "groupTypes",
+ "groupTypesZip",
+ with_metadata=True)
+
+
+def get_policy(base_file_location="/"):
+ return NormativeElementCandidate(base_file_location + "policy-types/",
+ "/sdc2/rest/v1/catalog/uploadType/policytypes",
+ "policyTypes",
+ "policyTypesZip",
+ with_metadata=True)
+
+
+def get_annotation(base_file_location="/"):
+ return NormativeElementCandidate(base_file_location + "annotation-types",
+ "/sdc2/rest/v1/catalog/uploadType/annotationtypes",
+ "annotationTypesZip",
+ "annotationTypes")