From: dliu5 Date: Mon, 21 Nov 2022 13:24:26 +0000 (+0800) Subject: Fix the objref issue. X-Git-Tag: 2.0.0-rc2~4 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;ds=sidebyside;h=refs%2Fchanges%2F29%2F9729%2F3;hp=51b371f14f46196e0cfea60264361364e3cc9f57;p=pti%2Fo2.git Fix the objref issue. Issue-ID: INF-369 Issue-ID: INF-370 Signed-off-by: dliu5 Change-Id: I608bb6e975f0b354160a8be73518837be8eab5d0 --- 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'