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
/
common
/
lcm_client.py
diff --git
a/osm_policy_module/common/lcm_client.py
b/osm_policy_module/common/lcm_client.py
index
102b0dc
..
e78420d
100644
(file)
--- a/
osm_policy_module/common/lcm_client.py
+++ b/
osm_policy_module/common/lcm_client.py
@@
-21,7
+21,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 datetime
import json
import logging
import datetime
import json
import logging
@@
-40,12
+39,9
@@
class LcmClient:
Client to communicate with LCM through the message bus.
"""
Client to communicate with LCM through the message bus.
"""
- def __init__(self, config: Config
, loop=None
):
+ def __init__(self, config: Config):
self.db_client = CommonDbClient(config)
self.msg_bus = MessageBusClient(config)
self.db_client = CommonDbClient(config)
self.msg_bus = MessageBusClient(config)
- if not loop:
- loop = asyncio.get_event_loop()
- self.loop = loop
async def scale(
self, nsr_id: str, scaling_group_name: str, vnf_member_index: str, action: str
async def scale(
self, nsr_id: str, scaling_group_name: str, vnf_member_index: str, action: str
@@
-133,8
+129,16
@@
class LcmClient:
return nslcmop
async def heal(
return nslcmop
async def heal(
- self, nsr_id: str, vnfinstance_id: str, vdur_name: str, vdu_id: str,
- vnf_member_index: str, heal_type: str, day1: bool, count_index: int):
+ self,
+ nsr_id: str,
+ vnfinstance_id: str,
+ vdur_name: str,
+ vdu_id: str,
+ vnf_member_index: str,
+ heal_type: str,
+ day1: bool,
+ count_index: int,
+ ):
"""
Sends healing action to LCM through the message bus.
"""
Sends healing action to LCM through the message bus.
@@
-159,8
+163,15
@@
class LcmClient:
)
nsr = self.db_client.get_nsr(nsr_id)
nslcmop = self._generate_nslcmop_heal(
)
nsr = self.db_client.get_nsr(nsr_id)
nslcmop = self._generate_nslcmop_heal(
- nsr_id, vnfinstance_id, vdur_name, vdu_id, vnf_member_index, heal_type, day1,
- count_index, nsr['_admin']
+ nsr_id,
+ vnfinstance_id,
+ vdur_name,
+ vdu_id,
+ vnf_member_index,
+ heal_type,
+ day1,
+ count_index,
+ nsr["_admin"],
)
self.db_client.create_nslcmop(nslcmop)
log.debug("Sending heal action message: %s", json.dumps(nslcmop))
)
self.db_client.create_nslcmop(nslcmop)
log.debug("Sending heal action message: %s", json.dumps(nslcmop))
@@
-213,12
+224,12
@@
class LcmClient:
{
"run-day1": day1,
"count-index": count_index,
{
"run-day1": day1,
"count-index": count_index,
- "vdu-id": vdu_id
+ "vdu-id": vdu_id
,
}
}
- ]
- }
+ ]
,
+ }
,
}
}
- ]
+ ]
,
}
nslcmop = {
}
nslcmop = {
@@
-239,8
+250,8
@@
class LcmClient:
"nsInstance": "/osm/nslcm/v1/ns_instances/" + nsr_id,
},
"_admin": {
"nsInstance": "/osm/nslcm/v1/ns_instances/" + nsr_id,
},
"_admin": {
- "projects_read": admin[
'projects_read'
],
- "projects_write": admin[
'projects_write']
- }
+ "projects_read": admin[
"projects_read"
],
+ "projects_write": admin[
"projects_write"],
+ }
,
}
return nslcmop
}
return nslcmop