Merge remote-tracking branch 'origin/rrc-pdu-session-release' into integration_2025_w46 (!3684)
PDU Session Release
This MR implements end-to-end PDU Session Release functionality
according to 3GPP TS 38.413 and TS 38.331 specifications.
Reason for Change Previous implementation had incomplete and wrongly
places tunnel cleanup during PDU session release. UP cleanup shall be
done at CUUP, RRCReconfiguration shall be sent after retrieval of
updated CellGroupConfig from the DU. This implies F1 and E1 exchanges
during PDU session release procedure.
Major Changes:
1. RRC PDU Session Release: DRBs and PDU session teardown in NGAP PDU
Session Release Response callback
- Helper Functions: Introduced rm_pduSession,
find_drb_by_pdusession_id and rm_drbs() helpers to locate and clean
up DRBs linked to a specific PDU session
- Targeted Cleanup: RRC PDU Session and per-session DRB removal in
rrc_gNB_send_NGAP_PDUSESSION_RELEASE_RESPONSE()
- Status Cleanup: Removed unused PDU_SESSION_STATUS_RELEASED status
2. RRC PDU Session Release: Refactor
rrc_gNB_process_NGAP_PDUSESSION_RELEASE_COMMAND
- Any PDU session in the pdusession_release_params list that is
present in the RRC list can be set to release, regardless of its
status
- Function Signature Update: Updated function signature and other
minor changes
- Response Handling: rrc_gNB_send_NGAP_PDUSESSION_RELEASE_RESPONSE is
sent upon completion of RRCReconfiguration
3. RRC PDU Session Release: add missing procedures E1AP Integration:
- Populates E1AP Bearer Modification for each to be released session
- PDCP Enhancement: Added nr_pdcp_release_drbs() to remove all DRBs
linked to a given PDU session in CUUP
- GTP-U Cleanup: GTP tunnel teardown handled in CUUP
e1_bearer_context_modif() using correct F1 or N3 GTP instance
4. NR PDCP/GTP:
- Enhanced Tunnel Deletion Logic: Separate handling for N3 tunnels (1
per PDU session) and F1-U tunnels (1 per DRB)
- New PDCP API Function: Added nr_pdcp_get_drb_ids_for_pdusession()
function to retrieve all DRB IDs associated with a specific PDU
session
5. RRC PDU Session Release: F1AP-based UE Context Modification:
- Replaced direct RRC message transfer with F1AP UE Context
Modification Request for proper retrieval from DU
- Cell Group Configuration: handling of updated CellGroupConfig from
DU ensures DRB release at CU
6. Docs and testing:
- Added PDU session add/remove test cases to 25 PRB RFSIM pipeline
- Documentation: Added PDU Session Release sequence diagram
- Telnet Commands: Added ci command to trigger NGAP PDU Session
Release and ciUE command to trigger establishment of a new PDU
Session
7. Additional fixes:
- UE RLC Management: ensure release of RLC entities
- Unify NG delay control before calling the RRC NGAP handler, for both
Setup and Release
8. Code Cleanup: Cleaned up unused GTP teardown functions.
Closes #867
This commit is contained in:
@@ -62,7 +62,7 @@ add_dependencies(telnetsrv telnetsrv_ci)
|
||||
|
||||
message(STATUS "Add CI specific telnet functions for nrUE in telnetsrv_ciUE.so")
|
||||
add_library(telnetsrv_ciUE MODULE telnetsrv_ciUE.c)
|
||||
target_link_libraries(telnetsrv_ciUE PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs UTIL)
|
||||
target_link_libraries(telnetsrv_ciUE PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs UTIL NR_L2_UE nr_nas)
|
||||
add_dependencies(telnetsrv telnetsrv_ciUE)
|
||||
|
||||
message(STATUS "Add bearer specific telnet functions in libtelnetsrv_bearer.so")
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "openair2/LAYER2/nr_rlc/nr_rlc_entity_am.h"
|
||||
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
#include "openair2/RRC/NR/rrc_gNB_mobility.h"
|
||||
#include "openair3/NGAP/ngap_gNB_ue_context.h"
|
||||
|
||||
#define TELNETSERVERCODE
|
||||
#include "telnetsrv.h"
|
||||
@@ -284,6 +285,86 @@ static int get_current_bwp(char *buf, int debug, telnet_printfunc_t prnt)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** @brief Trigger NGAP PDU Session Release for one or more PDU sessions associated with a UE ID/
|
||||
* Syntax: trigger_pdu_session_release [ue_id=gNB_ue_ngap_id(int,opt)],pdusession_id(int)[,pdusession_id(int)...]
|
||||
* - If the gNB_ue_ngap_id is omitted, it is fetched from the only UE present in the RRC layer
|
||||
* - At least one valid PDU session ID must be provided
|
||||
* @param[in] buf Comma-separated input string: [ue_id=gNB_ue_ngap_id(int,opt)],PDU1[,PDU2,...]
|
||||
* @param[in] debug Not used.
|
||||
* @param[in] prnt Callback for telnet output printing.
|
||||
* @return 0 on success; negative value on error. */
|
||||
static int trigger_ngap_pdu_session_release(char *buf, int debug, telnet_printfunc_t prnt)
|
||||
{
|
||||
if (buf == NULL) {
|
||||
ERROR_MSG_RET("Missing input. Usage: trigger_pdu_session_release [ue_id=gNB_ue_ngap_id(int,opt)],pdusession_id(int)[,pdusession_id(int)...]\n");
|
||||
}
|
||||
|
||||
char *tokens[NGAP_MAX_PDU_SESSION + 1];
|
||||
int count = 0;
|
||||
|
||||
for (char *tok = strtok(buf, ","); tok != NULL && count < (int)sizeofArray(tokens); tok = strtok(NULL, ",")) {
|
||||
tokens[count++] = tok;
|
||||
}
|
||||
|
||||
if (count < 1) {
|
||||
ERROR_MSG_RET("Invalid input. Usage: trigger_pdu_session_release [ue_id=gNB_ue_ngap_id(int,opt)],pdusession_id(int)[,pdusession_id(int)...]\n");
|
||||
}
|
||||
|
||||
int gNB_ue_ngap_id = -1;
|
||||
int pdu_start_index = 0;
|
||||
|
||||
if (strncmp(tokens[0], "ue_id=", 6) == 0) {
|
||||
gNB_ue_ngap_id = atoi(tokens[0] + 6);
|
||||
pdu_start_index = 1;
|
||||
} else {
|
||||
// No UE ID: infer it
|
||||
if (!RC.nrrrc)
|
||||
ERROR_MSG_RET("No RRC present\n");
|
||||
rrc_gNB_ue_context_t *ue = get_single_rrc_ue();
|
||||
if (!ue)
|
||||
ERROR_MSG_RET("No single UE in RRC present\n");
|
||||
gNB_ue_ngap_id = ue->ue_context.rrc_ue_id;
|
||||
}
|
||||
|
||||
if (pdu_start_index >= count) {
|
||||
ERROR_MSG_RET("No pdusession_id(int) provided\n");
|
||||
}
|
||||
|
||||
ngap_gNB_ue_context_t *ngap = ngap_get_ue_context(gNB_ue_ngap_id);
|
||||
if (!ngap) {
|
||||
ERROR_MSG_RET("No NGAP UE context for gNB_ue_ngap_id %d\n", gNB_ue_ngap_id);
|
||||
}
|
||||
|
||||
MessageDef *message_p = itti_alloc_new_message(TASK_NGAP, 0, NGAP_PDUSESSION_RELEASE_COMMAND);
|
||||
ngap_pdusession_release_command_t *msg = &NGAP_PDUSESSION_RELEASE_COMMAND(message_p);
|
||||
memset(msg, 0, sizeof(*msg));
|
||||
|
||||
msg->amf_ue_ngap_id = ngap->amf_ue_ngap_id;
|
||||
msg->gNB_ue_ngap_id = ngap->gNB_ue_ngap_id;
|
||||
|
||||
int nb_sessions = 0;
|
||||
for (int i = pdu_start_index; i < count; ++i) {
|
||||
int sid = atoi(tokens[i]);
|
||||
if (sid < 1 || sid > 255) {
|
||||
ERROR_MSG_RET("Invalid pdusession_id(int): %s (must be between 1 and 255)\n", tokens[i]);
|
||||
}
|
||||
msg->pdusession_release_params[nb_sessions++].pdusession_id = sid;
|
||||
}
|
||||
|
||||
msg->nb_pdusessions_torelease = nb_sessions;
|
||||
|
||||
if (prnt) {
|
||||
prnt("Triggering NGAP PDU Session Release for gNB_ue_ngap_id=%d: releasing pdusession_id=%d", gNB_ue_ngap_id);
|
||||
for (int i = 0; i < nb_sessions; ++i) {
|
||||
prnt(" %d,", msg->pdusession_release_params[i].pdusession_id);
|
||||
}
|
||||
prnt("\n");
|
||||
}
|
||||
|
||||
itti_send_msg_to_task(TASK_RRC_GNB, 0, message_p);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static telnetshell_cmddef_t cicmds[] = {
|
||||
{"get_single_rnti", "", get_single_rnti},
|
||||
{"force_reestab", "[rnti(hex,opt)]", trigger_reestab},
|
||||
@@ -294,6 +375,7 @@ static telnetshell_cmddef_t cicmds[] = {
|
||||
{"fetch_du_by_ue_id", "[rrc_ue_id(int,opt)]", fetch_du_by_ue_id},
|
||||
{"get_current_bwp", "[rnti(hex,opt)]", get_current_bwp},
|
||||
{"trigger_n2_ho", "[neighbour_pci(uint32_t),ueId(uint32_t)]", rrc_gNB_trigger_n2_ho},
|
||||
{"pdu_session_release", "[gNB_ue_ngap_id(int,opt)]", trigger_ngap_pdu_session_release},
|
||||
{"", "", NULL},
|
||||
};
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "openair2/RRC/NR_UE/rrc_proto.h"
|
||||
#include "openair1/PHY/phy_extern_nr_ue.h"
|
||||
#include "openair1/PHY/defs_nr_common.h"
|
||||
#include "openair3/NAS/NR_UE/nr_nas_msg.h"
|
||||
|
||||
#define TELNETSERVERCODE
|
||||
#include "telnetsrv.h"
|
||||
@@ -52,6 +53,14 @@ const char* NR_UE_L2_STATE_STR[] = {
|
||||
#undef UE_STATE
|
||||
};
|
||||
|
||||
static int get_default_ue_id(void)
|
||||
{
|
||||
NR_UE_RRC_INST_t *rrc = get_NR_UE_rrc_inst(0);
|
||||
if (!rrc)
|
||||
return -1;
|
||||
return rrc->ue_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the synchronization state of a UE.
|
||||
*
|
||||
@@ -132,6 +141,40 @@ static int get_dl_toa(char *buf, int debug, telnet_printfunc_t prnt)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int add_pdu_session(char *buf, int debug, telnet_printfunc_t prnt)
|
||||
{
|
||||
int ue_id = -1;
|
||||
int pdusession_id = -1;
|
||||
|
||||
if (!buf) {
|
||||
ERROR_MSG_RET("Missing argument: expected PDUSessionID[,UE_ID]\n");
|
||||
}
|
||||
|
||||
// Try parsing values in the form: "PDUSessionID[,UE_ID]"
|
||||
int n = sscanf(buf, "%d,%d", &pdusession_id, &ue_id);
|
||||
if (n == 1) {
|
||||
// Only PDUSessionID provided: use default UE ID
|
||||
ue_id = get_default_ue_id();
|
||||
if (ue_id < 0)
|
||||
ERROR_MSG_RET("No default UE context found\n");
|
||||
} else if (n != 2) {
|
||||
ERROR_MSG_RET("Invalid format: expected PDUSessionID[,UE_ID]\n");
|
||||
}
|
||||
|
||||
if (pdusession_id < 0 || pdusession_id > 255)
|
||||
ERROR_MSG_RET("PDUSessionID must be in range [0,255]\n");
|
||||
if (ue_id < 0)
|
||||
ERROR_MSG_RET("UE_ID must be >= 0\n");
|
||||
|
||||
nr_ue_nas_t *nas = get_ue_nas_info(ue_id);
|
||||
if (!nas)
|
||||
ERROR_MSG_RET("No NAS context found for UE_ID %d\n", ue_id);
|
||||
|
||||
request_pdusession(nas, pdusession_id);
|
||||
prnt("Triggered PDU session request for UE %d with ID %d\n", ue_id, pdusession_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Telnet shell command definitions */
|
||||
static telnetshell_cmddef_t cicmds[] = {
|
||||
{"sync_state", "[UE_ID(int,opt)]", get_sync_state},
|
||||
@@ -140,6 +183,7 @@ static telnetshell_cmddef_t cicmds[] = {
|
||||
{"force_crnti_ra", "", force_crnti_ra},
|
||||
{"deregistration", "", force_deregistration},
|
||||
{"get_max_dl_toa", "[ant]", get_dl_toa},
|
||||
{"add_pdu_session", "[PDUSessionID(int)],[UE_ID(int,opt)]", add_pdu_session},
|
||||
{"", "", NULL},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user