Stop tests after failures

Call mtc.stop after setverdict(fail), add reasons to most failures and
fail with verdict error for internal errors.

Change-Id: I9b618235939fa41160b9be6677b121963d3ec857
diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index 78086af..0a20dd6 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -134,7 +134,7 @@
 		[] GSUP_IPA_EVENT.receive(t_ASP_IPA_EVT_UD(ASP_IPA_EVENT_UP)) { }
 		[] T.timeout {
 			setverdict(fail, "No connection to GSUP Port");
-			self.stop;
+			mtc.stop;
 		}
 	}
 }
@@ -240,7 +240,7 @@
 private altstep as_Tguard() runs on BSSGP_ConnHdlr {
 	[] g_Tguard.timeout {
 		setverdict(fail, "Tguard timeout");
-		self.stop;
+		mtc.stop;
 	}
 }
 
@@ -385,19 +385,19 @@
 	if (not (g_pars.bssgp_cell_id.ra_id.lai.mcc_mnc == aa_plmn)) {
 		  setverdict(fail, "mismatching PLMN in Attach Accept: " & hex2str(aa_plmn)
 				   & "; expected " & hex2str(g_pars.bssgp_cell_id.ra_id.lai.mcc_mnc));
-		  self.stop;
+		  mtc.stop;
 	}
 	g_pars.ra := aa.routingAreaIdentification;
 	if (ispresent(aa.allocatedPTMSI)) {
 		if (not g_pars.net.expect_ptmsi) {
 			setverdict(fail, "unexpected P-TMSI allocation");
-			self.stop;
+			mtc.stop;
 		}
 		f_upd_ptmsi_and_tlli(aa.allocatedPTMSI.mobileIdentityLV.mobileIdentityV.oddEvenInd_identity.tmsi_ptmsi.octets);
 	}
 	if (ispresent(aa.msIdentity)) {
 		setverdict(fail, "unexpected TMSI allocation in non-combined attach");
-		self.stop;
+		mtc.stop;
 	}
 	/* P-TMSI.sig */
 	if (ispresent(aa.ptmsiSignature)) {
@@ -414,13 +414,13 @@
 	if (ispresent(ra.allocatedPTMSI)) {
 		if (not g_pars.net.expect_ptmsi) {
 			setverdict(fail, "unexpected P-TMSI allocation");
-			self.stop;
+			mtc.stop;
 		}
 		f_upd_ptmsi_and_tlli(ra.allocatedPTMSI.mobileIdentityLV.mobileIdentityV.oddEvenInd_identity.tmsi_ptmsi.octets);
 	}
 	if (ispresent(ra.msIdentity)) {
 		setverdict(fail, "unexpected TMSI allocation in non-combined attach");
-		self.stop;
+		mtc.stop;
 	}
 	/* P-TMSI.sig */
 	if (ispresent(ra.ptmsiSignature)) {
@@ -540,6 +540,7 @@
 		}
 	[] BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_REJECT(?))) {
 		setverdict(fail, "Wrong Attach Reject Cause");
+		mtc.stop;
 		}
 	}
 }
@@ -608,6 +609,7 @@
 	[] BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?))) -> value bd {
 		f_process_attach_accept(bd.l3_mt.msgs.gprs_mm.attachAccept);
 		setverdict(fail);
+		mtc.stop;
 		}
 	}
 }
@@ -637,6 +639,7 @@
 	[] BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?))) -> value bd {
 		f_process_attach_accept(bd.l3_mt.msgs.gprs_mm.attachAccept);
 		setverdict(fail);
+		mtc.stop;
 		}
 	}
 }
@@ -718,6 +721,7 @@
 		}
 	[] BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_ACCEPT(*, *, *))) {
 		setverdict(fail);
+		mtc.stop;
 		}
 	}
 }
@@ -771,6 +775,7 @@
 		}
 	[] BSSGP.receive(tr_BD_L3_MT(tr_GMM_RAU_REJECT)) {
 		setverdict(fail, "Unexpected RAU Reject");
+		mtc.stop;
 		}
 	[] BSSGP.receive { repeat; }
 	}
@@ -796,10 +801,12 @@
 	alt {
 	[not expect_purge] GSUP.receive(tr_GSUP_PURGE_MS_REQ(?)) {
 		setverdict(fail, "Unexpected GSUP PURGE MS for unregistered TLLI");
+		mtc.stop;
 		}
 	[power_off] BSSGP.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;
 		/* TODO: check if any PDP contexts are deactivated on network side? */
 		}
 	[power_off] T.timeout {
@@ -930,9 +937,11 @@
 		}
 	[exp_rej] BSSGP.receive(tr_BD_L3_MT(tr_SM_ACT_PDP_ACCEPT)) {
 		setverdict(fail, "Unexpected PDP CTX ACT ACC");
+		mtc.stop;
 		}
 	[not exp_rej] BSSGP.receive(tr_BD_L3_MT(tr_SM_ACT_PDP_REJ(apars.tid, ?))) {
 		setverdict(fail, "Unexpected PDP CTX ACT FAIL");
+		mtc.stop;
 		}
 	[not exp_rej] BSSGP.receive(tr_BD_L3_MT(tr_SM_ACT_PDP_ACCEPT(apars.tid, apars.sapi))) {
 		setverdict(pass);
@@ -1159,9 +1168,11 @@
 		}
 	[] GTP.receive(tr_GTPC_MsgType(?, createPDPContextRequest, ?)) {
 		setverdict(fail, "Unexpected GTP PDP CTX ACT");
+		mtc.stop;
 		}
 	[] BSSGP.receive(tr_BD_L3_MT(tr_SM_ACT_PDP_ACCEPT(?, ?))) {
 		setverdict(fail, "Unexpected SM PDP CTX ACT ACK");
+		mtc.stop;
 		}
 	[] BSSGP.receive { repeat; }
 	}
@@ -1403,10 +1414,11 @@
 		[] BSSGP.receive(tr_BD_L3_MT(tr_GMM_DET_REQ_MT(*, *, *))) {
 			T.stop;
 			setverdict(fail, "Unexpected GMM Detach Request");
+			mtc.stop;
 		}
 		[] T.timeout {
 			setverdict(pass);
-			self.stop;
+			mtc.stop;
 		}
 		[] BSSGP.receive {
 			repeat;
@@ -1569,6 +1581,7 @@
 	}
 	if (count_req != 5) {
 		setverdict(fail, "Did not received GMM ID Request Type IMEI 5 times!");
+		mtc.stop;
 	}
 	setverdict(pass);
 }
@@ -1616,6 +1629,7 @@
 	}
 	if (count_req != 5) {
 		setverdict(fail, "Did not received GMM ID Request Type IMSI 5 times!");
+		mtc.stop;
 	}
 	setverdict(pass);
 }
@@ -1675,6 +1689,7 @@
 	alt {
 		[] BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_REJECT(?))) {
 			setverdict(fail, "Received unexpected GMM Attach REJECT");
+			mtc.stop;
 		}
 		[] BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_ACCEPT(*, *, *))) -> value bd {
 			f_process_attach_accept(bd.l3_mt.msgs.gprs_mm.attachAccept);
@@ -1730,6 +1745,7 @@
 	}
 	if (count_req != 5) {
 		setverdict(fail, "Did not received GMM Attach Complete.");
+		mtc.stop;
 	}
 	setverdict(pass);
 }