Commit b90a59a6 authored by Robert Schmidt's avatar Robert Schmidt

Trigger Reestablishment via resetting RLC sequence numbers

Plugin can trigger reestablishment (on DU)
and show counters of reestablishment (on CU)
parent 1c07afbe
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
<testCase id="000002"> <testCase id="000002">
<class>IdleSleep</class> <class>IdleSleep</class>
<desc>Sleep</desc> <desc>Sleep</desc>
<idle_sleep_time_in_sec>20</idle_sleep_time_in_sec> <idle_sleep_time_in_sec>10</idle_sleep_time_in_sec>
</testCase> </testCase>
...@@ -168,14 +168,14 @@ ...@@ -168,14 +168,14 @@
<class>Custom_Command</class> <class>Custom_Command</class>
<desc>Trigger Reestablishment</desc> <desc>Trigger Reestablishment</desc>
<node>ofqot</node> <node>ofqot</node>
<command>echo ci force_reestab | nc -N 192.168.68.194 9090 | grep -E 'force-remove UE RNTI [0-9a-f]{4} from RLC to trigger reestablishment'</command> <command>echo ci force_reestab | nc -N 192.168.68.194 9090 | grep -E 'Reset RLC counters of UE RNTI [0-9a-f]{4} to trigger reestablishment'</command>
<command_fail>yes</command_fail> <command_fail>yes</command_fail>
</testCase> </testCase>
<testCase id="060002"> <testCase id="060002">
<class>Custom_Command</class> <class>Custom_Command</class>
<desc>Verify Reestablishment</desc> <desc>Verify Reestablishment</desc>
<node>ofqot</node> <node>ofqot</node>
<command>echo ci get_reestab_count | nc -N 192.168.68.194 9090 | grep -E 'UE RNTI [0-9a-f]{4} reestab 1 reconf_after_reestab 1'</command> <command>echo ci get_reestab_count | nc -N 192.168.68.194 9090 | grep -E 'UE RNTI [0-9a-f]{4} reestab 1'</command>
<command_fail>yes</command_fail> <command_fail>yes</command_fail>
</testCase> </testCase>
......
...@@ -105,7 +105,7 @@ ...@@ -105,7 +105,7 @@
<testCase id="200002"> <testCase id="200002">
<class>IdleSleep</class> <class>IdleSleep</class>
<desc>Sleep</desc> <desc>Sleep</desc>
<idle_sleep_time_in_sec>20</idle_sleep_time_in_sec> <idle_sleep_time_in_sec>10</idle_sleep_time_in_sec>
</testCase> </testCase>
...@@ -162,14 +162,14 @@ ...@@ -162,14 +162,14 @@
<class>Custom_Command</class> <class>Custom_Command</class>
<desc>Trigger Reestablishment</desc> <desc>Trigger Reestablishment</desc>
<node>ofqot</node> <node>ofqot</node>
<command>echo ci force_reestab | nc -N 192.168.68.194 9090 | grep -E 'force-remove UE RNTI [0-9a-f]{4} from RLC to trigger reestablishment'</command> <command>echo ci force_reestab | nc -N 192.168.68.194 9090 | grep -E 'Reset RLC counters of UE RNTI [0-9a-f]{4} to trigger reestablishment'</command>
<command_fail>yes</command_fail> <command_fail>yes</command_fail>
</testCase> </testCase>
<testCase id="260002"> <testCase id="260002">
<class>Custom_Command</class> <class>Custom_Command</class>
<desc>Verify Reestablishment</desc> <desc>Verify Reestablishment</desc>
<node>ofqot</node> <node>ofqot</node>
<command>echo ci get_reestab_count | nc -N 192.168.68.194 9090 | grep -E 'UE RNTI [0-9a-f]{4} reestab 1 reconf_after_reestab 1'</command> <command>echo ci get_reestab_count | nc -N 192.168.68.194 9090 | grep -E 'UE RNTI [0-9a-f]{4} reestab 1'</command>
<command_fail>yes</command_fail> <command_fail>yes</command_fail>
</testCase> </testCase>
......
...@@ -28,15 +28,17 @@ ...@@ -28,15 +28,17 @@
#include <stdarg.h> #include <stdarg.h>
#include "openair2/RRC/NR/rrc_gNB_UE_context.h" #include "openair2/RRC/NR/rrc_gNB_UE_context.h"
#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h"
#include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h" #include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h"
#include "openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h"
#include "openair2/LAYER2/nr_rlc/nr_rlc_entity_am.h"
#define TELNETSERVERCODE #define TELNETSERVERCODE
#include "telnetsrv.h" #include "telnetsrv.h"
#define ERROR_MSG_RET(mSG, aRGS...) do { prnt(mSG, ##aRGS); return 1; } while (0) #define ERROR_MSG_RET(mSG, aRGS...) do { prnt(mSG, ##aRGS); return 1; } while (0)
static int get_single_ue_rnti(void) static int get_single_ue_rnti_mac(void)
{ {
NR_UE_info_t *ue = NULL; NR_UE_info_t *ue = NULL;
UE_iterator(RC.nrmac[0]->UE_info.list, it) { UE_iterator(RC.nrmac[0]->UE_info.list, it) {
...@@ -48,11 +50,6 @@ static int get_single_ue_rnti(void) ...@@ -48,11 +50,6 @@ static int get_single_ue_rnti(void)
if (!ue) if (!ue)
return -1; return -1;
// verify it exists in RRC as well
rrc_gNB_ue_context_t *rrcue = rrc_gNB_get_ue_context_by_rnti(RC.nrrrc[0], ue->rnti);
if (!rrcue)
return -1;
return ue->rnti; return ue->rnti;
} }
...@@ -61,7 +58,7 @@ int get_single_rnti(char *buf, int debug, telnet_printfunc_t prnt) ...@@ -61,7 +58,7 @@ int get_single_rnti(char *buf, int debug, telnet_printfunc_t prnt)
if (buf) if (buf)
ERROR_MSG_RET("no parameter allowed\n"); ERROR_MSG_RET("no parameter allowed\n");
int rnti = get_single_ue_rnti(); int rnti = get_single_ue_rnti_mac();
if (rnti < 1) if (rnti < 1)
ERROR_MSG_RET("different number of UEs\n"); ERROR_MSG_RET("different number of UEs\n");
...@@ -71,23 +68,32 @@ int get_single_rnti(char *buf, int debug, telnet_printfunc_t prnt) ...@@ -71,23 +68,32 @@ int get_single_rnti(char *buf, int debug, telnet_printfunc_t prnt)
int get_reestab_count(char *buf, int debug, telnet_printfunc_t prnt) 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;
int rnti = -1; int rnti = -1;
if (!buf) { if (!buf) {
rnti = get_single_ue_rnti(); rrc_gNB_ue_context_t *l = NULL;
if (rnti < 1) int n = 0;
ERROR_MSG_RET("no UE found\n"); RB_FOREACH(l, rrc_nr_ue_tree_s, &RC.nrrrc[0]->rrc_ue_head) {
if (ue == NULL) ue = l;
n++;
}
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");
} else { } else {
rnti = strtol(buf, NULL, 16); rnti = strtol(buf, NULL, 16);
if (rnti < 1 || rnti >= 0xfffe) if (rnti < 1 || rnti >= 0xfffe)
ERROR_MSG_RET("RNTI needs to be [1,0xfffe]\n"); ERROR_MSG_RET("RNTI needs to be [1,0xfffe]\n");
ue = rrc_gNB_get_ue_context_by_rnti(RC.nrrrc[0], rnti);
if (!ue)
ERROR_MSG_RET("could not find UE with RNTI %04x in RRC\n");
} }
rrc_gNB_ue_context_t *ue = rrc_gNB_get_ue_context_by_rnti(RC.nrrrc[0], rnti);
if (!ue)
ERROR_MSG_RET("could not find UE with RNTI %04x\n", rnti);
prnt("UE RNTI %04x reestab %d reconf_after_reestab %d\n", prnt("UE RNTI %04x reestab %d reconf_after_reestab %d\n",
rnti, ue->ue_context.rnti,
ue->ue_context.ue_reestablishment_counter, ue->ue_context.ue_reestablishment_counter,
ue->ue_context.ue_reconfiguration_after_reestablishment_counter); ue->ue_context.ue_reconfiguration_after_reestablishment_counter);
return 0; return 0;
...@@ -95,9 +101,11 @@ int get_reestab_count(char *buf, int debug, telnet_printfunc_t prnt) ...@@ -95,9 +101,11 @@ int get_reestab_count(char *buf, int debug, telnet_printfunc_t prnt)
int trigger_reestab(char *buf, int debug, telnet_printfunc_t prnt) int trigger_reestab(char *buf, int debug, telnet_printfunc_t prnt)
{ {
if (!RC.nrmac)
ERROR_MSG_RET("no MAC/RLC present, cannot trigger reestablishment\n");
int rnti = -1; int rnti = -1;
if (!buf) { if (!buf) {
rnti = get_single_ue_rnti(); rnti = get_single_ue_rnti_mac();
if (rnti < 1) if (rnti < 1)
ERROR_MSG_RET("no UE found\n"); ERROR_MSG_RET("no UE found\n");
} else { } else {
...@@ -106,13 +114,9 @@ int trigger_reestab(char *buf, int debug, telnet_printfunc_t prnt) ...@@ -106,13 +114,9 @@ int trigger_reestab(char *buf, int debug, telnet_printfunc_t prnt)
ERROR_MSG_RET("RNTI needs to be [1,0xfffe]\n"); ERROR_MSG_RET("RNTI needs to be [1,0xfffe]\n");
} }
// verify it exists in RRC as well nr_rlc_test_trigger_reestablishment(rnti);
rrc_gNB_ue_context_t *rrcue = rrc_gNB_get_ue_context_by_rnti(RC.nrrrc[0], rnti);
if (!rrcue)
ERROR_MSG_RET("could not find UE with RNTI %04x\n", rnti);
nr_rlc_remove_ue(rnti); prnt("Reset RLC counters of UE RNTI %04x to trigger reestablishment\n", rnti);
prnt("force-remove UE RNTI %04x from RLC to trigger reestablishment\n", rnti);
return 0; return 0;
} }
......
...@@ -1010,6 +1010,24 @@ rlc_op_status_t rrc_rlc_remove_ue (const protocol_ctxt_t* const x) ...@@ -1010,6 +1010,24 @@ rlc_op_status_t rrc_rlc_remove_ue (const protocol_ctxt_t* const x)
return RLC_OP_STATUS_OK; return RLC_OP_STATUS_OK;
} }
/* This function is for testing purposes. At least on a COTS UE, it will
* trigger a reestablishment. */
void nr_rlc_test_trigger_reestablishment(int rnti)
{
nr_rlc_manager_lock(nr_rlc_ue_manager);
nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti);
if (ue == NULL) {
nr_rlc_manager_unlock(nr_rlc_ue_manager);
LOG_E(RLC, "Cannot find RLC entity for UE %04x\n", rnti);
return;
}
/* we simply assume the SRB exists, because the scheduler creates it as soon
* as the UE context is created. */
nr_rlc_entity_t *ent = ue->srb[0];
ent->reestablishment(ent);
nr_rlc_manager_unlock(nr_rlc_ue_manager);
}
void nr_rlc_tick(int frame, int subframe) void nr_rlc_tick(int frame, int subframe)
{ {
if (frame != nr_rlc_current_time_last_frame || if (frame != nr_rlc_current_time_last_frame ||
......
...@@ -44,6 +44,9 @@ void nr_rlc_add_drb(int rnti, int drb_id, const NR_RLC_BearerConfig_t *rlc_Beare ...@@ -44,6 +44,9 @@ void nr_rlc_add_drb(int rnti, int drb_id, const NR_RLC_BearerConfig_t *rlc_Beare
void nr_rlc_remove_ue(int rnti); void nr_rlc_remove_ue(int rnti);
/* test function for CI to trigger reestablishments */
void nr_rlc_test_trigger_reestablishment(int rnti);
int nr_rlc_get_available_tx_space( int nr_rlc_get_available_tx_space(
const rnti_t rntiP, const rnti_t rntiP,
const logical_chan_id_t channel_idP); const logical_chan_id_t channel_idP);
......
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