From b2bda65ba534ae72433f914f70384666e369ea0a Mon Sep 17 00:00:00 2001 From: dliu5 Date: Mon, 21 Nov 2022 21:24:26 +0800 Subject: [PATCH 1/1] Fix the objref issue. Issue-ID: INF-369 Issue-ID: INF-370 Signed-off-by: dliu5 Change-Id: I608bb6e975f0b354160a8be73518837be8eab5d0 --- o2app/entrypoints/redis_eventconsumer.py | 9 ++++++--- o2common/config/config.py | 8 ++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/o2app/entrypoints/redis_eventconsumer.py b/o2app/entrypoints/redis_eventconsumer.py index 98e198b..cc34099 100644 --- a/o2app/entrypoints/redis_eventconsumer.py +++ b/o2app/entrypoints/redis_eventconsumer.py @@ -30,6 +30,8 @@ r = redis.Redis(**config.get_redis_host_and_port()) apibase = config.get_o2ims_api_base() api_monitoring_base = config.get_o2ims_monitoring_api_base() +monitor_api_version = config.get_o2ims_monitoring_api_v1() +inventory_api_version = config.get_o2ims_inventory_api_v1() def main(): @@ -66,8 +68,8 @@ def handle_changed(m, bus): datastr = m['data'] data = json.loads(datastr) logger.info('ResourceChanged with cmd:{}'.format(data)) - ref = apibase + '/resourcePools/' + data['resourcePoolId'] +\ - '/resources/' + data['id'] + ref = apibase + inventory_api_version + '/resourcePools/' + \ + data['resourcePoolId'] + '/resources/' + data['id'] cmd = imscmd.PubMessage2SMO(data=Message2SMO( id=data['id'], ref=ref, eventtype=data['notificationEventType'], @@ -85,7 +87,8 @@ def handle_changed(m, bus): datastr = m['data'] data = json.loads(datastr) logger.info('AlarmEventChanged with cmd:{}'.format(data)) - ref = api_monitoring_base + '/alarms/' + data['id'] + ref = api_monitoring_base + \ + monitor_api_version + '/alarms/' + data['id'] cmd = imscmd.PubAlarm2SMO(data=AlarmEvent2SMO( id=data['id'], ref=ref, eventtype=data['notificationEventType'], diff --git a/o2common/config/config.py b/o2common/config/config.py index 54d6d0f..e36c889 100644 --- a/o2common/config/config.py +++ b/o2common/config/config.py @@ -70,6 +70,14 @@ def get_o2ims_api_base(): return get_root_api_base() + 'o2ims-infrastructureInventory' +def get_o2ims_monitoring_api_v1(): + return '/v1' + + +def get_o2ims_inventory_api_v1(): + return '/v1' + + def get_o2ims_monitoring_api_base(): return get_root_api_base() + 'o2ims-infrastructureMonitoring' -- 2.16.6