summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--catalog/pub/utils/toscaparser/pnfmodel.py3
-rw-r--r--catalog/pub/utils/toscaparser/testdata/pnf/ran-du.csarbin2703 -> 2688 bytes
-rw-r--r--catalog/pub/utils/toscaparser/tests.py5
3 files changed, 6 insertions, 2 deletions
diff --git a/catalog/pub/utils/toscaparser/pnfmodel.py b/catalog/pub/utils/toscaparser/pnfmodel.py
index 1acf6d4c..e092e927 100644
--- a/catalog/pub/utils/toscaparser/pnfmodel.py
+++ b/catalog/pub/utils/toscaparser/pnfmodel.py
@@ -30,10 +30,11 @@ class PnfdInfoModel(BaseInfoModel):
tosca.nodetemplates)
self.basepath = self.get_base_path(tosca)
self.pnf = {}
+ self.get_substitution_mappings(tosca)
self.get_all_cp(nodeTemplates)
def get_substitution_mappings(self, tosca):
- pnf_substitution_mappings = tosca.tpl['topology_template']['substitution_mappings']
+ pnf_substitution_mappings = tosca.tpl['topology_template'].get('substitution_mappings', None)
if pnf_substitution_mappings:
self.pnf['type'] = pnf_substitution_mappings['node_type']
self.pnf['properties'] = pnf_substitution_mappings['properties']
diff --git a/catalog/pub/utils/toscaparser/testdata/pnf/ran-du.csar b/catalog/pub/utils/toscaparser/testdata/pnf/ran-du.csar
index 73210685..45168a96 100644
--- a/catalog/pub/utils/toscaparser/testdata/pnf/ran-du.csar
+++ b/catalog/pub/utils/toscaparser/testdata/pnf/ran-du.csar
Binary files differ
diff --git a/catalog/pub/utils/toscaparser/tests.py b/catalog/pub/utils/toscaparser/tests.py
index 004911d9..8c6f57e9 100644
--- a/catalog/pub/utils/toscaparser/tests.py
+++ b/catalog/pub/utils/toscaparser/tests.py
@@ -58,8 +58,11 @@ class TestToscaparser(TestCase):
self.remove_temp_dir()
csar_path = os.path.dirname(os.path.abspath(__file__)) + "/testdata/pnf/ran-du.csar"
pnfd_json = parse_pnfd(csar_path)
- metadata = json.loads(pnfd_json).get("metadata")
+ pnfd_dict = json.loads(pnfd_json)
+ metadata = pnfd_dict.get("metadata")
self.assertEqual("RAN_DU", metadata.get("template_name", ""))
+ descriptor_id = pnfd_dict["pnf"]["properties"]["descriptor_id"]
+ self.assertEqual(1, descriptor_id)
def test_nsd_parse(self):
self.remove_temp_dir()