gbproxy: Generalize pcu2sgsn / sgsn2pcu transmission
This reduces code duplication between ConnHdlr test functions Change-Id: Ic13fa745178ffddf8e35fc5203ad8d824e8f338c
This commit is contained in:
parent
6dc2ac471b
commit
22ef5d92d9
|
@ -496,6 +496,51 @@ runs on BSSGP_ConnHdlr {
|
|||
}
|
||||
}
|
||||
|
||||
/* Send 'tx' on PTP-BVCI from PCU; expect 'rx' on SGSN */
|
||||
friend function f_pcu2sgsn(template (value) PDU_BSSGP tx, template (present) PDU_BSSGP exp_rx,
|
||||
integer pcu_idx := 0, integer sgsn_idx := 0) runs on BSSGP_ConnHdlr {
|
||||
var PDU_BSSGP rx;
|
||||
timer T := 1.0;
|
||||
|
||||
PCU[pcu_idx].send(tx);
|
||||
T.start;
|
||||
alt {
|
||||
[] SGSN[sgsn_idx].receive(exp_rx) {
|
||||
setverdict(pass);
|
||||
}
|
||||
[] 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_sgsn2pcu(template (value) PDU_BSSGP tx, template (present) PDU_BSSGP exp_rx,
|
||||
integer sgsn_idx:= 0, integer pcu_idx := 0) runs on BSSGP_ConnHdlr {
|
||||
var PDU_BSSGP rx;
|
||||
timer T := 1.0;
|
||||
|
||||
SGSN[sgsn_idx].send(tx);
|
||||
T.start;
|
||||
alt {
|
||||
[] PCU[pcu_idx].receive(exp_rx) {
|
||||
setverdict(pass);
|
||||
}
|
||||
[] 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
|
||||
|
@ -576,16 +621,7 @@ private function f_TC_ul_unitdata(charstring id) runs on BSSGP_ConnHdlr {
|
|||
/* 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, g_pars.bssgp_cell_id[0], payload);
|
||||
|
||||
PCU[0].send(pdu_tx);
|
||||
alt {
|
||||
[] SGSN[0].receive(pdu_rx);
|
||||
/* FIXME: Those should be handled before the ConnHdlr is started */
|
||||
[] SGSN[0].receive(BssgpStatusIndication:{*,?,BVC_S_UNBLOCKED}) { repeat; }
|
||||
[] SGSN[0].receive {
|
||||
setverdict(fail, "SGSN Received unexpected");
|
||||
mtc.stop;
|
||||
}
|
||||
}
|
||||
f_pcu2sgsn(pdu_tx, pdu_rx);
|
||||
}
|
||||
setverdict(pass);
|
||||
}
|
||||
|
@ -614,16 +650,7 @@ private function f_TC_dl_unitdata(charstring id) runs on BSSGP_ConnHdlr {
|
|||
var template (present) PDU_BSSGP pdu_rx :=
|
||||
tr_BSSGP_DL_UD(g_pars.tlli, payload, tr_BSSGP_IMSI(g_pars.imsi));
|
||||
|
||||
SGSN[0].send(pdu_tx);
|
||||
alt {
|
||||
[] PCU[0].receive(pdu_rx);
|
||||
/* FIXME: Those should be handled before the ConnHdlr is started */
|
||||
[] PCU[0].receive(BssgpStatusIndication:{*,?,BVC_S_UNBLOCKED}) { repeat; }
|
||||
[] PCU[0].receive {
|
||||
setverdict(fail, "PCU Received unexpected");
|
||||
mtc.stop;
|
||||
}
|
||||
}
|
||||
f_sgsn2pcu(pdu_tx, pdu_rx);
|
||||
}
|
||||
setverdict(pass);
|
||||
}
|
||||
|
@ -648,14 +675,7 @@ private function f_TC_ra_capability(charstring id) runs on BSSGP_ConnHdlr {
|
|||
/* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
|
||||
var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_RA_CAP(g_pars.tlli, { tr_RaCapRec_BSSGP })
|
||||
|
||||
SGSN[0].send(pdu_tx);
|
||||
alt {
|
||||
[] PCU[0].receive(pdu_rx);
|
||||
[] PCU[0].receive {
|
||||
setverdict(fail, "SGSN Received unexpected");
|
||||
mtc.stop;
|
||||
}
|
||||
}
|
||||
f_sgsn2pcu(pdu_tx, pdu_rx);
|
||||
}
|
||||
setverdict(pass);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue