Bug 1422 - NSR record contain stale vcaStatus after successful completion of day...
[osm/LCM.git] / osm_lcm / ns.py
index fab078f..5b0b7b0 100644 (file)
@@ -3607,16 +3607,19 @@ class NsLcm(LcmBase):
                 ee_id, vca_type = self._look_for_deployed_vca(nsr_deployed["VCA"], member_vnf_index=vnf_index,
                                                               vdu_id=vdu_id, vdu_count_index=vdu_count_index,
                                                               ee_descriptor_id=ee_descriptor_id)
-                db_nslcmop_notif = {"collection": "nslcmops",
-                                    "filter": {"_id": nslcmop_id},
-                                    "path": "admin.VCA"}
+                for vca_index, vca_deployed in enumerate(db_nsr['_admin']['deployed']['VCA']):
+                    if vca_deployed.get("member-vnf-index") == vnf_index:
+                        db_dict = {"collection": "nsrs",
+                                   "filter": {"_id": nsr_id},
+                                   "path": "_admin.deployed.VCA.{}.".format(vca_index)}
+                        break
                 nslcmop_operation_state, detailed_status = await self._ns_execute_primitive(
                     ee_id,
                     primitive=primitive_name,
                     primitive_params=self._map_primitive_params(config_primitive_desc, primitive_params, desc_params),
                     timeout=timeout_ns_action,
                     vca_type=vca_type,
-                    db_dict=db_nslcmop_notif)
+                    db_dict=db_dict)
 
             db_nslcmop_update["detailed-status"] = detailed_status
             error_description_nslcmop = detailed_status if nslcmop_operation_state == "FAILED" else ""