Feature-9904: Enhancing NG-UI to enable Juju operational view dashboard
[osm/LCM.git] / osm_lcm / tests / test_ns.py
index c0dda15..28b8fbe 100644 (file)
@@ -342,6 +342,25 @@ class TestMyNS(asynctest.TestCase):
         self.assertEqual(return_value, expected_value)
         # print("scale_result: {}".format(self.db.get_one("nslcmops", {"_id": nslcmop_id}).get("detailed-status")))
 
+    async def test_vca_status_refresh(self):
+        nsr_id = descriptors.test_ids["TEST-A"]["ns"]
+        nslcmop_id = descriptors.test_ids["TEST-A"]["instantiate"]
+        await self.my_ns.vca_status_refresh(nsr_id, nslcmop_id)
+        expected_value = dict()
+        return_value = dict()
+        vnf_descriptors = self.db.get_list("vnfds")
+        for i, _ in enumerate(vnf_descriptors):
+            for j, value in enumerate(vnf_descriptors[i]["df"]):
+                if "lcm-operations-configuration" in vnf_descriptors[i]["df"][j]:
+                    if "day1-2" in value["lcm-operations-configuration"]["operate-vnf-op-config"]:
+                        for k, v in enumerate(value["lcm-operations-configuration"]["operate-vnf-op-config"]["day1-2"]):
+                            if "juju" in v["execution-environment-list"][k]:
+                                expected_value = self.db.get_list("nsrs")[i]["vcaStatus"]
+                                await self.my_ns._on_update_n2vc_db("nsrs", {"_id": nsr_id},
+                                                                    "_admin.deployed.VCA.0", {})
+                                return_value = self.db.get_list("nsrs")[i]["vcaStatus"]
+        self.assertEqual(return_value, expected_value)
+
     # Test _retry_or_skip_suboperation()
     # Expected result:
     # - if a suboperation's 'operationState' is marked as 'COMPLETED', SUBOPERATION_STATUS_SKIP is expected