bsc: Only append Osmux IEs in BSSAP AoIP

Previous to this commit, BSSAP Reset (Ack) messages contained Osmux
Support IE even if transport was SCCPLite, where those IEs are actually
meaningless.

Change-Id: If6cc0f65a0f273297a4523e5d6a7564d966f0aa6
diff --git a/library/RAN_Emulation.ttcnpp b/library/RAN_Emulation.ttcnpp
index 85ae084..ba018b4 100644
--- a/library/RAN_Emulation.ttcnpp
+++ b/library/RAN_Emulation.ttcnpp
@@ -445,6 +445,11 @@
 type function BssmapUnitdataCallback(PDU_BSSAP bssap)
 runs on RAN_Emulation_CT return template PDU_BSSAP;
 
+private function append_osmux_ie()
+runs on RAN_Emulation_CT return boolean {
+	return g_ran_ops.use_osmux and (g_ran_ops.transport == BSSAP_TRANSPORT_AoIP);
+}
+
 /* handle common Unitdata such as Paging */
 private function CommonBssmapUnitdataCallback(PDU_BSSAP bssap)
 runs on RAN_Emulation_CT return template PDU_BSSAP {
@@ -469,14 +474,15 @@
 private function f_bssap_wait_for_reset() runs on RAN_Emulation_CT {
 	var BSSAP_N_UNITDATA_ind ud_ind;
 	timer T := 20.0;
+	var boolean append_osmux_support := append_osmux_ie();
 
 	T.start;
 	alt {
-	[] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_ran_ops.use_osmux))) -> value ud_ind {
+	[] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(append_osmux_support))) -> value ud_ind {
 		BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress, ud_ind.calledAddress,
-			   ts_BSSMAP_ResetAck(g_ran_ops.use_osmux)));
+			   ts_BSSMAP_ResetAck(append_osmux_support)));
 		}
-	[] as_reset_ack();
+	[] as_reset_ack(append_osmux_support);
 	[] BSSAP.receive {
 		repeat;
 		}
@@ -489,14 +495,15 @@
 
 function f_bssap_reset(SCCP_PAR_Address peer, SCCP_PAR_Address own) runs on RAN_Emulation_CT {
 	timer T := 5.0;
+	var boolean append_osmux_support := append_osmux_ie();
 
-	BSSAP.send(ts_BSSAP_UNITDATA_req(peer, own, ts_BSSMAP_Reset(0, g_ran_ops.use_osmux)));
+	BSSAP.send(ts_BSSAP_UNITDATA_req(peer, own, ts_BSSMAP_Reset(0, append_osmux_support)));
 	T.start;
 	alt {
-	[] BSSAP.receive(tr_BSSAP_UNITDATA_ind(own, peer, tr_BSSMAP_ResetAck(g_ran_ops.use_osmux))) {
+	[] BSSAP.receive(tr_BSSAP_UNITDATA_ind(own, peer, tr_BSSMAP_ResetAck(append_osmux_support))) {
 		log("Received RESET-ACK in response to RESET, we're ready to go!");
 		}
-	[] as_reset_ack();
+	[] as_reset_ack(append_osmux_support);
 	[] BSSAP.receive { repeat };
 	[] T.timeout {
 		setverdict(fail, "Timeout waiting for RESET-ACK after sending RESET");
@@ -728,7 +735,7 @@
 	f_ML3_patch_seq_nr(seq_nr, enc_l3);
 }
 
-private altstep as_reset_ack() runs on RAN_Emulation_CT {
+private altstep as_reset_ack(boolean append_osmux_support := false) runs on RAN_Emulation_CT {
 #ifdef RAN_EMULATION_BSSAP
 	var BSSAP_N_UNITDATA_ind ud_ind;
 #endif
@@ -736,10 +743,10 @@
 	var RANAP_N_UNITDATA_ind rud_ind;
 #endif
 #ifdef RAN_EMULATION_BSSAP
-	[] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_ran_ops.use_osmux))) -> value ud_ind {
+	[] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(append_osmux_support))) -> value ud_ind {
 		log("Respoding to inbound RESET with RESET-ACK");
 		BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress, ud_ind.calledAddress,
-			   ts_BSSMAP_ResetAck(g_ran_ops.use_osmux)));
+			   ts_BSSMAP_ResetAck(append_osmux_support)));
 		repeat;
 	}
 #endif