gbproxy: Refactor f_TC_{suspend,resume}
Move the entire body inside the loop to a separate function. This will be useful when adding pooling support next. Change-Id: Ia0f9d9128754c2196ab026623f1b6a254a958d2f
This commit is contained in:
parent
77218d0990
commit
009637505f
|
@ -1066,37 +1066,39 @@ testcase TC_radio_status() runs on test_CT
|
|||
f_cleanup();
|
||||
}
|
||||
|
||||
private function f_suspend_one(integer sgsn_idx, integer pcu_idx, integer bvc_idx, integer suffix)
|
||||
runs on GlobalTest_CT
|
||||
{
|
||||
var RoutingAreaIdentification ra_id := g_pcu[pcu_idx].cfg.bvc[bvc_idx].cell_id.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(tlli, ra_id);
|
||||
f_global_pcu2sgsn(pdu_tx, pdu_rx, pcu_idx, sgsn_idx);
|
||||
|
||||
pdu_tx := ts_BSSGP_SUSPEND_ACK(tlli, ra_id, int2oct(suffix, 1));
|
||||
/* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
|
||||
pdu_rx := tr_BSSGP_SUSPEND_ACK(tlli, ra_id, int2oct(suffix, 1));
|
||||
f_global_sgsn2pcu(pdu_tx, pdu_rx, sgsn_idx, pcu_idx);
|
||||
|
||||
pdu_tx := ts_BSSGP_SUSPEND(tlli, ra_id);
|
||||
/* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
|
||||
pdu_rx := tr_BSSGP_SUSPEND(tlli, ra_id);
|
||||
f_global_pcu2sgsn(pdu_tx, pdu_rx, pcu_idx, sgsn_idx);
|
||||
|
||||
/* These messages are simple passed through so just also test sending NACK */
|
||||
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(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);
|
||||
f_global_sgsn2pcu(pdu_tx, pdu_rx, sgsn_idx, pcu_idx);
|
||||
}
|
||||
|
||||
private function f_TC_suspend() runs on GlobalTest_CT {
|
||||
var integer i;
|
||||
|
||||
/* TODO: Generate RA ID for each ConnHdlr */
|
||||
var RoutingAreaIdentification ra_id := g_pcu[0].cfg.bvc[0].cell_id.ra_id;
|
||||
for (i := 0; i < 10; i := i+1) {
|
||||
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(tlli, ra_id);
|
||||
|
||||
f_global_pcu2sgsn(pdu_tx, pdu_rx);
|
||||
|
||||
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(tlli, ra_id, int2oct(i, 1));
|
||||
|
||||
f_global_sgsn2pcu(pdu_tx, pdu_rx);
|
||||
|
||||
pdu_tx := ts_BSSGP_SUSPEND(tlli, ra_id);
|
||||
/* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
|
||||
pdu_rx := tr_BSSGP_SUSPEND(tlli, ra_id);
|
||||
|
||||
f_global_pcu2sgsn(pdu_tx, pdu_rx);
|
||||
|
||||
/* These messages are simple passed through so just also test sending NACK */
|
||||
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(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);
|
||||
|
||||
f_global_sgsn2pcu(pdu_tx, pdu_rx);
|
||||
f_suspend_one(0, 0, 0, i);
|
||||
}
|
||||
setverdict(pass);
|
||||
}
|
||||
|
@ -1108,37 +1110,38 @@ testcase TC_suspend() runs on GlobalTest_CT
|
|||
f_cleanup();
|
||||
}
|
||||
|
||||
private function f_resume_one(integer sgsn_idx, integer pcu_idx, integer bvc_idx, integer suffix)
|
||||
runs on GlobalTest_CT
|
||||
{
|
||||
var RoutingAreaIdentification ra_id := g_pcu[pcu_idx].cfg.bvc[bvc_idx].cell_id.ra_id;
|
||||
var OCT4 tlli := f_gprs_tlli_random();
|
||||
var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_RESUME(tlli, ra_id, int2oct(suffix, 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(tlli, ra_id, int2oct(suffix, 1));
|
||||
f_global_pcu2sgsn(pdu_tx, pdu_rx, pcu_idx, sgsn_idx);
|
||||
|
||||
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(tlli, ra_id);
|
||||
f_global_sgsn2pcu(pdu_tx, pdu_rx, sgsn_idx, pcu_idx);
|
||||
|
||||
pdu_tx := ts_BSSGP_RESUME(tlli, ra_id, int2oct(suffix, 1));
|
||||
/* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
|
||||
pdu_rx := tr_BSSGP_RESUME(tlli, ra_id, int2oct(suffix, 1));
|
||||
f_global_pcu2sgsn(pdu_tx, pdu_rx, pcu_idx, sgsn_idx);
|
||||
|
||||
/* These messages are simple passed through so just also test sending NACK */
|
||||
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(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);
|
||||
f_global_sgsn2pcu(pdu_tx, pdu_rx, sgsn_idx, pcu_idx);
|
||||
}
|
||||
|
||||
private function f_TC_resume() runs on GlobalTest_CT {
|
||||
var integer i;
|
||||
|
||||
/* TODO: Generate RA ID for each ConnHdlr */
|
||||
var RoutingAreaIdentification ra_id := g_pcu[0].cfg.bvc[0].cell_id.ra_id;
|
||||
for (i := 0; i < 10; i := 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(tlli, ra_id, int2oct(i, 1));
|
||||
|
||||
f_global_pcu2sgsn(pdu_tx, pdu_rx);
|
||||
|
||||
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(tlli, ra_id);
|
||||
|
||||
f_global_sgsn2pcu(pdu_tx, pdu_rx);
|
||||
|
||||
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 :/ */
|
||||
pdu_rx := tr_BSSGP_RESUME(tlli, ra_id, int2oct(i, 1));
|
||||
|
||||
f_global_pcu2sgsn(pdu_tx, pdu_rx);
|
||||
|
||||
/* These messages are simple passed through so just also test sending NACK */
|
||||
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(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);
|
||||
|
||||
f_global_sgsn2pcu(pdu_tx, pdu_rx);
|
||||
f_resume_one(0, 0, 0, i);
|
||||
}
|
||||
setverdict(pass);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue