gbproxy: Add tests for RADIO-STATUS with TMSI and IMSI instead of TLLI

Change-Id: Ib3b052a12227a8f55cf063e5168b56f97b9a8f9b
Related: OS#4954
Related: OS#4951
This commit is contained in:
Harald Welte 2021-01-17 11:15:28 +01:00
parent 112bc1469a
commit 3148a9618f
1 changed files with 79 additions and 0 deletions

View File

@ -784,6 +784,44 @@ friend function f_pcu2sgsn(template (value) PDU_BSSGP tx, template (present) PDU
}
}
/* Send 'tx' from PCU; expect 'exp_rx' on _any_ SGSN */
friend function f_pcu2any_sgsn(template (value) PDU_BSSGP tx, template (present) PDU_BSSGP exp_rx,
integer pcu_idx := 0, boolean use_sig := false)
runs on BSSGP_ConnHdlr return integer {
var integer rx_idx := -1;
var PDU_BSSGP rx;
timer T := 1.0;
if (use_sig) {
PCU_SIG[pcu_idx].send(tx);
} else {
PCU_PTP[pcu_idx].send(tx);
}
T.start;
alt {
[use_sig] any from SGSN_SIG.receive(exp_rx) -> @index value rx_idx {
setverdict(pass);
}
[not use_sig] any from SGSN_PTP.receive(exp_rx) -> @index value rx_idx {
setverdict(pass);
}
[] any from SGSN_PTP.receive(PDU_BSSGP:?) -> value rx @index value rx_idx {
setverdict(fail, "Unexpected BSSGP on SGSN[", rx_idx, "] side: ", rx);
mtc.stop;
}
[] any from SGSN_SIG.receive(PDU_BSSGP:?) -> value rx @index value rx_idx {
setverdict(fail, "Unexpected SIG BSSGP on SGSN[", rx_idx, "] side: ", rx);
mtc.stop;
}
[] T.timeout {
setverdict(fail, "Timeout waiting for BSSGP on SGSN side: ", exp_rx);
mtc.stop;
}
}
return rx_idx;
}
/* Send 'tx' on PTP-BVCI from SGSN; expect 'rx' on PCU */
friend function f_sgsn2pcu(template (value) PDU_BSSGP tx, template (present) PDU_BSSGP exp_rx,
integer pcu_idx := 0, boolean use_sig := false) runs on BSSGP_ConnHdlr {
@ -1087,6 +1125,45 @@ testcase TC_radio_status() runs on test_CT
f_cleanup();
}
private function f_TC_radio_status_tmsi(charstring id) runs on BSSGP_ConnHdlr {
var integer i;
var BssgpRadioCause cause := BSSGP_RADIO_CAUSE_CONTACT_LOST;
for (i := 0; i < 10; i := i+1) {
var integer tmsi_int := oct2int(g_pars.p_tmsi);
var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_RADIO_STATUS(omit, cause, tmsi_int);
/* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_RADIO_STATUS(omit, cause, tmsi_int);
f_pcu2sgsn(pdu_tx, pdu_rx);
}
setverdict(pass);
}
testcase TC_radio_status_tmsi() runs on test_CT
{
f_init();
f_start_handlers(refers(f_TC_radio_status_tmsi), testcasename(), 5);
f_cleanup();
}
private function f_TC_radio_status_imsi(charstring id) runs on BSSGP_ConnHdlr {
var integer i;
var BssgpRadioCause cause := BSSGP_RADIO_CAUSE_CONTACT_LOST;
for (i := 0; i < 10; i := i+1) {
var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_RADIO_STATUS(omit, cause, imsi := g_pars.imsi);
/* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_RADIO_STATUS(omit, cause, imsi := g_pars.imsi);
f_pcu2any_sgsn(pdu_tx, pdu_rx);
}
setverdict(pass);
}
testcase TC_radio_status_imsi() runs on test_CT
{
f_init();
f_start_handlers(refers(f_TC_radio_status_imsi), testcasename(), 5);
f_cleanup();
}
private function f_suspend_one(integer sgsn_idx, integer nri_idx, integer pcu_idx, integer bvc_idx,
integer suffix)
runs on GlobalTest_CT
@ -2909,6 +2986,8 @@ control {
execute( TC_ra_capability() );
execute( TC_ra_capability_upd() );
execute( TC_radio_status() );
execute( TC_radio_status_tmsi() );
execute( TC_radio_status_imsi() );
execute( TC_suspend() );
execute( TC_resume() );
execute( TC_trace() );