X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_mon%2Fcollector%2Fvnf_collectors%2Fvmware.py;h=be34013a72a05713ae0999289804b7799362738b;hb=refs%2Fchanges%2F08%2F7708%2F1;hp=ba499c7685f5ebe7cd123b7c388975b930ac1e0c;hpb=5ac7c081ca13495185ecf6bdf302c16c25a4b759;p=osm%2FMON.git diff --git a/osm_mon/collector/vnf_collectors/vmware.py b/osm_mon/collector/vnf_collectors/vmware.py index ba499c7..be34013 100644 --- a/osm_mon/collector/vnf_collectors/vmware.py +++ b/osm_mon/collector/vnf_collectors/vmware.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- ## -# Copyright 2016-2017 VMware Inc. +# Copyright 2016-2019 VMware Inc. # This file is part of ETSI OSM # All Rights Reserved. # @@ -32,15 +32,15 @@ import six from pyvcloud.vcd.client import BasicLoginCredentials from pyvcloud.vcd.client import Client +from osm_mon.collector.utils.collector 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'] @@ -98,6 +94,7 @@ class VMwareCollector(BaseVimCollector): admin_passwd = self.admin_password org = 'System' client = Client(host, verify_ssl_certs=False) + client.set_highest_supported_version() client.set_credentials(BasicLoginCredentials(admin_user, org, admin_passwd)) return client @@ -116,7 +113,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