SOL006 patch for POL
[osm/POL.git] / osm_policy_module / utils / vnfd.py
index 234d864..0ecbda1 100644 (file)
@@ -28,14 +28,13 @@ class VnfdUtils:
 
     @staticmethod
     def get_mgmt_vdu(vnfd: dict):
-        if 'cp' in vnfd['mgmt-interface']:
-            for vdu in vnfd['vdu']:
-                for interface in vdu['interface']:
-                    if 'external-connection-point-ref' in interface:
-                        if interface['external-connection-point-ref'] == vnfd['mgmt-interface']['cp']:
-                            return vdu
-        elif 'vdu-id' in vnfd['mgmt-interface']:
-            for vdu in vnfd['vdu']:
-                if vdu['id'] == vnfd['mgmt-interface']['vdu-id']:
+        if 'mgmt-cp' in vnfd:
+            mgmt_cp = vnfd['mgmt-cp']
+            mgmt_cp_vdu_id = None
+            for cpd in vnfd.get('ext-cpd', ()):
+                if cpd.get('id') == mgmt_cp:
+                    mgmt_cp_vdu_id = cpd.get('int-cpd', {}).get('vdu-id')
+            for vdu in vnfd.get('vdu', ()):
+                if vdu.get('id') == mgmt_cp_vdu_id:
                     return vdu
-        raise ManagementVduNotFound("Management vdu not founr in vnfd %s", vnfd['id'])
+        raise ManagementVduNotFound("Management vdu not found in vnfd %s", vnfd['id'])