sgsn: replace variable gb_idx with ran_index
Since gb_idx also been used for Iu connection,
rename the variable to ran_index.
Be consistent and use the same variable name everywhere.
Change-Id: Ia119feee6a442c76dc337e75c07f4a385cd5e1df
diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index 084f167..10e98a8 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -486,11 +486,11 @@
f_cleanup();
}
-friend function is_gb(integer gb_idx) return boolean {
- return gb_idx < NUM_GB;
+friend function is_gb(integer ran_index) return boolean {
+ return ran_index < NUM_GB;
}
-friend function is_iu(integer gb_idx) return boolean {
- return gb_idx >= NUM_GB;
+friend function is_iu(integer ran_index) return boolean {
+ return ran_index >= NUM_GB;
}
function f_send_llc(template (value) PDU_LLC llc_pdu, integer ran_index := 0) runs on BSSGP_ConnHdlr {
@@ -552,38 +552,38 @@
}
}
-altstep as_mm_identity(integer gb_idx := 0) runs on BSSGP_ConnHdlr {
+altstep as_mm_identity(integer ran_index := 0) runs on BSSGP_ConnHdlr {
var MobileL3_CommonIE_Types.MobileIdentityLV mi;
- [is_gb(gb_idx)] BSSGP[gb_idx].receive(tr_GMM_ID_REQ('001'B)) {
+ [is_gb(ran_index)] BSSGP[ran_index].receive(tr_GMM_ID_REQ('001'B)) {
mi := valueof(ts_MI_IMSI_LV(g_pars.imsi));
- f_send_l3(ts_GMM_ID_RESP(mi), gb_idx);
+ f_send_l3(ts_GMM_ID_RESP(mi), ran_index);
repeat;
}
- [is_iu(gb_idx)] BSSAP.receive(tr_PDU_DTAP_PS_MT(tr_GMM_ID_REQ('001'B))) {
+ [is_iu(ran_index)] BSSAP.receive(tr_PDU_DTAP_PS_MT(tr_GMM_ID_REQ('001'B))) {
mi := valueof(ts_MI_IMSI_LV(g_pars.imsi));
- f_send_l3(ts_GMM_ID_RESP(mi), gb_idx);
+ f_send_l3(ts_GMM_ID_RESP(mi), ran_index);
repeat;
}
- [is_gb(gb_idx)] BSSGP[gb_idx].receive(tr_GMM_ID_REQ('010'B)) {
+ [is_gb(ran_index)] BSSGP[ran_index].receive(tr_GMM_ID_REQ('010'B)) {
mi := valueof(ts_MI_IMEI_LV(g_pars.imei));
- f_send_l3(ts_GMM_ID_RESP(mi), gb_idx);
+ f_send_l3(ts_GMM_ID_RESP(mi), ran_index);
repeat;
}
- [is_iu(gb_idx)] BSSAP.receive(tr_PDU_DTAP_PS_MT(tr_GMM_ID_REQ('010'B))) {
+ [is_iu(ran_index)] BSSAP.receive(tr_PDU_DTAP_PS_MT(tr_GMM_ID_REQ('010'B))) {
mi := valueof(ts_MI_IMEI_LV(g_pars.imei));
- f_send_l3(ts_GMM_ID_RESP(mi), gb_idx);
+ f_send_l3(ts_GMM_ID_RESP(mi), ran_index);
repeat;
}
}
/* receive a L3 (GMM/SM) message over whatever is the appropriate lower-layer bearer */
-function f_receive_l3(template PDU_L3_SGSN_MS rx_tpl := ?, integer gb_idx := 0)
+function f_receive_l3(template PDU_L3_SGSN_MS rx_tpl := ?, integer ran_index := 0)
runs on BSSGP_ConnHdlr return PDU_L3_SGSN_MS {
var PDU_DTAP_PS_MT mt;
var PDU_L3_SGSN_MS l3_mt;
alt {
- [is_gb(gb_idx)] BSSGP[gb_idx].receive(rx_tpl) -> value l3_mt { }
- [is_iu(gb_idx)] BSSAP.receive(tr_PDU_DTAP_PS_MT(rx_tpl)) -> value mt {
+ [is_gb(ran_index)] BSSGP[ran_index].receive(rx_tpl) -> value l3_mt { }
+ [is_iu(ran_index)] BSSAP.receive(tr_PDU_DTAP_PS_MT(rx_tpl)) -> value mt {
l3_mt := mt.dtap;
}
}
@@ -593,10 +593,10 @@
/* perform GMM authentication (if expected).
* Note, for umts_aka_challenge to work, the revisionLevelIndicatior needs to
* be 1 to mark R99 capability, in the GMM Attach Request, see f_gmm_attach(). */
-function f_gmm_auth (boolean umts_aka_challenge := false, boolean force_gsm_sres := false, integer gb_idx := 0) runs on BSSGP_ConnHdlr {
+function f_gmm_auth (boolean umts_aka_challenge := false, boolean force_gsm_sres := false, integer ran_index := 0) runs on BSSGP_ConnHdlr {
var PDU_L3_MS_SGSN l3_mo;
var PDU_L3_SGSN_MS l3_mt;
- var default di := activate(as_mm_identity(gb_idx));
+ var default di := activate(as_mm_identity(ran_index));
if (g_pars.net.expect_auth) {
var GSUP_IE auth_tuple;
var template AuthenticationParameterAUTNTLV autn;
@@ -631,7 +631,7 @@
var template PDU_L3_SGSN_MS auth_ciph_req := tr_GMM_AUTH_REQ(g_pars.vec.rand);
auth_ciph_req.msgs.gprs_mm.authenticationAndCipheringRequest.authenticationParameterAUTN := autn;
- l3_mt := f_receive_l3(auth_ciph_req, gb_idx);
+ l3_mt := f_receive_l3(auth_ciph_req, ran_index);
var BIT4 ac_ref := l3_mt.msgs.gprs_mm.authenticationAndCipheringRequest.acReferenceNumber.valueField;
var template PDU_L3_MS_SGSN auth_ciph_resp := ts_GMM_AUTH_RESP_2G(ac_ref, g_pars.vec.sres);
@@ -653,10 +653,10 @@
l3_mo.msgs.gprs_mm.authenticationAndCipheringResponse.imeisv :=
valueof(ts_MI_IMEISV_TLV(g_pars.imei & '0'H));
}
- f_send_l3(l3_mo, gb_idx);
+ f_send_l3(l3_mo, ran_index);
/* Security Mode Command + Complete on Iu case */
- if (is_iu(gb_idx)) {
+ if (is_iu(ran_index)) {
BSSAP.receive(tr_RANAP_SecurityModeCmd(uia_algs := ?, uia_key := oct2bit(g_pars.vec.ik),
key_sts := ?)) {
var IntegrityProtectionAlgorithm uia_chosen := 0; /* 0 = standard_UMTS_integrity_algorithm_UIA1 */
@@ -756,7 +756,7 @@
GSUP.send(ts_GSUP_UL_RES(g_pars.imsi));
}
-friend function f_gmm_attach(boolean umts_aka_challenge, boolean force_gsm_sres, integer gb_idx := 0) runs on BSSGP_ConnHdlr {
+friend function f_gmm_attach(boolean umts_aka_challenge, boolean force_gsm_sres, integer ran_index := 0) runs on BSSGP_ConnHdlr {
var RoutingAreaIdentificationV old_ra := f_random_RAI();
var template PDU_L3_MS_SGSN attach_req := ts_GMM_ATTACH_REQ(f_mi_get_lv(), old_ra, false, false, omit, omit);
var PDU_L3_SGSN_MS l3_mt;
@@ -768,19 +768,19 @@
* revisionLevelIndicatior is at the wrong place! */
attach_req.msgs.gprs_mm.attachRequest.msNetworkCapability.msNetworkCapabilityV.solSACapability := '0'B;
- f_send_l3(attach_req, gb_idx);
- f_gmm_auth(umts_aka_challenge, force_gsm_sres, gb_idx);
+ f_send_l3(attach_req, ran_index);
+ f_gmm_auth(umts_aka_challenge, force_gsm_sres, ran_index);
/* Expect SGSN to perform LU with HLR */
f_gmm_gsup_lu_isd();
- l3_mt := f_receive_l3(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?), gb_idx);
+ l3_mt := f_receive_l3(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?), ran_index);
f_process_attach_accept(l3_mt.msgs.gprs_mm.attachAccept);
/* FIXME: Extract P-TMSI, if any. Only send Complete if necessary */
- f_send_l3(ts_GMM_ATTACH_COMPL, gb_idx);
+ f_send_l3(ts_GMM_ATTACH_COMPL, ran_index);
/* IuPS case: Expect Iu Release */
- if (is_iu(gb_idx)) {
+ if (is_iu(ran_index)) {
as_iu_release_compl_disc();
}
}
@@ -1227,7 +1227,7 @@
f_gtp_register_teid(apars.ggsn_tei_u);
}
-function f_pdp_ctx_act(inout PdpActPars apars, boolean send_recovery := false, integer gb_idx := 0)
+function f_pdp_ctx_act(inout PdpActPars apars, boolean send_recovery := false, integer ran_index := 0)
runs on BSSGP_ConnHdlr {
var boolean exp_rej := ispresent(apars.exp_rej_cause);
var Gtp1cUnitdata g_ud;
@@ -1238,7 +1238,7 @@
}
f_send_l3(ts_SM_ACT_PDP_REQ(apars.tid, apars.nsapi, apars.sapi, apars.qos, apars.addr,
- apars.apn, apars.pco), gb_idx);
+ apars.apn, apars.pco), ran_index);
GTP.receive(tr_GTPC_MsgType(?, createPDPContextRequest, ?)) -> value g_ud {
f_process_gtp_ctx_act_req(apars, g_ud.gtpc);
var integer seq_nr := oct2int(g_ud.gtpc.opt_part.sequenceNumber);
@@ -1250,54 +1250,54 @@
omit, recovery));
}
alt {
- [exp_rej] BSSGP[gb_idx].receive(tr_SM_ACT_PDP_REJ(apars.tid, apars.exp_rej_cause)) {
+ [exp_rej] BSSGP[ran_index].receive(tr_SM_ACT_PDP_REJ(apars.tid, apars.exp_rej_cause)) {
setverdict(pass);
}
- [exp_rej] BSSGP[gb_idx].receive(tr_SM_ACT_PDP_ACCEPT) {
+ [exp_rej] BSSGP[ran_index].receive(tr_SM_ACT_PDP_ACCEPT) {
setverdict(fail, "Unexpected PDP CTX ACT ACC");
mtc.stop;
}
- [not exp_rej] BSSGP[gb_idx].receive(tr_SM_ACT_PDP_REJ(apars.tid, ?)) {
+ [not exp_rej] BSSGP[ran_index].receive(tr_SM_ACT_PDP_REJ(apars.tid, ?)) {
setverdict(fail, "Unexpected PDP CTX ACT FAIL");
mtc.stop;
}
- [not exp_rej] BSSGP[gb_idx].receive(tr_SM_ACT_PDP_REJ(apars.tid, ?)) {
+ [not exp_rej] BSSGP[ran_index].receive(tr_SM_ACT_PDP_REJ(apars.tid, ?)) {
setverdict(fail, "Unexpected PDP CTX ACT FAIL");
mtc.stop;
}
- [not exp_rej] BSSGP[gb_idx].receive(tr_SM_ACT_PDP_ACCEPT(apars.tid, apars.sapi)) {
+ [not exp_rej] BSSGP[ran_index].receive(tr_SM_ACT_PDP_ACCEPT(apars.tid, apars.sapi)) {
setverdict(pass);
}
- [] as_xid(apars, gb_idx);
+ [] as_xid(apars, ran_index);
}
}
-function f_pdp_ctx_deact_mo(inout PdpActPars apars, OCT1 cause, integer gb_idx := 0)
+function f_pdp_ctx_deact_mo(inout PdpActPars apars, OCT1 cause, integer ran_index := 0)
runs on BSSGP_ConnHdlr {
var boolean exp_rej := ispresent(apars.exp_rej_cause);
var Gtp1cUnitdata g_ud;
- f_send_l3(ts_SM_DEACT_PDP_REQ_MO(apars.tid, cause, false, omit), gb_idx);
+ f_send_l3(ts_SM_DEACT_PDP_REQ_MO(apars.tid, cause, false, omit), ran_index);
GTP.receive(tr_GTPC_MsgType(?, deletePDPContextRequest, apars.ggsn_tei_c)) -> value g_ud {
var integer seq_nr := oct2int(g_ud.gtpc.opt_part.sequenceNumber);
- BSSGP[gb_idx].clear;
+ BSSGP[ran_index].clear;
GTP.send(ts_GTPC_DeletePdpResp(g_ud.peer, seq_nr, apars.sgsn_tei_c, '7F'O));
}
alt {
- [] BSSGP[gb_idx].receive(tr_SM_DEACT_PDP_ACCEPT_MT(apars.tid)) {
+ [] BSSGP[ran_index].receive(tr_SM_DEACT_PDP_ACCEPT_MT(apars.tid)) {
setverdict(pass);
}
- [] as_xid(apars, gb_idx);
+ [] as_xid(apars, ran_index);
}
}
-function f_pdp_ctx_deact_mt(inout PdpActPars apars, boolean error_ind := false, integer gb_idx := 0)
+function f_pdp_ctx_deact_mt(inout PdpActPars apars, boolean error_ind := false, integer ran_index := 0)
runs on BSSGP_ConnHdlr {
var Gtp1cUnitdata g_ud;
var integer seq_nr := 23;
var GtpPeer peer := valueof(ts_GtpPeerC(apars.sgsn_ip_c));
- BSSGP[gb_idx].clear;
+ BSSGP[ran_index].clear;
if (error_ind) {
GTP.send(ts_GTPU_ErrorIndication(peer, 0 /* seq */, apars.ggsn_tei_u, apars.ggsn_ip_u));
} else {
@@ -1308,8 +1308,8 @@
T.start;
alt {
- [] BSSGP[gb_idx].receive(tr_SM_DEACT_PDP_REQ_MT(apars.tid, ?, true)) {
- f_send_l3(ts_SM_DEACT_PDP_ACCEPT_MO(apars.tid), gb_idx);
+ [] BSSGP[ran_index].receive(tr_SM_DEACT_PDP_REQ_MT(apars.tid, ?, true)) {
+ f_send_l3(ts_SM_DEACT_PDP_ACCEPT_MO(apars.tid), ran_index);
}
[not error_ind] GTP.receive(tr_GTPC_MsgType(?, deletePDPContextResponse, apars.ggsn_tei_c)) {
repeat;
@@ -1412,8 +1412,8 @@
GTP.send(ts_GTP1U_GPDU(peer, 0 /*seq*/, apars.sgsn_tei_u, payload));
}
-private altstep as_xid(PdpActPars apars, integer gb_idx := 0) runs on BSSGP_ConnHdlr {
- [] BSSGP[gb_idx].receive(tr_LLC_XID_MT_CMD(?, apars.sapi)) {
+private altstep as_xid(PdpActPars apars, integer ran_index := 0) runs on BSSGP_ConnHdlr {
+ [] BSSGP[ran_index].receive(tr_LLC_XID_MT_CMD(?, apars.sapi)) {
repeat;
}
}
@@ -1452,25 +1452,25 @@
}
/* Transceive given 'payload' as MT message from GTP -> OsmoSGSN -> Gb */
-private function f_gtpu_xceive_mt(inout PdpActPars apars, octetstring payload, integer gb_idx := 0)
+private function f_gtpu_xceive_mt(inout PdpActPars apars, octetstring payload, integer ran_index := 0)
runs on BSSGP_ConnHdlr {
/* Send PDU via GTP from our simulated GGSN to the SGSN */
f_gtpu_send(apars, payload);
/* Expect PDU via BSSGP/LLC on simulated PCU from SGSN */
alt {
- [] as_xid(apars, gb_idx);
- //[] BSSGP[gb_idx].receive(tr_BD_SNDCP(apars.sapi, tr_SN_UD(apars.nsapi, payload)));
- [] BSSGP[gb_idx].receive(tr_SN_UD(apars.nsapi, payload));
+ [] as_xid(apars, ran_index);
+ //[] BSSGP[ran_index].receive(tr_BD_SNDCP(apars.sapi, tr_SN_UD(apars.nsapi, payload)));
+ [] BSSGP[ran_index].receive(tr_SN_UD(apars.nsapi, payload));
}
}
/* Transceive given 'payload' as MT message from Gb -> OsmoSGSN -> GTP */
-private function f_gtpu_xceive_mo(inout PdpActPars apars, octetstring payload, integer gb_idx := 0)
+private function f_gtpu_xceive_mo(inout PdpActPars apars, octetstring payload, integer ran_index := 0)
runs on BSSGP_ConnHdlr {
/* Send PDU via SNDCP/LLC/BSSGP/NS via simulated MS/PCU to the SGSN */
var GtpPeer peer := valueof(ts_GtpPeerU(apars.sgsn_ip_u));
var PDU_SN sndcp := valueof(ts_SN_UD(apars.nsapi, payload));
- BSSGP[gb_idx].send(ts_LLC_UI(enc_PDU_SN(sndcp), apars.sapi, '0'B, 0));
+ BSSGP[ran_index].send(ts_LLC_UI(enc_PDU_SN(sndcp), apars.sapi, '0'B, 0));
/* Expect PDU via GTP from SGSN on simulated GGSN */
alt {
[] GTP.receive(tr_GTPU_GPDU(peer, apars.ggsn_tei_u, payload));