X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_policy_module%2Fcommon%2Fmon_client.py;h=e4f75336aaf02ace3a5463e36b876bfc965b25a4;hb=bfe6988e8ec5ad9283200f46134529cac10e006c;hp=e9216aabb108a3941c29b06ec1b009a3901f8a02;hpb=bb6bdfab64270428f29dfa0f03d9b7c35c9faa90;p=osm%2FPOL.git diff --git a/osm_policy_module/common/mon_client.py b/osm_policy_module/common/mon_client.py index e9216aa..e4f7533 100644 --- a/osm_policy_module/common/mon_client.py +++ b/osm_policy_module/common/mon_client.py @@ -23,7 +23,7 @@ ## import json import logging -import random +from random import SystemRandom from json import JSONDecodeError import yaml @@ -53,7 +53,7 @@ class MonClient: vnfr: object = None, vnfd: object = None, ): - cor_id = random.randint(1, 10e7) + cor_id = SystemRandom().randint(1, 10e7) msg = self._build_create_alarm_payload( cor_id, metric_name, @@ -111,7 +111,7 @@ class MonClient: async def delete_alarm( self, ns_id: str, vnf_member_index: str, vdu_name: str, alarm_uuid: str ): - cor_id = random.randint(1, 10e7) + cor_id = SystemRandom().randint(1, 10e7) msg = self._build_delete_alarm_payload( cor_id, ns_id, vdu_name, vnf_member_index, alarm_uuid ) @@ -180,6 +180,7 @@ class MonClient: if vnfr and vnfd: # TODO: Change for multiple DF support df = vnfd.get("df", [{}])[0] + metric_port = 9100 if "exporters-endpoints" in df: metric_port = df["exporters-endpoints"].get("metric-port", 9100) if metric_name.startswith("kpi_"):