BSSGP_Emulation: Support multiple PTP-BVC within one Entity

The existing BSSGP_Emulation is built around the assumption that every
instance of BSSGP_Emulation only servers one signaling-BVC and one
PTP-BVC.  While this is true for osmo-pcu at this point (BTS-colocated
PCU), other BSS/PCU implementations differ.

In general, there can always be any number of PTP BVC (one per cell)
next to the signaling BVC (one per BSS).  Let's represent this in
BSSGP_Emulation so we can create more comprehensive tests.

Change-Id: I7e30b4c4e188518a574e082962fba457b3a97ce3
diff --git a/pcu/SGSN_Components.ttcn b/pcu/SGSN_Components.ttcn
index 4a94c03..2f1fa75 100644
--- a/pcu/SGSN_Components.ttcn
+++ b/pcu/SGSN_Components.ttcn
@@ -20,18 +20,22 @@
 modulepar {
 	BssgpConfig mp_gb_cfg := {
 		nsei := 1234,
-		bvci := 1234,
-		cell_id := {
-			ra_id := {
-				lai := {
-					mcc_mnc := '262F42'H, lac := 13135
-				},
-				rac := 0
-			},
-			cell_id := 20960
-		},
 		sgsn_role := true,
-		depth := BSSGP_DECODE_DEPTH_BSSGP
+		bvc := {
+			{
+				bvci := 1234,
+				cell_id := {
+					ra_id := {
+						lai := {
+							mcc_mnc := '262F42'H, lac := 13135
+						},
+						rac := 0
+					},
+					cell_id := 20960
+				},
+				depth := BSSGP_DECODE_DEPTH_BSSGP
+			}
+		}
 	};
 
 	NSConfiguration mp_nsconfig := {
@@ -55,6 +59,7 @@
 type component bssgp_CT extends BSSGP_Client_CT {
 	var NS_CT ns_component;
 	var BSSGP_CT bssgp_component;
+	port BSSGP_CT_PROC_PT PROC;
 	var boolean g_initialized := false;
 }
 
@@ -75,16 +80,22 @@
 	/* create a new NS component */
 	ns_component := NS_CT.create;
 	bssgp_component := BSSGP_CT.create;
-	/* connect our BSSGP port to the BSSGP Emulation */
-	connect(self:BSSGP[0], bssgp_component:BSSGP_SP);
-	connect(self:BSSGP_SIG[0], bssgp_component:BSSGP_SP_SIG);
-	connect(self:BSSGP_PROC[0], bssgp_component:BSSGP_PROC);
 	/* connect lower-end of BSSGP with BSSGP_CODEC_PORT (maps to NS_PT*/
 	connect(bssgp_component:BSCP, ns_component:NS_SP);
+	connect(self:PROC, bssgp_component:PROC);
 	ns_component.start(NSStart(mp_nsconfig));
-	bssgp_component.start(BssgpStart(mp_gb_cfg));
+	bssgp_component.start(BssgpStart(mp_gb_cfg, testcasename()));
 
-	f_bssgp_client_register(mmctx.imsi, mmctx.tlli, mp_gb_cfg.cell_id);
+	for (var integer i := 0; i < lengthof(mp_gb_cfg.bvc); i := i+1) {
+		var BSSGP_BVC_CT vc_BVC;
+		/* obtain reference for BVC component (created by BssgpStart) */
+		vc_BVC := f_bssgp_get_bvci_ct(mp_gb_cfg.bvc[i].bvci, PROC);
+		/* connect our BSSGP port to the BSSGP Emulation */
+		connect(self:BSSGP[i], vc_BVC:BSSGP_SP);
+		connect(self:BSSGP_SIG[i], vc_BVC:BSSGP_SP_SIG);
+		connect(self:BSSGP_PROC[i], vc_BVC:BSSGP_PROC);
+		f_bssgp_client_register(mmctx.imsi, mmctx.tlli);
+	}
 }
 
 /* Establish BSSGP connection to PCU */
@@ -93,7 +104,7 @@
 
 	T.start
 	alt {
-	[] BSSGP[0].receive(t_BssgpStsInd(?, ?, BVC_S_UNBLOCKED)) { }
+	[] BSSGP[0].receive(tr_BssgpStsInd(*, ?, BVC_S_UNBLOCKED)) { }
 	[] BSSGP[0].receive { repeat; }
 	[] T.timeout {
 		setverdict(fail, "Timeout establishing BSSGP connection");