X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_mon%2Fcollector%2Fservice.py;h=eecad4df7b13a9cf8b4d242d2270692ddea8c951;hb=refs%2Fchanges%2F92%2F10192%2F2;hp=29ca13230b78b7d7dc5bae58b662de7be03ba3a4;hpb=c2a005ed542b4bc3bdb7bd47bf3b34b1110e1e0d;p=osm%2FMON.git diff --git a/osm_mon/collector/service.py b/osm_mon/collector/service.py index 29ca132..eecad4d 100644 --- a/osm_mon/collector/service.py +++ b/osm_mon/collector/service.py @@ -49,7 +49,8 @@ VIM_INFRA_COLLECTORS = { "vio": VIOInfraCollector } SDN_INFRA_COLLECTORS = { - "onos": OnosInfraCollector + "onosof": OnosInfraCollector, + "onos_vpls": OnosInfraCollector } @@ -61,8 +62,7 @@ class CollectorService: def _collect_vim_metrics(self, vnfr: dict, vim_account_id: str): # TODO(diazb) Add support for aws - common_db = CommonDbClient(self.conf) - vim_type = common_db.get_vim_account(vim_account_id)['vim_type'] + vim_type = self._get_vim_type(vim_account_id) if vim_type in VIM_COLLECTORS: collector = VIM_COLLECTORS[vim_type](self.conf, vim_account_id) metrics = collector.collect(vnfr) @@ -72,8 +72,7 @@ class CollectorService: log.debug("vimtype %s is not supported.", vim_type) def _collect_vim_infra_metrics(self, vim_account_id: str): - common_db = CommonDbClient(self.conf) - vim_type = common_db.get_vim_account(vim_account_id)['vim_type'] + vim_type = self._get_vim_type(vim_account_id) if vim_type in VIM_INFRA_COLLECTORS: collector = VIM_INFRA_COLLECTORS[vim_type](self.conf, vim_account_id) metrics = collector.collect() @@ -129,8 +128,21 @@ class CollectorService: processes.append(p) p.start() for process in processes: - process.join(timeout=10) + process.join(timeout=20) + for process in processes: + if process.is_alive(): + process.terminate() metrics = [] while not self.queue.empty(): metrics.append(self.queue.get()) return metrics + + def _get_vim_type(self, vim_account_id: str) -> str: + common_db = CommonDbClient(self.conf) + vim_account = common_db.get_vim_account(vim_account_id) + vim_type = vim_account['vim_type'] + if 'config' in vim_account and 'vim_type' in vim_account['config']: + vim_type = vim_account['config']['vim_type'].lower() + if vim_type == 'vio' and 'vrops_site' not in vim_account['config']: + vim_type = 'openstack' + return vim_type