sgsn: add optional bssgp index for f_upd_ptmsi_and_tlli f_bssgp_client_llgmm_assign f_process_rau_accept

f_process_rau_accept can send the RAU Complete over the correct BSSGP

Change-Id: Ib9a65f0d09d3689911843a1b40e2a4114710e5b5
diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index 82c37f2..497e45f 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -461,12 +461,12 @@
 	deactivate(di);
 }
 
-function f_upd_ptmsi_and_tlli(OCT4 p_tmsi) runs on BSSGP_ConnHdlr {
+function f_upd_ptmsi_and_tlli(OCT4 p_tmsi, integer bssgp_index := 0) runs on BSSGP_ConnHdlr {
 	g_pars.p_tmsi := p_tmsi;
 	/* update TLLI */
 	g_pars.tlli_old := g_pars.tlli;
 	g_pars.tlli := g_pars.p_tmsi or4b 'c0000000'O;
-	f_bssgp_client_llgmm_assign(g_pars.tlli_old, g_pars.tlli);
+	f_bssgp_client_llgmm_assign(g_pars.tlli_old, g_pars.tlli, BSSGP_PROC[bssgp_index]);
 }
 
 function f_process_attach_accept(PDU_GMM_AttachAccept aa) runs on BSSGP_ConnHdlr {
@@ -498,7 +498,7 @@
 	/* T3302, T3319, T3323, T3312_ext, T3324 */
 }
 
-function f_process_rau_accept(PDU_GMM_RoutingAreaUpdateAccept ra) runs on BSSGP_ConnHdlr {
+function f_process_rau_accept(PDU_GMM_RoutingAreaUpdateAccept ra, integer bssgp_index := 0) runs on BSSGP_ConnHdlr {
 	/* mandatory IE */
 	g_pars.ra := ra.routingAreaId;
 	if (ispresent(ra.allocatedPTMSI)) {
@@ -506,7 +506,7 @@
 			setverdict(fail, "unexpected P-TMSI allocation");
 			mtc.stop;
 		}
-		f_upd_ptmsi_and_tlli(ra.allocatedPTMSI.mobileIdentityLV.mobileIdentityV.oddEvenInd_identity.tmsi_ptmsi.octets);
+		f_upd_ptmsi_and_tlli(ra.allocatedPTMSI.mobileIdentityLV.mobileIdentityV.oddEvenInd_identity.tmsi_ptmsi.octets, bssgp_index);
 	}
 	if (ispresent(ra.msIdentity)) {
 		setverdict(fail, "unexpected TMSI allocation in non-combined attach");
@@ -867,10 +867,10 @@
 }
 
 /* general GPRS DETACH helper */
-function f_detach_mo(BIT3 detach_type, boolean power_off, boolean expect_purge) runs on BSSGP_ConnHdlr {
+function f_detach_mo(BIT3 detach_type, boolean power_off, boolean expect_purge, integer bssgp_index := 0) runs on BSSGP_ConnHdlr {
 	var BssgpDecoded bd;
 	timer T := 5.0;
-	f_send_l3_gmm_llc(ts_GMM_DET_REQ_MO(detach_type, power_off));
+	f_send_l3_gmm_llc(ts_GMM_DET_REQ_MO(detach_type, power_off), bssgp_index);
 	if (expect_purge) {
 		GSUP.receive(tr_GSUP_PURGE_MS_REQ(g_pars.imsi, OSMO_GSUP_CN_DOMAIN_PS));
 		GSUP.send(ts_GSUP_PURGE_MS_RES(g_pars.imsi));
@@ -881,7 +881,7 @@
 		setverdict(fail, "Unexpected GSUP PURGE MS for unregistered TLLI");
 		mtc.stop;
 		}
-	[power_off] BSSGP[0].receive(tr_BD_L3_MT(tr_GMM_DET_ACCEPT_MT)) -> value bd {
+	[power_off] BSSGP[bssgp_index].receive(tr_BD_L3_MT(tr_GMM_DET_ACCEPT_MT)) -> value bd {
 		g_pars.ra := omit;
 		setverdict(fail, "Unexpected ATTACH ACCEPT in no-power-off DETACH");
 		mtc.stop;
@@ -890,12 +890,12 @@
 	[power_off] T.timeout {
 		setverdict(pass);
 		}
-	[not power_off] BSSGP[0].receive(tr_BD_L3_MT(tr_GMM_DET_ACCEPT_MT)) -> value bd {
+	[not power_off] BSSGP[bssgp_index].receive(tr_BD_L3_MT(tr_GMM_DET_ACCEPT_MT)) -> value bd {
 		g_pars.ra := omit;
 		setverdict(pass);
 		/* TODO: check if any PDP contexts are deactivated on network side? */
 		}
-	[] BSSGP[0].receive { repeat; }
+	[] BSSGP[bssgp_index].receive { repeat; }
 	}
 }
 
@@ -1857,7 +1857,7 @@
 	f_send_l3_gmm_llc(ts_GMM_RAU_REQ(f_mi_get_lv(), GPRS_UPD_T_RA, g_pars.ra, false, omit, omit), bssgp);
 	alt {
 	[] BSSGP[bssgp].receive(tr_BD_L3_MT(tr_GMM_RAU_ACCEPT)) -> value bd {
-		f_process_rau_accept(bd.l3_mt.msgs.gprs_mm.routingAreaUpdateAccept);
+		f_process_rau_accept(bd.l3_mt.msgs.gprs_mm.routingAreaUpdateAccept, bssgp);
 		f_send_l3_gmm_llc(ts_GMM_RAU_COMPL, bssgp);
 		setverdict(pass);
 		}