Fix DES interface in PCI opt 10/114810/1
authorkrishnaa96 <krishna.moorthy6@wipro.com>
Thu, 12 Nov 2020 09:58:42 +0000 (15:28 +0530)
committerkrishnaa96 <krishna.moorthy6@wipro.com>
Thu, 12 Nov 2020 09:58:42 +0000 (15:28 +0530)
Issue-ID: OPTFRA-871
Signed-off-by: krishnaa96 <krishna.moorthy6@wipro.com>
Change-Id: Ie9a6ff2012f544cfe88db6b102b72c399a2c6186

apps/pci/optimizers/solver/ml_model.py
test/apps/pci_optimization/des_result.json

index 3e12387..952708d 100644 (file)
@@ -16,6 +16,8 @@
 # -------------------------------------------------------------------------
 #
 
+import json
+
 from osdf.adapters.dcae import des
 from osdf.adapters.dcae.des import DESException
 from osdf.config.base import osdf_config
@@ -53,7 +55,7 @@ class MlModel(object):
         request_data = self.config['DES']['filter']
         request_data['cell_id'] = cell_id
         try:
-            result = des.extract_data(service_id, request_data)
+            result = des.extract_data(service_id, json.dumps(request_data))
         except DESException as e:
             error_log.error("Error while calling DES {}".format(e))
             return 0, 0
@@ -63,7 +65,7 @@ class MlModel(object):
 
         ho_list = []
         for pm_data in result:
-            ho = sum([int(meas['hashMap']['InterEnbOutAtt_X2HO']) for meas in pm_data['additionalMeasurements']])
+            ho = pm_data['overallHoAtt']
             ho_list.append(ho)
 
         return sum(ho_list) / len(ho_list), ho_list[0]
index 2083ade..9209acf 100644 (file)
@@ -1,86 +1,18 @@
 [
   [
   {
-    "additionalMeasurements": [
-               {
-               "hashMap":{
-                  "networkId":"plmnid1",
-                  "InterEnbOutAtt_X2HO":"300",
-                  "InterEnbOutSucc_X2HO":"290"
-               },
-               "name":"Chn0004"
-            },
-            {
-               "hashMap":{
-                  "InterEnbOutAtt_X2HO":"1000",
-                  "InterEnbOutSucc_X2HO":"170"
-               },
-               "name":"Chn0001"
-            }
-
-        ]
+    "overallHoAtt": 1300
   },
   {
-    "additionalMeasurements": [
-               {
-               "hashMap":{
-                  "networkId":"plmnid1",
-                  "InterEnbOutAtt_X2HO":"300",
-                  "InterEnbOutSucc_X2HO":"290"
-               },
-               "name":"Chn0004"
-            },
-            {
-               "hashMap":{
-                  "InterEnbOutAtt_X2HO":"250",
-                  "InterEnbOutSucc_X2HO":"170"
-               },
-               "name":"Chn0001"
-            }
-
-        ]
+    "overallHoAtt": 550
   }
   ],
   [
   {
-    "additionalMeasurements": [
-               {
-               "hashMap":{
-                  "networkId":"plmnid1",
-                  "InterEnbOutAtt_X2HO":"200",
-                  "InterEnbOutSucc_X2HO":"290"
-               },
-               "name":"Chn0007"
-            },
-            {
-               "hashMap":{
-                  "InterEnbOutAtt_X2HO":"250",
-                  "InterEnbOutSucc_X2HO":"170"
-               },
-               "name":"Chn0005"
-            }
-
-        ]
+    "overallHoAtt": 450
   },
   {
-    "additionalMeasurements": [
-               {
-               "hashMap":{
-                  "networkId":"plmnid1",
-                  "InterEnbOutAtt_X2HO":"150",
-                  "InterEnbOutSucc_X2HO":"290"
-               },
-               "name":"Chn0007"
-            },
-            {
-               "hashMap":{
-                  "InterEnbOutAtt_X2HO":"250",
-                  "InterEnbOutSucc_X2HO":"170"
-               },
-               "name":"Chn0005"
-            }
-
-        ]
+    "overallHoAtt": 400
   }
   ]
-]
\ No newline at end of file
+]