From: Benjamin Diaz Date: Wed, 12 Jun 2019 19:18:55 +0000 (-0300) Subject: Replaces use of vdu_name for vdu_id and vdu_count_index in VCACollector X-Git-Tag: v6.0.0~1 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=f3d1c668ad8ffe5163847fc88effb2b411352e10;p=osm%2FMON.git Replaces use of vdu_name for vdu_id and vdu_count_index in VCACollector vdu_name param is no longer configured by LCM, causing issues during collection of VCA metrics. To fix that, it has been replaced by currently configured params: vdu_id and vdu_count_index, which are obtained from the vdur. Fixes bug 762 Change-Id: Ic8cc7e8572bfc6d78493fdceea32375c6f3a379e Signed-off-by: Benjamin Diaz --- diff --git a/osm_mon/collector/vnf_collectors/juju.py b/osm_mon/collector/vnf_collectors/juju.py index 6c5e314..b8c8b4e 100644 --- a/osm_mon/collector/vnf_collectors/juju.py +++ b/osm_mon/collector/vnf_collectors/juju.py @@ -57,8 +57,10 @@ class VCACollector(BaseCollector): ) if 'vdu-configuration' in vdu and 'metrics' in vdu['vdu-configuration']: try: - vca_deployment_info = self.get_vca_deployment_info(nsr_id, vnf_member_index, vdur['name']) - except VcaDeploymentInfoNotFound: + vca_deployment_info = self.get_vca_deployment_info(nsr_id, vnf_member_index, vdur['vdu-id-ref'], + vdur['count-index']) + except VcaDeploymentInfoNotFound as e: + log.warning(repr(e)) continue measures = self.loop.run_until_complete(self.n2vc.GetMetrics(vca_deployment_info['model'], vca_deployment_info['application'])) @@ -71,8 +73,9 @@ class VCACollector(BaseCollector): metrics.append(metric) if 'vnf-configuration' in vnfd and 'metrics' in vnfd['vnf-configuration']: try: - vca_deployment_info = self.get_vca_deployment_info(nsr_id, vnf_member_index, None) - except VcaDeploymentInfoNotFound: + vca_deployment_info = self.get_vca_deployment_info(nsr_id, vnf_member_index) + except VcaDeploymentInfoNotFound as e: + log.warning(repr(e)) return metrics measures = self.loop.run_until_complete(self.n2vc.GetMetrics(vca_deployment_info['model'], vca_deployment_info['application'])) @@ -84,11 +87,20 @@ class VCACollector(BaseCollector): metrics.append(metric) return metrics - def get_vca_deployment_info(self, nsr_id, vnf_member_index, vdur_name): + def get_vca_deployment_info(self, nsr_id, vnf_member_index, vdu_id=None, vdu_count=0): nsr = self.common_db.get_nsr(nsr_id) for vca_deployment in nsr["_admin"]["deployed"]["VCA"]: if vca_deployment: - if vca_deployment['member-vnf-index'] == vnf_member_index and vca_deployment['vdu_name'] == vdur_name: - return vca_deployment - raise VcaDeploymentInfoNotFound("VCA deployment info for nsr_id {}, index {} and vdur_name {} not found." - .format(nsr_id, vnf_member_index, vdur_name)) + if vdu_id is None: + if vca_deployment['member-vnf-index'] == vnf_member_index and vca_deployment['vdu_id'] is None: + return vca_deployment + else: + if vca_deployment['member-vnf-index'] == vnf_member_index and \ + vca_deployment['vdu_id'] == vdu_id and vca_deployment['vdu_count_index'] == vdu_count: + return vca_deployment + raise VcaDeploymentInfoNotFound( + "VCA deployment info for nsr_id {}, index {}, vdu_id {} and vdu_count_index {} not found.".format( + nsr_id, + vnf_member_index, + vdu_id, + vdu_count))