X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fcu_stub%2Fcu_stub.c;h=2df3cd76e7539d8a1002d0191ba39c096d3f1e08;hb=2ba58cd78e409ae234aac627914f954e6aa8b1ff;hp=df86911b898f6bcb31ac30d9c85a005ced1fa02f;hpb=b4e352a998576ab71aa74eb8b970f0ba39b471af;p=o-du%2Fl2.git diff --git a/src/cu_stub/cu_stub.c b/src/cu_stub/cu_stub.c index df86911b8..2df3cd76e 100644 --- a/src/cu_stub/cu_stub.c +++ b/src/cu_stub/cu_stub.c @@ -150,16 +150,16 @@ void readCuCfg() } cmInetAddr((S8*)g_cfg.DU_IPV4_Addr, &ipv4_du); - cuCb.cuCfgParams.sctpParams.destCb[0].destIpAddr.ipV4Addr = ipv4_du; - cuCb.cuCfgParams.sctpParams.destCb[0].destIpAddr.ipV6Pres = false; + cuCb.cuCfgParams.sctpParams.f1SctpInfo.destCb[0].destIpAddr.ipV4Addr = ipv4_du; + cuCb.cuCfgParams.sctpParams.f1SctpInfo.destCb[0].destIpAddr.ipV6Pres = false; cmInetAddr((S8*)g_cfg.CU_IPV4_Addr, &ipv4_cu); cuCb.cuCfgParams.sctpParams.localIpAddr.ipV4Addr = ipv4_cu; cuCb.cuCfgParams.sctpParams.localIpAddr.ipV6Pres = false; - cuCb.cuCfgParams.sctpParams.destCb[0].destPort = g_cfg.DU_Port; - cuCb.cuCfgParams.sctpParams.f1SctpPort = g_cfg.CU_Port; - cuCb.cuCfgParams.sctpParams.numDestNode = 1; + cuCb.cuCfgParams.sctpParams.f1SctpInfo.destCb[0].destPort = g_cfg.DU_Port; + cuCb.cuCfgParams.sctpParams.f1SctpInfo.port = g_cfg.CU_Port; + cuCb.cuCfgParams.sctpParams.f1SctpInfo.numDestNode = 1; cuCb.cuCfgParams.egtpParams.localIp.ipV4Pres = TRUE; cuCb.cuCfgParams.egtpParams.localIp.ipV4Addr = ipv4_cu; @@ -270,25 +270,31 @@ void readCuCfg() * RFAILED - failure * * ****************************************************************/ -void initiateInterDuHandover(uint32_t sourceDuId, uint32_t targetDuId, uint32_t ueId) +void initiateInterDuHandover(uint32_t sourceDuId, uint32_t targetDuId, uint32_t duUeF1apId) { - uint8_t duIdx = 0; - DuDb *duDb = NULLP; - CuUeCb *ueCb = NULLP; - - SEARCH_DU_DB(duIdx, sourceDuId, duDb); - if(duDb) - ueCb = &duDb->ueCb[ueId-1]; - if(ueCb) - { - ueCb->state = UE_HANDOVER_IN_PROGRESS; - ueCb->hoInfo.sourceDuId = sourceDuId; - ueCb->hoInfo.targetDuId = targetDuId; - } + uint8_t duIdx = 0; + DuDb *duDb = NULLP; + CuUeCb *ueCb = NULLP; + + DU_LOG("\nINFO --> CU_STUB: Inter-DU Handover Started for ueId [%d] from DU ID [%d] to DU ID [%d]", \ + duUeF1apId, sourceDuId, targetDuId); - DU_LOG("\nINFO --> CU_STUB: Inter-DU Handover Started for ueId [%d] from DU ID [%d] to DU ID [%d]", \ - ueId, sourceDuId, targetDuId); - BuildAndSendUeContextModificationReq(sourceDuId, ueCb, QUERY_CONFIG); + SEARCH_DU_DB(duIdx, sourceDuId, duDb); + if(duDb) + ueCb = &duDb->ueCb[duUeF1apId-1]; + if(ueCb) + { + ueCb->state = UE_HANDOVER_IN_PROGRESS; + ueCb->hoInfo.HOType = Inter_DU_HO; + ueCb->hoInfo.srcNodeId = sourceDuId; + ueCb->hoInfo.tgtNodeId = targetDuId; + + BuildAndSendUeContextModificationReq(sourceDuId, ueCb, QUERY_CONFIG); + } + else + { + DU_LOG("\nINFO --> CU_STUB: DU UE F1AP ID [%d] not found", duUeF1apId); + } } @@ -310,11 +316,44 @@ void initiateInterDuHandover(uint32_t sourceDuId, uint32_t targetDuId, uint32_t * RFAILED - failure * * ****************************************************************/ -void initiateInterCuHandover(uint32_t sourceCuId, uint32_t targetCuId, uint32_t ueId) +void initiateInterCuHandover(uint32_t targetCuId, uint32_t cellId, uint32_t cuUeF1apId) { - DU_LOG("\nINFO --> CU_STUB: Inter-CU Handover Started for ueId [%d] from CU ID [%d] to CU ID [%d]", \ - ueId, sourceCuId, targetCuId); - //TODO : First message of HO procedure to be triggered here. Changes to be done in next commit. + uint8_t duIdx, ueIdx; + CuUeCb *ueCb = NULLP; + + DU_LOG("\nINFO --> CU_STUB: Inter-CU Handover Started for ueId [%d] to CU ID [%d]", \ + cuUeF1apId, targetCuId); + + for(duIdx = 0; duIdx < cuCb.numDu; duIdx++) + { + for(ueIdx = 0; ueIdx < (MAX_NUM_CELL * MAX_NUM_UE); ueIdx++) + { + ueCb = &cuCb.duInfo[duIdx].ueCb[ueIdx]; + if(cuCb.duInfo[duIdx].ueCb[ueIdx].gnbCuUeF1apId == cuUeF1apId) + { + ueCb = &cuCb.duInfo[duIdx].ueCb[ueIdx]; + break; + } + } + if(ueCb) + break; + } + + if(ueCb) + { + ueCb->state = UE_HANDOVER_IN_PROGRESS; + ueCb->hoInfo.HOType = Xn_Based_Inter_CU_HO; + ueCb->hoInfo.srcNodeId = cuCb.cuCfgParams.cuId; + ueCb->hoInfo.tgtNodeId = targetCuId; + ueCb->hoInfo.tgtCellId = cellId; + ueCb->hoInfo.cuUeF1apIdSrc = ueCb->gnbCuUeF1apId; + + BuildAndSendUeContextModificationReq(cuCb.duInfo[duIdx].duId, ueCb, QUERY_CONFIG); + } + else + { + DU_LOG("\nINFO --> CU_STUB: CU UE F1AP ID [%d] not found", cuUeF1apId); + } } /******************************************************************* @@ -339,7 +378,7 @@ uint8_t startDlData() uint32_t duId; uint8_t ret = ROK; uint8_t cnt = 0; - int32_t totalNumOfTestFlow = 20; + int32_t totalNumOfTestFlow = 200; EgtpTeIdCb *teidCb = NULLP; while(totalNumOfTestFlow) @@ -449,32 +488,32 @@ void *cuConsoleHandler(void *args) else if(ch == 'h') { HandoverType hoType; - uint32_t sourceId, targetId, ueId; + uint32_t srcNodeId, tgtNodeId, targetCellId, ueId; DU_LOG("\n\nChoose the type of handover to initiate : \nEnter 1 for Inter-CU Handover over Xn interface\nEnter 2 for Inter-DU Handover\n"); scanf("%d", &hoType); if(hoType == Xn_Based_Inter_CU_HO) { - DU_LOG("\nEnter Source CU ID for Inter-CU Handover : "); - scanf("%d", &sourceId); DU_LOG("\nEnter Target CU ID for Inter-CU Handover : "); - scanf("%d", &targetId); + scanf("%d", &tgtNodeId); + DU_LOG("\nEnter Target Physical Cell ID for Inter-CU Handover : "); + scanf("%d", &targetCellId); DU_LOG("\nEnter CU UE F1AP ID to be handed over : "); scanf("%d", &ueId); - initiateInterCuHandover(sourceId, targetId, ueId); + initiateInterCuHandover(tgtNodeId, targetCellId, ueId); } else if(hoType == Inter_DU_HO) { DU_LOG("\nEnter Source DU ID for Inter-DU Handover : "); - scanf("%d", &sourceId); + scanf("%d", &srcNodeId); DU_LOG("\nEnter Target DU ID for Inter-DU Handover : "); - scanf("%d", &targetId); + scanf("%d", &tgtNodeId); DU_LOG("\nEnter DU UE F1AP ID to be handed over : "); scanf("%d", &ueId); - initiateInterDuHandover(sourceId, targetId, ueId); + initiateInterDuHandover(srcNodeId, tgtNodeId, ueId); } } /* Start Idle mode paging when 'p' is received from console input */ @@ -496,21 +535,64 @@ void *cuConsoleHandler(void *args) } else if(ch == 'm') { - uint8_t ueId = 1; - uint8_t duId = 1; - uint8_t duIdx = 0; + uint8_t ueId = 1; + uint8_t duId = 0; + uint8_t duIdx = 0; + DuDb *duDb = NULLP; + CuUeCb *ueCb = NULLP; + + DU_LOG("\nEnter DU ID whose UE has to be modified"); + scanf("%d", &duId); + DU_LOG("\nEnter UE ID to be modified"); + scanf("%d", &ueId); DU_LOG("\nINFO --> CU_STUB: UE Context Mod for ueId [%d] at DU ID [%d]", \ - ueId, duId ); - DuDb *duDb = NULLP; - CuUeCb *ueCb = NULLP; + ueId, duId); SEARCH_DU_DB(duIdx, duId, duDb); if(duDb) + { ueCb = &duDb->ueCb[ueId-1]; - BuildAndSendUeContextModificationReq(duId, ueCb, MODIFY_UE); + BuildAndSendUeContextModificationReq(duId, ueCb, MODIFY_UE); + } + else + { + DU_LOG("ERROR --> DuDb is NULLP"); + } + continue; } + /*UE context release command from CU*/ + else if(ch == 'c') + { + uint32_t duId, cuUeF1apId, duUeF1apId; + uint8_t duIdx = 0; + DuDb *duDb = NULLP; + + DU_LOG("\nEnter DU ID on which UE has to be released"); + scanf("%d", &duId); + DU_LOG("\nEnter UE ID to be released"); + scanf("%d", &duUeF1apId); + + SEARCH_DU_DB(duIdx, duId, duDb); + if(duDb) + { + if(duDb->ueCb[duUeF1apId-1].gnbDuUeF1apId == duUeF1apId) + { + cuUeF1apId = duDb->ueCb[duUeF1apId-1].gnbCuUeF1apId; + DU_LOG("INFO --> CU_STUB: Cu UeId: %d Du UeId:%d",cuUeF1apId, duUeF1apId); + BuildAndSendUeContextReleaseCommand(duId, cuUeF1apId, duUeF1apId); + } + else + { + DU_LOG("ERROR --> CU_STUB: Du UeId:%d in UeCb mismatch",\ + duDb->ueCb[duUeF1apId-1].gnbDuUeF1apId); + } + } + + sleep(5); + continue; + } } } /**********************************************************************