From 8d9fcf44617c3cedb7bda74bc2a2b10c8d5297ea Mon Sep 17 00:00:00 2001 From: Daniel Willmann Date: Fri, 28 May 2021 15:05:41 +0200 Subject: [PATCH] gbproxy: Test routing if an SGSN in a pool is down If an SGSN in a pool is down we expect the messages to instead be sent to a different SGSN in the pool. That SGSN will not necessarily know what to do with those messages, but it should )implicitly) detach that UE so that it can reattach at the new SGSN. Otherwise UEs on a failed SGSN would simply stop working as the messages would never be forwarded anywhere. This test also adjusts the NS timers so the failed NSVCs are detected faster. Change-Id: I46a6b8082441843f428a7681566228e5de375bcb Related: OS#4952 --- gbproxy/GBProxy_Tests.ttcn | 50 ++++++++++++++++++++++++++++++++++++++ gbproxy/osmo-gbproxy.cfg | 6 ++--- 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/gbproxy/GBProxy_Tests.ttcn b/gbproxy/GBProxy_Tests.ttcn index c496ca8ac..dd33106cd 100644 --- a/gbproxy/GBProxy_Tests.ttcn +++ b/gbproxy/GBProxy_Tests.ttcn @@ -337,6 +337,8 @@ type component test_CT extends CTRL_Adapter_CT { var GbInstances g_pcu; var GbInstances g_sgsn; + port NS_CTRL_PT NS_CTRL; + port BSSGP_CT_PROC_PT PROC; port BSSGP_BVC_MGMT_PT SGSN_MGMT; @@ -1130,6 +1132,53 @@ testcase TC_ul_unitdata() runs on test_CT f_cleanup(); } + +/* send uplink-unitdata of a variety of different sizes; expect it to show up on the only connected SGSN */ +private function f_TC_ul_unitdata_pool_failure(charstring id) runs on BSSGP_ConnHdlr { + var integer ran_idx := 0; + var BssgpBvcConfig bvcc := g_pars.pcu[ran_idx].cfg.bvc[0]; + var integer i; + + /* All data should arrive at the one SGSN that is still up */ + g_pars.sgsn_idx := 0; + + for (i := 0; i < max_fr_info_size-4; i := i+4) { + var octetstring payload := f_rnd_octstring(i); + var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_UL_UD(g_pars.tlli, bvcc.cell_id, payload); + /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ + var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_UL_UD(g_pars.tlli, bvcc.cell_id, payload); + + log("UL-UNITDATA(payload_size=", i); + f_pcu2sgsn(pdu_tx, pdu_rx); + } + setverdict(pass); +} + +testcase TC_ul_unitdata_pool_failure() runs on test_CT +{ + var integer i; + var integer j; + + f_init(60.0); + + for (i := 1; i < lengthof(mp_nsconfig_sgsn); i := i+1) { + connect(self:NS_CTRL, g_sgsn[i].vc_NS:NS_CTRL); + for (j := 0; j < lengthof(mp_nsconfig_sgsn[i].nsvc); j := j+1) { + var uint16_t nsvci := mp_nsconfig_sgsn[i].nsvc[j].nsvci; + var NsDisableVcRequest tx_disar; + tx_disar.nsvci := nsvci; + NS_CTRL.send(tx_disar); + } + disconnect(self:NS_CTRL, g_sgsn[i].vc_NS:NS_CTRL); + } + /* Wait until gbproxy notices that the NSVCs are down */ + f_sleep(15.0); + + f_start_handlers(refers(f_TC_ul_unitdata_pool_failure), testcasename(), 1); + /* TODO: start multiple handlers (UEs) on various cells on same and other NSEs */ + f_cleanup(); +} + /* send downlink-unitdata of a variety of different sizes; expect it to show up on PCU */ private function f_TC_dl_unitdata(charstring id) runs on BSSGP_ConnHdlr { var integer i; @@ -3461,6 +3510,7 @@ testcase TC_status_ptp_dl_bvci() runs on GlobalTest_CT control { execute( TC_BVC_bringup() ); execute( TC_ul_unitdata() ); + execute( TC_ul_unitdata_pool_failure() ); execute( TC_dl_unitdata() ); execute( TC_ra_capability() ); execute( TC_ra_capability_upd() ); diff --git a/gbproxy/osmo-gbproxy.cfg b/gbproxy/osmo-gbproxy.cfg index dab4ef354..d26956705 100644 --- a/gbproxy/osmo-gbproxy.cfg +++ b/gbproxy/osmo-gbproxy.cfg @@ -42,6 +42,6 @@ ns timer tns-block-retries 3 timer tns-reset 3 timer tns-reset-retries 3 - timer tns-test 30 - timer tns-alive 3 - timer tns-alive-retries 10 + timer tns-test 5 + timer tns-alive 2 + timer tns-alive-retries 3