From: Benjamin Diaz Date: Fri, 23 Nov 2018 21:36:28 +0000 (-0300) Subject: Fixes bug in collection of vnf-metric X-Git-Tag: v5.0.0~3 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=909b8c66a6a7dcd20ecfec513427f77afc839ec9;p=osm%2FMON.git Fixes bug in collection of vnf-metric Metrics declared in vnf-configuration block were not building correctly the juju application name. Change-Id: I952a0a2716edc7a0ea42ae1254ddc5047bcfff89 Signed-off-by: Benjamin Diaz --- diff --git a/osm_mon/collector/collectors/juju.py b/osm_mon/collector/collectors/juju.py index 589c355..34d9217 100644 --- a/osm_mon/collector/collectors/juju.py +++ b/osm_mon/collector/collectors/juju.py @@ -46,8 +46,8 @@ class VCACollector(BaseCollector): vnf_member_index = vnfr['member-vnf-index-ref'] vnfd = self.common_db.get_vnfd(vnfr['vnfd-id']) metrics = [] + nsr = self.common_db.get_nsr(nsr_id) for vdur in vnfr['vdur']: - nsr = self.common_db.get_nsr(nsr_id) vdu = next( filter(lambda vdu: vdu['id'] == vdur['vdu-id-ref'], vnfd['vdu']) ) @@ -60,13 +60,13 @@ class VCACollector(BaseCollector): log.debug("Metric: %s", measure) metric = Metric(nsr_id, vnf_member_index, vdur['name'], measure['key'], float(measure['value'])) metrics.append(metric) - if 'vnf-configuration' in vnfd and 'metrics' in vnfd['vnf-configuration']: - vnf_name_vca = self.n2vc.FormatApplicationName(nsr['name'], vnf_member_index, vdur['vdu-id-ref']) - measures = self.loop.run_until_complete(self.n2vc.GetMetrics(vca_model_name, vnf_name_vca)) - log.debug('Metrics: %s', metrics) - for measure_list in measures.values(): - for measure in measure_list: - log.debug("Metric: %s", measure) - metric = Metric(nsr_id, vnf_member_index, vdur['name'], measure['key'], float(measure['value'])) - metrics.append(metric) + if 'vnf-configuration' in vnfd and 'metrics' in vnfd['vnf-configuration']: + vnf_name_vca = self.n2vc.FormatApplicationName(nsr['name'], vnf_member_index, 'vnfd') + measures = self.loop.run_until_complete(self.n2vc.GetMetrics(vca_model_name, vnf_name_vca)) + log.debug('Metrics: %s', metrics) + for measure_list in measures.values(): + for measure in measure_list: + log.debug("Metric: %s", measure) + metric = Metric(nsr_id, vnf_member_index, '', measure['key'], float(measure['value'])) + metrics.append(metric) return metrics