X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_mon%2Fcollector%2Fvnf_collectors%2Fvrops%2Fvrops_helper.py;h=eadd5c7d21d164a37cf9916e3041496737b5554a;hb=a84ec1f1cc94028173d4f028766eece6171cd0e7;hp=219632664e29139d5bdb7d31e366a4f6f5446a3b;hpb=8e4179facf22c8096992f0a83caeec9f2f4996c7;p=osm%2FMON.git diff --git a/osm_mon/collector/vnf_collectors/vrops/vrops_helper.py b/osm_mon/collector/vnf_collectors/vrops/vrops_helper.py index 2196326..eadd5c7 100644 --- a/osm_mon/collector/vnf_collectors/vrops/vrops_helper.py +++ b/osm_mon/collector/vnf_collectors/vrops/vrops_helper.py @@ -44,10 +44,17 @@ METRIC_MULTIPLIERS = { class vROPS_Helper: - def __init__(self, vrops_site="https://vrops", vrops_user="", vrops_password=""): + def __init__( + self, + vrops_site="https://vrops", + vrops_user="", + vrops_password="", + verify_ssl=False, + ): self.vrops_site = vrops_site self.vrops_user = vrops_user self.vrops_password = vrops_password + self.verify_ssl = verify_ssl def get_vrops_token(self): """Fetches token from vrops""" @@ -55,7 +62,10 @@ class vROPS_Helper: headers = {"Content-Type": "application/json", "Accept": "application/json"} req_body = {"username": self.vrops_user, "password": self.vrops_password} resp = requests.post( - self.vrops_site + auth_url, json=req_body, verify=False, headers=headers + self.vrops_site + auth_url, + json=req_body, + verify=self.verify_ssl, + headers=headers, ) if resp.status_code != 200: log.error( @@ -78,7 +88,9 @@ class vROPS_Helper: } resource_list = [] - resp = requests.get(self.vrops_site + api_url, verify=False, headers=headers) + resp = requests.get( + self.vrops_site + api_url, verify=self.verify_ssl, headers=headers + ) if resp.status_code != 200: log.error( @@ -103,7 +115,6 @@ class vROPS_Helper: return resource_list def get_metrics(self, vdu_mappings={}, monitoring_params={}, vnfr=None, tags={}): - monitoring_keys = {} # Collect the names of all the metrics we need to query for metric_entry in monitoring_params: @@ -132,7 +143,6 @@ class vROPS_Helper: vdu_mappings = sanitized_vdu_mappings try: - # Now we can make a single call to vROPS to collect all relevant metrics for resources we need to monitor api_url = ( "/suite-api/api/resources/stats?IntervalType=MINUTES&IntervalCount=1" @@ -146,7 +156,7 @@ class vROPS_Helper: } resp = requests.get( - self.vrops_site + api_url, verify=False, headers=headers + self.vrops_site + api_url, verify=self.verify_ssl, headers=headers ) if resp.status_code != 200: