Integration issues of o1 48/7348/3
authorHariomGupta <hariom.g@hcl.com>
Tue, 14 Dec 2021 08:33:39 +0000 (14:03 +0530)
committerHariomGupta <hariom.g@hcl.com>
Tue, 14 Dec 2021 17:33:23 +0000 (23:03 +0530)
IssueID:  ODUHIGH-394

Signed-off-by: HariomGupta <hariom.g@hcl.com>
Change-Id: Ib3507bff70f3ac87b3fef04a28d67bc551b0d9f7

build/scripts/load_yang.sh
src/o1/NrCellDuCb.cpp
src/o1/PmInterface.h
src/o1/RrmPolicyCb.cpp
src/o1/ves/PerfMeasurementEvent.cpp
src/o1/ves/SliceMeasurementEvent.cpp

index d837210..03b999f 100755 (executable)
 CURRENT_DIR=$PWD
 ROOT_DIR=$CURRENT_DIR/../../
 
+if [ -d "$ROOT_DIR/bin/odu/config" ]
+then
+       CONFIG_PATH=$ROOT_DIR/bin/odu/config/
+       echo "CONFIG_PATH = $CONFIG_PATH"
+else
+       CONFIG_PATH=$ROOT_DIR/build/config/
+       echo "CONFIG_PATH = $CONFIG_PATH"
+fi
+       echo "CONFIG_PATH = $CONFIG_PATH"
+
 #load yand models
 echo "### loading yang model ###"
 sysrepoctl -i $ROOT_DIR/build/yang/o-ran-sc-odu-alarm-v1.yang
 sysrepoctl -i $ROOT_DIR/build/yang/o-ran-sc-du-hello-world.yang
 sysrepoctl -i $ROOT_DIR/build/yang/o-ran-sc-odu-interface-v1.yang
+
 echo "### loading yang model Done###"
 
 #load initial configuration
 echo "### loading initial configuration ###"
-sysrepocfg --import=$ROOT_DIR/bin/odu/config/startup_config.xml -v 3 --datastore running --module  o-ran-sc-odu-interface-v1
-sysrepocfg --import=$ROOT_DIR/bin/odu/config/nacm_config.xml -v 3 --datastore running --module  ietf-netconf-acm
-sysrepocfg --import=$ROOT_DIR/bin/odu/config/netconf_server_ipv6.xml -v 3 --datastore running --module  ietf-netconf-server
+
+sysrepocfg --import=$CONFIG_PATH/startup_config.xml -v 3 --datastore running --module  o-ran-sc-odu-interface-v1
+sysrepocfg --import=$CONFIG_PATH/nacm_config.xml -v 3 --datastore running --module  ietf-netconf-acm
+sysrepocfg --import=$CONFIG_PATH/netconf_server_ipv6.xml -v 3 --datastore running --module  ietf-netconf-server
 echo "### loading initial configuration done ###"
 
 ################################################################################
