SGSN_Tests: fix TC_attach_timeout_after_pdp_act

This patch fixes several problems:

* missing "vc_conn.done": the actual testsuite logic, which can be
  found in f_TC_attach_timeout_after_pdp_act(), was never executed
  fully because we did not wait for the BSSGP_ConnHdlr to complete;
* too short Tguard value: the testsuite logic takes slightly more
  time to complete than the default timeout of 30.0 seconds;
* osmo-sgsn does not require authentication for the second ATTACH.req:
  the testsuite logic gets stuck in f_gmm_auth() after sending the
  second ATTACH.req because:
** osmo-sgsn is waiting for a response to GMM IDENTITY REQUEST,
** osmo-sgsn does not send GSUP SendAuthInfo.req again.

As can be seen from the test execution artifacts on Jenkins, this
testcase never passed: either failing due to an error, or declaring
no verdict at all.  The average execution time is 650 ms.

Change-Id: Ibaf2134247153471bd45d7a7f91155294c6c6de5
Fixes: 3ede9e32b "sgsn: Add TC_attach_timeout_after_pdp_act"
Closes: OS#4221
diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index 3946058..88cbbb1 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -1030,17 +1030,28 @@
 	var template PDU_L3_MS_SGSN attach_req;
 	timer t_receive_GMM_ATTACH_ACCEPT;
 	var RoutingAreaIdentificationV rai := f_random_RAI();
+	timer T;
 
 	/* First establish PDP context */
 	f_TC_attach(id);
 	f_pdp_ctx_act(apars);
 
-	/* Now, try another GPRS attach procedure. For further code comments up until receiving the attach
-	 * accept from the SGSN, see definition of f_gmm_attach() */
+	/* Now, try another GPRS attach procedure. Note that osmo-sgsn does not require
+	 * authentication for the second GMM ATTACH REQUEST, so we expect GSUP UPDATE
+	 * LOCATION REQUEST and optionally a GMM IDENTITY REQUEST (IMEI). */
 	attach_req := ts_GMM_ATTACH_REQ(f_mi_get_lv(), rai, false, false, omit, omit);
 	f_send_l3(attach_req, ran_index);
-	f_gmm_auth(false, false, ran_index);
-	as_gmm_gsup_lu_isd();
+
+	T.start(1.0);
+	alt {
+	[] as_gmm_gsup_lu_isd();
+	[] as_mm_identity(ran_index);
+	[] as_xid(apars, ran_index);
+	[] T.timeout {
+		setverdict(fail, "Timeout waiting for GSUP UPDATE LOCATION REQUEST");
+		return;
+		}
+	}
 
 	BSSGP[ran_index].clear;
 	log("Trying to receive ", gmm_attach_repeats, " ATTACH ACCEPTs");
@@ -1071,7 +1082,9 @@
 testcase TC_attach_timeout_after_pdp_act() runs on test_CT {
 	var BSSGP_ConnHdlr vc_conn;
 	f_init();
-	vc_conn := f_start_handler(refers(f_TC_attach_timeout_after_pdp_act), testcasename(), g_gb, 21);
+	vc_conn := f_start_handler(refers(f_TC_attach_timeout_after_pdp_act),
+				   testcasename(), g_gb, 21, t_guard := 45.0);
+	vc_conn.done;
 	f_cleanup();
 }