From: HariomGupta Date: Wed, 24 Nov 2021 09:17:05 +0000 (+0530) Subject: Cell and Network slicing configuration over o1. X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=6178d5e32f0c57e198de80afc23b92c635e4f6df;p=o-du%2Fl2.git Cell and Network slicing configuration over o1. IssueID: ODUHIGH-383 Signed-off-by: HariomGupta Change-Id: I0808a76b956cb214aede6917ab9e9a88b5324817 --- diff --git a/src/5gnrrlc/rlc_msg_hdl.c b/src/5gnrrlc/rlc_msg_hdl.c index 0495a44c1..0e2aa41bf 100644 --- a/src/5gnrrlc/rlc_msg_hdl.c +++ b/src/5gnrrlc/rlc_msg_hdl.c @@ -974,18 +974,18 @@ uint8_t sendSlicePmToDu(SlicePmList *sliceStats) * recpord of this snssai * */ -bool rlcFindSliceEntry(uint32_t snssaiVal, uint8_t *snssaiIdx, SlicePmList *sliceStats) +bool rlcFindSliceEntry(SliceIdentifier snssaiVal, uint8_t *snssaiIdx, SlicePmList *sliceStats) { uint8_t cntSlices = sliceStats->numSlice; for(*snssaiIdx = 0;(*snssaiIdx) < cntSlices; (*snssaiIdx)++) { - if(snssaiVal == sliceStats->sliceRecord[*snssaiIdx].networkSliceIdentifier) + if((snssaiVal.sst == sliceStats->sliceRecord[*snssaiIdx].networkSliceIdentifier.sst)&& + (snssaiVal.sd == sliceStats->sliceRecord[*snssaiIdx].networkSliceIdentifier.sd)) { return TRUE; } } - DU_LOG("\nERROR --> RLC: Total no of Slice exhausted!"); return FALSE; } @@ -1013,7 +1013,7 @@ uint8_t BuildSliceReportToDu(uint8_t snssaiCnt) RlcTptPerSnssai *snssaiNode = NULLP; Direction dir = DIR_UL; SlicePmList *sliceStats = NULLP; /*Slice metric */ - uint32_t snssaiVal = 0; + SliceIdentifier snssaiVal ; uint8_t snssaiIdx = 0; if(snssaiCnt == 0) @@ -1049,12 +1049,11 @@ uint8_t BuildSliceReportToDu(uint8_t snssaiCnt) while(node) { - snssaiVal = 0; snssaiIdx = 0; snssaiNode = (RlcTptPerSnssai *)node->node; - memcpy(&snssaiVal, snssaiNode->snssai, sizeof(Snssai)); - + snssaiVal.sst = snssaiNode->snssai->sst; + snssaiVal.sd = snssaiNode->snssai->sd[2]+snssaiNode->snssai->sd[1]*10+snssaiNode->snssai->sd[0]*100; if(rlcFindSliceEntry(snssaiVal, &snssaiIdx, sliceStats) == FALSE) { sliceStats->sliceRecord[snssaiIdx].networkSliceIdentifier = snssaiVal; diff --git a/src/5gnrrlc/rlc_utils.h b/src/5gnrrlc/rlc_utils.h index 2bb5fba78..6f4b955bc 100755 --- a/src/5gnrrlc/rlc_utils.h +++ b/src/5gnrrlc/rlc_utils.h @@ -1815,7 +1815,7 @@ RlcTptPerSnssai* rlcHandleSnssaiTputlist(RlcCb *gCb, Snssai *snssai,\ uint8_t rlcCalculateTputPerSnssai(CmLListCp *snssaiList, Direction dir); uint8_t rlcDelTputSnssaiList(RlcCb *gCb, Direction dir); uint8_t BuildSliceReportToDu(uint8_t snssaiCnt); -bool rlcFindSliceEntry(uint32_t snssaiVal, uint8_t *snssaiIdx,\ +bool rlcFindSliceEntry(SliceIdentifier snssaiVal, uint8_t *snssaiIdx,\ SlicePmList *sliceStats); #ifdef LTE_L2_MEAS diff --git a/src/cm/du_app_rlc_inf.h b/src/cm/du_app_rlc_inf.h index 519862def..dfed87452 100644 --- a/src/cm/du_app_rlc_inf.h +++ b/src/cm/du_app_rlc_inf.h @@ -274,10 +274,16 @@ typedef struct rrcDeliveryStatus uint16_t triggeringMessage; }RrcDeliveryStatus; +typedef struct +{ + uint32_t sd:24; + uint8_t sst; +}SliceIdentifier; + /*Pm Metric for NW Slicing from RLC to DUAPP*/ typedef struct slicePm { - uint32_t networkSliceIdentifier; + SliceIdentifier networkSliceIdentifier; double ThpDl; double ThpUl; }SlicePm; diff --git a/src/cu_stub/cu_stub.c b/src/cu_stub/cu_stub.c index 0b9edb307..50ec5fc01 100644 --- a/src/cu_stub/cu_stub.c +++ b/src/cu_stub/cu_stub.c @@ -24,7 +24,7 @@ #include "du_log.h" #ifdef O1_ENABLE -#include "ConfigInterface.h" +#include "CmInterface.h" #endif #define CU_ID 1 diff --git a/src/du_app/du_cell_mgr.c b/src/du_app/du_cell_mgr.c index 531fa6864..cb7439d06 100644 --- a/src/du_app/du_cell_mgr.c +++ b/src/du_app/du_cell_mgr.c @@ -34,7 +34,7 @@ #ifdef O1_ENABLE #include "AlarmInterface.h" -#include "ConfigInterface.h" +#include "CmInterface.h" #endif diff --git a/src/du_app/du_cfg.c b/src/du_app/du_cfg.c index 3dd16d59d..be006395c 100644 --- a/src/du_app/du_cfg.c +++ b/src/du_app/du_cfg.c @@ -53,8 +53,9 @@ #include "BWP-UplinkCommon.h" #ifdef O1_ENABLE -#include "ConfigInterface.h" +#include "CmInterface.h" extern StartupConfig g_cfg; +extern NRCellDU cellParams; #endif char encBuf[ENC_BUF_MAX_LEN]; @@ -154,8 +155,14 @@ uint8_t readMacCfg() /* DL carrier configuration */ duCfgParam.macCellCfg.dlCarrCfg.pres = TRUE; +#ifdef O1_ENABLE + duCfgParam.macCellCfg.dlCarrCfg.bw = cellParams.bSChannelBwUL; + duCfgParam.macCellCfg.dlCarrCfg.freq = cellParams.bSChannelBwDL; +#else duCfgParam.macCellCfg.dlCarrCfg.bw = NR_BANDWIDTH; duCfgParam.macCellCfg.dlCarrCfg.freq = NR_DL_ARFCN; + +#endif duCfgParam.macCellCfg.dlCarrCfg.k0[0] = 1; duCfgParam.macCellCfg.dlCarrCfg.k0[1] = 1; duCfgParam.macCellCfg.dlCarrCfg.k0[2] = 1; @@ -189,11 +196,17 @@ uint8_t readMacCfg() /* SSB configuration */ duCfgParam.macCellCfg.ssbCfg.ssbPbchPwr = SSB_PBCH_PWR; duCfgParam.macCellCfg.ssbCfg.bchPayloadFlag = BCH_PAYLOAD; - duCfgParam.macCellCfg.ssbCfg.scsCmn = NR_SCS; duCfgParam.macCellCfg.ssbCfg.ssbOffsetPointA = OFFSET_TO_POINT_A; duCfgParam.macCellCfg.ssbCfg.betaPss = BETA_PSS; +#ifdef O1_ENABLE + duCfgParam.macCellCfg.ssbCfg.scsCmn = cellParams.ssbSubCarrierSpacing; + duCfgParam.macCellCfg.ssbCfg.ssbPeriod = cellParams.ssbPeriodicity; + duCfgParam.macCellCfg.ssbCfg.ssbScOffset = cellParams.ssbOffset; +#else + duCfgParam.macCellCfg.ssbCfg.scsCmn = NR_SCS; duCfgParam.macCellCfg.ssbCfg.ssbPeriod = SSB_PRDCTY_MS_20; duCfgParam.macCellCfg.ssbCfg.ssbScOffset = SSB_SUBCARRIER_OFFSET; +#endif duCfgParam.macCellCfg.ssbCfg.ssbMask[0] = 1; /* only one SSB is transmitted */ duCfgParam.macCellCfg.ssbCfg.ssbMask[1] = 0; if(BuildMibPdu() != ROK) @@ -678,7 +691,14 @@ uint8_t readCfg() sib1.plmn.mnc[1] = PLMN_MNC1; sib1.tac = DU_TAC; sib1.ranac = DU_RANAC; + +#ifdef O1_ENABLE + sib1.cellIdentity = cellParams.cellLocalId; + DU_LOG("\n*********DEBUG --> DU_APP: readCfg(): OAM CellLocalId=%d", \ + sib1.cellIdentity); +#else sib1.cellIdentity = CELL_IDENTITY; +#endif sib1.cellResvdForOpUse = PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved; sib1.connEstFailCnt = ConnEstFailureControl__connEstFailCount_n3; sib1.connEstFailOffValidity = ConnEstFailureControl__connEstFailOffsetValidity_s120; @@ -702,9 +722,11 @@ uint8_t readCfg() duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mnc[1] = PLMN_MNC1; /*Cell ID */ - duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.cellId = NR_CELL_ID; + #ifdef O1_ENABLE + duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrPci = cellParams.nRPCI; + #else duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrPci = NR_PCI; - +#endif /* List of Available PLMN */ for(srvdPlmnIdx=0; srvdPlmnIdx DU_APP: readCfg():Memory allocation failed"); return RFAILED; } +#ifdef O1_ENABLE + memcpy(taiSliceSuppLst->snssai[sliceIdx]->sd, cellParams.plmnList[sliceIdx].sd, \ +SD_SIZE*sizeof(uint8_t)); + taiSliceSuppLst->snssai[sliceIdx]->sst = cellParams.plmnList[sliceIdx].sst; +#else memcpy(taiSliceSuppLst->snssai[sliceIdx], &snssai[sliceIdx], sizeof(Snssai)); - } +#endif + } } + /* NR Mode info */ +#ifdef O1_ENABLE + /* TAC and EPSTAC */ + duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.epsTac = cellParams.nRTAC; //to check and fill + duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.tac = cellParams.nRTAC; + duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.nrArfcn = +cellParams.arfcnUL; + duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulArfcn = +cellParams.arfcnSUL; +#else /* TAC and EPSTAC */ - duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.tac = DU_TAC; duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.epsTac = DU_TAC; //to check and fill - /* NR Mode info */ + duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.tac = DU_TAC; duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.nrArfcn = NR_UL_ARFCN; duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN; +#endif duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrScs = SCS_15; duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106; @@ -803,8 +856,15 @@ uint8_t readCfg() sulBand[bandIdx] = SUL_BAND; } } +#ifdef O1_ENABLE + duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.nrArfcn = +cellParams.arfcnDL ; + duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulArfcn = +cellParams.arfcnSUL; +#else duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.nrArfcn = NR_DL_ARFCN; duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN; +#endif duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrScs = SCS_15; duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106; for(freqBandIdx=0; freqBandIdxrrmPolicy[policyIdx]->numMemberList = rrmPolicy[policyIdx].numMemberList; + tempSliceCfg->rrmPolicy[policyIdx]->numMemberList = rrmPolicy[policyIdx].rRMMemberNum; DU_ALLOC(tempSliceCfg->rrmPolicy[policyIdx]->memberList, tempSliceCfg->rrmPolicy[policyIdx]->numMemberList * sizeof(PolicyMemberList*)) if(tempSliceCfg->rrmPolicy[policyIdx]->memberList == NULLP) { @@ -963,22 +1024,25 @@ uint8_t cpyRrmPolicyInDuCfgParams(RrmPolicy rrmPolicy[], uint8_t policyNum, uint DU_LOG("\nERROR --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams"); return RFAILED; } - memcpy(&tempSliceCfg->rrmPolicy[policyIdx]->memberList[memberListIdx]->snssai, &rrmPolicy[policyIdx].memberList[memberListIdx]->snssai, sizeof(Snssai)); - memcpy(&tempSliceCfg->rrmPolicy[policyIdx]->memberList[memberListIdx]->plmn, &rrmPolicy[policyIdx].memberList[memberListIdx]->plmn, sizeof(Plmn)); + memcpy(&tempSliceCfg->rrmPolicy[policyIdx]->memberList[memberListIdx]->snssai.sd, &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].sd, 3 * sizeof(uint8_t)); + memcpy(&tempSliceCfg->rrmPolicy[policyIdx]->memberList[memberListIdx]->snssai.sst, &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].sst, sizeof(uint8_t)); + memcpy(&tempSliceCfg->rrmPolicy[policyIdx]->memberList[memberListIdx]->plmn.mcc, &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].mcc, 3 * sizeof(uint8_t)); + memcpy(&tempSliceCfg->rrmPolicy[policyIdx]->memberList[memberListIdx]->plmn.mnc, &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].mnc, 3 * sizeof(uint8_t)); count++; } } - tempSliceCfg->rrmPolicy[policyIdx]->rsrcType = RSRC_PRB; - tempSliceCfg->rrmPolicy[policyIdx]->policyMaxRatio = rrmPolicy[policyIdx].policyMaxRatio; - tempSliceCfg->rrmPolicy[policyIdx]->policyMinRatio = rrmPolicy[policyIdx].policyMinRatio; - tempSliceCfg->rrmPolicy[policyIdx]->policyDedicatedRatio = rrmPolicy[policyIdx].policyDedicatedRatio; + tempSliceCfg->rrmPolicy[policyIdx]->rsrcType = rrmPolicy[policyIdx].resourceType; + tempSliceCfg->rrmPolicy[policyIdx]->policyMaxRatio = rrmPolicy[policyIdx].rRMPolicyMaxRatio; + tempSliceCfg->rrmPolicy[policyIdx]->policyMinRatio = rrmPolicy[policyIdx].rRMPolicyMinRatio; + tempSliceCfg->rrmPolicy[policyIdx]->policyDedicatedRatio = rrmPolicy[policyIdx].rRMPolicyDedicatedRatio; } tempSliceCfg->totalSliceCount = count; } return ROK; } +#endif /******************************************************************* * * @brief Reads config and posts message to du_app on completion diff --git a/src/du_app/du_cfg.h b/src/du_app/du_cfg.h index 84f9beff6..3c0874dd3 100644 --- a/src/du_app/du_cfg.h +++ b/src/du_app/du_cfg.h @@ -19,6 +19,10 @@ #ifndef __DU_CONFIG_H_ #define __DU_CONFIG_H__ +#ifdef O1_ENABLE +#include "CmInterface.h" +#endif + /* MACROS */ #define DU_INST 0 #define DU_ID 1 @@ -1267,7 +1271,10 @@ uint8_t readClCfg(); uint8_t readCfg(); uint8_t duReadCfg(); uint16_t calcSliv(uint8_t startSymbol, uint8_t lengthSymbol); -uint8_t cpyRrmPolicyInDuCfgParams(RrmPolicy rrmPolicy[], uint8_t policyNum, uint8_t memberList, CopyOfRecvdSliceCfg *tempSliceCfg); + +#ifdef O1_ENABLE +uint8_t cpyRrmPolicyInDuCfgParams(RrmPolicyList rrmPolicy[], uint8_t policyNum, CopyOfRecvdSliceCfg *tempSliceCfg); +#endif #endif /* __DU_CONFIG_H__ */ diff --git a/src/du_app/du_f1ap_msg_hdl.c b/src/du_app/du_f1ap_msg_hdl.c index edc1afef5..abebe72fc 100644 --- a/src/du_app/du_f1ap_msg_hdl.c +++ b/src/du_app/du_f1ap_msg_hdl.c @@ -103,7 +103,7 @@ #include "GTPTunnel.h" #ifdef O1_ENABLE -#include "ConfigInterface.h" +#include "CmInterface.h" extern StartupConfig g_cfg; #endif diff --git a/src/du_app/du_mgr_main.c b/src/du_app/du_mgr_main.c index 3b1e36b26..e1a37a3d2 100644 --- a/src/du_app/du_mgr_main.c +++ b/src/du_app/du_mgr_main.c @@ -33,8 +33,7 @@ #ifdef O1_ENABLE #include "O1Interface.h" -#include "ConfigInterface.h" - +#include "CmInterface.h" #endif uint8_t rlcUlActvTsk (Pst *, Buffer *); @@ -53,6 +52,10 @@ uint8_t phyStubActvInit(Ent, Inst, Region, Reason); /* Global variable */ DuCfgParams duCfgParam; +#ifdef O1_ENABLE +extern NRCellDU cellParams; +#endif + /******************************************************************* * * @brief Initializes DU APP @@ -97,7 +100,7 @@ uint8_t duAppInit(SSTskId sysTskId) * * @details * - * Function : updateRrmPolicy + * Function : setRrmPolicy * * Functionality: * - update Rrm Policy at DU and process the slice cfg request @@ -107,12 +110,48 @@ uint8_t duAppInit(SSTskId sysTskId) * false - failure * * ****************************************************************/ -uint8_t updateRrmPolicy(RrmPolicy rrmPolicy[], uint8_t policyNum, \ - uint8_t memberList) + +uint8_t setRrmPolicy(RrmPolicyList rrmPolicy[], uint8_t policyNum) { - DuCellCb *cellCb = NULLP; + DU_LOG("\nINFO --> DU_APP : DU APP RRM number of policy %d,", \ + policyNum); + for(uint8_t i=0; i DU_APP : DU APP id = %s",rrmPolicy[i].id); + DU_LOG("\nINFO --> DU_APP : DU APP resourceType = %d", \ + rrmPolicy[i].resourceType); + DU_LOG("\nINFO --> DU_APP : DU APP rRMPolicyMaxRatio = %d", \ + rrmPolicy[i].rRMPolicyMaxRatio); + DU_LOG("\nINFO --> DU_APP : DU APP rRMPolicyMinRatio = %d", \ + rrmPolicy[i].rRMPolicyMinRatio); + DU_LOG("\nINFO --> DU_APP : DU APP rRMPolicyDedicatedRatio = %d", \ + rrmPolicy[i].rRMPolicyDedicatedRatio); + DU_LOG("\nINFO --> DU_APP : DU APP rRMMemberNum = %d", \ + rrmPolicy[i].rRMMemberNum); + for(uint8_t j=0; j DU_APP : DU APP mcc = %d%d%d", \ + rrmPolicy[i].rRMPolicyMemberList[j].mcc[0], \ + rrmPolicy[i].rRMPolicyMemberList[j].mcc[1], \ + rrmPolicy[i].rRMPolicyMemberList[j].mcc[2]); + DU_LOG("\nINFO --> DU_APP : DU APP mnc = %d%d%d", \ + rrmPolicy[i].rRMPolicyMemberList[j].mnc[0], \ + rrmPolicy[i].rRMPolicyMemberList[j].mnc[1], \ + rrmPolicy[i].rRMPolicyMemberList[j].mnc[2]); + + DU_LOG("\nINFO --> DU_APP : DU APP sd = %d%d%d", \ + rrmPolicy[i].rRMPolicyMemberList[j].sd[0], \ + rrmPolicy[i].rRMPolicyMemberList[j].sd[1], \ + rrmPolicy[i].rRMPolicyMemberList[j].sd[2]); + + DU_LOG("\nINFO --> DU_APP : DU APP sst = %d\n", \ + rrmPolicy[i].rRMPolicyMemberList[j].sst); + } + + } + DuCellCb *cellCb = NULLP; - cpyRrmPolicyInDuCfgParams(rrmPolicy, policyNum, memberList, &duCfgParam.tempSliceCfg); + cpyRrmPolicyInDuCfgParams(rrmPolicy, policyNum, &duCfgParam.tempSliceCfg); cellCb = duCb.actvCellLst[0]; if(cellCb) @@ -131,6 +170,7 @@ uint8_t updateRrmPolicy(RrmPolicy rrmPolicy[], uint8_t policyNum, \ } } } + return ROK; } /******************************************************************* @@ -157,6 +197,76 @@ bool bringCellUp(uint16_t cellId) return true; } +/******************************************************************* + * + * @brief configure cell parameters + * + * @details + * + * Function : configurecell + * + * Functionality: + * - configure cell parameters + * + * @params[in] Cell Id + * @return true - success + * false - failure + * + * ****************************************************************/ + +uint8_t setCellParam() +{ + //Read all the configs from smo edit-config into cellParams + DU_LOG("\nO1 configurecell du_app enterd"); + DU_LOG("\nDU_APP configurecell cellLocalId value:%d",cellParams.cellLocalId); + DU_LOG("\nDU_APP configurecell operationalState value:%d", \ + cellParams.operationalState); + DU_LOG("\nDU_APP configurecell administrativeState value:%d", \ + cellParams.administrativeState); + DU_LOG("\nDU_APP configurecell cellState value:%d",cellParams.cellState); + DU_LOG("\nDU_APP configurecell nRPCI value:%d",cellParams.nRPCI); + DU_LOG("\nDU_APP configurecell nRTAC value:%d",cellParams.nRTAC); + DU_LOG("\nDU_APP configurecell arfcnDL value:%d",cellParams.arfcnDL); + DU_LOG("\nDU_APP configurecell arfcnUL value:%d",cellParams.arfcnUL); + DU_LOG("\nDU_APP configurecell arfcnSUL value:%d",cellParams.arfcnSUL); + DU_LOG("\nDU_APP configurecell ssbFrequency value:%d",cellParams.ssbFrequency); + DU_LOG("\nDU_APP configurecell ssbPeriodicity value:%d", \ + cellParams.ssbPeriodicity); + DU_LOG("\nDU_APP configurecell ssbSubCarrierSpacing value:%d", \ + cellParams.ssbSubCarrierSpacing); + DU_LOG("\nDU_APP configurecell ssbOffset value:%d",cellParams.ssbOffset); + DU_LOG("\nDU_APP configurecell ssbDuration value:%d",cellParams.ssbDuration); + DU_LOG("\nDU_APP configurecell bSChannelBwUL value:%d", \ + cellParams.bSChannelBwUL); + DU_LOG("\nDU_APP configurecell bSChannelBwDL value:%d", \ + cellParams.bSChannelBwDL); + DU_LOG("\nDU_APP configurecell bSChannelBwSUL value:%d", \ + cellParams.bSChannelBwSUL); + for (int i=0 ; i DU_APP : DU APP mcellParams.plmnList[%d].mcc = %d%d%d", i,\ + cellParams.plmnList[i].mcc[0], \ + cellParams.plmnList[i].mcc[1], \ + cellParams.plmnList[i].mcc[2]); + DU_LOG("\nINFO --> DU_APP : DU APP cellParams.plmnList[%d].mnc = %d%d%d", i,\ + cellParams.plmnList[i].mnc[0], \ + cellParams.plmnList[i].mnc[1], \ + cellParams.plmnList[i].mnc[2]); + + DU_LOG("\nINFO --> DU_APP : DU APP cellParams.plmnList[%d].sd = %d%d%d", i,\ + cellParams.plmnList[i].sd[0], \ + cellParams.plmnList[i].sd[1], \ + cellParams.plmnList[i].sd[2]); + + DU_LOG("\nINFO --> DU_APP : DU APP cellParams.plmnList[%d].sst = %d\n", i,\ + cellParams.plmnList[i].sst); + + } + + duReadCfg(); + return ROK; +} /******************************************************************* * * @brief Bring the cell Down @@ -537,6 +647,7 @@ uint8_t commonInit() } #endif + return ROK; } @@ -604,7 +715,9 @@ uint8_t tst(void) } //Read all the configs from du_utils.c into duCfgParams +#ifndef O1_ENABLE duReadCfg(); +#endif #ifdef O1_ENABLE //Send VES PNF registration message to SMO diff --git a/src/du_app/du_msg_hdl.c b/src/du_app/du_msg_hdl.c index 97c251c9a..24ae6e01a 100644 --- a/src/du_app/du_msg_hdl.c +++ b/src/du_app/du_msg_hdl.c @@ -42,12 +42,8 @@ #ifdef O1_ENABLE #include "AlarmInterface.h" -#include "ConfigInterface.h" - -/*TODO: Uncomment when PM O1 gerrit gets ready*/ -#if 0 +#include "CmInterface.h" #include "PmInterface.h" -#endif #endif @@ -1933,6 +1929,7 @@ uint8_t DuProcMacSliceCfgRsp(Pst *pst, MacSliceCfgRsp *cfgRsp) duFreeSliceCfgRsp(pst, cfgRsp); } duFreeTempSliceCfg(); + return ROK; } /******************************************************************* @@ -2172,14 +2169,11 @@ uint8_t DuProcRlcSliceMetrics(Pst *pst, SlicePmList *sliceStats) DU_LOG("\nINFO --> DU_APP: SliceIndx:%d, DlTput %.5lf, UlTput:%.5lf", sliceStats->sliceRecord[sliceRecord].networkSliceIdentifier,\ sliceStats->sliceRecord[sliceRecord].ThpDl, sliceStats->sliceRecord[sliceRecord].ThpUl); } -/*TODO: Uncomment when PM O1 gerrit gets ready*/ -#if 0 #ifdef O1_ENABLE if(sliceStats) { - sendSliceMetric(sliceStats); + sendSliceMetric((SliceMetricList*) sliceStats); } -#endif #endif DU_FREE_SHRABL_BUF(pst->region, pst->pool,sliceStats->sliceRecord, (sliceStats->numSlice) * (sizeof(SlicePm))); diff --git a/src/du_app/du_ue_mgr.c b/src/du_app/du_ue_mgr.c index aa67128f4..f796cb905 100644 --- a/src/du_app/du_ue_mgr.c +++ b/src/du_app/du_ue_mgr.c @@ -36,7 +36,7 @@ #ifdef O1_ENABLE #include "AlarmInterface.h" -#include "ConfigInterface.h" +#include "CmInterface.h" #endif DuMacDlCcchInd packMacDlCcchIndOpts[] = diff --git a/src/o1/ConfigInterface.cpp b/src/o1/CmInterface.cpp similarity index 98% rename from src/o1/ConfigInterface.cpp rename to src/o1/CmInterface.cpp index 161d6caab..d7e97e7bf 100644 --- a/src/o1/ConfigInterface.cpp +++ b/src/o1/CmInterface.cpp @@ -20,7 +20,7 @@ configuration */ -#include "ConfigInterface.h" +#include "CmInterface.h" #include "GlobalDefs.hpp" #include "UnixSocketClient.hpp" #include "SessionHandler.hpp" @@ -136,7 +136,7 @@ uint8_t getStartupConfigForStub(StartupConfig *cfg) bool setCellOpState(uint16_t cellId, OpState opState, CellState cellState) { - O1_LOG("\nO1 ConfigInterface: Setting cellId = %d, opState=%d, \ + O1_LOG("\nO1 CmInterface: Setting cellId = %d, opState=%d, \ cellState=%d", cellId, opState, cellState); return NrCellList::instance().setCellOpState(cellId, opState, \ cellState); diff --git a/src/o1/CmInterface.h b/src/o1/CmInterface.h new file mode 100644 index 000000000..0e496c237 --- /dev/null +++ b/src/o1/CmInterface.h @@ -0,0 +1,175 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2020] [HCL Technologies Ltd.] # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ +*******************************************************************************/ + +/* This file contains C interface for ODU and stubs to get startup + configuration +*/ + +#ifndef __CM_INTERFACE_H__ +#define __CM_INTERFACE_H__ + +#include +#include + +#define IPV4_LEN 16 +#define PORT_LEN 10 + + + +//RRM POLICY MACRO + +#define MAX_MEMBER_LIST 2 +#define ID_MAX_LEN 64 +#define MAX_LEN 100 +#define MAX_POLICY 2 +#define MAX_POLICY_LIST 4 +#define MCC_LEN 3 +#define MNC_LEN 3 +#define SD_LEN 3 + +//NRCELLDU MACRO +#define MAX_SUPPORTED_PLMN 2 + +#ifdef __cplusplus +extern "C" +{ +#endif + +typedef struct +{ + char DU_IPV4_Addr[IPV4_LEN]; + char CU_IPV4_Addr[IPV4_LEN]; + char RIC_IPV4_Addr[IPV4_LEN]; + uint16_t CU_Port; + uint16_t DU_Port; + uint16_t RIC_Port; +}StartupConfig; + +//RRM POLICY STRUCT + +typedef struct rRMPolicyMemberList +{ + uint8_t mcc[MCC_LEN]; + uint8_t mnc[MNC_LEN]; + uint8_t sd[SD_LEN]; + uint8_t sst; +}RRMPolicyMemberList; + +typedef enum +{ + PRB, + PRB_UL, + PRB_DL, + RRC, + DRB +}RrmResourceType; + +typedef struct rrmPolicyList +{ + char id[ID_MAX_LEN]; + RrmResourceType resourceType; + uint8_t rRMMemberNum; + RRMPolicyMemberList rRMPolicyMemberList[MAX_MEMBER_LIST]; + uint8_t rRMPolicyMaxRatio; + uint8_t rRMPolicyMinRatio; + uint8_t rRMPolicyDedicatedRatio; +}RrmPolicyList; + +//NRCELLDU STRUCT + +typedef enum +{ + DISABLED, //value 0 + ENABLED, //value 1 +}OpState; + +typedef enum +{ + LOCKED, //value 0 + UNLOCKED, //value 1 + SHUTTING_DOWN, //value 2 +}AdminState; + +typedef enum +{ + IDLE, + INACTIVE, + ACTIVE, +}CellState; + +typedef struct plmnInfo +{ + uint8_t mcc[MCC_LEN]; + uint8_t mnc[MNC_LEN]; + uint8_t sd[SD_LEN]; + uint8_t sst; +}PlmnInfo; + + +typedef struct nRCellDU +{ + uint32_t cellLocalId; + OpState operationalState; + AdminState administrativeState; + CellState cellState; + PlmnInfo plmnList[MAX_SUPPORTED_PLMN]; + uint32_t nRPCI; + uint32_t nRTAC; + uint32_t arfcnDL; + uint32_t arfcnUL; + uint32_t arfcnSUL; + uint32_t ssbFrequency; + uint32_t ssbPeriodicity; + uint32_t ssbSubCarrierSpacing; + uint32_t ssbOffset; + uint32_t ssbDuration; + uint32_t bSChannelBwUL; + uint32_t bSChannelBwDL; + uint32_t bSChannelBwSUL; +}NRCellDU; + +//ME, GNB and NRCELLDU ID's struct +typedef struct managedElement +{ + char meId[ID_MAX_LEN]; + char gnbId[ID_MAX_LEN]; + char nrCellDuId[ID_MAX_LEN]; +}ManagedElement; + + +uint8_t getStartupConfig(StartupConfig *cfg); +uint8_t getStartupConfigForStub(StartupConfig *cfg); +bool setCellOpState(uint16_t cellId, OpState opState, \ + CellState cellState); + +#ifndef ODU_TEST_STUB +//Defined in odu high +bool bringCellUp(uint16_t cellId); +bool bringCellDown(uint16_t cellId); +uint8_t setRrmPolicy(RrmPolicyList rrmPolicy[],uint8_t policyNum); +uint8_t setCellParam(); +#endif //ODU_TEST_STUB +#ifdef __cplusplus +} +#endif + +#endif + +/********************************************************************** + End of file +**********************************************************************/ diff --git a/src/o1/GlobalDefs.hpp b/src/o1/GlobalDefs.hpp index 6bf2578bc..f767115a2 100644 --- a/src/o1/GlobalDefs.hpp +++ b/src/o1/GlobalDefs.hpp @@ -39,9 +39,17 @@ using std::string; #define CELL_STATE_MODULE_PATH "/o-ran-sc-du-hello-world:network-function" #define IETF_NACM_MODULE_NAME "ietf-netconf-acm" #define IETF_NACM_MODULE_PATH "/ietf-netconf-acm:nacm" +#define MANAGED_ELEMENT_MODULE_NAME "_3gpp-common-managed-element" +#define MANAGED_ELEMENT_MODULE_PATH "/_3gpp-common-managed-element:ManagedElement" +#define GNB_DU_FUNTION_MODULE_NAME "_3gpp-nr-nrm-gnbdufunction" +#define NR_CELL_DU_MODULE_NAME "_3gpp-nr-nrm-nrcelldu" +#define RRMPOLICY_MODULE_NAME "_3gpp-nr-nrm-rrmpolicy" +#define RRMPOLICY_MODULE_PATH "/_3gpp-nr-nrm-rrmpolicy:RRMPolicyRatio" #define MAX_ALARM_ID_LEN 10 -class O1 +#define ROK 0 + +class O1 { public: static const int SUCCESS; diff --git a/src/o1/InitConfig.hpp b/src/o1/InitConfig.hpp index 5626ba920..32addedbf 100644 --- a/src/o1/InitConfig.hpp +++ b/src/o1/InitConfig.hpp @@ -28,7 +28,7 @@ #include #include "sysrepo-cpp/Session.hpp" #include "Singleton.hpp" -#include "ConfigInterface.h" +#include "CmInterface.h" #include "GlobalDefs.hpp" #define IP_ADDRESS "interface-address" diff --git a/src/o1/NetconfUtils.cpp b/src/o1/NetconfUtils.cpp new file mode 100644 index 000000000..60867fce1 --- /dev/null +++ b/src/o1/NetconfUtils.cpp @@ -0,0 +1,139 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2020-2021] [HCL Technologies Ltd.] # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ +*******************************************************************************/ + +/* This file contains defination of generic netconf utility function which can + * be used by any class*/ + +#include +#include "NetconfUtils.hpp" + +/******************************************************************* + * + * @brief print changes of given operation + * + * @details + * + * Function : printChange + * + * Functionality: + * - print changes of given operation, old and new value + * + * + * @params[in] sysrepo::S_Change change + * @return void + ******************************************************************/ + +void NetconfUtils::printChange(sysrepo::S_Change change) { + switch(change->oper()) { + case SR_OP_CREATED: + if (nullptr != change->new_val()) { + O1_LOG("\nO1 NetconfUtils : CREATED: %s", \ + change->new_val()->to_string().c_str()); + } + break; + case SR_OP_DELETED: + if (nullptr != change->old_val()) { + O1_LOG("\nO1 NetconfUtils : DELETED: %s", \ + change->old_val()->to_string().c_str()); + } + break; + case SR_OP_MODIFIED: + if (nullptr != change->old_val() && nullptr != change->new_val()) { + O1_LOG("\nO1 NetconfUtils : MODIFIED: old value %s :new value %s", \ + change->old_val()->to_string().c_str(), \ + change->new_val()->to_string().c_str()); + } + break; + case SR_OP_MOVED: + if (nullptr != change->old_val() && nullptr != change->new_val()) { + O1_LOG("\nO1 NetconfUtils : MOVED: %s :after %s ", \ + change->new_val()->xpath(), \ + change->old_val()->xpath()); + } + else if (nullptr != change->new_val()) { + O1_LOG("\nO1 NetconfUtils : MOVED: %s : first", \ + change->new_val()->xpath()); + } + break; + } +} + +/******************************************************************* + * + * @brief convert event type to string + * + * @details + * + * Function : evToStr + * + * Functionality: + * - convert event type to string + * + * + * @params[in] sr_event_t event + * @return event name in string form + ******************************************************************/ + +/* Helper function for printing events. */ +const char *NetconfUtils::evToStr(sr_event_t ev) { + switch (ev) { + case SR_EV_CHANGE: + return "change"; + case SR_EV_DONE: + return "done"; + case SR_EV_ABORT: + default: + return "abort"; + } +} + +/******************************************************************* + * + * @brief get the leaf name from xpath + * + * @details + * + * Function : getLeafInfo + * + * Functionality: + * - extract the leaf name from xpath + * + * + * @params[in] xpath, output string + * @return void + ******************************************************************/ + +void NetconfUtils::getLeafInfo(string xpath,string &parent, string &leaf ){ + std::stringstream ssLeaf(xpath); + std::stringstream ssParent(xpath); + char ch='/'; + getline(ssLeaf, leaf, ch); + while(getline(ssLeaf, leaf, ch)){ + getline(ssParent, parent, ch); + } //get leaf name after the last '/' + std::stringstream ss(leaf); + ch=' '; + getline(ss, leaf, ch); //remove extra space + //O1_LOG("\nO1 NetconfUtils : parent = [%s]", parent.c_str()); + //O1_LOG("\nO1 NetconfUtils : leaf = [%s]", leaf.c_str()); + +} + +/********************************************************************** + End of file +**********************************************************************/ diff --git a/src/o1/ConfigInterface.h b/src/o1/NetconfUtils.hpp similarity index 60% rename from src/o1/ConfigInterface.h rename to src/o1/NetconfUtils.hpp index a8c8d1d89..3a8b52c89 100644 --- a/src/o1/ConfigInterface.h +++ b/src/o1/NetconfUtils.hpp @@ -1,6 +1,6 @@ /******************************************************************************* ################################################################################ -# Copyright (c) [2020] [HCL Technologies Ltd.] # +# Copyright (c) [2020-2021] [HCL Technologies Ltd.] # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may not use this file except in compliance with the License. # @@ -16,59 +16,26 @@ ################################################################################ *******************************************************************************/ -/* This file contains C interface for ODU and stubs to get startup - configuration -*/ +/* This file contains generic netconf utility function which can be used by any + * class*/ -#ifndef __CONFIG_INTERFACE_H__ -#define __CONFIG_INTERFACE_H__ -#include -#include - -#define IPV4_LEN 16 -#define PORT_LEN 10 +#ifndef __NETCONF_UTILS_HPP__ +#define __NETCONF_UTILS_HPP__ -#ifdef __cplusplus -extern "C" -{ -#endif +#include +#include +#include +#include "GlobalDefs.hpp" +#include "sysrepo-cpp/Session.hpp" -typedef struct +class NetconfUtils { - char DU_IPV4_Addr[IPV4_LEN]; - char CU_IPV4_Addr[IPV4_LEN]; - char RIC_IPV4_Addr[IPV4_LEN]; - uint16_t CU_Port; - uint16_t DU_Port; - uint16_t RIC_Port; -}StartupConfig; - -typedef enum { - INACTIVE, - ACTIVE, - IDLE -}CellState; - -typedef enum { - DISABLED, - ENABLED -}OpState; - - -uint8_t getStartupConfig(StartupConfig *cfg); -uint8_t getStartupConfigForStub(StartupConfig *cfg); -bool setCellOpState(uint16_t cellId, OpState opState, \ - CellState cellState); - -#ifndef ODU_TEST_STUB -//Defined in odu high -bool bringCellUp(uint16_t cellId); -bool bringCellDown(uint16_t cellId); -#endif //ODU_TEST_STUB -#ifdef __cplusplus -} -#endif + public: + static void printChange(sysrepo::S_Change change); + static const char *evToStr(sr_event_t ev); + static void getLeafInfo(string xpath,string &parent, string &leaf ); +}; #endif diff --git a/src/o1/NrCellCb.hpp b/src/o1/NrCellCb.hpp index 00655d218..de5904be9 100644 --- a/src/o1/NrCellCb.hpp +++ b/src/o1/NrCellCb.hpp @@ -27,7 +27,7 @@ #include #include #include "sysrepo-cpp/Session.hpp" -#include "ConfigInterface.h" +#include "CmInterface.h" #include "GlobalDefs.hpp" #include "Singleton.hpp" #include "NrCellInfo.hpp" diff --git a/src/o1/NrCellDuCb.cpp b/src/o1/NrCellDuCb.cpp new file mode 100644 index 000000000..62a2fb92c --- /dev/null +++ b/src/o1/NrCellDuCb.cpp @@ -0,0 +1,397 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2020-2021] [HCL Technologies Ltd.] # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ +*******************************************************************************/ + +/* This file contains NrCellDu get and update handler . It handles + get and change callback for NrCellDu yang module */ + +#include +#include "NrCellDuCb.hpp" +#include "NrCellInfo.hpp" +#include "NrCellList.hpp" + +#define XPATH_MAX_LEN 256 +#define MAX_PLMN_MEMBER 4 + +using namespace std; + +//Global variable +NRCellDU cellParams; +ManagedElement managedElement; +int plmnListNum = 0; + +/******************************************************************* + * + * @brief override oper_get_items to handle callback + * + * @details + * + * Function : oper_get_items + * + * Functionality: + * - override oper_get_items to handle callback + * + * + * @params[in] sysrepo::S_Session session, const char *module_name, + * const char *path, const char *request_xpath, + * uint32_t request_id, libyang::S_Data_Node &parent, + * void *private_data + * @return SR_ERR_OK/SR_ERR_NOK + ******************************************************************/ + +int NrCellDuCb::oper_get_items(sysrepo::S_Session session, \ + const char *module_name, \ + const char *path, \ + const char *request_xpath, \ + uint32_t request_id, \ + libyang::S_Data_Node &parent, \ + void *private_data) +{ + O1_LOG("\nO1 NrCellCb : Callback called for path=%s on get request", path); + libyang::S_Context ctx = session->get_context(); + libyang::S_Module modMe = ctx->get_module(module_name); + + //first create root of the tree then add nodes and leaves and fill data + parent.reset(new libyang::Data_Node(ctx, MANAGED_ELEMENT_MODULE_PATH, \ + nullptr, LYD_ANYDATA_CONSTSTRING, 0)); + libyang::S_Data_Node id(new libyang::Data_Node(parent, modMe, "id", \ + managedElement.meId)); + libyang::S_Module modGnbdu = ctx->get_module(GNB_DU_FUNTION_MODULE_NAME); + libyang::S_Data_Node gnbdu(new libyang::Data_Node(parent, modGnbdu, \ + "GNBDUFunction")); + libyang::S_Data_Node id1 (new libyang::Data_Node(gnbdu, modGnbdu, "id", \ + managedElement.gnbId)); + libyang::S_Module mod = ctx->get_module(NR_CELL_DU_MODULE_NAME); + libyang::S_Data_Node nrCellDu(new libyang::Data_Node(gnbdu, mod, \ + "NRCellDU")); + id.reset(new libyang::Data_Node(nrCellDu, mod, "id", \ + managedElement.nrCellDuId)); + libyang::S_Data_Node attributes(new libyang::Data_Node(nrCellDu, mod, \ + "attributes")); + + libyang::S_Data_Node name; + libyang::S_Data_Node operational_state; + libyang::S_Data_Node cell_state; + libyang::S_Data_Node administrative_state; + + NrCellList & cellList = NrCellList::instance(); + NrCellInfo cellInfo; + const NrCellList::CellOpStateMap & cellOpStateMap = cellList.getCellOpStateList(); + //read the data from CellOpStateMap + std::map::const_iterator it; + for(it = cellOpStateMap.begin(); it !=cellOpStateMap.end(); it++) + { + O1_LOG("\nO1 NrCellCb : cellId = %d, opState=%d, cellState=%d", \ + it->first, (int) it->second.getOpState(), (int) it->second.getCellState()); + operational_state.reset(new libyang::Data_Node(attributes, mod, \ + "operationalState", \ + cellInfo.enumToOperationalStateString(it->second.getOpState()).c_str())); + cell_state.reset(new libyang::Data_Node(attributes, mod, "cellState", \ + cellInfo.enumToCellStateString(it->second.getCellState()).c_str())); + } + return SR_ERR_OK; +} + +/******************************************************************* + * + * @brief convert administrative state string to enum + * + * @details + * + * Function : administrativeStateToEnum + * + * Functionality: + * - convert administrative state string to enum + * + * + * @params[in] string AdminState + * @return Enum AdminState + ******************************************************************/ + +AdminState NrCellDuCb::administrativeStateToEnum(string &val) +{ + AdminState state; + if (val=="LOCKED") { + state = LOCKED; + } + else if(val=="UNLOCKED") { + state = UNLOCKED; + } + else if(val=="SHUTTING_DOWN") { + state = SHUTTING_DOWN; + } + return state; +} + +/******************************************************************* + * + * @brief fill the parameters value into the structure instance + * + * @details + * + * Function : updateParams + * + * Functionality: + * - fill the parameters value into the structure instance + * + * + * @params[in] string leaf, string val + * @return void + ******************************************************************/ + + +void NrCellDuCb::updateParams(string &parent, string &leaf, string &val) +{ + int memberNum = plmnListNum/MAX_PLMN_MEMBER; + if(parent.find("attribute") != string::npos) + { + if(leaf == "cellLocalId"){ + cellParams.cellLocalId = atoi(val.c_str()); + O1_LOG("\nO1 NrCellDuCb : val = %d", cellParams.cellLocalId); + } + else if(leaf == "administrativeState"){ + cellParams.administrativeState = administrativeStateToEnum(val); + O1_LOG("\nO1 NrCellDuCb : val = %d", cellParams.administrativeState); + } + else if(leaf == "nRPCI"){ + cellParams.nRPCI = atoi(val.c_str()); + O1_LOG("\nO1 NrCellDuCb : val = %d", cellParams.nRPCI); + } + else if(leaf == "nRTAC"){ + cellParams.nRTAC = atoi(val.c_str()); + O1_LOG("\nO1 NrCellDuCb : val = %d", cellParams.nRTAC); + } + else if(leaf == "arfcnDL"){ + cellParams.arfcnDL = atoi(val.c_str()); + O1_LOG("\nO1 NrCellDuCb : val = %d", cellParams.arfcnDL); + } + else if(leaf == "arfcnUL"){ + cellParams.arfcnUL = atoi(val.c_str()); + O1_LOG("\nO1 NrCellDuCb : val = %d", cellParams.arfcnUL); + } + else if(leaf == "arfcnSUL"){ + cellParams.arfcnSUL = atoi(val.c_str()); + O1_LOG("\nO1 NrCellDuCb : val = %d", cellParams.arfcnSUL); + } + else if(leaf == "ssbFrequency"){ + cellParams.ssbFrequency = atoi(val.c_str()); + O1_LOG("\nO1 NrCellDuCb : val = %d", cellParams.ssbFrequency); + } + else if(leaf == "ssbPeriodicity"){ + cellParams.ssbPeriodicity = atoi(val.c_str()); + O1_LOG("\nO1 NrCellDuCb : val = %d", cellParams.ssbPeriodicity); + } + else if(leaf == "ssbSubCarrierSpacing"){ + cellParams.ssbSubCarrierSpacing = atoi(val.c_str()); + O1_LOG("\nO1 NrCellDuCb : val = %d", cellParams.ssbSubCarrierSpacing); + } + else if(leaf == "ssbOffset"){ + cellParams.ssbOffset = atoi(val.c_str()); + O1_LOG("\nO1 NrCellDuCb : val = %d", cellParams.ssbOffset); + } + else if(leaf == "ssbDuration"){ + cellParams.ssbDuration = atoi(val.c_str()); + O1_LOG("\nO1 NrCellDuCb : val = %d", cellParams.ssbDuration); + } + else if(leaf == "bSChannelBwUL"){ + cellParams.bSChannelBwUL = atoi(val.c_str()); + O1_LOG("\nO1 NrCellDuCb : val = %d", cellParams.bSChannelBwUL); + } + else if(leaf == "bSChannelBwDL"){ + cellParams.bSChannelBwDL = atoi(val.c_str()); + O1_LOG("\nO1 NrCellDuCb : val = %d", cellParams.bSChannelBwDL); + } + else if(leaf == "bSChannelBwSUL"){ + cellParams.bSChannelBwSUL = atoi(val.c_str()); + O1_LOG("\nO1 NrCellDuCb : val = %d", cellParams.bSChannelBwSUL); + } + } + else if(parent.find("pLMNInfoList") != string::npos && memberNum < MAX_SUPPORTED_PLMN) + { + if(leaf == "mcc") + { + 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", + 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", + memberNum, cellParams.plmnList[memberNum].mnc[1]); + } + else if(leaf == "sst") + { + cellParams.plmnList[memberNum].sst = \ + atoi(val.c_str()); + O1_LOG("\nO1 NrCellDuCb : cellParams.plmnList[%d].sst = %d", \ + memberNum, cellParams.plmnList[memberNum].sst); + } + else if(leaf == "sd") + { + memset(cellParams.plmnList[memberNum].sd, \ + '\0', SD_LEN); + + cellParams.plmnList[memberNum].sd[0] = \ + stoi(val.substr(0,2).c_str(),0,16); + cellParams.plmnList[memberNum].sd[1] = \ + stoi(val.substr(2,2).c_str(),0,16); + cellParams.plmnList[memberNum].sd[2] = \ + 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]); + } + plmnListNum++; + } + else if(parent.find("ManagedElement") != string::npos) + { + if(leaf == "id") + { + strncpy(managedElement.meId, val.c_str(), strlen(val.c_str())); + O1_LOG("\nO1 NrCellDuCb : ManagedElement id = %s", managedElement.meId); + } + } + else if(parent.find("GNBDUFunction") != string::npos) + { + if(leaf == "id") + { + strncpy(managedElement.gnbId, val.c_str(), strlen(val.c_str())); + O1_LOG("\nO1 NrCellDuCb : GNBDUFuntion id = %s", managedElement.gnbId); + } + } + else if(parent.find("NRCellDu") != string::npos) + { + if(leaf == "id") + { + strncpy(managedElement.nrCellDuId, val.c_str(), strlen(val.c_str())); + O1_LOG("\nO1 NrCellDuCb : NRCELLDU id = %s", managedElement.nrCellDuId); + } + } +} + +/******************************************************************* + * + * @brief set cell parameters + * + * @details + * + * Function : configureCell + * + * Functionality: + * - pass the cell Parameters to ODU high stack + * + * + * @params[in] void + * @return success/failure + ******************************************************************/ + +bool NrCellDuCb::configureCell() +{ + O1_LOG("\nO1 rannetworkCb : configcell"); +#ifndef ODU_TEST_STUB + if( setCellParam() != ROK) + { + O1_LOG("\nO1 rannetworkCb : fail to set cell configuration in DU"); + return false; + } + return true; +#else + return true; +#endif +} + +/******************************************************************* + * + * @brief override module_change to handle callback + * + * @details + * + * Function : module_change + * + * Functionality: + * - override module_change to handle callback of modification of + * o-ran-sc-du-hello-world yang module + * + * + * @params[in] sysrepo::S_Session session, const char *module_name, + * const char *xpath, sr_event_t event, uint32_t request_id, + * void *private_data + * @return SR_ERR_OK - success + * SR_ERR_INTERNAL - failure + ******************************************************************/ + +int NrCellDuCb::module_change(sysrepo::S_Session sess, \ + const char *module_name, \ + const char *xpath, \ + sr_event_t event, \ + uint32_t request_id, \ + void *private_data) +{ + O1_LOG("\nO1 NrCellDuCb : Notification edit sucessful"); + + char change_path[XPATH_MAX_LEN]; + plmnListNum = 0; + + try { + O1_LOG("\nO1 NrCellDuCbCb : Notification %s", NetconfUtils::evToStr(event)); + if (SR_EV_CHANGE == event) + { + snprintf(change_path, XPATH_MAX_LEN, "/%s:*//.", module_name); + auto it = sess->get_changes_iter(change_path); + while (auto change = sess->get_change_next(it)) { + //NetconfUtils::printChange(change); //enable only for debugging + + if(nullptr != change->new_val()) + { + //O1_LOG("\nO1 NrCellDuCb : Parameter value has been \ +changed val=%s", change->new_val()->val_to_string().c_str()); + string val = change->new_val()->val_to_string(); + string parent, leaf; + + NetconfUtils::getLeafInfo(change->new_val()->to_string(), \ + parent, leaf); + O1_LOG("\nO1 NrCellDuCb : parent = [%s], leaf = [%s]", \ + parent.c_str(), leaf.c_str()); + updateParams(parent, leaf ,val); + } + } + if(!configureCell()) + { + O1_LOG("\nO1 NrCellDuCb : configcell failed"); + return SR_ERR_INTERNAL; + } + + } + } + catch( const std::exception& e ) { + O1_LOG("\nO1 rannetworkCb exception : %s\n", e.what()); + } + + return SR_ERR_OK; +} + +/********************************************************************** + End of file +**********************************************************************/ diff --git a/src/o1/NrCellDuCb.hpp b/src/o1/NrCellDuCb.hpp new file mode 100644 index 000000000..7b3ecfc68 --- /dev/null +++ b/src/o1/NrCellDuCb.hpp @@ -0,0 +1,61 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2020-2021] [HCL Technologies Ltd.] # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ +*******************************************************************************/ + +/* This file contains NrCellDu get and update handler . It handles + get and change callback for NrCellDu yang module */ + +#ifndef __NR_CELL_DU_HPP__ +#define __NR_CELL_DU_HPP__ + +#include +#include +#include "sysrepo-cpp/Session.hpp" +#include "AlarmManager.hpp" +#include "GlobalDefs.hpp" +#include "CmInterface.h" +#include "NetconfUtils.hpp" + +class NrCellDuCb: public sysrepo::Callback +{ + public: + int oper_get_items(sysrepo::S_Session session,\ + const char *module_name,\ + const char *path,\ + const char *request_xpath,\ + uint32_t request_id,\ + libyang::S_Data_Node &parent,\ + void *private_data); + + int module_change(sysrepo::S_Session sess, \ + const char *module_name, \ + const char *xpath, \ + sr_event_t event, \ + uint32_t request_id, \ + void *private_data); //override + private: + bool configureCell(); + void updateParams(string &parent, string &leaf, string &val); + AdminState administrativeStateToEnum(string &val); + +}; + +#endif + +/********************************************************************** + End of file +**********************************************************************/ diff --git a/src/o1/NrCellInfo.hpp b/src/o1/NrCellInfo.hpp index 2c27b13aa..e2052866c 100644 --- a/src/o1/NrCellInfo.hpp +++ b/src/o1/NrCellInfo.hpp @@ -25,18 +25,11 @@ #include #include #include "sysrepo-cpp/Session.hpp" -#include "ConfigInterface.h" +#include "CmInterface.h" #include "GlobalDefs.hpp" #include "Singleton.hpp" #include "NrCellInfo.hpp" - -typedef enum AdminState{ - LOCKED, - UNLOCKED, - SHUTTING_DOWN -}adminState; - class NrCellInfo { public: diff --git a/src/o1/NrCellList.hpp b/src/o1/NrCellList.hpp index 45dd0f680..9418dae6b 100644 --- a/src/o1/NrCellList.hpp +++ b/src/o1/NrCellList.hpp @@ -27,7 +27,7 @@ #include #include #include "sysrepo-cpp/Session.hpp" -#include "ConfigInterface.h" +#include "CmInterface.h" #include "GlobalDefs.hpp" #include "Singleton.hpp" #include "NrCellInfo.hpp" diff --git a/src/o1/O1App.cpp b/src/o1/O1App.cpp index 5b1382160..d63498f38 100644 --- a/src/o1/O1App.cpp +++ b/src/o1/O1App.cpp @@ -24,7 +24,7 @@ #include "O1App.hpp" #include "GlobalDefs.hpp" #include "SessionHandler.hpp" -#include "ConfigInterface.h" +#include "CmInterface.h" #include #include "VesUtils.hpp" diff --git a/src/o1/PmInterface.h b/src/o1/PmInterface.h index 5208779a6..b822c5f33 100644 --- a/src/o1/PmInterface.h +++ b/src/o1/PmInterface.h @@ -28,17 +28,22 @@ extern "C" { #endif +typedef struct +{ + uint32_t sd:24; + uint8_t sst; +}SliceId; typedef struct { - uint32_t networkSliceIdentifier; + SliceId networkSliceIdentifier; double DRB_UEThpDl_SNSSAI; double DRB_UEThpUl_SNSSAI; }SliceMetricRecord; typedef struct { - SliceMetricRecord *sliceRecord; uint8_t nRecords; + SliceMetricRecord *sliceRecord; }SliceMetricList; diff --git a/src/o1/RrmPolicyCb.cpp b/src/o1/RrmPolicyCb.cpp new file mode 100644 index 000000000..5186ab0b3 --- /dev/null +++ b/src/o1/RrmPolicyCb.cpp @@ -0,0 +1,311 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2020-2021] [HCL Technologies Ltd.] # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ +*******************************************************************************/ + +/* This file contains implementation of RRM Policy get and update handler along + * with some supporting funtion. It handles get and change callback for + * rrmpolicy yang module */ + +#include +#include "RrmPolicyCb.hpp" + +RrmPolicyList rrmPolicy[MAX_POLICY]; + +uint8_t policyNum = 0; +uint8_t policyIndex = 0; +uint8_t policyMemberListNum =0; + +/******************************************************************* + * + * @brief override oper_get_items to handle callback + * + * @details + * + * Function : oper_get_items + * + * Functionality: + * - override oper_get_items to handle callback of get of + * o-ran-sc-du-hello-world yang module + * + * + * @params[in] sysrepo::S_Session session, const char *module_name, + * const char *path, const char *request_xpath, + * uint32_t request_id, libyang::S_Data_Node &parent, + * void *private_data + * @return SR_ERR_OK - success + * SR_ERR_OK - failure + ******************************************************************/ + +int RrmPolicyCb::oper_get_items(sysrepo::S_Session session, \ + const char *module_name, \ + const char *path, \ + const char *request_xpath, \ + uint32_t request_id, \ + libyang::S_Data_Node &parent, \ + void *private_data) +{ + O1_LOG("\nO1 RrmPolicyCb : Callback called for path=%s on get request", \ + path); + return SR_ERR_OK; +} + +/******************************************************************* + * + * @brief convert string resouce type to enum + * + * @details + * + * Function : resourceTypeToEnum + * + * Functionality: + * - convert string resouce type to enum + * + * + * @params[in] string resouceType + * @return Enum resouceType + ******************************************************************/ +RrmResourceType RrmPolicyCb::resourceTypeToEnum(string &val) +{ + RrmResourceType ret; + + if(val == "PRB") + { + ret = PRB; + } + else if(val == "PRB_UL") + { + ret = PRB_UL; + } + else if(val == "PRB_DL") + { + ret = PRB_DL; + } + else if(val == "RRC") + { + ret = RRC; + } + else if(val == "DRB") + { + ret = DRB; + } + else + { + O1_LOG("\nO1 RrmPolicyCb::updateParams non handeled value of " + "ResourceType = %s", val.c_str()); + } + O1_LOG("\nO1 rrmPolicy resourceTypeToEnum : val [%d]", ret); + return ret; +} + +/******************************************************************* + * + * @brief fill the parameters value into the structure instance + * + * @details + * + * Function : updateParams + * + * Functionality: + * - fill the parameters value into the structure instance + * + * + * @params[in] string leafNode, string val + * @return void + ******************************************************************/ + +bool RrmPolicyCb::updateParams(string &parent, string &leafNode, string &val) +{ + + O1_LOG("\nO1 RrmPolicyCb::updateParams parameter name=%s val = %s", \ + leafNode.c_str(), val.c_str()); + bool ret = true; + + if(val != "") + { + if (leafNode == "id") + { + policyIndex++; + policyNum = policyIndex -1 ; + memset(rrmPolicy[policyNum].id, '\0', ID_MAX_LEN); + strncpy(rrmPolicy[policyNum].id, val.c_str(), ID_MAX_LEN-1); + O1_LOG("\nO1 RrmPolicyCb::updateParams id = %s", rrmPolicy[policyNum].id); + rrmPolicy[policyNum].rRMMemberNum = 0; + } + else if(leafNode == "resourceType") + { + rrmPolicy[policyNum].resourceType = resourceTypeToEnum(val); + O1_LOG("\nO1 RrmPolicyCb::updateParams ResourceType = %d", \ + rrmPolicy[policyNum].resourceType); + } + else if(leafNode == "rRMPolicyMaxRatio") + { + rrmPolicy[policyNum].rRMPolicyMaxRatio = atoi(val.c_str()); + O1_LOG("\nO1 RrmPolicyCb::updateParams rRMPolicyMaxRatio = %d", \ + rrmPolicy[policyNum].rRMPolicyMaxRatio); + } + else if(leafNode == "rRMPolicyMinRatio") + { + rrmPolicy[policyNum].rRMPolicyMinRatio = atoi(val.c_str()); + O1_LOG("\nO1 RrmPolicyCb::updateParams rRMPolicyMinRatio = %d", \ + rrmPolicy[policyNum].rRMPolicyMinRatio); + } + else if(leafNode == "rRMPolicyDedicatedRatio") + { + rrmPolicy[policyNum].rRMPolicyDedicatedRatio = atoi(val.c_str()); + O1_LOG("\nO1 RrmPolicyCb::updateParams rRMPolicyDedicatedRatio = %d", \ + rrmPolicy[policyNum].rRMPolicyDedicatedRatio); + } + else if((leafNode == "mcc") || (leafNode == "mnc") + || leafNode == "sst" || leafNode == "sd") + { + int memberNum = policyMemberListNum/MAX_POLICY_LIST; + rrmPolicy[policyNum].rRMMemberNum = memberNum+1; + if(leafNode == "mcc") + { + memset(rrmPolicy[policyNum].rRMPolicyMemberList[memberNum].mcc, \ + '\0', MCC_LEN); + 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, \ + rrmPolicy[policyNum].rRMPolicyMemberList[memberNum].mcc[2]); + } + else if(leafNode == "mnc") + { + memset(rrmPolicy[policyNum].rRMPolicyMemberList[memberNum].mnc, \ + '\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, \ + rrmPolicy[policyNum].rRMPolicyMemberList[memberNum].mnc[1]); + } + else if(leafNode == "sst") + { + rrmPolicy[policyNum].rRMPolicyMemberList[memberNum].sst = \ + atoi(val.c_str()); + O1_LOG("\nO1 RrmPolicyCb::updateParams sst val = %d", + rrmPolicy[policyNum].rRMPolicyMemberList[memberNum].sst); + } + else if(leafNode == "sd") + { + memset(rrmPolicy[policyNum].rRMPolicyMemberList[memberNum].sd, \ + '\0', SD_LEN); + + rrmPolicy[policyNum].rRMPolicyMemberList[memberNum].sd[0] = \ + std::stoi(val.substr(0,2).c_str(),0,16); + rrmPolicy[policyNum].rRMPolicyMemberList[memberNum].sd[1] = \ + std::stoi(val.substr(2,2).c_str(),0,16); + rrmPolicy[policyNum].rRMPolicyMemberList[memberNum].sd[2] = \ + std::stoi(val.substr(4,2).c_str(),0,16); + O1_LOG("\nO1 RrmPolicyCb::updateParams rrmPolicy[%d]." + "rRMPolicyMemberList[%d].sd[2] = %c", policyNum, memberNum, \ + rrmPolicy[policyNum].rRMPolicyMemberList[memberNum].sd[SD_LEN-1]); + } + policyMemberListNum++; + } + else + { + O1_LOG("\nO1 RrmPolicyCb::updateParams some parameter not handled name=%s " + "val = %s", leafNode.c_str(), val.c_str()); + ret = false; + } + } + else + { + O1_LOG("\nO1 RrmPolicyCb::updateParams without value node name=%s val = %s", + leafNode.c_str(), val.c_str()); + } + return ret; +} + +/******************************************************************* + * + * @brief override module_change to handle callback + * + * @details + * + * Function : module_change + * + * Functionality: + * - override module_change to handle callback of modification of + * o-ran-sc-du-hello-world yang module + * + * + * @params[in] sysrepo::S_Session session, const char *module_name, + * const char *xpath, sr_event_t event, uint32_t request_id, + * void *private_data + * @return SR_ERR_OK - success + * SR_ERR_OK - failure + ******************************************************************/ + +int RrmPolicyCb::module_change(sysrepo::S_Session sess, \ + const char *module_name, \ + const char *xpath, \ + sr_event_t event, \ + uint32_t request_id, \ + void *private_data) +{ + char change_path[MAX_LEN]; + + try { + O1_LOG("\nO1 RrmPolicyCb : Notification %s", NetconfUtils::evToStr(event)); + if (SR_EV_CHANGE == event) + { + snprintf(change_path, MAX_LEN, "/%s:*//.", module_name); + auto it = sess->get_changes_iter(change_path); + while (auto change = sess->get_change_next(it)) { + //NetconfUtils::printChange(change); //enable only for debugging + if(nullptr != change->new_val()) + { + O1_LOG("\n\nO1 RrmPolicyCb : Parameter value has been \ +changed val=%s", change->new_val()->val_to_string().c_str()); + string val = change->new_val()->val_to_string(); + string parent, leafNode; + NetconfUtils::getLeafInfo(change->new_val()->to_string(), parent, leafNode); + O1_LOG("\nO1 RrmPolicy : LeafNode name = [%s]", leafNode.c_str()); + if(!updateParams(parent, leafNode, val)){ + O1_LOG("\nO1 RrmPolicy : LeafNode [%s] not handled", leafNode.c_str()); + //later error handling can be done + } + } + } +#ifndef ODU_TEST_STUB + if(ROK != setRrmPolicy(rrmPolicy, policyIndex)) + { + O1_LOG("\nO1 RrmPolicy : updateRrmPolicy failed"); + return SR_ERR_INTERNAL; + //later error handling can be done + } +#endif + } + } + catch( const std::exception& e ) { + O1_LOG("\nO1 RrmPolicyCb exception : %s\n", e.what()); + } + return SR_ERR_OK; +} + +/********************************************************************** + End of file +**********************************************************************/ diff --git a/src/o1/RrmPolicyCb.hpp b/src/o1/RrmPolicyCb.hpp new file mode 100644 index 000000000..e3018a405 --- /dev/null +++ b/src/o1/RrmPolicyCb.hpp @@ -0,0 +1,61 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2020-2021] [HCL Technologies Ltd.] # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ +*******************************************************************************/ + +/* This file contains RRM Policy get and update handler . It handles + get and change callback for rrmpolicy yang module */ + + +#ifndef __RRM_POLICY_CB_HPP__ +#define __RRM_POLICY_CB_HPP__ + +#include +#include +#include +#include "sysrepo-cpp/Session.hpp" +#include "CmInterface.h" +#include "GlobalDefs.hpp" +#include "Singleton.hpp" +#include "NetconfUtils.hpp" + +class RrmPolicyCb : public sysrepo::Callback +{ + public: + int oper_get_items(sysrepo::S_Session session,\ + const char *module_name,\ + const char *path,\ + const char *request_xpath,\ + uint32_t request_id,\ + libyang::S_Data_Node &parent,\ + void *private_data); //override + int module_change(sysrepo::S_Session sess, \ + const char *module_name, \ + const char *xpath, \ + sr_event_t event, \ + uint32_t request_id, \ + void *private_data); //override + + private: + bool updateParams(string &parent, string &leaf, string &val); + RrmResourceType resourceTypeToEnum(string &val); +}; + +#endif + +/********************************************************************** + End of file +**********************************************************************/ diff --git a/src/o1/SessionHandler.cpp b/src/o1/SessionHandler.cpp index 7c745ac5c..4fbe39007 100644 --- a/src/o1/SessionHandler.cpp +++ b/src/o1/SessionHandler.cpp @@ -25,6 +25,8 @@ #include "SessionHandler.hpp" #include "InitConfig.hpp" #include "NrCellCb.hpp" +#include "NrCellDuCb.hpp" +#include "RrmPolicyCb.hpp" using namespace std; /* Default constructor */ @@ -35,7 +37,7 @@ SessionHandler::SessionHandler() /* Destructor */ SessionHandler::~SessionHandler() -{ +{ } /********************************************************************** @@ -163,6 +165,17 @@ bool SessionHandler::subscribeModule(sysrepo::S_Subscribe subscrb) nrCellCb); subscrb->module_change_subscribe(CELL_STATE_MODULE_NAME, nrCellCb); + sysrepo::S_Callback nrCellDuCb(new NrCellDuCb()); + subscrb->oper_get_items_subscribe(MANAGED_ELEMENT_MODULE_NAME, \ + MANAGED_ELEMENT_MODULE_PATH, \ + nrCellDuCb); + subscrb->module_change_subscribe(MANAGED_ELEMENT_MODULE_NAME, nrCellDuCb); + + sysrepo::S_Callback rrmPolicyCb(new RrmPolicyCb()); + subscrb->oper_get_items_subscribe(RRMPOLICY_MODULE_NAME, \ + RRMPOLICY_MODULE_PATH, \ + rrmPolicyCb); + subscrb->module_change_subscribe(RRMPOLICY_MODULE_NAME, rrmPolicyCb); return true; } diff --git a/src/o1/UnixSocketServer.cpp b/src/o1/UnixSocketServer.cpp index 412d28820..ef954fa87 100644 --- a/src/o1/UnixSocketServer.cpp +++ b/src/o1/UnixSocketServer.cpp @@ -24,7 +24,7 @@ #include "UnixSocketServer.hpp" #include "Alarm.hpp" #include "AlarmManager.hpp" -#include "ConfigInterface.h" +#include "CmInterface.h" #include "GlobalDefs.hpp" #include #include @@ -153,14 +153,6 @@ int UnixSocketServer::readMessage(int fd) O1_LOG("\nO1 UnixSocketServer : " "Alarm raised for alarm Id %s", alrmRec->alarmId); - - // triggering VES notification for the risen Alarm - - VesEventHandler vesEvtHdr; - if(vesEvtHdr.prepare(VesEventType::FAULT_NOTIFICATION, &alrm)) { - vesEvtHdr.send(); - } - } else @@ -178,11 +170,6 @@ int UnixSocketServer::readMessage(int fd) "Alarm cleared for alarm Id %s", alrmRec->alarmId); - // triggering VES notification for the cleared Alarm - VesEventHandler vesEvtHdr; - if(vesEvtHdr.prepare(VesEventType::FAULT_NOTIFICATION, &alrm)) { - vesEvtHdr.send(); - } } else { @@ -191,37 +178,6 @@ int UnixSocketServer::readMessage(int fd) alrmRec->alarmId); } break; -#if 0 - case GET_STARTUP_CONFIG: - { - StartupConfig cfg; - InitConfig::instance().getCurrInterfaceConfig(cfg); - O1_LOG("\nO1 UnixSocketServer : " - "cfg.DU_IPV4_Addr [%s]", - cfg.DU_IPV4_Addr); - O1_LOG("\nO1 UnixSocketServer : " - "cfg.DU_Port [%d]", - cfg.DU_Port); - O1_LOG("\nO1 UnixSocketServer : " - "cfg.CU_IPV4_Addr [%s]", - cfg.CU_IPV4_Addr); - O1_LOG("\nO1 UnixSocketServer : " - "cfg.CU_Port [%d]", - cfg.CU_Port); - O1_LOG("\nO1 UnixSocketServer : " - "cfg.RIC_IPV4_Addr [%s]", - cfg.RIC_IPV4_Addr); - O1_LOG("\nO1 UnixSocketServer : " - "cfg.RIC_Port [%d]", - cfg.RIC_Port); - if (write (fd, &cfg, sizeof(cfg)) < 0) - { - O1_LOG("\nO1 UnixSocketServer : " - "Error sending startup configuration \n"); - } - break; - } -#endif default: O1_LOG("\nO1 UnixSocketServer : No action performed"); break; diff --git a/src/o1/ves/SliceMeasurementEvent.cpp b/src/o1/ves/SliceMeasurementEvent.cpp index ab219bb51..53fc4f5a0 100644 --- a/src/o1/ves/SliceMeasurementEvent.cpp +++ b/src/o1/ves/SliceMeasurementEvent.cpp @@ -87,6 +87,9 @@ 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); if(Slice == 0) { ret = false; @@ -111,7 +114,7 @@ bool SliceMeasurementEvent::prepareEventFields(const Message* msg) } else if (JsonHelper::addNodeToObject(Slice, \ "networkSliceIdentifier", \ - sliceList[i].networkSliceIdentifier) == 0) + networkId) == 0) { ret = false; } diff --git a/src/ric_stub/ric_stub.c b/src/ric_stub/ric_stub.c index bbb4dde76..0f36cb52d 100644 --- a/src/ric_stub/ric_stub.c +++ b/src/ric_stub/ric_stub.c @@ -23,7 +23,7 @@ #include "du_log.h" #ifdef O1_ENABLE -#include "ConfigInterface.h" +#include "CmInterface.h" #endif #define RIC_ID 1