Feature 10908: LCM process NS update request
[osm/LCM.git] / osm_lcm / data_utils / vnfd.py
index f8c11ca..ffcb582 100644 (file)
@@ -169,3 +169,25 @@ def get_juju_ee_ref(vnfd, entity_id):
         get_configuration(vnfd, entity_id).get("execution-environment-list", []),
         lambda ee: "juju" in ee,
     )
+
+
+def find_software_version(vnfd: dict) -> str:
+    """Find the sotware version in the VNFD descriptors
+
+    Args:
+        vnfd (dict): Descriptor as a dictionary
+
+    Returns:
+        software-version (str)
+    """
+
+    default_sw_version = "1.0"
+
+    if vnfd.get("vnfd"):
+        vnfd = vnfd["vnfd"]
+
+    if vnfd.get("software-version"):
+        return vnfd["software-version"]
+
+    else:
+        return default_sw_version