Telnet: add ciUE command to trigger establishment of a new PDU Session
This commit is contained in:
committed by
Robert Schmidt
parent
653c0fd6d5
commit
55c3cd2b31
@@ -62,7 +62,7 @@ add_dependencies(telnetsrv telnetsrv_ci)
|
|||||||
|
|
||||||
message(STATUS "Add CI specific telnet functions for nrUE in telnetsrv_ciUE.so")
|
message(STATUS "Add CI specific telnet functions for nrUE in telnetsrv_ciUE.so")
|
||||||
add_library(telnetsrv_ciUE MODULE telnetsrv_ciUE.c)
|
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)
|
add_dependencies(telnetsrv telnetsrv_ciUE)
|
||||||
|
|
||||||
message(STATUS "Add bearer specific telnet functions in libtelnetsrv_bearer.so")
|
message(STATUS "Add bearer specific telnet functions in libtelnetsrv_bearer.so")
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
#include "openair2/RRC/NR_UE/rrc_proto.h"
|
#include "openair2/RRC/NR_UE/rrc_proto.h"
|
||||||
#include "openair1/PHY/phy_extern_nr_ue.h"
|
#include "openair1/PHY/phy_extern_nr_ue.h"
|
||||||
#include "openair1/PHY/defs_nr_common.h"
|
#include "openair1/PHY/defs_nr_common.h"
|
||||||
|
#include "openair3/NAS/NR_UE/nr_nas_msg.h"
|
||||||
|
|
||||||
#define TELNETSERVERCODE
|
#define TELNETSERVERCODE
|
||||||
#include "telnetsrv.h"
|
#include "telnetsrv.h"
|
||||||
@@ -52,6 +53,14 @@ const char* NR_UE_L2_STATE_STR[] = {
|
|||||||
#undef UE_STATE
|
#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.
|
* 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;
|
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 */
|
/* Telnet shell command definitions */
|
||||||
static telnetshell_cmddef_t cicmds[] = {
|
static telnetshell_cmddef_t cicmds[] = {
|
||||||
{"sync_state", "[UE_ID(int,opt)]", get_sync_state},
|
{"sync_state", "[UE_ID(int,opt)]", get_sync_state},
|
||||||
@@ -140,6 +183,7 @@ static telnetshell_cmddef_t cicmds[] = {
|
|||||||
{"force_crnti_ra", "", force_crnti_ra},
|
{"force_crnti_ra", "", force_crnti_ra},
|
||||||
{"deregistration", "", force_deregistration},
|
{"deregistration", "", force_deregistration},
|
||||||
{"get_max_dl_toa", "[ant]", get_dl_toa},
|
{"get_max_dl_toa", "[ant]", get_dl_toa},
|
||||||
|
{"add_pdu_session", "[PDUSessionID(int)],[UE_ID(int,opt)]", add_pdu_session},
|
||||||
{"", "", NULL},
|
{"", "", NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1772,7 +1772,7 @@ static void send_nas_5gmm_ind(instance_t instance, const Guti5GSMobileIdentity_t
|
|||||||
itti_send_msg_to_task(TASK_RRC_NRUE, instance, msg);
|
itti_send_msg_to_task(TASK_RRC_NRUE, instance, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_pdusession(nr_ue_nas_t *nas, int pdusession_id)
|
void request_pdusession(nr_ue_nas_t *nas, int pdusession_id)
|
||||||
{
|
{
|
||||||
MessageDef *message_p = itti_alloc_new_message(TASK_NAS_NRUE, nas->UE_id, NAS_PDU_SESSION_REQ);
|
MessageDef *message_p = itti_alloc_new_message(TASK_NAS_NRUE, nas->UE_id, NAS_PDU_SESSION_REQ);
|
||||||
NAS_PDU_SESSION_REQ(message_p).pdusession_id = pdusession_id;
|
NAS_PDU_SESSION_REQ(message_p).pdusession_id = pdusession_id;
|
||||||
|
|||||||
@@ -113,5 +113,6 @@ void *nas_nrue_task(void *args_p);
|
|||||||
void *nas_nrue(void *args_p);
|
void *nas_nrue(void *args_p);
|
||||||
void nas_init_nrue(int num_ues);
|
void nas_init_nrue(int num_ues);
|
||||||
void nr_ue_create_ip_if(const char *ifnameprefix, const char *ipv4, const char *ipv6, int ue_id, int pdu_session_id);
|
void nr_ue_create_ip_if(const char *ifnameprefix, const char *ipv4, const char *ipv6, int ue_id, int pdu_session_id);
|
||||||
|
void request_pdusession(nr_ue_nas_t *nas, int pdusession_id);
|
||||||
|
|
||||||
#endif /* __NR_NAS_MSG_SIM_H__*/
|
#endif /* __NR_NAS_MSG_SIM_H__*/
|
||||||
|
|||||||
Reference in New Issue
Block a user