Commit b4bf59c5 authored by Robert Schmidt's avatar Robert Schmidt

Add telnet module function to trigger F1 HO

parent b5e35077
......@@ -71,30 +71,41 @@ int get_single_rnti(char *buf, int debug, telnet_printfunc_t prnt)
return 0;
}
int get_reestab_count(char *buf, int debug, telnet_printfunc_t prnt)
rrc_gNB_ue_context_t *get_single_rrc_ue(void)
{
if (!RC.nrrrc)
ERROR_MSG_RET("no RRC present, cannot list counts\n");
rrc_gNB_ue_context_t *ue = NULL;
int rnti = -1;
if (!buf) {
rrc_gNB_ue_context_t *l = NULL;
int n = 0;
RB_FOREACH(l, rrc_nr_ue_tree_s, &RC.nrrrc[0]->rrc_ue_head) {
if (ue == NULL) ue = l;
RB_FOREACH (l, rrc_nr_ue_tree_s, &RC.nrrrc[0]->rrc_ue_head) {
if (ue == NULL)
ue = l;
n++;
}
if (!ue) {
printf("could not find any UE in RRC\n");
}
if (n > 1) {
printf("more than one UE in RRC present\n");
ue = NULL;
}
return ue;
}
int get_reestab_count(char *buf, int debug, telnet_printfunc_t prnt)
{
if (!RC.nrrrc)
ERROR_MSG_RET("no RRC present, cannot list counts\n");
rrc_gNB_ue_context_t *ue = NULL;
if (!buf) {
ue = get_single_rrc_ue();
if (!ue)
ERROR_MSG_RET("could not find any UE in RRC\n");
if (n > 1)
ERROR_MSG_RET("more than one UE in RRC present\n");
ERROR_MSG_RET("no single UE in RRC present\n");
} else {
rnti = strtol(buf, NULL, 16);
if (rnti < 1 || rnti >= 0xfffe)
ERROR_MSG_RET("RNTI needs to be [1,0xfffe]\n");
ue = rrc_gNB_get_ue_context_by_rnti_any_du(RC.nrrrc[0], rnti);
ue_id_t ue_id = strtol(buf, NULL, 10);
ue = rrc_gNB_get_ue_context(RC.nrrrc[0], ue_id);
if (!ue)
ERROR_MSG_RET("could not find UE with RNTI %04x in RRC\n");
ERROR_MSG_RET("could not find UE with ue_id %d in RRC\n");
}
prnt("UE RNTI %04x reestab %d reconfig %d\n",
......@@ -125,10 +136,42 @@ int trigger_reestab(char *buf, int debug, telnet_printfunc_t prnt)
return 0;
}
extern void nr_HO_F1_trigger_telnet(gNB_RRC_INST *rrc, uint32_t rrc_ue_id);
/**
* @brief Trigger F1 handover for UE
* @param buf: RRC UE ID or NULL for the first UE in list
* @param debug: Debug flag
* @param prnt: Print function
* @return 0 on success, -1 on failure
*/
int rrc_gNB_trigger_f1_ho(char *buf, int debug, telnet_printfunc_t prnt)
{
if (!RC.nrrrc)
ERROR_MSG_RET("no RRC present, cannot list counts\n");
rrc_gNB_ue_context_t *ue = NULL;
if (!buf) {
ue = get_single_rrc_ue();
if (!ue)
ERROR_MSG_RET("no single UE in RRC present\n");
} else {
ue_id_t ue_id = strtol(buf, NULL, 10);
ue = rrc_gNB_get_ue_context(RC.nrrrc[0], ue_id);
if (!ue)
ERROR_MSG_RET("could not find UE with ue_id %d in RRC\n", ue_id);
}
gNB_RRC_UE_t *UE = &ue->ue_context;
nr_HO_F1_trigger_telnet(RC.nrrrc[0], UE->rrc_ue_id);
prnt("RRC F1 handover triggered for UE %u\n", UE->rrc_ue_id);
return 0;
}
static telnetshell_cmddef_t cicmds[] = {
{"get_single_rnti", "", get_single_rnti},
{"force_reestab", "[rnti(hex,opt)]", trigger_reestab},
{"get_reestab_count", "[rnti(hex,opt)]", get_reestab_count},
{"trigger_f1_ho", "[rrc_ue_id(int,opt)]", rrc_gNB_trigger_f1_ho},
{"", "", NULL},
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment