Fix the objref issue. 29/9729/3
authordliu5 <david.liu@windriver.com>
Mon, 21 Nov 2022 13:24:26 +0000 (21:24 +0800)
committerdliu5 <david.liu@windriver.com>
Tue, 22 Nov 2022 01:30:08 +0000 (09:30 +0800)
Issue-ID: INF-369
Issue-ID: INF-370

Signed-off-by: dliu5 <david.liu@windriver.com>
Change-Id: I608bb6e975f0b354160a8be73518837be8eab5d0

o2app/entrypoints/redis_eventconsumer.py
o2common/config/config.py

index 98e198b..cc34099 100644 (file)
@@ -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'],
index 54d6d0f..e36c889 100644 (file)
@@ -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'