projects
/
osm
/
POL.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Coverity-CWE 330: Use of Insufficiently Random Values (137944 Cryptographically weak...
[osm/POL.git]
/
osm_policy_module
/
alarming
/
service.py
diff --git
a/osm_policy_module/alarming/service.py
b/osm_policy_module/alarming/service.py
index
dbc375e
..
f3a316d
100644
(file)
--- a/
osm_policy_module/alarming/service.py
+++ b/
osm_policy_module/alarming/service.py
@@
-22,7
+22,6
@@
# For those usages not covered by the Apache License, Version 2.0 please
# contact: bdiaz@whitestack.com or glavado@whitestack.com
##
# For those usages not covered by the Apache License, Version 2.0 please
# contact: bdiaz@whitestack.com or glavado@whitestack.com
##
-import asyncio
import json
import logging
import operator
import json
import logging
import operator
@@
-47,14
+46,11
@@
log = logging.getLogger(__name__)
class AlarmingService:
class AlarmingService:
- def __init__(self, config: Config
, loop=None
):
+ def __init__(self, config: Config):
self.conf = config
self.conf = config
- if not loop:
- loop = asyncio.get_event_loop()
- self.loop = loop
self.db_client = CommonDbClient(config)
self.db_client = CommonDbClient(config)
- self.mon_client = MonClient(config
, loop=self.loop
)
- self.lcm_client = LcmClient(config
, loop=self.loop
)
+ self.mon_client = MonClient(config)
+ self.lcm_client = LcmClient(config)
async def configure_vnf_alarms(self, nsr_id: str, vnf_member_index=None):
log.info("Configuring vnf alarms for network service %s", nsr_id)
async def configure_vnf_alarms(self, nsr_id: str, vnf_member_index=None):
log.info("Configuring vnf alarms for network service %s", nsr_id)
@@
-132,6
+128,8
@@
class AlarmingService:
threshold=alarm_descriptor["value"],
operation=alarm_descriptor["operation"],
action=str(alarm_action),
threshold=alarm_descriptor["value"],
operation=alarm_descriptor["operation"],
action=str(alarm_action),
+ vnfr=vnfr,
+ vnfd=vnfd,
)
alarm = VnfAlarmRepository.create(
alarm_id=alarm_descriptor["alarm-id"],
)
alarm = VnfAlarmRepository.create(
alarm_id=alarm_descriptor["alarm-id"],
@@
-275,7
+273,14
@@
class AlarmingService:
status,
)
try:
status,
)
try:
- if status == "alarm" and alarm.last_action == "ok":
+ if (
+ status == "alarm"
+ and alarm.last_action == "ok"
+ or (
+ status == "alarm"
+ and alarm.last_action == "insufficient-data"
+ )
+ ):
alarm.id_suffix += 1
alarm.ok_ack = False
if status == "ok" and alarm.last_action == "alarm":
alarm.id_suffix += 1
alarm.ok_ack = False
if status == "ok" and alarm.last_action == "alarm":
@@
-294,7
+299,6
@@
class AlarmingService:
url=action.url,
data=json.dumps(payload),
headers=headers,
url=action.url,
data=json.dumps(payload),
headers=headers,
- verify=False,
timeout=alert_timeout,
)
log.info("Response %s", resp)
timeout=alert_timeout,
)
log.info("Response %s", resp)