From 2a1e7b739f61e7fa582bf14f0d263cec9b34bb95 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Thu, 30 Sep 2021 21:40:11 +0200 Subject: [PATCH 01/20] fix gcc warnings, hardcode gtpu debug level for ci debug --- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 1 - openair2/F1AP/f1ap_du_task.c | 11 --- openair2/RRC/NR/MESSAGES/asn1_msg.c | 21 +---- openair3/ocp-gtpu/gtp_itf.cpp | 85 +++++++++++--------- 4 files changed, 48 insertions(+), 70 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 50490d2897..2200071971 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -68,7 +68,6 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, /* GNB_DU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); - instance_t du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; /* NRCGI * Fixme: process NRCGI */ diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 6c5094d248..49df62d078 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -90,18 +90,7 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat tmp= &RC.nrmac[instance]->eth_params_n; else tmp= &RC.mac[instance]->eth_params_n; - const cudu_params_t params = { - .local_ipv4_address = tmp->my_addr, - .local_port = tmp->my_portd, - .remote_ipv4_address = tmp->remote_addr, - .remote_port = tmp->remote_portd - }; - /* - if (!RC.nrrrc) - AssertFatal(proto_agent_start(instance, ¶ms) == 0, - "could not start PROTO_AGENT for F1U on instance %ld!\n", instance); - */ DU_send_F1_SETUP_REQUEST(instance); } diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 097353f43a..e0dd1e0a0a 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -153,15 +153,6 @@ typedef struct xer_sprint_string_s { size_t string_index; } xer_sprint_string_t; - -#define asn1cCallocOne(VaR, VaLue) \ - VaR = calloc(1,sizeof(*VaR)); *VaR=VaLue; -#define asn1cCalloc(VaR, lOcPtr) \ - typeof(VaR) lOcPtr = VaR = calloc(1,sizeof(*VaR)); -#define asn1cSequenceAdd(VaR, TyPe, lOcPtr) \ - TyPe *lOcPtr= calloc(1,sizeof(TyPe)); \ - ASN_SEQUENCE_ADD(&VaR,lOcPtr); - //replace LTE //extern unsigned char NB_eNB_INST; extern unsigned char NB_gNB_INST; @@ -310,9 +301,6 @@ uint8_t do_MIB_NR(gNB_RRC_INST *rrc,uint32_t frame) { return((enc_rval.encoded+7)/8); } -#define asn1cCalloc(VaR, TyPe, lOcPtr) TyPe *lOcPtr=VaR=(TyPe*) calloc(1,sizeof(TyPe)); -#define asn1cCallocOne(VaR, VaLue) VaR=calloc(1,sizeof(*VaR)); *VaR=VaLue; -#define asn1cSequenceAdd(VaR, TyPe, lOcPtr) TyPe *lOcPtr=(TyPe*) calloc(1,sizeof(TyPe)); ASN_SEQUENCE_ADD(&VaR,lOcPtr); uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, gNB_RrcConfigurationReq *configuration @@ -342,7 +330,7 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, asn1cSequenceAdd(sib1->cellAccessRelatedInfo.plmn_IdentityList.list, struct NR_PLMN_IdentityInfo, nr_plmn_info); for (int i = 0; i < num_plmn; ++i) { asn1cSequenceAdd(nr_plmn_info->plmn_IdentityList.list, struct NR_PLMN_Identity, nr_plmn); - asn1cCalloc(nr_plmn->mcc, struct NR_MCC, mcc); + asn1cCalloc(nr_plmn->mcc, mcc); int confMcc=configuration->mcc[i]; asn1cSequenceAdd(mcc->list, NR_MCC_MNC_Digit_t, mcc0); *mcc0=(confMcc/100)%10; @@ -411,8 +399,7 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, ASN_SEQUENCE_ADD(&sib1->si_SchedulingInfo->schedulingInfoList.list,schedulingInfo);*/ // servingCellConfigCommon - asn1cCalloc(sib1->servingCellConfigCommon, - struct NR_ServingCellConfigCommonSIB, ServCellCom); + asn1cCalloc(sib1->servingCellConfigCommon, ServCellCom); NR_BWP_DownlinkCommon_t *initialDownlinkBWP=&ServCellCom->downlinkConfigCommon.initialDownlinkBWP; initialDownlinkBWP->genericParameters= configuration->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters; @@ -547,19 +534,17 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, ServCellCom->downlinkConfigCommon.pcch_Config.ns = NR_PCCH_Config__ns_one; asn1cCalloc(ServCellCom->downlinkConfigCommon.pcch_Config.firstPDCCH_MonitoringOccasionOfPO, - struct NR_PCCH_Config__firstPDCCH_MonitoringOccasionOfPO, P0); P0->present = NR_PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT; asn1cCalloc(P0->choice.sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT, - struct NR_PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT, Z8); asn1cSequenceAdd(Z8->list, long, ZoneEight); asn1cCallocOne(ZoneEight, 0); - asn1cCalloc(ServCellCom->uplinkConfigCommon, struct NR_UplinkConfigCommonSIB, UL) + asn1cCalloc(ServCellCom->uplinkConfigCommon, UL) asn_set_empty(&UL->frequencyInfoUL.scs_SpecificCarrierList.list); for(int i = 0; i< configuration->scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.count; i++) { ASN_SEQUENCE_ADD(&UL->frequencyInfoUL.scs_SpecificCarrierList.list, diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 330e680d3e..0b8c533c88 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -163,7 +163,7 @@ static void gtpv1uSend(instance_t instance, gtpv1u_enb_tunnel_data_req_t *req, b auto ptrRnti=inst->ue2te_mapping.find(rnti); if ( ptrRnti==inst->ue2te_mapping.end() ) { - LOG_E(GTPU, "gtpv1uSend failed: while getting ue rnti %x in hashtable ue_mapping\n", rnti); + LOG_E(GTPU, "[%ld] gtpv1uSend failed: while getting ue rnti %x in hashtable ue_mapping\n", instance, rnti); pthread_mutex_unlock(&globGtp.gtp_lock); return; } @@ -171,13 +171,13 @@ static void gtpv1uSend(instance_t instance, gtpv1u_enb_tunnel_data_req_t *req, b map::iterator ptr2=ptrRnti->second.bearers.find(rab_id); if ( ptr2 == ptrRnti->second.bearers.end() ) { - LOG_E(GTPU,"GTP-U instance: %ld sending a packet to a non existant RNTI:RAB: %x/%x\n", instance, rnti, rab_id); + LOG_E(GTPU,"[%ld] GTP-U instance: sending a packet to a non existant RNTI:RAB: %x/%x\n", instance, rnti, rab_id); pthread_mutex_unlock(&globGtp.gtp_lock); return; } - LOG_D(GTPU,"sending a packet to RNTI:RAB:teid %x/%x/%x, len %lu, oldseq %d, oldnum %d\n", - rnti, rab_id,ptr2->second.teid_outgoing,length, ptr2->second.seqNum,ptr2->second.npduNum ); + LOG_D(GTPU,"[%ld] sending a packet to RNTI:RAB:teid %x/%x/%x, len %lu, oldseq %d, oldnum %d\n", + instance, rnti, rab_id,ptr2->second.teid_outgoing,length, ptr2->second.seqNum,ptr2->second.npduNum ); if(seqNumFlag) ptr2->second.seqNum++; @@ -205,7 +205,7 @@ static void gtpv1uSend2(instance_t instance, gtpv1u_gnb_tunnel_data_req_t *req, auto ptrRnti=inst->ue2te_mapping.find(rnti); if ( ptrRnti==inst->ue2te_mapping.end() ) { - LOG_E(GTPU, "GTP-U instance: %ld gtpv1uSend failed: while getting ue rnti %x in hashtable ue_mapping\n", instance, rnti); + LOG_E(GTPU, "[%ld] GTP-U gtpv1uSend failed: while getting ue rnti %x in hashtable ue_mapping\n", instance, rnti); pthread_mutex_unlock(&globGtp.gtp_lock); return; } @@ -218,7 +218,7 @@ static void gtpv1uSend2(instance_t instance, gtpv1u_gnb_tunnel_data_req_t *req, return; } - LOG_D(GTPU,"GTP-U instance: %ld sending a packet to RNTI:RAB:teid %x/%x/%x, len %lu, oldseq %d, oldnum %d\n", + LOG_D(GTPU,"[%ld] GTP-U sending a packet to RNTI:RAB:teid %x/%x/%x, len %lu, oldseq %d, oldnum %d\n", instance, rnti, rab_id,ptr2->second.teid_outgoing,length, ptr2->second.seqNum,ptr2->second.npduNum ); if(seqNumFlag) @@ -245,7 +245,7 @@ static void gtpv1uEndTunnel(instance_t instance, gtpv1u_enb_tunnel_data_req_t *r auto ptrRnti=inst->ue2te_mapping.find(rnti); if ( ptrRnti==inst->ue2te_mapping.end() ) { - LOG_E(GTPU, "gtpv1uSend failed: while getting ue rnti %x in hashtable ue_mapping\n", rnti); + LOG_E(GTPU, "[%ld] gtpv1uSend failed: while getting ue rnti %x in hashtable ue_mapping\n", instance, rnti); pthread_mutex_unlock(&globGtp.gtp_lock); return; } @@ -253,13 +253,13 @@ static void gtpv1uEndTunnel(instance_t instance, gtpv1u_enb_tunnel_data_req_t *r map::iterator ptr2=ptrRnti->second.bearers.find(rab_id); if ( ptr2 == ptrRnti->second.bearers.end() ) { - LOG_E(GTPU,"GTP-U instance: %ld sending a packet to a non existant RNTI:RAB: %x/%x\n", instance, rnti, rab_id); + LOG_E(GTPU,"[%ld] GTP-U sending a packet to a non existant RNTI:RAB: %x/%x\n", instance, rnti, rab_id); pthread_mutex_unlock(&globGtp.gtp_lock); return; } - LOG_D(GTPU,"sending a end packet packet to RNTI:RAB:teid %x/%x/%x\n", - rnti, rab_id,ptr2->second.teid_outgoing); + LOG_D(GTPU,"[%ld] sending a end packet packet to RNTI:RAB:teid %x/%x/%x\n", + instance, rnti, rab_id,ptr2->second.teid_outgoing); ocp_gtpv1u_bearer_t tmp=ptr2->second; pthread_mutex_unlock(&globGtp.gtp_lock); Gtpv1uMsgHeaderT msgHdr; @@ -281,11 +281,11 @@ static void gtpv1uEndTunnel(instance_t instance, gtpv1u_enb_tunnel_data_req_t *r to.sin_addr.s_addr = tmp.outgoing_ip_addr; char ip4[INET_ADDRSTRLEN]; //char ip6[INET6_ADDRSTRLEN]; - LOG_D(GTPU,"sending end packet to %s\n", inet_ntoa(to.sin_addr) ); + LOG_D(GTPU,"[%ld] sending end packet to %s\n", instance, inet_ntoa(to.sin_addr) ); if (sendto(compatInst(instance), (void *)&msgHdr, sizeof(msgHdr), 0,(struct sockaddr *)&to, sizeof(to) ) != sizeof(msgHdr)) { LOG_E(GTPU, - "[SD %ld] Failed to send data to %s on port %d, buffer size %lu\n", + "[%ld] Failed to send data to %s on port %d, buffer size %lu\n", compatInst(instance), inet_ntop(AF_INET, &tmp.outgoing_ip_addr, ip4, INET_ADDRSTRLEN), tmp.outgoing_port, sizeof(msgHdr)); } } @@ -373,7 +373,7 @@ static int udpServerSocket(openAddr_s addr) { int sendbuff = 1000*1000*10; AssertFatal(0==setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, &sendbuff, sizeof(sendbuff)),""); - LOG_D(GTPU,"Created listener for paquets to: %s:%s, send buffer size: %d\n", addr.originHost, addr.originService,sendbuff); + LOG_D(GTPU,"[%d] Created listener for paquets to: %s:%s, send buffer size: %d\n", sockfd, addr.originHost, addr.originService,sendbuff); return sockfd; } @@ -397,7 +397,7 @@ void GtpuUpdateTunnelOutgoingTeid(instance_t instance, rnti_t rnti, ebi_t bearer auto ptrRnti=inst->ue2te_mapping.find(rnti); if ( ptrRnti == inst->ue2te_mapping.end() ) { - LOG_E(GTPU,"Update tunnel for a not existing rnti %x\n", rnti); + LOG_E(GTPU,"[%ld] Update tunnel for a not existing rnti %x\n", instance, rnti); pthread_mutex_unlock(&globGtp.gtp_lock); return; } @@ -405,13 +405,13 @@ void GtpuUpdateTunnelOutgoingTeid(instance_t instance, rnti_t rnti, ebi_t bearer map::iterator ptr2=ptrRnti->second.bearers.find(bearer_id); if ( ptr2 == ptrRnti->second.bearers.end() ) { - LOG_E(GTPU,"Update tunnel for a existing rnti %x, but wrong bearer_id %u\n", rnti, bearer_id); + LOG_E(GTPU,"[%ld] Update tunnel for a existing rnti %x, but wrong bearer_id %u\n", instance, rnti, bearer_id); pthread_mutex_unlock(&globGtp.gtp_lock); return; } ptr2->second.teid_outgoing = newOutgoingTeid; - LOG_I(GTPU, "Tunnel Outgoing TEID updated to %d \n", ptr2->second.teid_outgoing); + LOG_I(GTPU, "[%ld] Tunnel Outgoing TEID updated to %d \n", instance, ptr2->second.teid_outgoing); pthread_mutex_unlock(&globGtp.gtp_lock); return; } @@ -424,14 +424,14 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer auto it=inst->ue2te_mapping.find(rnti); if ( it != inst->ue2te_mapping.end() ) { - LOG_W(GTPU,"Create a config for a already existing GTP tunnel (rnti %x)\n", rnti); + LOG_W(GTPU,"[%ld] Create a config for a already existing GTP tunnel (rnti %x)\n", instance, rnti); inst->ue2te_mapping.erase(it); } teid_t incoming_teid=gtpv1uNewTeid(); while ( inst->te2ue_mapping.find(incoming_teid) != inst->te2ue_mapping.end() ) { - LOG_W(GTPU, "generated a random Teid that exists, re-generating (%x)\n",incoming_teid); + LOG_W(GTPU, "[%ld] generated a random Teid that exists, re-generating (%x)\n", instance, incoming_teid); incoming_teid=gtpv1uNewTeid(); }; @@ -471,7 +471,8 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer pthread_mutex_unlock(&globGtp.gtp_lock); char ip4[INET_ADDRSTRLEN]; char ip6[INET6_ADDRSTRLEN]; - LOG_I(GTPU, "Created tunnel for RNTI %x, teid for DL: %u, teid for UL %u to remote IPv4: %s, IPv6 %s\n", + LOG_I(GTPU, "[%ld] Created tunnel for RNTI %x, teid for DL: %u, teid for UL %u to remote IPv4: %s, IPv6 %s\n", + instance, rnti, tmp->teid_incoming, tmp->teid_outgoing, @@ -483,7 +484,8 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer int ocp_gtpv1u_create_s1u_tunnel(instance_t instance, const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req, gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp) { - LOG_D(GTPU, "Start create tunnels for RNTI %x, num_tunnels %d, sgw_S1u_teid %x\n", + LOG_D(GTPU, "[%ld] Start create tunnels for RNTI %x, num_tunnels %d, sgw_S1u_teid %x\n", + instance, create_tunnel_req->rnti, create_tunnel_req->num_tunnels, create_tunnel_req->sgw_S1u_teid[0]); @@ -517,7 +519,8 @@ int ocp_gtpv1u_update_s1u_tunnel( const gtpv1u_enb_create_tunnel_req_t *const create_tunnel_req, const rnti_t prior_rnti ) { - LOG_D(GTPU, "Start update tunnels for old RNTI %x, new RNTI %x, num_tunnels %d, sgw_S1u_teid %x, eps_bearer_id %x\n", + LOG_D(GTPU, "[%ld] Start update tunnels for old RNTI %x, new RNTI %x, num_tunnels %d, sgw_S1u_teid %x, eps_bearer_id %x\n", + instance, prior_rnti, create_tunnel_req->rnti, create_tunnel_req->num_tunnels, @@ -527,13 +530,13 @@ int ocp_gtpv1u_update_s1u_tunnel( auto inst=&globGtp.instances[compatInst(instance)]; if ( inst->ue2te_mapping.find(create_tunnel_req->rnti) == inst->ue2te_mapping.end() ) { - LOG_E(GTPU,"Update not already existing tunnel (new rnti %x, old rnti %x)\n", create_tunnel_req->rnti, prior_rnti); + LOG_E(GTPU,"[%ld] Update not already existing tunnel (new rnti %x, old rnti %x)\n", instance, create_tunnel_req->rnti, prior_rnti); } auto it=inst->ue2te_mapping.find(prior_rnti); if ( it != inst->ue2te_mapping.end() ) { - LOG_W(GTPU,"Update a not existing tunnel, start create the new one (new rnti %x, old rnti %x)\n", create_tunnel_req->rnti, prior_rnti); + LOG_W(GTPU,"[%ld] Update a not existing tunnel, start create the new one (new rnti %x, old rnti %x)\n", instance, create_tunnel_req->rnti, prior_rnti); pthread_mutex_unlock(&globGtp.gtp_lock); gtpv1u_enb_create_tunnel_resp_t tmp; (void)ocp_gtpv1u_create_s1u_tunnel(instance, create_tunnel_req, &tmp); @@ -549,7 +552,8 @@ int ocp_gtpv1u_update_s1u_tunnel( int gtpv1u_create_ngu_tunnel( const instance_t instance, const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req, gtpv1u_gnb_create_tunnel_resp_t *const create_tunnel_resp) { - LOG_D(GTPU, "Start create tunnels for RNTI %x, num_tunnels %d, sgw_S1u_teid %x\n", + LOG_D(GTPU, "[%ld] Start create tunnels for RNTI %x, num_tunnels %d, sgw_S1u_teid %x\n", + instance, create_tunnel_req->rnti, create_tunnel_req->num_tunnels, create_tunnel_req->outgoing_teid[0]); @@ -590,14 +594,14 @@ int ocp_gtpv1u_create_x2u_tunnel( } int newGtpuDeleteTunnel(instance_t instance, rnti_t rnti) { - LOG_D(GTPU, "Start delete tunnels for RNTI %x\n", - rnti); + LOG_D(GTPU, "[%ld] Start delete tunnels for RNTI %x\n", + instance, rnti); pthread_mutex_lock(&globGtp.gtp_lock); auto inst=&globGtp.instances[compatInst(instance)]; auto it=inst->ue2te_mapping.find(rnti); if ( it == inst->ue2te_mapping.end() ) { - LOG_W(GTPU,"Delete a non existing GTP tunnel\n"); + LOG_W(GTPU,"[%ld] Delete a non existing GTP tunnel\n", instance); pthread_mutex_unlock(&globGtp.gtp_lock); return -1; } @@ -613,7 +617,7 @@ int newGtpuDeleteTunnel(instance_t instance, rnti_t rnti) { inst->ue2te_mapping.erase(it); pthread_mutex_unlock(&globGtp.gtp_lock); - LOG_I(GTPU, "Deleted all tunnels for RNTI %d (%d tunnels deleted)\n", rnti, nb); + LOG_I(GTPU, "[%ld] Deleted all tunnels for RNTI %d (%d tunnels deleted)\n", instance, rnti, nb); return !GTPNOK; } @@ -671,7 +675,7 @@ static int Gtpv1uHandleEndMarker(int h, Gtpv1uMsgHeaderT *msgHdr = (Gtpv1uMsgHeaderT *) msgBuf; if ( msgHdr->version != 1 || msgHdr->PT != 1 ) { - LOG_E(GTPU, "Received a packet that is not GTP header\n"); + LOG_E(GTPU, "[%d] Received a packet that is not GTP header\n", h); return GTPNOK; } @@ -681,7 +685,7 @@ static int Gtpv1uHandleEndMarker(int h, auto tunnel=inst->te2ue_mapping.find(ntohl(msgHdr->teid)); if ( tunnel == inst->te2ue_mapping.end() ) { - LOG_E(GTPU,"Received a incoming packet on unknown teid (%x) Dropping!\n", msgHdr->teid); + LOG_E(GTPU,"[%d] Received a incoming packet on unknown teid (%x) Dropping!\n", h, msgHdr->teid); pthread_mutex_unlock(&globGtp.gtp_lock); return GTPNOK; } @@ -717,9 +721,9 @@ static int Gtpv1uHandleEndMarker(int h, mode, &sourceL2Id, &destinationL2Id) ) - LOG_E(GTPU,"down layer refused incoming packet\n"); + LOG_E(GTPU,"[%d] down layer refused incoming packet\n", h); - LOG_D(GTPU,"Received END marker packet for: teid:%x\n", ntohl(msgHdr->teid)); + LOG_D(GTPU,"[%d] Received END marker packet for: teid:%x\n", h, ntohl(msgHdr->teid)); return !GTPNOK; } @@ -731,7 +735,7 @@ static int Gtpv1uHandleGpdu(int h, Gtpv1uMsgHeaderT *msgHdr = (Gtpv1uMsgHeaderT *) msgBuf; if ( msgHdr->version != 1 || msgHdr->PT != 1 ) { - LOG_E(GTPU, "Received a packet that is not GTP header\n"); + LOG_E(GTPU, "[%d] Received a packet that is not GTP header\n", h); return GTPNOK; } @@ -741,7 +745,7 @@ static int Gtpv1uHandleGpdu(int h, auto tunnel=inst->te2ue_mapping.find(ntohl(msgHdr->teid)); if ( tunnel == inst->te2ue_mapping.end() ) { - LOG_E(GTPU,"Received a incoming packet on unknown teid (%x) Dropping!\n", msgHdr->teid); + LOG_E(GTPU,"[%d] Received a incoming packet on unknown teid (%x) Dropping!\n", h, ntohl(msgHdr->teid)); pthread_mutex_unlock(&globGtp.gtp_lock); return GTPNOK; } @@ -784,9 +788,9 @@ static int Gtpv1uHandleGpdu(int h, mode, &sourceL2Id, &destinationL2Id) ) - LOG_E(GTPU,"down layer refused incoming packet\n"); + LOG_E(GTPU,"[%d] down layer refused incoming packet\n", h); - LOG_D(GTPU,"Received a %d bytes packet for: teid:%x\n", + LOG_D(GTPU,"[%d] Received a %d bytes packet for: teid:%x\n", h, msgBufLen-offset, ntohl(msgHdr->teid)); return !GTPNOK; @@ -801,14 +805,14 @@ void gtpv1uReceiver(int h) { if ((udpDataLen = recvfrom(h, udpData, sizeof(udpData), 0, (struct sockaddr *)&addr, &from_len)) < 0) { - LOG_E(GTPU, "Recvfrom failed on %d (%s)\n", h, strerror(errno)); + LOG_E(GTPU, "[%d] Recvfrom failed (%s)\n", h, strerror(errno)); return; } else if (udpDataLen == 0) { - LOG_W(GTPU, "Recvfrom returned 0\n"); + LOG_W(GTPU, "[%d] Recvfrom returned 0\n", h); return; } else { uint8_t msgType = *((uint8_t *)(udpData + 1)); - LOG_D(GTPU, "Received GTP data, msg type: %x\n", msgType); + LOG_D(GTPU, "[%d] Received GTP data, msg type: %x\n", h, msgType); switch(msgType) { case GTP_ECHO_RSP: @@ -835,7 +839,7 @@ void gtpv1uReceiver(int h) { break; default: - LOG_E(GTPU, "Received a GTP packet of unknown type: %d\n",msgType); + LOG_E(GTPU, "[%d] Received a GTP packet of unknown type: %d\n", h, msgType); break; } } @@ -844,6 +848,7 @@ void gtpv1uReceiver(int h) { #include void *ocp_gtpv1uTask(void *args) { + set_log(GTPU, OAILOG_DEBUG); while(1) { /* Trying to fetch a message from the message queue. If the queue is empty, this function will block till a From c43bde33f5ba712fccb68b9615434af014f71a37 Mon Sep 17 00:00:00 2001 From: matzakos Date: Fri, 1 Oct 2021 10:58:35 +0200 Subject: [PATCH 02/20] Use the updates of the masterCellGroup configuration as input to UE context setup response, instead of the whole mastercellgroup configuration stored at the UE context of the DU. -Deallocate memory for the updates on masterCellGroup config. after the information is encoded. --- openair2/RRC/NR/rrc_gNB.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index e240c9d269..d2132b4e30 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -3253,10 +3253,11 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha resp->du_to_cu_rrc_information = calloc(1,1024*sizeof(uint8_t)); asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, NULL, - (void *)ue_context_p->ue_context.masterCellGroup, + (void *)cellGroupConfig, resp->du_to_cu_rrc_information, 1024); resp->du_to_cu_rrc_information_length = (enc_rval.encoded+7)>>3; + free(cellGroupConfig); itti_send_msg_to_task (TASK_DU_F1, ctxt.module_id, message_p); } From b75fc441c594a16f196ff210eb10ae778ae75fb5 Mon Sep 17 00:00:00 2001 From: matzakos Date: Fri, 1 Oct 2021 12:23:11 +0200 Subject: [PATCH 03/20] Change presence of gNB_CU_UE_F1AP_ID as mandatory field in handling UE context setup response --- openair2/F1AP/f1ap_cu_ue_context_management.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index f54218a3b8..d4ebafa2a8 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -644,7 +644,7 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, /* GNB_CU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, - F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, false); + F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); f1ap_ue_context_setup_resp->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; LOG_D(F1AP, "f1ap_ue_context_setup_resp->gNB_CU_ue_id is: %d \n", f1ap_ue_context_setup_resp->gNB_CU_ue_id); From da65316765b6ff089734cec7806ff0992d1fa298 Mon Sep 17 00:00:00 2001 From: matzakos Date: Fri, 1 Oct 2021 12:42:37 +0200 Subject: [PATCH 04/20] Additional corrections for non-mandatory presence of DRB,SRB setup lists in handling of F1AP UE ctxt setup request,response messages --- openair2/F1AP/f1ap_cu_ue_context_management.c | 4 ++-- openair2/F1AP/f1ap_du_ue_context_management.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index d4ebafa2a8..096cd21bac 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -673,7 +673,7 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, // DRBs_Setup_List F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, - F1AP_ProtocolIE_ID_id_DRBs_Setup_List, true); + F1AP_ProtocolIE_ID_id_DRBs_Setup_List, false); if(ie!=NULL){ f1ap_ue_context_setup_resp->drbs_to_be_setup_length = ie->value.choice.DRBs_Setup_List.list.count; f1ap_ue_context_setup_resp->drbs_to_be_setup = calloc(f1ap_ue_context_setup_resp->drbs_to_be_setup_length, @@ -739,7 +739,7 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, // SRBs_Setup_List F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, - F1AP_ProtocolIE_ID_id_SRBs_Setup_List, true); + F1AP_ProtocolIE_ID_id_SRBs_Setup_List, false); if(ie!=NULL){ f1ap_ue_context_setup_resp->srbs_to_be_setup_length = ie->value.choice.SRBs_Setup_List.list.count; f1ap_ue_context_setup_resp->srbs_to_be_setup = calloc(f1ap_ue_context_setup_resp->srbs_to_be_setup_length, diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 5580741a63..35251ec248 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -134,7 +134,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* DRB */ F1AP_UEContextSetupRequestIEs_t *ieDrb; F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ieDrb, container, - F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_List, true); + F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_List, false); if(ieDrb!=NULL) { f1ap_ue_context_setup_req->drbs_to_be_setup_length = ieDrb->value.choice.DRBs_ToBeSetup_List.list.count; @@ -187,7 +187,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* SRB */ F1AP_UEContextSetupRequestIEs_t *ieSrb; F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ieSrb, container, - F1AP_ProtocolIE_ID_id_SRBs_ToBeSetup_List, true); + F1AP_ProtocolIE_ID_id_SRBs_ToBeSetup_List, false); if(ieSrb != NULL) { f1ap_ue_context_setup_req->srbs_to_be_setup_length = ieSrb->value.choice.SRBs_ToBeSetup_List.list.count; From 2acecb40a25fb4dbabb818426f8101125af743c2 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Fri, 1 Oct 2021 12:59:08 +0200 Subject: [PATCH 05/20] code review, CI result configuration issues, gcc warnings --- .../conf_files/cu.band7.tm1.100PRB.conf | 10 ++++----- ci-scripts/conf_files/gNB_SA_CU.conf | 10 ++++----- ci-scripts/conf_files/gNB_SA_DU.conf | 4 ++-- openair2/F1AP/f1ap_cu_interface_management.c | 2 +- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 21 +------------------ openair2/F1AP/f1ap_du_task.c | 5 ----- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 18 ++++++++-------- openair3/ocp-gtpu/gtp_itf.cpp | 10 ++++----- 8 files changed, 28 insertions(+), 52 deletions(-) diff --git a/ci-scripts/conf_files/cu.band7.tm1.100PRB.conf b/ci-scripts/conf_files/cu.band7.tm1.100PRB.conf index aefcb7a714..e2c94b14ab 100644 --- a/ci-scripts/conf_files/cu.band7.tm1.100PRB.conf +++ b/ci-scripts/conf_files/cu.band7.tm1.100PRB.conf @@ -13,7 +13,7 @@ eNBs = ( // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ( { mcc = 450; mnc = 05; mnc_length = 2; } ) + plmn_list = ( { mcc = 208; mnc = 92; mnc_length = 2; } ) nr_cellid = 12345678L @@ -179,7 +179,7 @@ eNBs = ( ////////// MME parameters: mme_ip_address = ( { - ipv4 = "192.168.5.233"; + ipv4 = "CI_MME_IP_ADDR"; ipv6 = "192:168:30::17"; port = 36412 ; active = "yes"; @@ -189,11 +189,11 @@ eNBs = ( NETWORK_INTERFACES : { ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.5.244"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR"; ENB_INTERFACE_NAME_FOR_S1U = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.5.244"; + ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 - ENB_IPV4_ADDRESS_FOR_X2C = "192.168.5.244"; + ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_X2C = 36422; # Spec 36422 }; } diff --git a/ci-scripts/conf_files/gNB_SA_CU.conf b/ci-scripts/conf_files/gNB_SA_CU.conf index 8479f0f7a2..0e9a5e2b45 100644 --- a/ci-scripts/conf_files/gNB_SA_CU.conf +++ b/ci-scripts/conf_files/gNB_SA_CU.conf @@ -17,8 +17,8 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; plmn_list = ({ - mcc = 450; - mnc = 05; + mcc = 208; + mnc = 99; mnc_length = 2; snssaiList = ( { @@ -66,10 +66,10 @@ gNBs = NETWORK_INTERFACES : { - GNB_INTERFACE_NAME_FOR_NG_AMF = "enp0s31f6:"; - GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.5.244/24"; + GNB_INTERFACE_NAME_FOR_NG_AMF = "eth0"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "CI_GNB_IP_ADDR"; GNB_INTERFACE_NAME_FOR_NGU = "bond0"; - GNB_IPV4_ADDRESS_FOR_NGU = "192.168.5.244/24"; + GNB_IPV4_ADDRESS_FOR_NGU = ""CI_GNB_IP_ADDR"; GNB_PORT_FOR_S1U = 2152; # Spec 2152 }; } diff --git a/ci-scripts/conf_files/gNB_SA_DU.conf b/ci-scripts/conf_files/gNB_SA_DU.conf index c1183ce4f8..be1e78464f 100644 --- a/ci-scripts/conf_files/gNB_SA_DU.conf +++ b/ci-scripts/conf_files/gNB_SA_DU.conf @@ -16,8 +16,8 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; plmn_list = ({ - mcc = 450; - mnc = 05; + mcc = 208; + mnc = 99; mnc_length = 2; snssaiList = ( { diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 6d63394f8a..dac78154e7 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -221,7 +221,7 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, } } else { CU_send_F1_SETUP_FAILURE(instance); - itti_free(TASK_RRC_GNB,message_p); + itti_free(TASK_CU_F1,message_p); return -1; } diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 2200071971..1f6d7d7f44 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -288,28 +288,9 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, /* RRC Container */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_RRCContainer, true); - // print message in debug mode - // create an ITTI message and copy SDU - /* - - message_p = itti_alloc_new_message (TASK_CU_F1, 0, RRC_DCCH_DATA_IND); - - RRC_DCCH_DATA_IND (message_p).sdu_p = malloc(ie->value.choice.RRCContainer.size); - - RRC_DCCH_DATA_IND (message_p).sdu_size = ie->value.choice.RRCContainer.size; - memcpy(RRC_DCCH_DATA_IND (message_p).sdu_p, ie->value.choice.RRCContainer.buf, - ie->value.choice.RRCContainer.size); - - RRC_DCCH_DATA_IND (message_p).dcch_index = srb_id; - RRC_DCCH_DATA_IND (message_p).rnti = f1ap_get_rnti_by_cu_id(CUtype, instance, cu_ue_f1ap_id); - RRC_DCCH_DATA_IND (message_p).instance = instance; - RRC_DCCH_DATA_IND (message_p).eNB_index = instance; // not needed for CU - - itti_send_msg_to_task(TASK_RRC_ENB, instance, message_p); - */ protocol_ctxt_t ctxt; ctxt.instance = instance; - ctxt.instance = instance; + ctxt.module_id = instance; ctxt.rnti = f1ap_get_rnti_by_cu_id(CUtype, instance, cu_ue_f1ap_id); ctxt.enb_flag = 1; ctxt.eNB_index = 0; diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 49df62d078..ff072f3269 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -85,11 +85,6 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat f1ap_du_data->sctp_out_streams = sctp_new_association_resp->out_streams; f1ap_du_data->default_sctp_stream_id = 0; /* setup parameters for F1U and start the server */ - eth_params_t *tmp; - if ( RC.nrmac ) - tmp= &RC.nrmac[instance]->eth_params_n; - else - tmp= &RC.mac[instance]->eth_params_n; DU_send_F1_SETUP_REQUEST(instance); } diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index d466ee904b..35ef057527 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -537,16 +537,16 @@ rb_found: __func__, rb_id, size); extern instance_t CUuniqInstance; itti_send_msg_to_task(TASK_VARIABLE, CUuniqInstance, message_p); - return; - } + } else { - memblock = get_free_mem_block(size, __FUNCTION__); - memcpy(memblock->data, buf, size); - - LOG_D(PDCP, "%s(): (srb %d) calling rlc_data_req size %d\n", __func__, rb_id, size); - //for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)memblock->data[i]); - //printf("\n"); - enqueue_rlc_data_req(&ctxt, 0, MBMS_FLAG_NO, rb_id, sdu_id, 0, size, memblock); + memblock = get_free_mem_block(size, __FUNCTION__); + memcpy(memblock->data, buf, size); + + LOG_D(PDCP, "%s(): (srb %d) calling rlc_data_req size %d\n", __func__, rb_id, size); + //for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)memblock->data[i]); + //printf("\n"); + enqueue_rlc_data_req(&ctxt, 0, MBMS_FLAG_NO, rb_id, sdu_id, 0, size, memblock); + } } static void deliver_sdu_srb(void *_ue, nr_pdcp_entity_t *entity, diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 0b8c533c88..7c2027e96b 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -601,7 +601,7 @@ int newGtpuDeleteTunnel(instance_t instance, rnti_t rnti) { auto it=inst->ue2te_mapping.find(rnti); if ( it == inst->ue2te_mapping.end() ) { - LOG_W(GTPU,"[%ld] Delete a non existing GTP tunnel\n", instance); + LOG_W(GTPU,"[%ld] Delete GTP tunnels for rnti: %x, but no tunnel exits\n", instance, rnti); pthread_mutex_unlock(&globGtp.gtp_lock); return -1; } @@ -617,7 +617,7 @@ int newGtpuDeleteTunnel(instance_t instance, rnti_t rnti) { inst->ue2te_mapping.erase(it); pthread_mutex_unlock(&globGtp.gtp_lock); - LOG_I(GTPU, "[%ld] Deleted all tunnels for RNTI %d (%d tunnels deleted)\n", instance, rnti, nb); + LOG_I(GTPU, "[%ld] Deleted all tunnels for RNTI %x (%d tunnels deleted)\n", instance, rnti, nb); return !GTPNOK; } @@ -639,7 +639,7 @@ static int Gtpv1uHandleEchoReq(int h, uint32_t msgBufLen, uint16_t peerPort, uint32_t peerIp) { - LOG_E(GTPU,"to be dev\n"); + LOG_E(GTPU,"EchoReq reply to be dev\n"); int rc = GTPNOK; return rc; } @@ -649,7 +649,7 @@ static int Gtpv1uHandleError(int h, uint32_t msgBufLen, uint16_t peerPort, uint32_t peerIp) { - LOG_E(GTPU,"to be dev\n"); + LOG_E(GTPU,"Hadle error to be dev\n"); int rc = GTPNOK; return rc; } @@ -659,7 +659,7 @@ static int Gtpv1uHandleSupportedExt(int h, uint32_t msgBufLen, uint16_t peerPort, uint32_t peerIp) { - LOG_E(GTPU,"to be dev\n"); + LOG_E(GTPU,"Supported extensions to be dev\n"); int rc = GTPNOK; return rc; } From 1e3c0fa7e38c265d8075d6edfc43baaaf0f591c7 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Fri, 1 Oct 2021 15:05:52 +0200 Subject: [PATCH 06/20] only change LOG_x format --- openair3/ocp-gtpu/gtp_itf.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 7c2027e96b..2d8d56ba7b 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -411,7 +411,7 @@ void GtpuUpdateTunnelOutgoingTeid(instance_t instance, rnti_t rnti, ebi_t bearer } ptr2->second.teid_outgoing = newOutgoingTeid; - LOG_I(GTPU, "[%ld] Tunnel Outgoing TEID updated to %d \n", instance, ptr2->second.teid_outgoing); + LOG_I(GTPU, "[%ld] Tunnel Outgoing TEID updated to %x \n", instance, ptr2->second.teid_outgoing); pthread_mutex_unlock(&globGtp.gtp_lock); return; } @@ -471,7 +471,7 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer pthread_mutex_unlock(&globGtp.gtp_lock); char ip4[INET_ADDRSTRLEN]; char ip6[INET6_ADDRSTRLEN]; - LOG_I(GTPU, "[%ld] Created tunnel for RNTI %x, teid for DL: %u, teid for UL %u to remote IPv4: %s, IPv6 %s\n", + LOG_I(GTPU, "[%ld] Created tunnel for RNTI %x, teid for DL: %x, teid for UL %x to remote IPv4: %s, IPv6 %s\n", instance, rnti, tmp->teid_incoming, From fd816a037c63abd6bfd787a4b55debb2428af210 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Fri, 1 Oct 2021 15:43:49 +0200 Subject: [PATCH 07/20] remove hardcoded log level --- ci-scripts/conf_files/gNB_SA_CU.conf | 5 +---- ci-scripts/conf_files/gNB_SA_DU.conf | 5 +---- openair3/ocp-gtpu/gtp_itf.cpp | 1 - 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/ci-scripts/conf_files/gNB_SA_CU.conf b/ci-scripts/conf_files/gNB_SA_CU.conf index 0e9a5e2b45..684588de36 100644 --- a/ci-scripts/conf_files/gNB_SA_CU.conf +++ b/ci-scripts/conf_files/gNB_SA_CU.conf @@ -16,10 +16,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ - mcc = 208; - mnc = 99; - mnc_length = 2; + plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ( { sst = 1; diff --git a/ci-scripts/conf_files/gNB_SA_DU.conf b/ci-scripts/conf_files/gNB_SA_DU.conf index be1e78464f..61ebcc1f09 100644 --- a/ci-scripts/conf_files/gNB_SA_DU.conf +++ b/ci-scripts/conf_files/gNB_SA_DU.conf @@ -15,10 +15,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ - mcc = 208; - mnc = 99; - mnc_length = 2; + plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ( { sst = 1; diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 2d8d56ba7b..a12a53814c 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -848,7 +848,6 @@ void gtpv1uReceiver(int h) { #include void *ocp_gtpv1uTask(void *args) { - set_log(GTPU, OAILOG_DEBUG); while(1) { /* Trying to fetch a message from the message queue. If the queue is empty, this function will block till a From 0fcb4098d863ed0bdcba9978f8fb9b399530641a Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Fri, 1 Oct 2021 15:54:42 +0200 Subject: [PATCH 08/20] fix(ci): wrong plmn Signed-off-by: Raphael Defosseux --- ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf b/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf index 28a6bc0779..a3ecffb9be 100644 --- a/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf +++ b/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf @@ -12,7 +12,7 @@ eNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ( { mcc = 450; mnc = 05; mnc_length = 2; } ) + plmn_list = ( { mcc = 208; mnc = 92; mnc_length = 2; } ) nr_cellid = 12345678L From c17ba044bc45666b3f9bd44ad753de73c198b792 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Fri, 1 Oct 2021 17:14:02 +0200 Subject: [PATCH 09/20] make gtp-u port on F1-U configurable --- ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf | 2 +- ci-scripts/conf_files/gNB_SA_DU.conf | 4 ++-- openair2/F1AP/f1ap_du_ue_context_management.c | 5 +++-- openair2/RRC/NR/rrc_gNB.c | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf b/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf index 28a6bc0779..a3ecffb9be 100644 --- a/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf +++ b/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf @@ -12,7 +12,7 @@ eNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ( { mcc = 450; mnc = 05; mnc_length = 2; } ) + plmn_list = ( { mcc = 208; mnc = 92; mnc_length = 2; } ) nr_cellid = 12345678L diff --git a/ci-scripts/conf_files/gNB_SA_DU.conf b/ci-scripts/conf_files/gNB_SA_DU.conf index 61ebcc1f09..cc20066721 100644 --- a/ci-scripts/conf_files/gNB_SA_DU.conf +++ b/ci-scripts/conf_files/gNB_SA_DU.conf @@ -233,9 +233,9 @@ MACRLCs = ( local_n_if_name = "lo"; local_n_address = "127.0.0.3"; remote_n_address = "127.0.0.4"; - local_n_portc = 601; + local_n_portc = 500; local_n_portd = 2152; - remote_n_portc = 600; + remote_n_portc = 501; remote_n_portd = 2152; } diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 35251ec248..ce1743b349 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -157,7 +157,8 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, F1AP_GTPTunnel_t *ul_up_tnl0 = ul_up_tnl_info_p->uLUPTNLInformation.choice.gTPTunnel; BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&ul_up_tnl0->transportLayerAddress, drb_p->up_ul_tnl[0].tl_address); OCTET_STRING_TO_INT32(&ul_up_tnl0->gTP_TEID, drb_p->up_ul_tnl[0].teid); - + // 3GPP assumes GTP-U is on port 2152, but OAI is configurable + drb_p->up_ul_tnl[0].port=getCxt(false,instance)->setupReq.CUport; switch (drbs_tobesetup_item_p->rLCMode) { case F1AP_RLCMode_rlc_am: drb_p->rlc_mode = RLC_MODE_AM; @@ -177,7 +178,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, drb_p->drb_id, drb_p->up_ul_tnl[0].teid, addr, - 2152, + drb_p->up_ul_tnl[0].port, lteDURecvCb); drb_p->up_dl_tnl_length++; } diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index d2132b4e30..b034825bab 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -3210,7 +3210,7 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha drb_p.drb_id, drb_p.up_ul_tnl[0].teid, addr, - 2152, + drb_p.up_ul_tnl[0].port, DURecvCb); } } From f9bb4150cbce61e6f555a92917abd4d8158a0522 Mon Sep 17 00:00:00 2001 From: Laurent Thomas Date: Sun, 3 Oct 2021 22:04:17 +0200 Subject: [PATCH 10/20] astyle only --- openair2/F1AP/f1ap_common.c | 7 +- openair2/F1AP/f1ap_cu_interface_management.c | 39 +- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 1 - openair2/F1AP/f1ap_cu_task.c | 17 +- openair2/F1AP/f1ap_cu_ue_context_management.c | 106 ++--- openair2/F1AP/f1ap_du_interface_management.c | 6 +- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 11 +- openair2/F1AP/f1ap_du_task.c | 29 +- openair2/F1AP/f1ap_du_ue_context_management.c | 400 +++++++++--------- openair2/F1AP/f1ap_encoder.c | 2 + openair3/ocp-gtpu/gtp_itf.cpp | 8 +- 11 files changed, 315 insertions(+), 311 deletions(-) diff --git a/openair2/F1AP/f1ap_common.c b/openair2/F1AP/f1ap_common.c index 0b957bd32f..338b5f0c2b 100644 --- a/openair2/F1AP/f1ap_common.c +++ b/openair2/F1AP/f1ap_common.c @@ -100,6 +100,7 @@ int f1ap_add_ue(F1_t isCu, return i; } } + // We didn't find the rnti for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { if (f1_inst->f1ap_ue[i].rnti == 0 ) { @@ -188,12 +189,12 @@ int f1ap_du_add_cu_ue_id(instance_t instanceP, instance_t du_ue_f1ap_id, instance_t cu_ue_f1ap_id) { f1ap_cudu_inst_t *f1_inst=getCxt(DUtype, instanceP); - instance_t f1ap_uid=-1; + for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { if (f1_inst->f1ap_ue[i].du_ue_f1ap_id == du_ue_f1ap_id) { - f1ap_uid=i; - break; + f1ap_uid=i; + break; } } diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index dac78154e7..7e9105a970 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -97,8 +97,6 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, /* assoc_id */ f1ap_setup_req_t *req=&getCxt(true, instance)->setupReq; - - req->assoc_id = assoc_id; /* gNB_DU_id */ // this function exits if the ie is mandatory @@ -124,8 +122,8 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, for (i=0; ivalue.choice.GNB_DU_Served_Cells_List.list.array[i])-> - value.choice.GNB_DU_Served_Cells_Item); + ie->value.choice.GNB_DU_Served_Cells_List.list.array[i])-> + value.choice.GNB_DU_Served_Cells_Item); /* tac */ if (served_cells_item_p->served_Cell_Information.fiveGS_TAC) { @@ -153,6 +151,7 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, f1ap_req(true, instance)->cell_type=CELL_MACRO_GNB; else f1ap_req(true, instance)->cell_type=CELL_MACRO_ENB; + LOG_I(F1AP, "Received Cell in %d context\n", f1ap_req(true, instance)->cell_type==CELL_MACRO_GNB); // System Information /* mib */ @@ -209,10 +208,10 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, // uint16_t nr_sul_band[32]; // } tdd; // } nr_mode_info[F1AP_MAX_NB_CELLS]; - // We copy and store in F1 task data, RRC will free "req" as it frees all itti received messages message_p = itti_alloc_new_message(TASK_CU_F1, 0, F1AP_SETUP_REQ); memcpy(&F1AP_SETUP_REQ(message_p), req, sizeof(f1ap_setup_req_t) ); + if (num_cells_available > 0) { if (f1ap_req(true, instance)->cell_type == CELL_MACRO_GNB) { itti_send_msg_to_task(TASK_RRC_GNB, GNB_MODULE_ID_TO_INSTANCE(instance), message_p); @@ -521,14 +520,14 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu ieC3->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Deactivated_List; for (int i=0; i<1; i++) { - asn1cSequenceAdd(ieC3->value.choice.Cells_to_be_Deactivated_List.list, - F1AP_Cells_to_be_Deactivated_List_ItemIEs_t, cells_to_be_deactivated); + asn1cSequenceAdd(ieC3->value.choice.Cells_to_be_Deactivated_List.list, + F1AP_Cells_to_be_Deactivated_List_ItemIEs_t, cells_to_be_deactivated); cells_to_be_deactivated->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; cells_to_be_deactivated->criticality = F1AP_Criticality_reject; cells_to_be_deactivated->value.present = F1AP_Cells_to_be_Deactivated_List_ItemIEs__value_PR_Cells_to_be_Deactivated_List_Item; // 3.1 cells to be Deactivated list item F1AP_Cells_to_be_Deactivated_List_Item_t *cells_to_be_deactivated_list= - cells_to_be_deactivated->value.choice.Cells_to_be_Deactivated_List_Item; + cells_to_be_deactivated->value.choice.Cells_to_be_Deactivated_List_Item; addnRCGI(cells_to_be_deactivated_item->nRCGI, f1ap_setup_resp->cells_to_deactivate+i); } } @@ -543,19 +542,19 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu for (int i=0; i<1; i++) { asn1cSequenceAdd(ieC4->value.choice.GNB_CU_TNL_Association_To_Add_List.list, - F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs_t, gnb_cu_tnl_association_to_add; + F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs_t, gnb_cu_tnl_association_to_add; gnb_cu_tnl_association_to_add->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Add_Item; gnb_cu_tnl_association_to_add->criticality = F1AP_Criticality_reject; gnb_cu_tnl_association_to_add->value.present = F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Add_Item; // 4.1 GNB_CU_TNL_Association_To_Add_Item F1AP_GNB_CU_TNL_Association_To_Add_Item_t *gnb_cu_tnl_association_to_add_item= - &gnb_cu_tnl_association_to_add_item_ies->value.choice.GNB_CU_TNL_Association_To_Add_Item; + &gnb_cu_tnl_association_to_add_item_ies->value.choice.GNB_CU_TNL_Association_To_Add_Item; // 4.1.1 tNLAssociationTransportLayerAddress F1AP_CP_TransportLayerAddress_t *transportLayerAddress=; - gnb_cu_tnl_association_to_add->value.choice.GNB_CU_TNL_Association_To_Add_Item; - + gnb_cu_tnl_association_to_add->value.choice.GNB_CU_TNL_Association_To_Add_Item; + transportLayerAddress->present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress->choice.endpoint_IP_address); @@ -577,18 +576,18 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu ieC5->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_GNB_CU_TNL_Association_To_Remove_List; for (int i=0; i<1; i++) { asn1cSequenceAdd(ieC5->value.choice.GNB_CU_TNL_Association_To_Remove_List.list, - F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs_t, gnb_cu_tnl_association_to_remove); + F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs_t, gnb_cu_tnl_association_to_remove); gnb_cu_tnl_association_to_remove->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Remove_Item; gnb_cu_tnl_association_to_remove->criticality = F1AP_Criticality_reject; gnb_cu_tnl_association_to_remove->value.present = F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Remove_Item; // 4.1 GNB_CU_TNL_Association_To_Remove_Item F1AP_GNB_CU_TNL_Association_To_Remove_Item_t *gnb_cu_tnl_association_to_remove_item= - &gnb_cu_tnl_association_to_remove->value.choice.GNB_CU_TNL_Association_To_Remove_Item; + &gnb_cu_tnl_association_to_remove->value.choice.GNB_CU_TNL_Association_To_Remove_Item; // 4.1.1 tNLAssociationTransportLayerAddress F1AP_CP_TransportLayerAddress_t *transportLayerAddress= - &gnb_cu_tnl_association_to_remove_item->tNLAssociationTransportLayerAddress; + &gnb_cu_tnl_association_to_remove_item->tNLAssociationTransportLayerAddress; transportLayerAddress->present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress->choice.endpoint_IP_address); @@ -609,7 +608,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu for (int i=0; i<1; i++) { asn1cSequenceAdd(ieC3->value.choice.GNB_CU_TNL_Association_To_Update_List.list, - F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs_t, gnb_cu_tnl_association_to_update); + F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs_t, gnb_cu_tnl_association_to_update); gnb_cu_tnl_association_to_update->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Update_Item; gnb_cu_tnl_association_to_update->criticality = F1AP_Criticality_reject; gnb_cu_tnl_association_to_update->value.present = F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Update_Item; @@ -642,7 +641,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu for (int i=0; i<1; i++) { asn1cSequenceAdd(ieC7->value.choice.Cells_to_be_Barred_List.list, - F1AP_Cells_to_be_Barred_ItemIEs_t,cells_to_be_barred); + F1AP_Cells_to_be_Barred_ItemIEs_t,cells_to_be_barred); cells_to_be_barred->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; cells_to_be_barred->criticality = F1AP_Criticality_reject; cells_to_be_barred->value.present = F1AP_Cells_to_be_Barred_ItemIEs__value_PR_Cells_to_be_Barred_Item; @@ -665,7 +664,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu for (int i=0; i<1; i++) { asn1cSequenceAdd(ieC8->value.choice.Protected_EUTRA_Resources_List.list, - F1AP_Protected_EUTRA_Resources_ItemIEs_t, protected_eutra_resources); + F1AP_Protected_EUTRA_Resources_ItemIEs_t, protected_eutra_resources); // 8.1 SpectrumSharingGroupID protected_eutra_resources->id = F1AP_ProtocolIE_ID_id_Protected_EUTRA_Resources_List; protected_eutra_resources->criticality = F1AP_Criticality_reject; @@ -675,11 +674,11 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu sizeof(F1AP_Protected_EUTRA_Resources_Item_t)); asn1cSequenceAdd(protected_eutra_resources->value.choice.ListofEUTRACellsinGNBDUCoordination.list, - F1AP_Served_EUTRA_Cells_Information_t, served_eutra_cells_information); + F1AP_Served_EUTRA_Cells_Information_t, served_eutra_cells_information); memset((void *)&served_eutra_cells_information, 0, sizeof(F1AP_Served_EUTRA_Cells_Information_t)); F1AP_EUTRA_Mode_Info_t *eUTRA_Mode_Info= - &served_eutra_cells_information.eUTRA_Mode_Info; + &served_eutra_cells_information.eUTRA_Mode_Info; // eUTRAFDD eUTRA_Mode_Info->present = F1AP_EUTRA_Mode_Info_PR_eUTRAFDD; diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 1f6d7d7f44..747ca7be59 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -100,7 +100,6 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, } LOG_I(F1AP, "%s() RRCContainer (CCCH) size %ld: ", __func__, ie->value.choice.RRCContainer.size); - /* DUtoCURRCContainer */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_DUtoCURRCContainer, false); diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index fbe0508f60..13f08b9458 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -42,7 +42,7 @@ instance_t CUuniqInstance=0; static instance_t cu_task_create_gtpu_instance_to_du(eth_params_t *IPaddrs) { - openAddr_t tmp={0}; + openAddr_t tmp= {0}; strncpy(tmp.originHost, IPaddrs->my_addr, sizeof(tmp.originHost)-1); strncpy(tmp.destinationHost, IPaddrs->remote_addr, sizeof(tmp.destinationHost)-1); sprintf(tmp.originService, "%d", IPaddrs->my_portd); @@ -51,7 +51,7 @@ static instance_t cu_task_create_gtpu_instance_to_du(eth_params_t *IPaddrs) { } static void cu_task_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind, - eth_params_t *IPaddrs) { + eth_params_t *IPaddrs) { createF1inst(true, instance, NULL); // save the assoc id f1ap_setup_req_t *f1ap_cu_data=f1ap_req(true, instance); @@ -90,7 +90,7 @@ static void cu_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *s AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); } -static void cu_task_send_sctp_init_req(instance_t instance, char * my_addr) { +static void cu_task_send_sctp_init_req(instance_t instance, char *my_addr) { // 1. get the itti msg, and retrive the enb_id from the message // 2. use RC.rrc[enb_id] to fill the sctp_init_t with the ip, port // 3. creat an itti message to init @@ -103,7 +103,6 @@ static void cu_task_send_sctp_init_req(instance_t instance, char * my_addr) { message_p->ittiMsg.sctp_init.ipv6 = 0; message_p->ittiMsg.sctp_init.nb_ipv4_addr = 1; message_p->ittiMsg.sctp_init.ipv4_address[0] = inet_addr(my_addr); - /* * SR WARNING: ipv6 multi-homing fails sometimes for localhost. * * * * Disable it for now. @@ -113,7 +112,7 @@ static void cu_task_send_sctp_init_req(instance_t instance, char * my_addr) { itti_send_msg_to_task(TASK_SCTP, instance, message_p); } -void * F1AP_CU_task(void *arg) { +void *F1AP_CU_task(void *arg) { MessageDef *received_msg = NULL; int result; LOG_I(F1AP, "Starting F1AP at CU\n"); @@ -121,13 +120,15 @@ void * F1AP_CU_task(void *arg) { pool_buffer_init(); itti_mark_task_ready(TASK_CU_F1); eth_params_t *IPaddrs; + // Hardcoded instance id! if (RC.nrrrc && RC.nrrrc[0]->node_type == ngran_gNB_CU) IPaddrs=&RC.nrrrc[0]->eth_params_s; - else + else IPaddrs=&RC.rrc[0]->eth_params_s; + cu_task_send_sctp_init_req(0, IPaddrs->my_addr); - + while (1) { itti_receive_msg(TASK_CU_F1, &received_msg); @@ -137,7 +138,7 @@ void * F1AP_CU_task(void *arg) { ITTI_MSG_DESTINATION_INSTANCE(received_msg)); cu_task_handle_sctp_association_ind(ITTI_MSG_ORIGIN_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_ind, - IPaddrs); + IPaddrs); break; case SCTP_NEW_ASSOCIATION_RESP: diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 096cd21bac..c68bfb3852 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -113,7 +113,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ie4->criticality = F1AP_Criticality_reject; ie4->value.present = F1AP_UEContextSetupRequestIEs__value_PR_ServCellIndex; ie4->value.choice.ServCellIndex = 0; - + /* optional */ /* c5. CellULConfigured */ if (0) { @@ -130,6 +130,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ie6->id = F1AP_ProtocolIE_ID_id_CUtoDURRCInformation; ie6->criticality = F1AP_Criticality_reject; ie6->value.present = F1AP_UEContextSetupRequestIEs__value_PR_CUtoDURRCInformation; + /* optional */ /* 6.1 cG_ConfigInfo */ if (0) { @@ -152,7 +153,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ie7->id = F1AP_ProtocolIE_ID_id_Candidate_SpCell_List; //90 ie7->criticality = F1AP_Criticality_ignore; ie7->value.present = F1AP_UEContextSetupRequestIEs__value_PR_Candidate_SpCell_List; - + for (int i=0; i<1; i++) { asn1cSequenceAdd(ie7->value.choice.Candidate_SpCell_List.list,F1AP_Candidate_SpCell_ItemIEs_t, candidate_spCell_item_ies); candidate_spCell_item_ies->id = F1AP_ProtocolIE_ID_id_Candidate_SpCell_Item; // 91 @@ -205,13 +206,14 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, OCTET_STRING_fromBuf(&ie9->value.choice.ResourceCoordinationTransferContainer, "asdsa1d32sa1d31asd31as", strlen("asdsa1d32sa1d31asd31as")); } - /* mandatory */ + + /* mandatory */ /* c10. SCell_ToBeSetup_List */ asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupRequestIEs_t, ie10); ie10->id = F1AP_ProtocolIE_ID_id_SCell_ToBeSetup_List; ie10->criticality = F1AP_Criticality_ignore; ie10->value.present = F1AP_UEContextSetupRequestIEs__value_PR_SCell_ToBeSetup_List; - + for (int i=0; i<1; i++) { // asn1cSequenceAdd(ie10->value.choice.SCell_ToBeSetup_List.list, F1AP_SCell_ToBeSetup_ItemIEs_t, scell_toBeSetup_item_ies); @@ -391,7 +393,6 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* 12.1.2.2 sNSSAI */ { /* sST */ - OCTET_STRING_fromBuf(&DRB_Information->sNSSAI.sST, "1", 1); /* OPTIONAL */ @@ -507,16 +508,15 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, int sz=sizeof(f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_dl_tnl[0].tl_address); memcpy(addr.buffer,&f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_dl_tnl[0].tl_address, sz); addr.length = sz*8; - f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_ul_tnl[j].teid= - newGtpuCreateTunnel(getCxt(CUtype, instance)->gtpInst, - f1ap_ue_context_setup_req->rnti, - f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id, - f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id, - 0xFFFF, // We will set the right value from DU answer - addr, - f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_dl_tnl[0].port, - cu_f1u_data_req); + newGtpuCreateTunnel(getCxt(CUtype, instance)->gtpInst, + f1ap_ue_context_setup_req->rnti, + f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id, + f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id, + 0xFFFF, // We will set the right value from DU answer + addr, + f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_dl_tnl[0].port, + cu_f1u_data_req); /* 12.3.1 ULTunnels_ToBeSetup_Item */ asn1cSequenceAdd(drbs_toBeSetup_item->uLUPTNLInformation_ToBeSetup_List.list, F1AP_ULUPTNLInformation_ToBeSetup_Item_t, uLUPTNLInformation_ToBeSetup_Item); @@ -525,10 +525,10 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, gTPTunnel); /* 12.3.1.1.1 transportLayerAddress */ TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_ul_tnl[j].tl_address, - &gTPTunnel->transportLayerAddress); + &gTPTunnel->transportLayerAddress); /* 12.3.1.1.2 gTP_TEID */ INT32_TO_OCTET_STRING(f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_ul_tnl[j].teid, - &gTPTunnel->gTP_TEID); + &gTPTunnel->gTP_TEID); } /* 12.1.4 rLCMode */ @@ -641,111 +641,115 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup_t *f1ap_ue_context_setup_resp = &F1AP_UE_CONTEXT_SETUP_RESP(msg_p); container = &pdu->choice.successfulOutcome->value.choice.UEContextSetupResponse; int i; - /* GNB_CU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); - f1ap_ue_context_setup_resp->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; - + f1ap_ue_context_setup_resp->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; LOG_D(F1AP, "f1ap_ue_context_setup_resp->gNB_CU_ue_id is: %d \n", f1ap_ue_context_setup_resp->gNB_CU_ue_id); - /* GNB_DU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); f1ap_ue_context_setup_resp->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; - LOG_D(F1AP, "f1ap_ue_context_setup_resp->gNB_DU_ue_id is: %d \n", f1ap_ue_context_setup_resp->gNB_DU_ue_id); - f1ap_ue_context_setup_resp->rnti = - f1ap_get_rnti_by_du_id(CUtype, instance, f1ap_ue_context_setup_resp->gNB_DU_ue_id); - - // DUtoCURRCInformation + f1ap_get_rnti_by_du_id(CUtype, instance, f1ap_ue_context_setup_resp->gNB_DU_ue_id); + // DUtoCURRCInformation F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_DUtoCURRCInformation, true); - if (ie == NULL){ + + if (ie == NULL) { LOG_E(F1AP,"%s %d: ie is a NULL pointer \n",__FILE__,__LINE__); return -1; } - f1ap_ue_context_setup_resp->du_to_cu_rrc_information = (uint8_t *)calloc(1,ie->value.choice.DUtoCURRCInformation.cellGroupConfig.size); + f1ap_ue_context_setup_resp->du_to_cu_rrc_information = (uint8_t *)calloc(1,ie->value.choice.DUtoCURRCInformation.cellGroupConfig.size); memcpy(f1ap_ue_context_setup_resp->du_to_cu_rrc_information, ie->value.choice.DUtoCURRCInformation.cellGroupConfig.buf, ie->value.choice.DUtoCURRCInformation.cellGroupConfig.size); f1ap_ue_context_setup_resp->du_to_cu_rrc_information_length = ie->value.choice.DUtoCURRCInformation.cellGroupConfig.size; - - // DRBs_Setup_List + // DRBs_Setup_List F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_DRBs_Setup_List, false); - if(ie!=NULL){ + + if(ie!=NULL) { f1ap_ue_context_setup_resp->drbs_to_be_setup_length = ie->value.choice.DRBs_Setup_List.list.count; f1ap_ue_context_setup_resp->drbs_to_be_setup = calloc(f1ap_ue_context_setup_resp->drbs_to_be_setup_length, sizeof(f1ap_drb_to_be_setup_t)); AssertFatal(f1ap_ue_context_setup_resp->drbs_to_be_setup, - "could not allocate memory for f1ap_ue_context_setup_resp->drbs_setup\n"); + "could not allocate memory for f1ap_ue_context_setup_resp->drbs_setup\n"); + for (i = 0; i < f1ap_ue_context_setup_resp->drbs_to_be_setup_length; ++i) { f1ap_drb_to_be_setup_t *drb_p = &f1ap_ue_context_setup_resp->drbs_to_be_setup[i]; F1AP_DRBs_Setup_Item_t *drbs_setup_item_p; drbs_setup_item_p = &((F1AP_DRBs_Setup_ItemIEs_t *)ie->value.choice.DRBs_Setup_List.list.array[i])->value.choice.DRBs_Setup_Item; drb_p->drb_id = drbs_setup_item_p->dRBID; // TODO in the following, assume only one UP UL TNL is present. - // this matches/assumes OAI CU/DU implementation, can be up to 2! + // this matches/assumes OAI CU/DU implementation, can be up to 2! drb_p->up_dl_tnl_length = 1; AssertFatal(drbs_setup_item_p->dLUPTNLInformation_ToBeSetup_List.list.count > 0, - "no DL UP TNL Information in DRBs to be Setup list\n"); + "no DL UP TNL Information in DRBs to be Setup list\n"); F1AP_DLUPTNLInformation_ToBeSetup_Item_t *dl_up_tnl_info_p = (F1AP_DLUPTNLInformation_ToBeSetup_Item_t *)drbs_setup_item_p->dLUPTNLInformation_ToBeSetup_List.list.array[0]; F1AP_GTPTunnel_t *dl_up_tnl0 = dl_up_tnl_info_p->dLUPTNLInformation.choice.gTPTunnel; BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&dl_up_tnl0->transportLayerAddress, drb_p->up_dl_tnl[0].tl_address); OCTET_STRING_TO_INT32(&dl_up_tnl0->gTP_TEID, drb_p->up_dl_tnl[0].teid); GtpuUpdateTunnelOutgoingTeid(getCxt(CUtype, instance)->gtpInst, - f1ap_ue_context_setup_resp->rnti, - (ebi_t)drbs_setup_item_p->dRBID, - drb_p->up_dl_tnl[0].teid); + f1ap_ue_context_setup_resp->rnti, + (ebi_t)drbs_setup_item_p->dRBID, + drb_p->up_dl_tnl[0].teid); } } - // SRBs_FailedToBeSetup_List + + // SRBs_FailedToBeSetup_List F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_List, false); - if(ie!=NULL){ + + if(ie!=NULL) { f1ap_ue_context_setup_resp->srbs_failed_to_be_setup_length = ie->value.choice.SRBs_FailedToBeSetup_List.list.count; f1ap_ue_context_setup_resp->srbs_failed_to_be_setup = calloc(f1ap_ue_context_setup_resp->srbs_failed_to_be_setup_length, sizeof(f1ap_rb_failed_to_be_setup_t)); AssertFatal(f1ap_ue_context_setup_resp->srbs_failed_to_be_setup, - "could not allocate memory for f1ap_ue_context_setup_resp->srbs_failed_to_be_setup\n"); + "could not allocate memory for f1ap_ue_context_setup_resp->srbs_failed_to_be_setup\n"); + for (i = 0; i < f1ap_ue_context_setup_resp->srbs_failed_to_be_setup_length; ++i) { f1ap_rb_failed_to_be_setup_t *srb_p = &f1ap_ue_context_setup_resp->srbs_failed_to_be_setup[i]; srb_p->rb_id = ((F1AP_SRBs_FailedToBeSetup_Item_t *)ie->value.choice.SRBs_FailedToBeSetup_List.list.array[i])->sRBID; } - } - // DRBs_FailedToBeSetup_List + + // DRBs_FailedToBeSetup_List F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_List, false); - if(ie!=NULL){ + + if(ie!=NULL) { f1ap_ue_context_setup_resp->drbs_failed_to_be_setup_length = ie->value.choice.DRBs_FailedToBeSetup_List.list.count; f1ap_ue_context_setup_resp->drbs_failed_to_be_setup = calloc(f1ap_ue_context_setup_resp->drbs_failed_to_be_setup_length, sizeof(f1ap_rb_failed_to_be_setup_t)); AssertFatal(f1ap_ue_context_setup_resp->drbs_failed_to_be_setup, - "could not allocate memory for f1ap_ue_context_setup_resp->drbs_failed_to_be_setup\n"); + "could not allocate memory for f1ap_ue_context_setup_resp->drbs_failed_to_be_setup\n"); + for (i = 0; i < f1ap_ue_context_setup_resp->drbs_failed_to_be_setup_length; ++i) { f1ap_rb_failed_to_be_setup_t *drb_p = &f1ap_ue_context_setup_resp->drbs_failed_to_be_setup[i]; drb_p->rb_id = ((F1AP_DRBs_FailedToBeSetup_Item_t *)ie->value.choice.DRBs_FailedToBeSetup_List.list.array[i])->dRBID; } } - // SCell_FailedtoSetup_List + // SCell_FailedtoSetup_List F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_List, false); - if(ie!=NULL){ + + if(ie!=NULL) { LOG_E (F1AP, "Not supporting handling of SCell_FailedtoSetup_List \n"); } - // SRBs_Setup_List + // SRBs_Setup_List F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, - F1AP_ProtocolIE_ID_id_SRBs_Setup_List, false); - if(ie!=NULL){ + F1AP_ProtocolIE_ID_id_SRBs_Setup_List, false); + + if(ie!=NULL) { f1ap_ue_context_setup_resp->srbs_to_be_setup_length = ie->value.choice.SRBs_Setup_List.list.count; f1ap_ue_context_setup_resp->srbs_to_be_setup = calloc(f1ap_ue_context_setup_resp->srbs_to_be_setup_length, sizeof(f1ap_srb_to_be_setup_t)); AssertFatal(f1ap_ue_context_setup_resp->srbs_to_be_setup, - "could not allocate memory for f1ap_ue_context_setup_resp->drbs_setup\n"); + "could not allocate memory for f1ap_ue_context_setup_resp->drbs_setup\n"); + for (i = 0; i < f1ap_ue_context_setup_resp->srbs_to_be_setup_length; ++i) { f1ap_srb_to_be_setup_t *srb_p = &f1ap_ue_context_setup_resp->srbs_to_be_setup[i]; F1AP_SRBs_Setup_Item_t *srbs_setup_item_p; @@ -1063,8 +1067,8 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { ie5->value.choice.DRXCycle.longDRXCycleLength = F1AP_LongDRXCycleLength_ms10; // enum if (0) { - asn1cCallocOne(ie5->value.choice.DRXCycle.shortDRXCycleLength, - F1AP_ShortDRXCycleLength_ms2); // enum + asn1cCallocOne(ie5->value.choice.DRXCycle.shortDRXCycleLength, + F1AP_ShortDRXCycleLength_ms2); // enum } if (0) { diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 22a370024e..12b0559003 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -44,8 +44,10 @@ int to_NRNRB(int nrb) { for (int i=0; isIBmessage.buf, size); - F1AP_SETUP_RESP (msg_p).cells_to_activate[i].SI_type[si]=sib_item->sIBtype; + F1AP_SETUP_RESP (msg_p).cells_to_activate[i].SI_type[si]=sib_item->sIBtype; } break; @@ -869,7 +871,7 @@ int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, memcpy((void *)F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_container[si], (void *)sib_item->sIBmessage.buf, size); - F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_type[si]=sib_item->sIBtype; + F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_type[si]=sib_item->sIBtype; } break; diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index c456f9e2d2..ba7a32398e 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -137,7 +137,6 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, /* RRC Container */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_RRCContainer, true); - rrc_dl_sdu_len = ie->value.choice.RRCContainer.size; /* optional */ @@ -763,7 +762,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instanceP, LOG_E(F1AP, "Failed to add UE \n"); return -1; } - + /* Create */ /* 0. Message Type */ pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; @@ -920,7 +919,7 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, LOG_E(F1AP, "Failed to find the F1AP UID \n"); //return -1; } - + /* optional */ /* oldgNB_DU_UE_F1AP_ID */ if (0) { @@ -932,7 +931,6 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, /* SRBID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_SRBID, true); - uint64_t srb_id = ie->value.choice.SRBID; LOG_D(F1AP, "srb_id %lu \n", srb_id); @@ -985,13 +983,12 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, // decode RRC Container and act on the message type AssertFatal(srb_id<3,"illegal srb_id\n"); - MessageDef * msg = itti_alloc_new_message(TASK_DU_F1, 0, NR_DU_RRC_DL_INDICATION); - NRDuDlReq_t * req=&NRDuDlReq(msg); + MessageDef *msg = itti_alloc_new_message(TASK_DU_F1, 0, NR_DU_RRC_DL_INDICATION); + NRDuDlReq_t *req=&NRDuDlReq(msg); req->rnti=f1ap_get_rnti_by_du_id(DUtype, instance, du_ue_f1ap_id); req->srb_id=srb_id; req->buf= get_free_mem_block( ie->value.choice.RRCContainer.size, __func__); memcpy(req->buf->data, ie->value.choice.RRCContainer.buf, ie->value.choice.RRCContainer.size); itti_send_msg_to_task(TASK_RRC_GNB, instance, msg); - return 0; } diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index ff072f3269..537f0060ae 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -85,7 +85,6 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat f1ap_du_data->sctp_out_streams = sctp_new_association_resp->out_streams; f1ap_du_data->default_sctp_stream_id = 0; /* setup parameters for F1U and start the server */ - DU_send_F1_SETUP_REQUEST(instance); } @@ -98,8 +97,8 @@ void du_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_dat AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); } -static instance_t du_create_gtpu_instance_to_cu(char* CUaddr, uint16_t CUport, char * DUaddr, uint16_t DUport) { - openAddr_t tmp={0}; +static instance_t du_create_gtpu_instance_to_cu(char *CUaddr, uint16_t CUport, char *DUaddr, uint16_t DUport) { + openAddr_t tmp= {0}; strncpy(tmp.originHost, DUaddr, sizeof(tmp.originHost)-1); strncpy(tmp.destinationHost, CUaddr, sizeof(tmp.destinationHost)-1); sprintf(tmp.originService, "%d", DUport); @@ -121,22 +120,22 @@ void *F1AP_DU_task(void *arg) { switch (ITTI_MSG_ID(msg)) { case F1AP_SETUP_REQ: - // this is not a true F1 message, but rather an ITTI message sent by enb_app + // this is not a true F1 message, but rather an ITTI message sent by enb_app // 1. save the itti msg so that you can use it to sen f1ap_setup_req, fill the f1ap_setup_req message, // 2. store the message in f1ap context, that is also stored in RC // 2. send a sctp_association req - LOG_I(F1AP, "DU Task Received F1AP_SETUP_REQ\n"); - f1ap_setup_req_t * msgSetup=&F1AP_SETUP_REQ(msg); + LOG_I(F1AP, "DU Task Received F1AP_SETUP_REQ\n"); + f1ap_setup_req_t *msgSetup=&F1AP_SETUP_REQ(msg); createF1inst(false, myInstance, msgSetup); - getCxt(DUtype, myInstance)->gtpInst=du_create_gtpu_instance_to_cu(msgSetup->CU_f1_ip_address.ipv4_address, - msgSetup->CUport, - msgSetup->DU_f1_ip_address.ipv4_address, - msgSetup->DUport); - AssertFatal(getCxt(DUtype, myInstance)->gtpInst>0,"Failed to create CU F1-U UDP listener"); - // Fixme: fully inconsistent instances management - // dirty global var is a bad fix - extern instance_t legacyInstanceMapping; - legacyInstanceMapping = DUuniqInstance = getCxt(DUtype, myInstance)->gtpInst; + getCxt(DUtype, myInstance)->gtpInst=du_create_gtpu_instance_to_cu(msgSetup->CU_f1_ip_address.ipv4_address, + msgSetup->CUport, + msgSetup->DU_f1_ip_address.ipv4_address, + msgSetup->DUport); + AssertFatal(getCxt(DUtype, myInstance)->gtpInst>0,"Failed to create CU F1-U UDP listener"); + // Fixme: fully inconsistent instances management + // dirty global var is a bad fix + extern instance_t legacyInstanceMapping; + legacyInstanceMapping = DUuniqInstance = getCxt(DUtype, myInstance)->gtpInst; du_task_send_sctp_association_req(myInstance,msgSetup); break; diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index ce1743b349..a825fab7ff 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -43,15 +43,15 @@ #include boolean_t lteDURecvCb( protocol_ctxt_t *ctxt_pP, - const srb_flag_t srb_flagP, - const rb_id_t rb_idP, - const mui_t muiP, - const confirm_t confirmP, - const sdu_size_t sdu_buffer_sizeP, - unsigned char *const sdu_buffer_pP, - const pdcp_transmission_mode_t modeP, - const uint32_t *sourceL2Id, - const uint32_t *destinationL2Id) { + const srb_flag_t srb_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + const confirm_t confirmP, + const sdu_size_t sdu_buffer_sizeP, + unsigned char *const sdu_buffer_pP, + const pdcp_transmission_mode_t modeP, + const uint32_t *sourceL2Id, + const uint32_t *destinationL2Id) { // The buffer comes from the stack in gtp-u thread, we have a make a separate buffer to enqueue in a inter-thread message queue mem_block_t *sdu=get_free_mem_block(sdu_buffer_sizeP, __func__); memcpy(sdu->data, sdu_buffer_pP, sdu_buffer_sizeP); @@ -134,53 +134,55 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* DRB */ F1AP_UEContextSetupRequestIEs_t *ieDrb; F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ieDrb, container, - F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_List, false); - + F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_List, false); + if(ieDrb!=NULL) { f1ap_ue_context_setup_req->drbs_to_be_setup_length = ieDrb->value.choice.DRBs_ToBeSetup_List.list.count; f1ap_ue_context_setup_req->drbs_to_be_setup = calloc(f1ap_ue_context_setup_req->drbs_to_be_setup_length, - sizeof(f1ap_drb_to_be_setup_t)); + sizeof(f1ap_drb_to_be_setup_t)); AssertFatal(f1ap_ue_context_setup_req->drbs_to_be_setup, - "could not allocate memory for f1ap_ue_context_setup_req->drbs_to_be_setup\n"); - + "could not allocate memory for f1ap_ue_context_setup_req->drbs_to_be_setup\n"); + for (i = 0; i < f1ap_ue_context_setup_req->drbs_to_be_setup_length; ++i) { f1ap_drb_to_be_setup_t *drb_p = &f1ap_ue_context_setup_req->drbs_to_be_setup[i]; F1AP_DRBs_ToBeSetup_Item_t *drbs_tobesetup_item_p = - &((F1AP_DRBs_ToBeSetup_ItemIEs_t *)ieDrb->value.choice.DRBs_ToBeSetup_List.list.array[i])->value.choice.DRBs_ToBeSetup_Item; + &((F1AP_DRBs_ToBeSetup_ItemIEs_t *)ieDrb->value.choice.DRBs_ToBeSetup_List.list.array[i])->value.choice.DRBs_ToBeSetup_Item; drb_p->drb_id = drbs_tobesetup_item_p->dRBID; /* TODO in the following, assume only one UP UL TNL is present. * this matches/assumes OAI CU implementation, can be up to 2! */ drb_p->up_ul_tnl_length = 1; AssertFatal(drbs_tobesetup_item_p->uLUPTNLInformation_ToBeSetup_List.list.count > 0, - "no UL UP TNL Information in DRBs to be Setup list\n"); + "no UL UP TNL Information in DRBs to be Setup list\n"); F1AP_ULUPTNLInformation_ToBeSetup_Item_t *ul_up_tnl_info_p = (F1AP_ULUPTNLInformation_ToBeSetup_Item_t *)drbs_tobesetup_item_p->uLUPTNLInformation_ToBeSetup_List.list.array[0]; F1AP_GTPTunnel_t *ul_up_tnl0 = ul_up_tnl_info_p->uLUPTNLInformation.choice.gTPTunnel; BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&ul_up_tnl0->transportLayerAddress, drb_p->up_ul_tnl[0].tl_address); OCTET_STRING_TO_INT32(&ul_up_tnl0->gTP_TEID, drb_p->up_ul_tnl[0].teid); // 3GPP assumes GTP-U is on port 2152, but OAI is configurable drb_p->up_ul_tnl[0].port=getCxt(false,instance)->setupReq.CUport; + switch (drbs_tobesetup_item_p->rLCMode) { - case F1AP_RLCMode_rlc_am: - drb_p->rlc_mode = RLC_MODE_AM; - break; - - default: - drb_p->rlc_mode = RLC_MODE_TM; - break; + case F1AP_RLCMode_rlc_am: + drb_p->rlc_mode = RLC_MODE_AM; + break; + + default: + drb_p->rlc_mode = RLC_MODE_TM; + break; } + if (!(RC.nrrrc && RC.nrrrc[instance]->node_type == ngran_gNB_DU)) { - transport_layer_addr_t addr; + transport_layer_addr_t addr; memcpy(addr.buffer, &drb_p->up_ul_tnl[0].tl_address, sizeof(drb_p->up_ul_tnl[0].tl_address)); addr.length=sizeof(drb_p->up_ul_tnl[0].tl_address)*8; drb_p->up_dl_tnl[0].teid=newGtpuCreateTunnel(INSTANCE_DEFAULT, - f1ap_ue_context_setup_req->rnti, - drb_p->drb_id, - drb_p->drb_id, - drb_p->up_ul_tnl[0].teid, - addr, - drb_p->up_ul_tnl[0].port, - lteDURecvCb); - drb_p->up_dl_tnl_length++; + f1ap_ue_context_setup_req->rnti, + drb_p->drb_id, + drb_p->drb_id, + drb_p->up_ul_tnl[0].teid, + addr, + drb_p->up_ul_tnl[0].port, + lteDURecvCb); + drb_p->up_dl_tnl_length++; } } } @@ -188,15 +190,15 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* SRB */ F1AP_UEContextSetupRequestIEs_t *ieSrb; F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ieSrb, container, - F1AP_ProtocolIE_ID_id_SRBs_ToBeSetup_List, false); - + F1AP_ProtocolIE_ID_id_SRBs_ToBeSetup_List, false); + if(ieSrb != NULL) { f1ap_ue_context_setup_req->srbs_to_be_setup_length = ieSrb->value.choice.SRBs_ToBeSetup_List.list.count; f1ap_ue_context_setup_req->srbs_to_be_setup = calloc(f1ap_ue_context_setup_req->srbs_to_be_setup_length, - sizeof(f1ap_srb_to_be_setup_t)); + sizeof(f1ap_srb_to_be_setup_t)); AssertFatal(f1ap_ue_context_setup_req->srbs_to_be_setup, - "could not allocate memory for f1ap_ue_context_setup_req->srbs_to_be_setup\n"); - + "could not allocate memory for f1ap_ue_context_setup_req->srbs_to_be_setup\n"); + for (i = 0; i < f1ap_ue_context_setup_req->srbs_to_be_setup_length; ++i) { f1ap_srb_to_be_setup_t *srb_p = &f1ap_ue_context_setup_req->srbs_to_be_setup[i]; F1AP_SRBs_ToBeSetup_Item_t *srbs_tobesetup_item_p; @@ -234,11 +236,12 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, LOG_W(F1AP, "can't find RRCContainer in UEContextSetupRequestIEs by id %ld \n", F1AP_ProtocolIE_ID_id_RRCContainer); } - if (RC.nrrrc && RC.nrrrc[instance]->node_type == ngran_gNB_DU) + if (RC.nrrrc && RC.nrrrc[instance]->node_type == ngran_gNB_DU) itti_send_msg_to_task(TASK_RRC_GNB, instance, msg_p); else // in 4G, race conditon is to fix DU_send_UE_CONTEXT_SETUP_RESPONSE(instance, f1ap_ue_context_setup_req); + return 0; } @@ -261,7 +264,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup ie1->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; ie1->criticality = F1AP_Criticality_reject; ie1->value.present = F1AP_UEContextSetupResponseIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie1->value.choice.GNB_CU_UE_F1AP_ID = req->gNB_CU_ue_id; + ie1->value.choice.GNB_CU_UE_F1AP_ID = req->gNB_CU_ue_id; /* mandatory */ /* c2. GNB_DU_UE_F1AP_ID */ asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie2); @@ -269,33 +272,32 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup ie2->criticality = F1AP_Criticality_reject; ie2->value.present = F1AP_UEContextSetupResponseIEs__value_PR_GNB_DU_UE_F1AP_ID; ie2->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(DUtype, instance, req->rnti); - /* mandatory */ /* c3. DUtoCURRCInformation */ //if (0) { - asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie3); - ie3->id = F1AP_ProtocolIE_ID_id_DUtoCURRCInformation; - ie3->criticality = F1AP_Criticality_reject; - ie3->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DUtoCURRCInformation; - { - /* cellGroupConfig */ - OCTET_STRING_fromBuf(&ie3->value.choice.DUtoCURRCInformation.cellGroupConfig, (const char *)req->du_to_cu_rrc_information, - req->du_to_cu_rrc_information_length); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie3); + ie3->id = F1AP_ProtocolIE_ID_id_DUtoCURRCInformation; + ie3->criticality = F1AP_Criticality_reject; + ie3->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DUtoCURRCInformation; + { + /* cellGroupConfig */ + OCTET_STRING_fromBuf(&ie3->value.choice.DUtoCURRCInformation.cellGroupConfig, (const char *)req->du_to_cu_rrc_information, + req->du_to_cu_rrc_information_length); - /* OPTIONAL */ - /* measGapConfig */ - if (0) { - asn1cCalloc(ie3->value.choice.DUtoCURRCInformation.measGapConfig, tmp); - OCTET_STRING_fromBuf(tmp, "asdsa", strlen("asdsa")); - } - - /* OPTIONAL */ - /* requestedP_MaxFR1 */ - if (0) { - asn1cCalloc(ie3->value.choice.DUtoCURRCInformation.requestedP_MaxFR1, tmp); - OCTET_STRING_fromBuf(tmp, "asdsa", strlen("asdsa")); - } + /* OPTIONAL */ + /* measGapConfig */ + if (0) { + asn1cCalloc(ie3->value.choice.DUtoCURRCInformation.measGapConfig, tmp); + OCTET_STRING_fromBuf(tmp, "asdsa", strlen("asdsa")); } + + /* OPTIONAL */ + /* requestedP_MaxFR1 */ + if (0) { + asn1cCalloc(ie3->value.choice.DUtoCURRCInformation.requestedP_MaxFR1, tmp); + OCTET_STRING_fromBuf(tmp, "asdsa", strlen("asdsa")); + } + } //} /* optional */ @@ -337,6 +339,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup ie7->id = F1AP_ProtocolIE_ID_id_DRBs_Setup_List; ie7->criticality = F1AP_Criticality_ignore; ie7->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DRBs_Setup_List; + for (int i=0; i< req->drbs_to_be_setup_length; i++) { // asn1cSequenceAdd(ie7->value.choice.DRBs_Setup_List.list, @@ -375,148 +378,148 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup /* mandatory */ /* c8. SRBs_FailedToBeSetup_List */ - if(0){ - asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie8); - ie8->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_List; - ie8->criticality = F1AP_Criticality_ignore; - ie8->value.present = F1AP_UEContextSetupResponseIEs__value_PR_SRBs_FailedToBeSetup_List; + if(0) { + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie8); + ie8->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_List; + ie8->criticality = F1AP_Criticality_ignore; + ie8->value.present = F1AP_UEContextSetupResponseIEs__value_PR_SRBs_FailedToBeSetup_List; - for (int i=0; i<1; i++) { - // - asn1cSequenceAdd(ie8->value.choice.SRBs_FailedToBeSetup_List.list, - F1AP_SRBs_FailedToBeSetup_ItemIEs_t, srbs_failedToBeSetup_item_ies); - srbs_failedToBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_Item; - srbs_failedToBeSetup_item_ies->criticality = F1AP_Criticality_ignore; - srbs_failedToBeSetup_item_ies->value.present = F1AP_SRBs_FailedToBeSetup_ItemIEs__value_PR_SRBs_FailedToBeSetup_Item; - /* 8.1 SRBs_Setup_Item */ - F1AP_SRBs_FailedToBeSetup_Item_t *srbs_failedToBeSetup_item= - &srbs_failedToBeSetup_item_ies->value.choice.SRBs_FailedToBeSetup_Item; - /* sRBID */ - srbs_failedToBeSetup_item->sRBID = 13L; - /* cause */ - asn1cCalloc(srbs_failedToBeSetup_item->cause, tmp); - // dummy value - tmp->present = F1AP_Cause_PR_radioNetwork; + for (int i=0; i<1; i++) { + // + asn1cSequenceAdd(ie8->value.choice.SRBs_FailedToBeSetup_List.list, + F1AP_SRBs_FailedToBeSetup_ItemIEs_t, srbs_failedToBeSetup_item_ies); + srbs_failedToBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_Item; + srbs_failedToBeSetup_item_ies->criticality = F1AP_Criticality_ignore; + srbs_failedToBeSetup_item_ies->value.present = F1AP_SRBs_FailedToBeSetup_ItemIEs__value_PR_SRBs_FailedToBeSetup_Item; + /* 8.1 SRBs_Setup_Item */ + F1AP_SRBs_FailedToBeSetup_Item_t *srbs_failedToBeSetup_item= + &srbs_failedToBeSetup_item_ies->value.choice.SRBs_FailedToBeSetup_Item; + /* sRBID */ + srbs_failedToBeSetup_item->sRBID = 13L; + /* cause */ + asn1cCalloc(srbs_failedToBeSetup_item->cause, tmp); + // dummy value + tmp->present = F1AP_Cause_PR_radioNetwork; - switch(tmp->present) { - case F1AP_Cause_PR_radioNetwork: - tmp->choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified; - break; + switch(tmp->present) { + case F1AP_Cause_PR_radioNetwork: + tmp->choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified; + break; - case F1AP_Cause_PR_transport: - tmp->choice.transport = F1AP_CauseTransport_unspecified; - break; + case F1AP_Cause_PR_transport: + tmp->choice.transport = F1AP_CauseTransport_unspecified; + break; - case F1AP_Cause_PR_protocol: - tmp->choice.protocol = F1AP_CauseProtocol_unspecified; - break; + case F1AP_Cause_PR_protocol: + tmp->choice.protocol = F1AP_CauseProtocol_unspecified; + break; - case F1AP_Cause_PR_misc: - tmp->choice.misc = F1AP_CauseMisc_unspecified; - break; + case F1AP_Cause_PR_misc: + tmp->choice.misc = F1AP_CauseMisc_unspecified; + break; - case F1AP_Cause_PR_NOTHING: - default: - break; - } // switch - } // for i + case F1AP_Cause_PR_NOTHING: + default: + break; + } // switch + } // for i } /* */ /* c9. DRBs_FailedToBeSetup_List */ - if(0){ - asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie9); - ie9->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_List; - ie9->criticality = F1AP_Criticality_ignore; - ie9->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DRBs_FailedToBeSetup_List; + if(0) { + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie9); + ie9->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_List; + ie9->criticality = F1AP_Criticality_ignore; + ie9->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DRBs_FailedToBeSetup_List; - for (int i=0; i<1; i++) { - asn1cSequenceAdd(ie9->value.choice.DRBs_FailedToBeSetup_List.list, - F1AP_DRBs_FailedToBeSetup_ItemIEs_t, drbs_failedToBeSetup_item_ies); - drbs_failedToBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_Item; - drbs_failedToBeSetup_item_ies->criticality = F1AP_Criticality_ignore; - drbs_failedToBeSetup_item_ies->value.present = F1AP_DRBs_FailedToBeSetup_ItemIEs__value_PR_DRBs_FailedToBeSetup_Item; - /* 9.1 DRBs_Setup_Item */ - /* ADD */ - F1AP_DRBs_FailedToBeSetup_Item_t *drbs_failedToBeSetup_item= - &drbs_failedToBeSetup_item_ies->value.choice.DRBs_FailedToBeSetup_Item; - /* dRBID */ - drbs_failedToBeSetup_item->dRBID = 14; - /* cause */ - asn1cCalloc(drbs_failedToBeSetup_item->cause,tmp); - // dummy value - tmp->present = F1AP_Cause_PR_radioNetwork; + for (int i=0; i<1; i++) { + asn1cSequenceAdd(ie9->value.choice.DRBs_FailedToBeSetup_List.list, + F1AP_DRBs_FailedToBeSetup_ItemIEs_t, drbs_failedToBeSetup_item_ies); + drbs_failedToBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_Item; + drbs_failedToBeSetup_item_ies->criticality = F1AP_Criticality_ignore; + drbs_failedToBeSetup_item_ies->value.present = F1AP_DRBs_FailedToBeSetup_ItemIEs__value_PR_DRBs_FailedToBeSetup_Item; + /* 9.1 DRBs_Setup_Item */ + /* ADD */ + F1AP_DRBs_FailedToBeSetup_Item_t *drbs_failedToBeSetup_item= + &drbs_failedToBeSetup_item_ies->value.choice.DRBs_FailedToBeSetup_Item; + /* dRBID */ + drbs_failedToBeSetup_item->dRBID = 14; + /* cause */ + asn1cCalloc(drbs_failedToBeSetup_item->cause,tmp); + // dummy value + tmp->present = F1AP_Cause_PR_radioNetwork; - switch(tmp->present) { - case F1AP_Cause_PR_radioNetwork: - tmp->choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified; - break; + switch(tmp->present) { + case F1AP_Cause_PR_radioNetwork: + tmp->choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified; + break; - case F1AP_Cause_PR_transport: - tmp->choice.transport = F1AP_CauseTransport_unspecified; - break; + case F1AP_Cause_PR_transport: + tmp->choice.transport = F1AP_CauseTransport_unspecified; + break; - case F1AP_Cause_PR_protocol: - tmp->choice.protocol = F1AP_CauseProtocol_unspecified; - break; + case F1AP_Cause_PR_protocol: + tmp->choice.protocol = F1AP_CauseProtocol_unspecified; + break; - case F1AP_Cause_PR_misc: - tmp->choice.misc = F1AP_CauseMisc_unspecified; - break; + case F1AP_Cause_PR_misc: + tmp->choice.misc = F1AP_CauseMisc_unspecified; + break; - case F1AP_Cause_PR_NOTHING: - default: - break; - } // switch - } // for i + case F1AP_Cause_PR_NOTHING: + default: + break; + } // switch + } // for i } // /* */ /* c10. SCell_FailedtoSetup_List */ - if(0){ - asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie10); - ie10->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_List; - ie10->criticality = F1AP_Criticality_ignore; - ie10->value.present = F1AP_UEContextSetupResponseIEs__value_PR_SCell_FailedtoSetup_List; + if(0) { + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie10); + ie10->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_List; + ie10->criticality = F1AP_Criticality_ignore; + ie10->value.present = F1AP_UEContextSetupResponseIEs__value_PR_SCell_FailedtoSetup_List; - for (int i=0; i<1; i++) { - asn1cSequenceAdd(ie10->value.choice.SCell_FailedtoSetup_List.list, - F1AP_SCell_FailedtoSetup_ItemIEs_t, sCell_FailedtoSetup_item_ies); - sCell_FailedtoSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_Item; - sCell_FailedtoSetup_item_ies->criticality = F1AP_Criticality_ignore; - sCell_FailedtoSetup_item_ies->value.present = F1AP_SCell_FailedtoSetup_ItemIEs__value_PR_SCell_FailedtoSetup_Item; - /* 10.1 DRBs_Setup_Item */ - F1AP_SCell_FailedtoSetup_Item_t *sCell_FailedtoSetup_item= - &sCell_FailedtoSetup_item_ies->value.choice.SCell_FailedtoSetup_Item; - /* sCell_ID */ - addnRCGI(sCell_FailedtoSetup_item->sCell_ID,f1ap_req(false, instance)->cell+i); - /* cause */ - asn1cCalloc(sCell_FailedtoSetup_item->cause, tmp); - // dummy value - tmp->present = F1AP_Cause_PR_radioNetwork; + for (int i=0; i<1; i++) { + asn1cSequenceAdd(ie10->value.choice.SCell_FailedtoSetup_List.list, + F1AP_SCell_FailedtoSetup_ItemIEs_t, sCell_FailedtoSetup_item_ies); + sCell_FailedtoSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_Item; + sCell_FailedtoSetup_item_ies->criticality = F1AP_Criticality_ignore; + sCell_FailedtoSetup_item_ies->value.present = F1AP_SCell_FailedtoSetup_ItemIEs__value_PR_SCell_FailedtoSetup_Item; + /* 10.1 DRBs_Setup_Item */ + F1AP_SCell_FailedtoSetup_Item_t *sCell_FailedtoSetup_item= + &sCell_FailedtoSetup_item_ies->value.choice.SCell_FailedtoSetup_Item; + /* sCell_ID */ + addnRCGI(sCell_FailedtoSetup_item->sCell_ID,f1ap_req(false, instance)->cell+i); + /* cause */ + asn1cCalloc(sCell_FailedtoSetup_item->cause, tmp); + // dummy value + tmp->present = F1AP_Cause_PR_radioNetwork; - switch(tmp->present) { - case F1AP_Cause_PR_radioNetwork: - tmp->choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified; - break; + switch(tmp->present) { + case F1AP_Cause_PR_radioNetwork: + tmp->choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified; + break; - case F1AP_Cause_PR_transport: - tmp->choice.transport = F1AP_CauseTransport_unspecified; - break; + case F1AP_Cause_PR_transport: + tmp->choice.transport = F1AP_CauseTransport_unspecified; + break; - case F1AP_Cause_PR_protocol: - tmp->choice.protocol = F1AP_CauseProtocol_unspecified; - break; + case F1AP_Cause_PR_protocol: + tmp->choice.protocol = F1AP_CauseProtocol_unspecified; + break; - case F1AP_Cause_PR_misc: - tmp->choice.misc = F1AP_CauseMisc_unspecified; - break; + case F1AP_Cause_PR_misc: + tmp->choice.misc = F1AP_CauseMisc_unspecified; + break; - case F1AP_Cause_PR_NOTHING: - default: - break; - } // switch - } // for i + case F1AP_Cause_PR_NOTHING: + default: + break; + } // switch + } // for i } /* mandatory */ @@ -528,7 +531,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup for (int i=0; i< req->srbs_to_be_setup_length; i++) {// asn1cSequenceAdd(ie11->value.choice.SRBs_Setup_List.list, - F1AP_SRBs_Setup_ItemIEs_t, srbs_setup_item_ies); + F1AP_SRBs_Setup_ItemIEs_t, srbs_setup_item_ies); srbs_setup_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_Setup_Item; srbs_setup_item_ies->criticality = F1AP_Criticality_ignore; srbs_setup_item_ies->value.present = F1AP_SRBs_Setup_ItemIEs__value_PR_SRBs_Setup_Item; @@ -679,7 +682,6 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, AssertFatal(ctxt.rnti == rnti, "RNTI obtained through DU ID (%x) is different from CU ID (%x)\n", rnti, ctxt.rnti); - int UE_out_of_sync = 0; if (RC.nrrrc && RC.nrrrc[instance]->node_type == ngran_gNB_DU) { @@ -753,34 +755,32 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance, &cplt); return 0; } else { - struct rrc_eNB_ue_context_s *ue_context_p; - ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt.instance], ctxt.rnti); - + if (ue_context_p && !UE_out_of_sync) { /* UE exists and is in sync so we start a timer before releasing the * connection */ pthread_mutex_lock(&rrc_release_freelist); - + for (uint16_t release_num = 0; release_num < NUMBER_OF_UE_MAX; release_num++) { - if (rrc_release_info.RRC_release_ctrl[release_num].flag == 0) { - if (ue_context_p->ue_context.ue_release_timer_s1 > 0) - rrc_release_info.RRC_release_ctrl[release_num].flag = 1; - else - rrc_release_info.RRC_release_ctrl[release_num].flag = 2; - - rrc_release_info.RRC_release_ctrl[release_num].rnti = ctxt.rnti; - LOG_D(F1AP, "add rrc_release_info RNTI %x\n", ctxt.rnti); - // TODO: how to provide the correct MUI? - rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui = 0; - rrc_release_info.num_UEs++; - LOG_D(RRC,"Generate DLSCH Release send: index %d rnti %x mui %d flag %d \n",release_num, - ctxt.rnti, 0, rrc_release_info.RRC_release_ctrl[release_num].flag); - break; - } + if (rrc_release_info.RRC_release_ctrl[release_num].flag == 0) { + if (ue_context_p->ue_context.ue_release_timer_s1 > 0) + rrc_release_info.RRC_release_ctrl[release_num].flag = 1; + else + rrc_release_info.RRC_release_ctrl[release_num].flag = 2; + + rrc_release_info.RRC_release_ctrl[release_num].rnti = ctxt.rnti; + LOG_D(F1AP, "add rrc_release_info RNTI %x\n", ctxt.rnti); + // TODO: how to provide the correct MUI? + rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui = 0; + rrc_release_info.num_UEs++; + LOG_D(RRC,"Generate DLSCH Release send: index %d rnti %x mui %d flag %d \n",release_num, + ctxt.rnti, 0, rrc_release_info.RRC_release_ctrl[release_num].flag); + break; + } } - + pthread_mutex_unlock(&rrc_release_freelist); ue_context_p->ue_context.ue_release_timer_s1 = 0; } else if (ue_context_p && UE_out_of_sync) { @@ -789,7 +789,7 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, } else { LOG_E(F1AP, "no ue_context for RNTI %x, acknowledging release\n", rnti); } - + /* TODO send this once the connection has really been released */ f1ap_ue_context_release_cplt_t cplt; cplt.rnti = ctxt.rnti; diff --git a/openair2/F1AP/f1ap_encoder.c b/openair2/F1AP/f1ap_encoder.c index f1208565bb..e623e66536 100644 --- a/openair2/F1AP/f1ap_encoder.c +++ b/openair2/F1AP/f1ap_encoder.c @@ -50,10 +50,12 @@ int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length) { char errbuf[128]; /* Buffer for error message */ size_t errlen = sizeof(errbuf); /* Size of the buffer */ int ret = asn_check_constraints(&asn_DEF_F1AP_F1AP_PDU, pdu, errbuf, &errlen); + /* assert(errlen < sizeof(errbuf)); // Guaranteed: you may rely on that */ if(ret) { fprintf(stderr, "Constraint validation failed: %s\n", errbuf); } + encoded = aper_encode_to_new_buffer(&asn_DEF_F1AP_F1AP_PDU, 0, pdu, (void **)buffer); if (encoded < 0) { diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index a12a53814c..86899520a0 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -472,7 +472,7 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer char ip4[INET_ADDRSTRLEN]; char ip6[INET6_ADDRSTRLEN]; LOG_I(GTPU, "[%ld] Created tunnel for RNTI %x, teid for DL: %x, teid for UL %x to remote IPv4: %s, IPv6 %s\n", - instance, + instance, rnti, tmp->teid_incoming, tmp->teid_outgoing, @@ -485,7 +485,7 @@ int ocp_gtpv1u_create_s1u_tunnel(instance_t instance, const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req, gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp) { LOG_D(GTPU, "[%ld] Start create tunnels for RNTI %x, num_tunnels %d, sgw_S1u_teid %x\n", - instance, + instance, create_tunnel_req->rnti, create_tunnel_req->num_tunnels, create_tunnel_req->sgw_S1u_teid[0]); @@ -520,7 +520,7 @@ int ocp_gtpv1u_update_s1u_tunnel( const rnti_t prior_rnti ) { LOG_D(GTPU, "[%ld] Start update tunnels for old RNTI %x, new RNTI %x, num_tunnels %d, sgw_S1u_teid %x, eps_bearer_id %x\n", - instance, + instance, prior_rnti, create_tunnel_req->rnti, create_tunnel_req->num_tunnels, @@ -553,7 +553,7 @@ int gtpv1u_create_ngu_tunnel( const instance_t instance, const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req, gtpv1u_gnb_create_tunnel_resp_t *const create_tunnel_resp) { LOG_D(GTPU, "[%ld] Start create tunnels for RNTI %x, num_tunnels %d, sgw_S1u_teid %x\n", - instance, + instance, create_tunnel_req->rnti, create_tunnel_req->num_tunnels, create_tunnel_req->outgoing_teid[0]); From cbd6a2ff1b4a64668cc9c4db1e97755d0667b23a Mon Sep 17 00:00:00 2001 From: matzakos Date: Mon, 4 Oct 2021 11:35:31 +0200 Subject: [PATCH 11/20] Remove typo in 5G CU config. file used from the CI --- ci-scripts/conf_files/gNB_SA_CU.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci-scripts/conf_files/gNB_SA_CU.conf b/ci-scripts/conf_files/gNB_SA_CU.conf index 684588de36..b00d5691d6 100644 --- a/ci-scripts/conf_files/gNB_SA_CU.conf +++ b/ci-scripts/conf_files/gNB_SA_CU.conf @@ -65,8 +65,8 @@ gNBs = GNB_INTERFACE_NAME_FOR_NG_AMF = "eth0"; GNB_IPV4_ADDRESS_FOR_NG_AMF = "CI_GNB_IP_ADDR"; - GNB_INTERFACE_NAME_FOR_NGU = "bond0"; - GNB_IPV4_ADDRESS_FOR_NGU = ""CI_GNB_IP_ADDR"; + GNB_INTERFACE_NAME_FOR_NGU = "eth0"; + GNB_IPV4_ADDRESS_FOR_NGU = "CI_GNB_IP_ADDR"; GNB_PORT_FOR_S1U = 2152; # Spec 2152 }; } From ef5f43707e470596fffdbaa41d8f255b170f8449 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Mon, 4 Oct 2021 16:28:24 +0200 Subject: [PATCH 12/20] fix(docker): proper formatting for docker image generation Signed-off-by: Raphael Defosseux --- ci-scripts/conf_files/gNB_SA_CU.conf | 6 ++++-- ci-scripts/conf_files/gNB_SA_DU.conf | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ci-scripts/conf_files/gNB_SA_CU.conf b/ci-scripts/conf_files/gNB_SA_CU.conf index b00d5691d6..029f02006e 100644 --- a/ci-scripts/conf_files/gNB_SA_CU.conf +++ b/ci-scripts/conf_files/gNB_SA_CU.conf @@ -13,10 +13,12 @@ gNBs = gNB_name = "gNB-Eurecom-CU"; - // Tracking area code, 0x0000 and 0xfffe are reserved values // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; + plmn_list = ({ + mcc = 208; + mnc = 99; + mnc_length = 2; snssaiList = ( { sst = 1; diff --git a/ci-scripts/conf_files/gNB_SA_DU.conf b/ci-scripts/conf_files/gNB_SA_DU.conf index cc20066721..255905e74d 100644 --- a/ci-scripts/conf_files/gNB_SA_DU.conf +++ b/ci-scripts/conf_files/gNB_SA_DU.conf @@ -12,10 +12,12 @@ gNBs = gNB_name = "gNB-Eurecom-DU"; - // Tracking area code, 0x0000 and 0xfffe are reserved values // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; + plmn_list = ({ + mcc = 208; + mnc = 99; + mnc_length = 2; snssaiList = ( { sst = 1; From 31567fe3901e67682b47685420a598685f5dfcd6 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Tue, 5 Oct 2021 10:56:07 +0200 Subject: [PATCH 13/20] doc(release): Updating the 5F RF simulator documentation and docker-compose following the v1.2.0 release of OAI-CN5G Signed-off-by: Raphael Defosseux --- .../yaml_files/5g_rfsimulator/README.md | 67 +++++++++++++++++++ .../5g_rfsimulator/docker-compose.yaml | 9 ++- 2 files changed, 74 insertions(+), 2 deletions(-) diff --git a/ci-scripts/yaml_files/5g_rfsimulator/README.md b/ci-scripts/yaml_files/5g_rfsimulator/README.md index 1351d6742b..915b71296f 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/README.md +++ b/ci-scripts/yaml_files/5g_rfsimulator/README.md @@ -14,6 +14,8 @@ This page is only valid for an `Ubuntu18` host. +**NOTE: this version (2021-10-05) is valid for the `v1.1.0` and `v1.2.0` versions of the `OAI 5G CN`.** + **TABLE OF CONTENTS** 1. [Retrieving the images on Docker-Hub](#1-retrieving-the-images-on-docker-hub) @@ -26,6 +28,9 @@ This page is only valid for an `Ubuntu18` host. 2. [Start the iperf server inside the NR-UE container](#32-start-the-iperf-server-inside-the-nr-ue-container) 3. [Start the iperf client inside the ext-dn container](#33-start-the-iperf-client-inside-the-ext-dn-container) 4. [Un-deployment](#4-un-deployment) +5. [Explanations on the configuration in the docker-compose.yaml](##5-explanations-on-the-configuration-in-the-docker-composeyaml) + 1. [Making the NR-UE connect to the core network](#51-making-the-nr-ue-connect-to-the-core-network) + 2. [Making the gNB connect to the core network](#52-making-the-gnb-connect-to-the-core-network) # 1. Retrieving the images on Docker-Hub # @@ -71,6 +76,10 @@ $ docker image tag rdefosseoai/oai-nr-ue:develop oai-nr-ue:develop $ docker logout ``` +**CAUTION: 2021/10/05 with the release `v1.2.0` of the `CN5G`, the previous version was not compatible any-more.** + +**This new version is working for both the `v1.1.0` and `v1.2.0` of the `CN5G`.** + # 2. Deploy containers # ![Deployment](./oai-end-to-end.jpg) @@ -137,6 +146,8 @@ rfsim5g-traffic: flags=4163 mtu 1500 ## 2.2. Deploy OAI gNB in RF simulator mode and in Standalone Mode ## +**CAUTION: To execute this 2nd step, the whole `CN5G` SHALL be in `healthy` state (especially the `mysql` container).** + ```bash $ docker-compose up -d oai-gnb rfsim5g-oai-nrf is up-to-date @@ -160,6 +171,18 @@ rfsim5g-oai-smf /bin/bash -c /openair-smf/ ... Up (healthy) 80/tcp, 880 rfsim5g-oai-spgwu /openair-spgwu-tiny/bin/en ... Up (healthy) 2152/udp, 8805/udp ``` +You can verify that the `gNB` is connected with the `AMF`: + +```bagh +$ docker logs rfsim5g-oai-amf +... +[AMF] [amf_app] [info ] |----------------------------------------------------gNBs' information-------------------------------------------| +[AMF] [amf_app] [info ] | Index | Status | Global ID | gNB Name | PLMN | +[AMF] [amf_app] [info ] | 1 | Connected | 0x0 | gnb-rfsim | 208, 99 | +[AMF] [amf_app] [info ] |----------------------------------------------------------------------------------------------------------------| +... +``` + ## 2.3. Deploy OAI NR-UE in RF simulator mode and in Standalone Mode ## ```bash @@ -366,3 +389,47 @@ Removing rfsim5g-mysql ... done Removing network rfsim5g-oai-public-net Removing network rfsim5g-oai-traffic_net-net ``` + +# 5. Explanations on the configuration in the `docker-compose.yaml` # + +## 5.1. Making the NR-UE connect to the core network ## + +The NR-UE **SHALL** be provisioned in the core network, especially in the `SQL` database and in the `AMF`. + +* in AMF section of `docker-compose.yaml` --> `OPERATOR_KEY=c42449363bbad02b66d16bc975d77cc1` +* in NR-UE section --> `OPC: 'C42449363BBAD02B66D16BC975D77CC1' + +Both values shall match! + +This value is also present in the `oai_db.sql` file: + +```bash +INSERT INTO `users` VALUES ('208990100001100','1','55000000000000',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0xfec86ba6eb707ed08905757b1bb44b8f,0,0,0x40,'ebd07771ace8677a',0xc42449363bbad02b66d16bc975d77cc1); +``` + +As you can see, 2 other values shall match in the NR-UE section of `docker-compose.yaml`: + +* `FULL_IMSI: '208990100001100'` +* `FULL_KEY: 'fec86ba6eb707ed08905757b1bb44b8f'` + +We are also using a dedicated `oai-smf.conf` for the `SMF` container: the `oai` DNN shall match the one in the NR-UE section of `docker-compose.yaml` (`DNN: oai`). + +## 5.2. Making the gNB connect to the core network ## + +Mainly you need to match the PLMN in `gNB`, `AMF` and `SPGWU` parameters: + +* `AMF` + - `MCC=208` + - `MNC=99` + - `PLMN_SUPPORT_TAC=0x0001` + - ... +* `SPGWU` + - `MCC=208` + - `MNC=99` + - `TAC=1` +* `gNB` + - `MCC: '208'` + - `MNC: '99'` + - `TAC: 1` + +The `ST` and `SD` values shall also match. diff --git a/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml index 5da7a353ab..31d64f35dc 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml @@ -90,11 +90,14 @@ services: - USE_FQDN_DNS=yes - NRF_API_VERSION=v1 - NRF_FQDN=oai-nrf - - AUSF_IPV4_ADDRESS=127.0.0.1 + - EXTERNAL_AUSF=no + - AUSF_IPV4_ADDRESS=0.0.0.0 - AUSF_PORT=80 - AUSF_API_VERSION=v1 + - AUSF_FQDN=localhost depends_on: - oai-nrf + - mysql volumes: - ./amf-healthcheck.sh:/openair-amf/bin/amf-healthcheck.sh healthcheck: @@ -139,6 +142,7 @@ services: - USE_FQDN_DNS=yes depends_on: - oai-nrf + - oai-amf volumes: - ./smf-healthcheck.sh:/openair-smf/bin/smf-healthcheck.sh - ./oai-smf.conf:/openair-smf/bin/oai-smf.conf @@ -183,6 +187,7 @@ services: - DNN_0=oai depends_on: - oai-nrf + - oai-smf cap_add: - NET_ADMIN - SYS_ADMIN @@ -285,7 +290,7 @@ networks: com.docker.network.bridge.name: "rfsim5g-public" traffic_net: driver: bridge - name: rfsim5g-oai-traffic_net-net + name: rfsim5g-oai-traffic-net ipam: config: - subnet: 192.168.72.128/26 From 81e4a7832a1121925e93d46765908fbc3f78890e Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Tue, 5 Oct 2021 11:38:51 +0200 Subject: [PATCH 14/20] style(ci): LTE F1 split has its own pipeline now. less confusion Signed-off-by: Raphael Defosseux --- ci-scripts/Jenkinsfile-gitlab | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab index 6b53230c09..a0284edb71 100644 --- a/ci-scripts/Jenkinsfile-gitlab +++ b/ci-scripts/Jenkinsfile-gitlab @@ -503,6 +503,29 @@ pipeline { } } } + stage ("Test F1 - FDD - Band 7 - B210") { + when { + expression {doFullTestsuite} + } + steps { + script { + sh "sleep 60" + triggerSlaveJob ('eNB-CI-F1-FDD-Band7-B210', 'Test-F1-FDD-Band7') + } + } + post { + always { + script { + finalizeSlaveJob('eNB-CI-F1-FDD-Band7-B210') + } + } + failure { + script { + currentBuild.result = 'FAILURE' + } + } + } + } stage ("Test IF4p5 - TDD - Band 40 - B210") { when { expression {doFullTestsuite} From 64ad04b552bc55d3a1f991213257d7de3974ed4c Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Tue, 5 Oct 2021 10:56:07 +0200 Subject: [PATCH 15/20] doc(release): Updating the 5F RF simulator documentation and docker-compose following the v1.2.0 release of OAI-CN5G Signed-off-by: Raphael Defosseux --- .../yaml_files/5g_rfsimulator/README.md | 67 +++++++++++++++++++ .../5g_rfsimulator/docker-compose.yaml | 9 ++- 2 files changed, 74 insertions(+), 2 deletions(-) diff --git a/ci-scripts/yaml_files/5g_rfsimulator/README.md b/ci-scripts/yaml_files/5g_rfsimulator/README.md index 1351d6742b..915b71296f 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/README.md +++ b/ci-scripts/yaml_files/5g_rfsimulator/README.md @@ -14,6 +14,8 @@ This page is only valid for an `Ubuntu18` host. +**NOTE: this version (2021-10-05) is valid for the `v1.1.0` and `v1.2.0` versions of the `OAI 5G CN`.** + **TABLE OF CONTENTS** 1. [Retrieving the images on Docker-Hub](#1-retrieving-the-images-on-docker-hub) @@ -26,6 +28,9 @@ This page is only valid for an `Ubuntu18` host. 2. [Start the iperf server inside the NR-UE container](#32-start-the-iperf-server-inside-the-nr-ue-container) 3. [Start the iperf client inside the ext-dn container](#33-start-the-iperf-client-inside-the-ext-dn-container) 4. [Un-deployment](#4-un-deployment) +5. [Explanations on the configuration in the docker-compose.yaml](##5-explanations-on-the-configuration-in-the-docker-composeyaml) + 1. [Making the NR-UE connect to the core network](#51-making-the-nr-ue-connect-to-the-core-network) + 2. [Making the gNB connect to the core network](#52-making-the-gnb-connect-to-the-core-network) # 1. Retrieving the images on Docker-Hub # @@ -71,6 +76,10 @@ $ docker image tag rdefosseoai/oai-nr-ue:develop oai-nr-ue:develop $ docker logout ``` +**CAUTION: 2021/10/05 with the release `v1.2.0` of the `CN5G`, the previous version was not compatible any-more.** + +**This new version is working for both the `v1.1.0` and `v1.2.0` of the `CN5G`.** + # 2. Deploy containers # ![Deployment](./oai-end-to-end.jpg) @@ -137,6 +146,8 @@ rfsim5g-traffic: flags=4163 mtu 1500 ## 2.2. Deploy OAI gNB in RF simulator mode and in Standalone Mode ## +**CAUTION: To execute this 2nd step, the whole `CN5G` SHALL be in `healthy` state (especially the `mysql` container).** + ```bash $ docker-compose up -d oai-gnb rfsim5g-oai-nrf is up-to-date @@ -160,6 +171,18 @@ rfsim5g-oai-smf /bin/bash -c /openair-smf/ ... Up (healthy) 80/tcp, 880 rfsim5g-oai-spgwu /openair-spgwu-tiny/bin/en ... Up (healthy) 2152/udp, 8805/udp ``` +You can verify that the `gNB` is connected with the `AMF`: + +```bagh +$ docker logs rfsim5g-oai-amf +... +[AMF] [amf_app] [info ] |----------------------------------------------------gNBs' information-------------------------------------------| +[AMF] [amf_app] [info ] | Index | Status | Global ID | gNB Name | PLMN | +[AMF] [amf_app] [info ] | 1 | Connected | 0x0 | gnb-rfsim | 208, 99 | +[AMF] [amf_app] [info ] |----------------------------------------------------------------------------------------------------------------| +... +``` + ## 2.3. Deploy OAI NR-UE in RF simulator mode and in Standalone Mode ## ```bash @@ -366,3 +389,47 @@ Removing rfsim5g-mysql ... done Removing network rfsim5g-oai-public-net Removing network rfsim5g-oai-traffic_net-net ``` + +# 5. Explanations on the configuration in the `docker-compose.yaml` # + +## 5.1. Making the NR-UE connect to the core network ## + +The NR-UE **SHALL** be provisioned in the core network, especially in the `SQL` database and in the `AMF`. + +* in AMF section of `docker-compose.yaml` --> `OPERATOR_KEY=c42449363bbad02b66d16bc975d77cc1` +* in NR-UE section --> `OPC: 'C42449363BBAD02B66D16BC975D77CC1' + +Both values shall match! + +This value is also present in the `oai_db.sql` file: + +```bash +INSERT INTO `users` VALUES ('208990100001100','1','55000000000000',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0xfec86ba6eb707ed08905757b1bb44b8f,0,0,0x40,'ebd07771ace8677a',0xc42449363bbad02b66d16bc975d77cc1); +``` + +As you can see, 2 other values shall match in the NR-UE section of `docker-compose.yaml`: + +* `FULL_IMSI: '208990100001100'` +* `FULL_KEY: 'fec86ba6eb707ed08905757b1bb44b8f'` + +We are also using a dedicated `oai-smf.conf` for the `SMF` container: the `oai` DNN shall match the one in the NR-UE section of `docker-compose.yaml` (`DNN: oai`). + +## 5.2. Making the gNB connect to the core network ## + +Mainly you need to match the PLMN in `gNB`, `AMF` and `SPGWU` parameters: + +* `AMF` + - `MCC=208` + - `MNC=99` + - `PLMN_SUPPORT_TAC=0x0001` + - ... +* `SPGWU` + - `MCC=208` + - `MNC=99` + - `TAC=1` +* `gNB` + - `MCC: '208'` + - `MNC: '99'` + - `TAC: 1` + +The `ST` and `SD` values shall also match. diff --git a/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml index 5da7a353ab..31d64f35dc 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml @@ -90,11 +90,14 @@ services: - USE_FQDN_DNS=yes - NRF_API_VERSION=v1 - NRF_FQDN=oai-nrf - - AUSF_IPV4_ADDRESS=127.0.0.1 + - EXTERNAL_AUSF=no + - AUSF_IPV4_ADDRESS=0.0.0.0 - AUSF_PORT=80 - AUSF_API_VERSION=v1 + - AUSF_FQDN=localhost depends_on: - oai-nrf + - mysql volumes: - ./amf-healthcheck.sh:/openair-amf/bin/amf-healthcheck.sh healthcheck: @@ -139,6 +142,7 @@ services: - USE_FQDN_DNS=yes depends_on: - oai-nrf + - oai-amf volumes: - ./smf-healthcheck.sh:/openair-smf/bin/smf-healthcheck.sh - ./oai-smf.conf:/openair-smf/bin/oai-smf.conf @@ -183,6 +187,7 @@ services: - DNN_0=oai depends_on: - oai-nrf + - oai-smf cap_add: - NET_ADMIN - SYS_ADMIN @@ -285,7 +290,7 @@ networks: com.docker.network.bridge.name: "rfsim5g-public" traffic_net: driver: bridge - name: rfsim5g-oai-traffic_net-net + name: rfsim5g-oai-traffic-net ipam: config: - subnet: 192.168.72.128/26 From 52367f270115692477d976e81413c0cc5d1b03d0 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Tue, 5 Oct 2021 11:57:51 +0200 Subject: [PATCH 16/20] fix(ci): fixing docker-compose for F1 RF split following the v1.2.0 release of OAI-CN5G Signed-off-by: Raphael Defosseux --- .../yaml_files/5g_f1_rfsimulator/docker-compose.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml index 1e30c6bf51..a536de14f2 100644 --- a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml @@ -90,11 +90,14 @@ services: - USE_FQDN_DNS=yes - NRF_API_VERSION=v1 - NRF_FQDN=oai-nrf - - AUSF_IPV4_ADDRESS=127.0.0.1 + - EXTERNAL_AUSF=no + - AUSF_IPV4_ADDRESS=0.0.0.0 - AUSF_PORT=80 - AUSF_API_VERSION=v1 + - AUSF_FQDN=localhost depends_on: - oai-nrf + - mysql volumes: - ./amf-healthcheck.sh:/openair-amf/bin/amf-healthcheck.sh healthcheck: @@ -139,6 +142,7 @@ services: - USE_FQDN_DNS=yes depends_on: - oai-nrf + - oai-amf volumes: - ./smf-healthcheck.sh:/openair-smf/bin/smf-healthcheck.sh - ./oai-smf.conf:/openair-smf/bin/oai-smf.conf @@ -183,6 +187,7 @@ services: - DNN_0=oai depends_on: - oai-nrf + - oai-smf cap_add: - NET_ADMIN - SYS_ADMIN From df36de9b491417e1438264698fd4284f01ca6dd4 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Wed, 6 Oct 2021 10:03:39 +0200 Subject: [PATCH 17/20] fix(ci): better handling of wrong exit during iperf/ping tests; adding PCAP capture Signed-off-by: Raphael Defosseux --- ci-scripts/cls_containerize.py | 52 +++++++++++++++++-- .../xml_files/container_5g_f1_rfsim.xml | 16 ++++-- ci-scripts/xml_files/container_5g_rfsim.xml | 11 +++- 3 files changed, 71 insertions(+), 8 deletions(-) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 6cf3e95db7..ea09cd0585 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -93,6 +93,7 @@ class Containerize(): self.allImagesSize = {} self.collectInfo = {} + self.tsharkStarted = False self.pingContName = '' self.pingOptions = '' self.pingLossThreshold = '' @@ -597,6 +598,10 @@ class Containerize(): time.sleep(10) if count == 100 and healthy == self.nb_healthy[0]: + if self.tsharkStarted == False: + logging.debug('Starting tshark on public network') + self.CaptureOnDockerNetworks() + self.tsharkStarted = True HTML.CreateHtmlTestRow('n/a', 'OK', CONST.ALL_PROCESSES_OK) logging.info('\u001B[1m Deploying OAI Object(s) PASS\u001B[0m') else: @@ -604,6 +609,20 @@ class Containerize(): HTML.CreateHtmlTestRow('Could not deploy in time', 'KO', CONST.ALL_PROCESSES_OK) logging.error('\u001B[1m Deploying OAI Object(s) FAILED\u001B[0m') + def CaptureOnDockerNetworks(self): + cmd = 'cd ' + self.yamlPath[0] + ' && docker-compose -f docker-compose-ci.yml config | grep com.docker.network.bridge.name | sed -e "s@^.*name: @@"' + networkNames = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) + cmd = 'sudo nohup tshark -f "not tcp and not arp and not port 53 and not host archive.ubuntu.com and not host security.ubuntu.com"' + for name in networkNames.split('\n'): + res = re.search('rfsim', name) + if res is not None: + cmd += ' -i ' + name + cmd += ' -w /tmp/capture_' + ymlPath = self.yamlPath[0].split('/') + cmd += ymlPath[1] + '.pcap > /tmp/tshark.log 2>&1 &' + logging.debug(cmd) + networkNames = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) + def UndeployGenObject(self, HTML): self.exitStatus = 0 ymlPath = self.yamlPath[0].split('/') @@ -638,6 +657,18 @@ class Containerize(): cmd = 'mkdir -p '+ logPath + ' && mv ' + self.yamlPath[0] + '/*.log ' + logPath logging.debug(cmd) deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) + if self.tsharkStarted: + self.tsharkStarted = True + ymlPath = self.yamlPath[0].split('/') + cmd = 'sudo chmod 666 /tmp/capture_' + ymlPath[1] + '.pcap' + logging.debug(cmd) + copyStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) + cmd = 'cp /tmp/capture_' + ymlPath[1] + '.pcap ' + logPath + logging.debug(cmd) + copyStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) + cmd = 'sudo rm /tmp/capture_' + ymlPath[1] + '.pcap' + logging.debug(cmd) + copyStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) cmd = 'cd ' + self.yamlPath[0] + ' && docker-compose -f docker-compose-ci.yml down' logging.debug(cmd) @@ -715,9 +746,16 @@ class Containerize(): if status: HTML.CreateHtmlTestRowQueue(self.pingOptions, 'OK', 1, html_queue) else: - self.exitStatus = 1 - logging.error('\u001B[1;37;41m ' + message + ' \u001B[0m') + logging.error('\u001B[1;37;41m ping test FAIL -- ' + message + ' \u001B[0m') HTML.CreateHtmlTestRowQueue(self.pingOptions, 'KO', 1, html_queue) + # Automatic undeployment + logging.debug('----------------------------------------') + logging.debug('\u001B[1m Starting Automatic undeployment \u001B[0m') + logging.debug('----------------------------------------') + HTML.testCase_id = 'AUTO-UNDEPLOY' + HTML.desc = 'Automatic Un-Deployment' + self.UndeployGenObject(HTML) + self.exitStatus = 1 def IperfFromContainer(self, HTML): self.exitStatus = 0 @@ -836,5 +874,13 @@ class Containerize(): if status: HTML.CreateHtmlTestRowQueue(self.cliOptions, 'OK', 1, html_queue) else: - self.exitStatus = 1 + logging.error('\u001B[1m Iperf Test FAIL -- ' + message + ' \u001B[0m') HTML.CreateHtmlTestRowQueue(self.cliOptions, 'KO', 1, html_queue) + # Automatic undeployment + logging.debug('----------------------------------------') + logging.debug('\u001B[1m Starting Automatic undeployment \u001B[0m') + logging.debug('----------------------------------------') + HTML.testCase_id = 'AUTO-UNDEPLOY' + HTML.desc = 'Automatic Un-Deployment' + self.UndeployGenObject(HTML) + self.exitStatus = 1 diff --git a/ci-scripts/xml_files/container_5g_f1_rfsim.xml b/ci-scripts/xml_files/container_5g_f1_rfsim.xml index 400cd86fcd..501f2fe46f 100644 --- a/ci-scripts/xml_files/container_5g_f1_rfsim.xml +++ b/ci-scripts/xml_files/container_5g_f1_rfsim.xml @@ -26,6 +26,7 @@ wrench 100021 + 000020 000021 000022 000023 @@ -33,16 +34,23 @@ 020021 020022 030021 - 030022 100021 + + DeployGenObject + Deploy MySql Database + yaml_files/5g_f1_rfsimulator + mysql + 1 + + DeployGenObject Deploy OAI 5G CoreNetwork yaml_files/5g_f1_rfsimulator - mysql oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn + oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn 6 @@ -92,7 +100,7 @@ rfsim5g-oai-nr-ue rfsim5g-oai-ext-dn -B 12.1.1.2 -u -i 1 -s - -c 12.1.1.2 -u -i 1 -t 30 -b 400K + -c 12.1.1.2 -u -i 1 -t 30 -b 200K @@ -101,7 +109,7 @@ rfsim5g-oai-ext-dn rfsim5g-oai-nr-ue -u -i 1 -s - -B 12.1.1.2 -c 192.168.72.135 -u -i 1 -t 30 -b 20K + -B 12.1.1.2 -c 192.168.72.135 -u -i 1 -t 30 -b 5K diff --git a/ci-scripts/xml_files/container_5g_rfsim.xml b/ci-scripts/xml_files/container_5g_rfsim.xml index 31d7c1429b..da727f59c4 100644 --- a/ci-scripts/xml_files/container_5g_rfsim.xml +++ b/ci-scripts/xml_files/container_5g_rfsim.xml @@ -26,6 +26,7 @@ wrench 100001 + 000000 000001 000002 000003 @@ -37,11 +38,19 @@ + + DeployGenObject + Deploy MySql Database + yaml_files/5g_rfsimulator + mysql + 1 + + DeployGenObject Deploy OAI 5G CoreNetwork yaml_files/5g_rfsimulator - mysql oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn + oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn 6 From 3105a232484ab048f67beb3847a0bc8bbc4cd064 Mon Sep 17 00:00:00 2001 From: matzakos Date: Wed, 6 Oct 2021 13:39:29 +0200 Subject: [PATCH 18/20] Address two remaining review comments --- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 2 +- openair2/F1AP/f1ap_du_ue_context_management.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index ba7a32398e..ac281af81d 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -165,7 +165,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, protocol_ctxt_t ctxt; ctxt.rnti = f1ap_get_rnti_by_du_id(DUtype, instance, du_ue_f1ap_id); ctxt.instance = instance; - ctxt.instance = instance; + ctxt.module_id = instance; ctxt.enb_flag = 1; struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context( RC.rrc[ctxt.instance], diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index a825fab7ff..7b20bfb2aa 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -672,7 +672,7 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); ctxt.rnti = f1ap_get_rnti_by_cu_id(DUtype, instance, ie->value.choice.GNB_CU_UE_F1AP_ID); ctxt.instance = instance; - ctxt.instance = instance; + ctxt.module_id = instance; ctxt.enb_flag = 1; /* GNB_DU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCommandIEs_t, ie, container, From 4349e436ba06eebefe5e001db7daef8ae3fd5779 Mon Sep 17 00:00:00 2001 From: Panos Matzakos Date: Wed, 6 Oct 2021 13:20:27 +0000 Subject: [PATCH 19/20] Update README.md for CU/DU split deployment option --- ci-scripts/yaml_files/5g_rfsimulator/README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ci-scripts/yaml_files/5g_rfsimulator/README.md b/ci-scripts/yaml_files/5g_rfsimulator/README.md index 915b71296f..88dfa81a81 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/README.md +++ b/ci-scripts/yaml_files/5g_rfsimulator/README.md @@ -88,7 +88,9 @@ $ docker logout **Just `docker-compose up -d` WILL NOT WORK!** -All the following commands **SHALL** be run from the `ci-scripts/yaml_files/5g_rfsimulator` folder. +All the following commands **SHALL** be run from the `ci-scripts/yaml_files/5g_rfsimulator` folder for a deployment with monolithic gNB. + +For a deployment with the gNB split in CU and DU components, the following commands **SHALL** be run from the `ci-scripts/yaml_files/5g_f1_rfsimulator` folder. ## 2.1. Deploy OAI 5G Core Network ## @@ -148,6 +150,8 @@ rfsim5g-traffic: flags=4163 mtu 1500 **CAUTION: To execute this 2nd step, the whole `CN5G` SHALL be in `healthy` state (especially the `mysql` container).** +The gNB can be deployed either in monolithic mode, or in CU/DU split mode. +- For a deployment with a monolithic gNB: ```bash $ docker-compose up -d oai-gnb rfsim5g-oai-nrf is up-to-date @@ -155,7 +159,16 @@ rfsim5g-oai-spgwu is up-to-date rfsim5g-oai-ext-dn is up-to-date Creating rfsim5g-oai-gnb ... done ``` +- For a deployment with the gNB split in CU and DU components: +```bash +#Deployment of the CU +$ docker-compose up -d oai-cu +``` +```bash +#Deployment of the DU +$ docker-compose up -d oai-du +``` Wait for a bit. ```bash From 67e91af2f1a17ee3bf2179e8044ee726cf3fa06d Mon Sep 17 00:00:00 2001 From: Panos Matzakos Date: Wed, 6 Oct 2021 13:55:21 +0000 Subject: [PATCH 20/20] Update TESTING_5GSA_setup.md --- doc/TESTING_5GSA_setup.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/TESTING_5GSA_setup.md b/doc/TESTING_5GSA_setup.md index 475123c990..048d8c86ff 100644 --- a/doc/TESTING_5GSA_setup.md +++ b/doc/TESTING_5GSA_setup.md @@ -95,7 +95,7 @@ To get the code and build the gNB executable: ./build_oai --gNB -w USRP ``` -A reference configuration file for the gNB is provided [here](https://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/develop/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf). +A reference configuration file for the **monolithic** gNB is provided [here](https://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/develop/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf). In the following, we highlight the fields of the file that have to be configured according to the configuration and interfaces of the Core Network. First, the PLMN section has to be filled with the proper values that match the configuration of the AMF and the UE USIM. @@ -194,6 +194,8 @@ The SA setup with OAI UE has been validated with **RFSIMULATOR**. Both control p In the following, we provide the instructions on how to build, configure and execute this SA setup. +As another option, if you do not want to build anything and instead deploy the OAI RAN (RFSIMULATOR) and Core Network components directly using docker images and docker-compose, please have a look at [this tutorial](https://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/develop/ci-scripts/yaml_files/5g_rfsimulator/README.md). + ### NAS configuration for the OAI UE The NAS configuration parameters of the OAI UE can be set as input parameters, configuration file or can be hardcoded. More specifically: - SUCI (*Subscription Concealed Identifier*) @@ -245,7 +247,6 @@ The gNB configuration can be performed according to what is described in [sectio ## 2.2 OAI 5G Core Network installation and configuration The instructions for the installation of OAI CN components (AMF, SMF, NRF, UPF) using `docker-compose` can be found [here](https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-fed/-/blob/master/README.md). -In addition, if you do not want to build anything, please have a look at [this tutorial](https://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/develop/ci-scripts/yaml_files/5g_rfsimulator/README.md). ## 2.3 Execution of SA scenario