bsc: check channel release message presence

Instead of vaguely allowing any release messages to be present or not, exactly
pinpoint for each test case the exact release messages expected during lchan
release.

Related: an osmo-bsc change broke sending of RR Release messages, which was
utterly ignored and hence not caught by ttcn tests. That must not happen again.

I am not actually sure that these expectations are 100% correct; if errors
become apparent, we shall change the expectations in ttcn3 and then fix
osmo-bsc according to that.

Adjust f_expect_chan_rel() and callers,
and the Assignment procedures (as_assignment and f_establish_fully).

The current state of the bsc tests should all pass with osmo-bsc
Id3301df059582da2377ef82feae554e94fa42035

Related: OS#3413
Change-Id: Ibc64058f1e214bea585f4e8dcb66f3df8ead3845
diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index 07eafc7..116d7af 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -603,6 +603,8 @@
 	boolean is_assignment,
 	/* Assignment related bits */
 	boolean rr_ass_cmpl_seen,
+	boolean old_lchan_deact_sacch_seen,
+	boolean old_lchan_rll_rel_req_seen,
 	boolean assignment_done,
 	RslChannelNr old_chan_nr,
 	/* Modify related bits */
@@ -614,6 +616,8 @@
 	voice_call := false,
 	is_assignment := false,
 	rr_ass_cmpl_seen := false,
+	old_lchan_deact_sacch_seen := false,
+	old_lchan_rll_rel_req_seen := false,
 	assignment_done := false,
 	old_chan_nr := -,
 	rr_modify_seen := false,
@@ -683,9 +687,11 @@
 		}
 		}
 	[st.rr_ass_cmpl_seen] RSL.receive(tr_RSL_DEACT_SACCH(st.old_chan_nr)) {
+		st.old_lchan_deact_sacch_seen := true;
 		repeat;
 		}
 	[st.rr_ass_cmpl_seen] RSL.receive(tr_RSL_REL_REQ(st.old_chan_nr, tr_RslLinkID_DCCH(0))) {
+		st.old_lchan_rll_rel_req_seen := true;
 		RSL.send(ts_RSL_REL_CONF(st.old_chan_nr, valueof(ts_RslLinkID_DCCH(0))));
 		repeat;
 		}
@@ -994,6 +1000,17 @@
 	}
 
 	f_check_mgcp_expectations();
+
+	if (st.is_assignment and st.assignment_done) {
+	    if (not st.old_lchan_deact_sacch_seen) {
+		setverdict(fail, "f_establish_fully(): Assignment completed, but the old lchan was not",
+			   " released properly: expected a Deact SACCH on the old lchan, but saw none.");
+	    }
+	    if (st.old_lchan_rll_rel_req_seen) {
+		setverdict(fail, "f_establish_fully(): Assignment completed, but the old lchan was not",
+			   " released properly: saw an RLL Release on the old lchan, but expecting none.");
+	    }
+	}
 }
 
 type record HandoverState {