Make vcloud api version compatible for different vCDs
[osm/MON.git] / osm_mon / collector / vnf_collectors / vmware.py
index ba499c7..9322408 100644 (file)
@@ -32,15 +32,15 @@ import six
 from pyvcloud.vcd.client import BasicLoginCredentials
 from pyvcloud.vcd.client import Client
 
+from osm_mon.collector.utils import CollectorUtils
 from osm_mon.collector.vnf_collectors.base_vim import BaseVimCollector
 from osm_mon.collector.vnf_metric import VnfMetric
-from osm_mon.core.auth import AuthManager
 from osm_mon.core.common_db import CommonDbClient
 from osm_mon.core.config import Config
 
 log = logging.getLogger(__name__)
 
-API_VERSION = '5.9'
+API_VERSION = '27.0'
 
 PERIOD_MSEC = {'HR': 3600000,
                'DAY': 86400000,
@@ -62,15 +62,11 @@ METRIC_MAPPINGS = {
     "packets_sent": "net:Aggregate of all instances|packetsTxPerSec",
 }
 
-# Disable warnings from self-signed certificates.
-requests.packages.urllib3.disable_warnings()
-
 
 class VMwareCollector(BaseVimCollector):
     def __init__(self, config: Config, vim_account_id: str):
         super().__init__(config, vim_account_id)
         self.common_db = CommonDbClient(config)
-        self.auth_manager = AuthManager(config)
         vim_account = self.get_vim_account(vim_account_id)
         self.vrops_site = vim_account['vrops_site']
         self.vrops_user = vim_account['vrops_user']
@@ -116,7 +112,7 @@ class VMwareCollector(BaseVimCollector):
            return - dict with vim account details
         """
         vim_account = {}
-        vim_account_info = self.auth_manager.get_credentials(vim_account_id)
+        vim_account_info = CollectorUtils.get_credentials(vim_account_id)
 
         vim_account['name'] = vim_account_info.name
         vim_account['vim_tenant_name'] = vim_account_info.tenant_name