msc: Introduce shared f_expect_clear()

Avoid having to copy+paste the matching of a channel clear/relesae

Change-Id: If070b079f2ffadb8065fb99d1c8951ac9baec88b
diff --git a/msc_tests/BSC_ConnectionHandler.ttcn b/msc_tests/BSC_ConnectionHandler.ttcn
index 97c02b8..a7ce1ea 100644
--- a/msc_tests/BSC_ConnectionHandler.ttcn
+++ b/msc_tests/BSC_ConnectionHandler.ttcn
@@ -454,6 +454,41 @@
 	setverdict(pass);
 }
 
+/* expect a clear command */
+function f_expect_clear(float t := 5.0) runs on BSC_ConnHdlr {
+	timer T := t;
+
+	T.start;
+	alt {
+	[] BSSAP.receive(tr_BSSMAP_ClearCommand) { }
+	[] BSSAP.receive {
+		setverdict(fail, "Unexpected BSSMAP while waiting for ClearCommand");
+		self.stop;
+		}
+	[] T.timeout {
+		setverdict(inconc, "Timeout waiting for ClearCommand");
+		self.stop;
+		}
+	}
+
+	BSSAP.send(ts_BSSMAP_ClearComplete);
+
+	T.start;
+	alt {
+	[] BSSAP.receive(BSSAP_Conn_Prim:MSC_CONN_PRIM_DISC_IND) {
+		setverdict(pass);
+		}
+	[] BSSAP.receive {
+		setverdict(fail, "Unexpected BSSMAP while waiting for SCCP Release");
+		self.stop;
+		}
+	[] T.timeout {
+		setverdict(inconc, "Timeout waiting for SCCP Release");
+		self.stop;
+		}
+	}
+}
+