fix problem vnfpkg internal-vlds without name 26/9026/1
authortierno <alfonso.tiernosepulveda@telefonica.com>
Thu, 21 May 2020 15:09:22 +0000 (15:09 +0000)
committertierno <alfonso.tiernosepulveda@telefonica.com>
Wed, 3 Jun 2020 09:48:12 +0000 (09:48 +0000)
Change-Id: I06fba0317f13e6691b7d9c41177d1178dbd26d2b
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
osm_nbi/descriptor_topics.py
osm_nbi/instance_topics.py

index c1c1f63..fdf46e5 100644 (file)
@@ -569,13 +569,14 @@ class VnfdTopic(DescriptorTopic):
         vld_names = []  # For detection of duplicated VLD names
         for ivld in get_iterable(indata.get("internal-vld")):
             # BEGIN Detection of duplicated VLD names
-            ivld_name = ivld["name"]
-            if ivld_name in vld_names:
-                raise EngineException("Duplicated VLD name '{}' in vnfd[id={}]:internal-vld[id={}]"
-                                      .format(ivld["name"], indata["id"], ivld["id"]),
-                                      http_code=HTTPStatus.UNPROCESSABLE_ENTITY)
-            else:
-                vld_names.append(ivld_name)
+            ivld_name = ivld.get("name")
+            if ivld_name:
+                if ivld_name in vld_names:
+                    raise EngineException("Duplicated VLD name '{}' in vnfd[id={}]:internal-vld[id={}]"
+                                          .format(ivld["name"], indata["id"], ivld["id"]),
+                                          http_code=HTTPStatus.UNPROCESSABLE_ENTITY)
+                else:
+                    vld_names.append(ivld_name)
             # END Detection of duplicated VLD names
             for icp in get_iterable(ivld.get("internal-connection-point")):
                 icp_mark = False
index b73d85f..6ac3bce 100644 (file)
@@ -596,7 +596,7 @@ class NsLcmOpTopic(BaseTopic):
 
             for in_ivld in get_iterable(in_vnfd.get("internal-vld")):
                 for ivld in get_iterable(vnfd.get("internal-vld")):
-                    if in_ivld["name"] == ivld["name"] or in_ivld["name"] == ivld["id"]:
+                    if in_ivld["name"] in (ivld["id"], ivld.get("name")):
                         for in_icp in get_iterable(in_ivld.get("internal-connection-point")):
                             for icp in ivld["internal-connection-point"]:
                                 if in_icp["id-ref"] == icp["id-ref"]: