X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=osm_lcm%2Fns.py;h=a11a2fa8036eb5a0b9133a2845163f6fe37cce71;hb=5b2c45aad0bbfdd4410ed3912ff6a21cea1216a9;hp=ca856614f4c6ea3d15372bcc17a30e934851a70e;hpb=6d9a7511c261e9da05766aa32dd635462f762c64;p=osm%2FLCM.git diff --git a/osm_lcm/ns.py b/osm_lcm/ns.py index ca85661..a11a2fa 100644 --- a/osm_lcm/ns.py +++ b/osm_lcm/ns.py @@ -208,7 +208,6 @@ class NsLcm(LcmBase): # self.logger.debug('_on_update_n2vc_db(table={}, filter={}, path={}, updated_data={}' # .format(table, filter, path, updated_data)) - try: nsr_id = filter.get('_id') @@ -223,6 +222,7 @@ class NsLcm(LcmBase): # vcaStatus db_dict = dict() db_dict['vcaStatus'] = status_dict + await self.n2vc.update_vca_status(db_dict['vcaStatus']) # update configurationStatus for this VCA try: @@ -3372,6 +3372,24 @@ class NsLcm(LcmBase): except Exception as e: return 'FAIL', 'Error executing action {}: {}'.format(primitive, e) + async def vca_status_refresh(self, nsr_id, nslcmop_id): + """ + Updating the vca_status with latest juju information in nsrs record + :param: nsr_id: Id of the nsr + :param: nslcmop_id: Id of the nslcmop + :return: None + """ + + self.logger.debug("Task ns={} action={} Enter".format(nsr_id, nslcmop_id)) + db_nsr = self.db.get_one("nsrs", {"_id": nsr_id}) + + for vca_index, _ in enumerate(db_nsr['_admin']['deployed']['VCA']): + table, filter, path = "nsrs", {"_id": nsr_id}, "_admin.deployed.VCA.{}.".format(vca_index) + await self._on_update_n2vc_db(table, filter, path, {}) + + self.logger.debug("Task ns={} action={} Exit".format(nsr_id, nslcmop_id)) + self.lcm_tasks.remove("ns", nsr_id, nslcmop_id, "ns_vca_status_refresh") + async def action(self, nsr_id, nslcmop_id): # Try to lock HA task here task_is_locked_by_me = self.lcm_tasks.lock_HA('ns', 'nslcmops', nslcmop_id) @@ -3896,7 +3914,7 @@ class NsLcm(LcmBase): vdu_count_index=None, ee_descriptor_id=ee_descriptor_id) result, result_detail = await self._ns_execute_primitive( - ee_id, primitive_name, primitive_params, vca_type) + ee_id, primitive_name, primitive_params, vca_type=vca_type) self.logger.debug(logging_text + "vnf_config_primitive={} Done with result {} {}".format( vnf_config_primitive, result, result_detail)) # Update operationState = COMPLETED | FAILED @@ -4161,7 +4179,7 @@ class NsLcm(LcmBase): vdu_count_index=None, ee_descriptor_id=ee_descriptor_id) result, result_detail = await self._ns_execute_primitive( - ee_id, primitive_name, primitive_params, vca_type) + ee_id, primitive_name, primitive_params, vca_type=vca_type) self.logger.debug(logging_text + "vnf_config_primitive={} Done with result {} {}".format( vnf_config_primitive, result, result_detail)) # Update operationState = COMPLETED | FAILED