diff options
author | Harald Welte <laforge@osmocom.org> | 2020-11-24 19:05:22 +0100 |
---|---|---|
committer | Harald Welte <laforge@osmocom.org> | 2020-11-25 17:14:25 +0100 |
commit | 3807ed12860fa18e5be4c244d75676ab6c836f1b (patch) | |
tree | e5e1808a155ee5bd5c7283e4deece7959bfabcdc | |
parent | 57de220cdbbc0c9b64e6bada64b388c5fb55fab4 (diff) |
gbproxy: Port TC_{suspend,resume} to new GLOBAL port
With the previous commit, we change the processing of the SUSPEND/RESUME
related PDUs and handle them now via a new per-NSE "GLOBAL" port.
Change-Id: I805372f3024a0ec2491a24422e02c0bc6dc669d2
-rw-r--r-- | gbproxy/GBProxy_Tests.ttcn | 134 |
1 files changed, 96 insertions, 38 deletions
diff --git a/gbproxy/GBProxy_Tests.ttcn b/gbproxy/GBProxy_Tests.ttcn index 4f0f8b6a..0bafaa07 100644 --- a/gbproxy/GBProxy_Tests.ttcn +++ b/gbproxy/GBProxy_Tests.ttcn @@ -605,6 +605,72 @@ friend function f_sgsn2pcu(template (value) PDU_BSSGP tx, template (present) PDU } } +/*********************************************************************** + * GlobaLTest_CT: Using the per-NSE GLOBAL ports on PCU + SGSN side + ***********************************************************************/ + +type component GlobalTest_CT extends test_CT { + port BSSGP_PT G_PCU[NUM_PCU]; + port BSSGP_PT G_SGSN[NUM_SGSN]; +}; + +private function f_global_init() runs on GlobalTest_CT { + var integer i; + for (i := 0; i < lengthof(g_sgsn); i := i+1) { + connect(self:G_SGSN[i], g_sgsn[i].vc_BSSGP:GLOBAL); + } + for (i := 0; i < lengthof(g_pcu); i := i+1) { + connect(self:G_PCU[i], g_pcu[i].vc_BSSGP:GLOBAL); + } +} + +/* Send 'tx' on PTP-BVCI from PCU; expect 'rx' on SGSN */ +friend function f_global_pcu2sgsn(template (value) PDU_BSSGP tx, template (present) PDU_BSSGP exp_rx, + integer pcu_idx := 0, integer sgsn_idx := 0) runs on GlobalTest_CT { + var PDU_BSSGP rx; + timer T := 1.0; + + G_PCU[pcu_idx].send(tx); + T.start; + alt { + [] G_SGSN[sgsn_idx].receive(exp_rx) { + setverdict(pass); + } + [] G_SGSN[sgsn_idx].receive(PDU_BSSGP:?) -> value rx { + setverdict(fail, "Unexpected BSSGP on SGSN side: ", rx); + mtc.stop; + } + [] T.timeout { + setverdict(fail, "Timeout waiting for BSSGP on SGSN side: ", rx); + mtc.stop; + } + } +} + +/* Send 'tx' on PTP-BVCI from SGSN; expect 'rx' on PCU */ +friend function f_global_sgsn2pcu(template (value) PDU_BSSGP tx, template (present) PDU_BSSGP exp_rx, + integer sgsn_idx := 0, integer pcu_idx := 0) runs on GlobalTest_CT { + var PDU_BSSGP rx; + timer T := 1.0; + + G_SGSN[sgsn_idx].send(tx); + T.start; + alt { + [] G_PCU[pcu_idx].receive(exp_rx) { + setverdict(pass); + } + [] G_PCU[pcu_idx].receive(PDU_BSSGP:?) -> value rx { + setverdict(fail, "Unexpected BSSGP on PCU side: ", rx); + mtc.stop; + } + [] T.timeout { + setverdict(fail, "Timeout waiting for BSSGP on PCU side: ", rx); + mtc.stop; + } + } +} + + /* TODO: * Detach without Attach * SM procedures without attach / RAU @@ -812,83 +878,75 @@ testcase TC_radio_status() runs on test_CT f_cleanup(); } -private function f_TC_suspend(charstring id) runs on BSSGP_ConnHdlr { +private function f_TC_suspend() runs on GlobalTest_CT { var integer i; /* TODO: Generate RA ID for each ConnHdlr */ - var RoutingAreaIdentification ra_id := g_pars.pcu[0].cfg.bvc[0].cell_id.ra_id; + var RoutingAreaIdentification ra_id := g_pcu[0].cfg.bvc[0].cell_id.ra_id; for (i := 0; i < 10; i := i+1) { - - var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_SUSPEND(g_pars.tlli, ra_id); + var OCT4 tlli := f_gprs_tlli_random(); + var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_SUSPEND(tlli, ra_id); /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ - var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_SUSPEND(g_pars.tlli, ra_id); + var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_SUSPEND(tlli, ra_id); - f_pcu2sgsn(pdu_tx, pdu_rx); + f_global_pcu2sgsn(pdu_tx, pdu_rx); - pdu_tx := ts_BSSGP_SUSPEND_ACK(g_pars.tlli, ra_id, int2oct(i, 1)); + pdu_tx := ts_BSSGP_SUSPEND_ACK(tlli, ra_id, int2oct(i, 1)); /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ - pdu_rx := tr_BSSGP_SUSPEND_ACK(g_pars.tlli, ra_id, int2oct(i, 1)); + pdu_rx := tr_BSSGP_SUSPEND_ACK(tlli, ra_id, int2oct(i, 1)); - f_sgsn2pcu(pdu_tx, pdu_rx); + f_global_sgsn2pcu(pdu_tx, pdu_rx); /* These messages are simple passed through so just also test sending NACK */ - pdu_tx := ts_BSSGP_SUSPEND_NACK(g_pars.tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS); + pdu_tx := ts_BSSGP_SUSPEND_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS); /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ - pdu_rx := tr_BSSGP_SUSPEND_NACK(g_pars.tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS); + pdu_rx := tr_BSSGP_SUSPEND_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS); - f_sgsn2pcu(pdu_tx, pdu_rx); + f_global_sgsn2pcu(pdu_tx, pdu_rx); } setverdict(pass); } -testcase TC_suspend() runs on test_CT +testcase TC_suspend() runs on GlobalTest_CT { - var BSSGP_ConnHdlr vc_conn; f_init(); - - vc_conn := f_start_handler(refers(f_TC_suspend), testcasename(), g_pcu, g_sgsn, 6); - vc_conn.done; - /* TODO: start multiple handlers (UEs) on various cells on same and other NSEs */ - + f_global_init(); + f_TC_suspend(); f_cleanup(); } -private function f_TC_resume(charstring id) runs on BSSGP_ConnHdlr { +private function f_TC_resume() runs on GlobalTest_CT { var integer i; /* TODO: Generate RA ID for each ConnHdlr */ - var RoutingAreaIdentification ra_id := g_pars.pcu[0].cfg.bvc[0].cell_id.ra_id; + var RoutingAreaIdentification ra_id := g_pcu[0].cfg.bvc[0].cell_id.ra_id; for (i := 0; i < 10; i := i+1) { - - var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_RESUME(g_pars.tlli, ra_id, int2oct(i, 1)); + var OCT4 tlli := f_gprs_tlli_random(); + var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_RESUME(tlli, ra_id, int2oct(i, 1)); /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ - var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_RESUME(g_pars.tlli, ra_id, int2oct(i, 1)); + var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_RESUME(tlli, ra_id, int2oct(i, 1)); - f_pcu2sgsn(pdu_tx, pdu_rx); + f_global_pcu2sgsn(pdu_tx, pdu_rx); - pdu_tx := ts_BSSGP_RESUME_ACK(g_pars.tlli, ra_id); + pdu_tx := ts_BSSGP_RESUME_ACK(tlli, ra_id); /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ - pdu_rx := tr_BSSGP_RESUME_ACK(g_pars.tlli, ra_id); + pdu_rx := tr_BSSGP_RESUME_ACK(tlli, ra_id); - f_sgsn2pcu(pdu_tx, pdu_rx); + f_global_sgsn2pcu(pdu_tx, pdu_rx); /* These messages are simple passed through so just also test sending NACK */ - pdu_tx := ts_BSSGP_RESUME_NACK(g_pars.tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS); + pdu_tx := ts_BSSGP_RESUME_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS); /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */ - pdu_rx := tr_BSSGP_RESUME_NACK(g_pars.tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS); + pdu_rx := tr_BSSGP_RESUME_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS); - f_sgsn2pcu(pdu_tx, pdu_rx); + f_global_sgsn2pcu(pdu_tx, pdu_rx); } setverdict(pass); } -testcase TC_resume() runs on test_CT +testcase TC_resume() runs on GlobalTest_CT { - var BSSGP_ConnHdlr vc_conn; f_init(); - - vc_conn := f_start_handler(refers(f_TC_resume), testcasename(), g_pcu, g_sgsn, 6); - vc_conn.done; - /* TODO: start multiple handlers (UEs) on various cells on same and other NSEs */ - + f_global_init(); + f_TC_resume(); f_cleanup(); } |