Code Review
/
pti
/
o2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Update model of resourcetype and set empty for the gLocationId of the resourcepool...
[pti/o2.git]
/
o2ims
/
service
/
command
/
registration_handler.py
diff --git
a/o2ims/service/command/registration_handler.py
b/o2ims/service/command/registration_handler.py
index
40cd390
..
0c6bbef
100644
(file)
--- a/
o2ims/service/command/registration_handler.py
+++ b/
o2ims/service/command/registration_handler.py
@@
-42,7
+42,7
@@
def registry_to_smo(
ocloud = uow.oclouds.get(data.id)
if ocloud is None:
return
ocloud = uow.oclouds.get(data.id)
if ocloud is None:
return
- logger.debug('O-Cloud Global UUID: {}'.format(ocloud.global
c
loudId))
+ logger.debug('O-Cloud Global UUID: {}'.format(ocloud.global
C
loudId))
ocloud_dict = ocloud.serialize()
if data.notificationEventType == NotificationEventEnum.CREATE:
register_smo(uow, ocloud_dict)
ocloud_dict = ocloud.serialize()
if data.notificationEventType == NotificationEventEnum.CREATE:
register_smo(uow, ocloud_dict)
@@
-68,15
+68,24
@@
def register_smo(uow, ocloud_data):
@retry((ConnectionRefusedError), tries=2, delay=2)
def call_smo(reg_data: dict):
@retry((ConnectionRefusedError), tries=2, delay=2)
def call_smo(reg_data: dict):
+ smo_token = conf.DEFAULT.smo_token_data
+ smo_token_info = {
+ 'iss': 'o2ims',
+ 'aud': 'smo',
+ 'smo_token_payload': smo_token,
+ 'smo_token_type': 'jwt',
+ 'smo_token_expiration': '',
+ 'smo_token_algo': 'RS256'
+ }
+
callback_data = json.dumps({
callback_data = json.dumps({
- '
consumerSubscriptionId': reg_data['globalc
loudId'],
- '
notificationEventType': 'CREATE'
,
- '
objectRef
': config.get_api_url(),
- '
postObjectState': reg_data
+ '
globalCloudId': reg_data['globalC
loudId'],
+ '
oCloudId': reg_data['oCloudId']
,
+ '
IMS_EP
': config.get_api_url(),
+ '
smo_token_data': smo_token_info
})
logger.info('URL: {}, data: {}'.format(
conf.DEFAULT.smo_register_url, callback_data))
})
logger.info('URL: {}, data: {}'.format(
conf.DEFAULT.smo_register_url, callback_data))
-
o = urlparse(conf.DEFAULT.smo_register_url)
conn = http.client.HTTPConnection(o.netloc)
headers = {'Content-type': 'application/json'}
o = urlparse(conf.DEFAULT.smo_register_url)
conn = http.client.HTTPConnection(o.netloc)
headers = {'Content-type': 'application/json'}