Feature 10509 manual scaling for native k8s charm

Also includes improvements for scale function

Change-Id: I23f51b8c1b219681841d0b1f7f4db3a0d9ed4c7b
Signed-off-by: aktas <emin.aktas@ulakhaberlesme.com.tr>
diff --git a/osm_lcm/data_utils/nsr.py b/osm_lcm/data_utils/nsr.py
index f62b0b4..006713c 100644
--- a/osm_lcm/data_utils/nsr.py
+++ b/osm_lcm/data_utils/nsr.py
@@ -22,6 +22,20 @@
 # contact: fbravo@whitestack.com
 ##
 
+from osm_lcm.lcm_utils import get_iterable
+
 
 def get_vlds(nsr):
     return nsr.get("vld", ())
+
+
+def get_deployed_kdu(nsr_deployed, kdu_name, member_vnf_index):
+    deployed_kdu = None
+    index = None
+    for index, deployed_kdu in enumerate(get_iterable(nsr_deployed, "K8s")):
+        if (
+            kdu_name == deployed_kdu["kdu-name"]
+            and deployed_kdu["member-vnf-index"] == member_vnf_index
+        ):
+            break
+    return deployed_kdu, index