index 62a2fb9..3eb86ef 100644 (file)
@@ -1,3 +1,4 @@
+
 /*******************************************************************************
 ################################################################################
 #   Copyright (c) [2020-2021] [HCL Technologies Ltd.]                          #
@@ -226,20 +227,23 @@ void NrCellDuCb::updateParams(string &parent, string &leaf, string &val)
          {
             memset(cellParams.plmnList[memberNum].mcc, \
                   '\0', MCC_LEN);
-            cellParams.plmnList[memberNum].mcc[0] = stoi(val.substr(0,1).c_str(),0,10);
-            cellParams.plmnList[memberNum].mcc[1] = stoi(val.substr(1,1).c_str(),0,10);
-            cellParams.plmnList[memberNum].mcc[2] = stoi(val.substr(2,1).c_str(),0,10);
-            O1_LOG("\nO1 NrCellDuCb : cellParams.plmnList[%d].mcc[2]  = %c",
+            cellParams.plmnList[memberNum].mcc[0] = std::stoi(val.substr(0,1).c_str(),0,10);
+            cellParams.plmnList[memberNum].mcc[1] = std::stoi(val.substr(1,1).c_str(),0,10);
+            cellParams.plmnList[memberNum].mcc[2] = std::stoi(val.substr(2,1).c_str(),0,10);
+            O1_LOG("\nO1 NrCellDuCb : cellParams.plmnList[%d].mcc[2]  = %d",
                   memberNum, cellParams.plmnList[memberNum].mcc[2]);
          }
         else if(leaf == "mnc")
          {
            memset(cellParams.plmnList[memberNum].mnc, \
                   '\0', MNC_LEN);
-            cellParams.plmnList[memberNum].mnc[0] = stoi(val.substr(0,1).c_str(),0,10);
-            cellParams.plmnList[memberNum].mnc[1] = stoi(val.substr(1,1).c_str(),0,10);
-            cellParams.plmnList[memberNum].mnc[2] = stoi(val.substr(2,1).c_str(),0,10);
-            O1_LOG("\nO1 NrCellDuCb : cellParams.plmnList[%d].mnc[1]  = %c",
+            cellParams.plmnList[memberNum].mnc[0] = std::stoi(val.substr(0,1).c_str(),0,10);
+            cellParams.plmnList[memberNum].mnc[1] = std::stoi(val.substr(1,1).c_str(),0,10);
+            if(strlen(val.c_str())>2)
+            {
+               cellParams.plmnList[memberNum].mnc[2] = std::stoi(val.substr(2,1).c_str(),0,10);
+            }
+            O1_LOG("\nO1 NrCellDuCb : cellParams.plmnList[%d].mnc[1]  = %d",
                   memberNum, cellParams.plmnList[memberNum].mnc[1]);
          }
          else if(leaf == "sst")
@@ -255,11 +259,11 @@ void NrCellDuCb::updateParams(string &parent, string &leaf, string &val)
                   '\0', SD_LEN);
 
             cellParams.plmnList[memberNum].sd[0] = \
-                    stoi(val.substr(0,2).c_str(),0,16);
+                    std::stoi(val.substr(0,2).c_str(),0,16);
             cellParams.plmnList[memberNum].sd[1] = \
-                    stoi(val.substr(2,2).c_str(),0,16);
+                    std::stoi(val.substr(2,2).c_str(),0,16);
             cellParams.plmnList[memberNum].sd[2] = \
-                    stoi(val.substr(4,2).c_str(),0,16);
+                    std::stoi(val.substr(4,2).c_str(),0,16);
             O1_LOG("\nO1 NrCellDuCb : cellParams.plmnList[%d].sd[2]  = %d",
                     memberNum, cellParams.plmnList[memberNum].sd[SD_LEN-1]);
          }
@@ -387,6 +391,7 @@ changed val=%s", change->new_val()->val_to_string().c_str());
    }
    catch( const std::exception& e ) {
       O1_LOG("\nO1 rannetworkCb exception : %s\n", e.what());
+      return SR_ERR_INTERNAL;
    }
 
    return SR_ERR_OK;
index b822c5f..e97e3c7 100644 (file)
@@ -32,11 +32,11 @@ typedef struct
 {
   uint32_t sd:24;
   uint8_t sst;
-}SliceId;
+}SNSSAI;
 
 
 typedef struct {
-   SliceId networkSliceIdentifier;
+   SNSSAI networkSliceIdentifier;
    double DRB_UEThpDl_SNSSAI;
    double DRB_UEThpUl_SNSSAI;
 }SliceMetricRecord;
index 5186ab0..e6b602e 100644 (file)
@@ -181,10 +181,8 @@ bool RrmPolicyCb::updateParams(string &parent, string &leafNode, string &val)
             rrmPolicy[policyNum].rRMPolicyMemberList[memberNum].mcc[0] = std::stoi(val.substr(0,1).c_str(),0,10);
             rrmPolicy[policyNum].rRMPolicyMemberList[memberNum].mcc[1] = std::stoi(val.substr(1,1).c_str(),0,10);
             rrmPolicy[policyNum].rRMPolicyMemberList[memberNum].mcc[2] = std::stoi(val.substr(2,1).c_str(),0,10);
-            //strncpy((char *)rrmPolicy[policyNum].rRMPolicyMemberList[memberNum].mcc, \
-                           val.c_str(), MCC_LEN);
             O1_LOG("\nO1 RrmPolicyCb::updateParams rrmPolicy[%d]."
-                  "rRMPolicyMemberList[%d].mcc[2] = %c", policyNum, memberNum, \
+                  "rRMPolicyMemberList[%d].mcc[2] = %d", policyNum, memberNum, \
                   rrmPolicy[policyNum].rRMPolicyMemberList[memberNum].mcc[2]);
          }
         else if(leafNode == "mnc")
@@ -193,11 +191,12 @@ bool RrmPolicyCb::updateParams(string &parent, string &leafNode, string &val)
                   '\0', MNC_LEN);
             rrmPolicy[policyNum].rRMPolicyMemberList[memberNum].mnc[0] = std::stoi(val.substr(0,1).c_str(),0,10);
             rrmPolicy[policyNum].rRMPolicyMemberList[memberNum].mnc[1] = std::stoi(val.substr(1,1).c_str(),0,10);
-            rrmPolicy[policyNum].rRMPolicyMemberList[memberNum].mnc[2] = std::stoi(val.substr(2,1).c_str(),0,10);
-           //strncpy((char *) rrmPolicy[policyNum].rRMPolicyMemberList[memberNum].mnc, \
-                   val.c_str(), MNC_LEN);
-            O1_LOG("\nO1 RrmPolicyCb::updateParams rrmPolicy[%d]."
-                     "rRMPolicyMemberList[%d].mnc[1] = %c", policyNum, memberNum, \
+            if(strlen(val.c_str())>2)
+            {
+               rrmPolicy[policyNum].rRMPolicyMemberList[memberNum].mnc[2] = std::stoi(val.substr(2,1).c_str(),0,10);
+            }
+           O1_LOG("\nO1 RrmPolicyCb::updateParams rrmPolicy[%d]."
+                     "rRMPolicyMemberList[%d].mnc[1] = %d", policyNum, memberNum, \
                      rrmPolicy[policyNum].rRMPolicyMemberList[memberNum].mnc[1]);
          }
          else if(leafNode == "sst")
@@ -267,6 +266,9 @@ int RrmPolicyCb::module_change(sysrepo::S_Session sess, \
                                     void *private_data)
 {
    char change_path[MAX_LEN];
+   policyNum = 0;
+   policyIndex = 0;
+   policyMemberListNum =0;
 
    try {
       O1_LOG("\nO1 RrmPolicyCb : Notification %s", NetconfUtils::evToStr(event));
@@ -302,6 +304,7 @@ changed val=%s", change->new_val()->val_to_string().c_str());
    }
    catch( const std::exception& e ) {
       O1_LOG("\nO1 RrmPolicyCb exception : %s\n", e.what());
+      return SR_ERR_INTERNAL;
    }
    return SR_ERR_OK;
 }
index c8bff7e..98be603 100644 (file)
@@ -74,7 +74,8 @@ void PerfMeasurementEvent::getConfig()
  ******************************************************************/
 void PerfMeasurementEvent::createUrl()
 {
-   mVesUrl = "http://" + mVesServerIp + ":" + mVesServerPort + "/eventListener/v7/events";
+   mVesUrl = "https://" + mVesServerIp + ":" + mVesServerPort + "/eventListener/v7";
+   O1_LOG("\nURL=%s", mVesUrl.c_str());
 }
 
 /**********************************************************************
index 53fc4f5..59a229e 100644 (file)
@@ -24,7 +24,7 @@
 #include "PmInterface.h"
 
 #define MEASUREMENT_INTERVAL 60
-#define MEASUREMENT_FIELDS_VERSION 4.0
+#define MEASUREMENT_FIELDS_VERSION "4.0"
 
 /* Constructor*/
 SliceMeasurementEvent::SliceMeasurementEvent() 
@@ -87,9 +87,8 @@ bool SliceMeasurementEvent::prepareEventFields(const Message* msg)
         for (size_t i{0}; i < sliceList.size(); i++)            
         {
             cJSON *Slice = JsonHelper::createNode();
-           char networkId[12];
-           sprintf(networkId,"%d%x\n", sliceList[i].networkSliceIdentifier.sst,sliceList[i].networkSliceIdentifier.sd);
-            //O1_LOG("sliceList[i].networkSliceIdentifier  %s",networkId);
+            char networkSliceId[7] = {0};
+            sprintf(networkSliceId,"%06X", sliceList[i].networkSliceIdentifier.sd);
             if(Slice == 0)
             {
                 ret = false;
@@ -114,7 +113,7 @@ bool SliceMeasurementEvent::prepareEventFields(const Message* msg)
             }
             else if (JsonHelper::addNodeToObject(Slice, \
                                                 "networkSliceIdentifier", \
-                                                 networkId) == 0)
+                                                 networkSliceId) == 0)
             {
                 ret = false;
             }