msc: new test: TC_lu_and_mo_csd

Related: OS#4394
Depends: https://gitlab.eclipse.org/eclipse/titan/titan.ProtocolModules.MobileL3_v13.4.0/-/merge_requests/3
Change-Id: Ia863a63a318a9b0a8b4bfc1dc425cbc0235256b3
diff --git a/deps/Makefile b/deps/Makefile
index d4f209a..c7be960 100644
--- a/deps/Makefile
+++ b/deps/Makefile
@@ -104,7 +104,7 @@
 titan.ProtocolModules.MAP_commit=		R.2.A-1-g79c6a3d
 titan.ProtocolModules.M2PA_commit=		R.2.A-5-ga75b589
 titan.ProtocolModules.M3UA_commit=		c496d298876fed55c2b730278b7ee77982555563
-titan.ProtocolModules.MobileL3_v13.4.0_commit=	badbad680df216b3211260d56b14734eeb2c9028
+titan.ProtocolModules.MobileL3_v13.4.0_commit=	76a3557f69834b6171652aaeaeef220444c35ba7
 titan.ProtocolModules.NAS_EPS_15.2.0.1_commit=	R.1.A-2-g2ba853c
 titan.ProtocolModules.NS_v7.3.0_commit=		R.2.A-6-gf73f195
 titan.ProtocolModules.RTP_commit=		R.5.A-4-g83ee83a
diff --git a/library/L3_Templates.ttcn b/library/L3_Templates.ttcn
index de7063f..edec440 100644
--- a/library/L3_Templates.ttcn
+++ b/library/L3_Templates.ttcn
@@ -1305,6 +1305,7 @@
 template (value) Speech_AuxiliarySpeech ts_SpeechAuxFR(SpeechVer ver) := ts_SpeechAux(ver, '0'B);
 template (value) Speech_AuxiliarySpeech ts_SpeechAuxHR(SpeechVer ver) := ts_SpeechAux(ver, '1'B);
 
+/* TS 3GPP 24.008 § 10.5.4.5 */
 template (value) BearerCapability_TLV ts_Bcap_voice := {
 	elementIdentifier := '04'O,
 	lengthIndicator := 0, /* overwritten */
@@ -1328,6 +1329,86 @@
 	octet7 := omit
 }
 
+/* TS 3GPP 24.008 § 10.5.4.5 */
+template (value) BearerCapability_TLV ts_Bcap_csd := {
+	elementIdentifier := '04'O,
+	lengthIndicator := 0, /* overwritten */
+	octet3 := {
+		informationTransferCapability := '001'B,
+		transferMode := '0'B,
+		codingStandard := '0'B,
+		radioChannelRequirement := '11'B,
+		extension_octet_3 := '0'B,
+		speech_aux_3a_3b := omit
+	},
+	octet4 := {
+		establishment := '0'B,
+		nirr := '1'B,
+		configuration := '0'B,
+		duplexMode := '1'B,
+		structure := '00'B,
+		compression := '0'B,
+		extension_octet_4 := '1'B
+	},
+	octet5 := {
+		signallingAccessProtocol := '001'B,
+		rateAdaptation := '01'B, /* V.110 */
+		accessId := '00'B,
+		extension_octet_5 := '0'B,
+		spare2_3 := omit,
+		otherRateAdaptation := omit,
+		otherInformationTransferCapability := omit,
+		extension_octet_5a := omit,
+		spare3_1 := omit,
+		inbandNegotiation := omit,
+		assignor_assignee := omit,
+		lli := omit,
+		mode := omit,
+		multiframe := omit,
+		hdrNohdr := omit,
+		extension_octet_5b := omit
+	},
+	octet6 := {
+		synchronous_asynchronous := '1'B, /* 0: sync, 1: async */
+		userInformationLayer1Protocol := '0000'B,
+		layer1Id := '01'B,
+		extension_octet_6 := '0'B,
+		/* octet 6a */
+		userRate := '0100'B, /* 4.8 kbit/s */
+		numberDataBits := '0'B,
+		negotiation := '0'B,
+		numberStopBits := '0'B,
+		extension_octet_6a := '1'B,
+		/* octet 6b */
+		parity := '000'B,
+		nicOnRX := '0'B,
+		nicOnTX := '0'B,
+		intermediateRate := '10'B,
+		extension_octet_6b := '1'B,
+		/* octet 6c */
+		modemType := '00000'B,
+		connectionElement := '00'B, /* 00: T / 01: NT */
+		extension_octet_6c := '0'B,
+		/* octet 6d */
+		fixedNetworkUserRate := omit,
+		otherModemType := omit,
+		extension_octet_6d := omit,
+		/* octet 6e */
+		maxNumberOfTrafficChannels := omit,
+		acceptableChannelCodings := omit,
+		extension_octet_6e := omit,
+		wantedAirInterfaceUserRate := omit,
+		uimi := omit,
+		/* octet 6f */
+		extension_octet_6f := omit,
+		spare := omit,
+		asymetryIndication := omit,
+		acceptableChannelCodingsExt := omit,
+		extension_octet_6g := omit
+	},
+	octet7 := omit
+}
+
 template PDU_ML3_MS_NW ts_ML3_MO_CC_SETUP(integer tid, hexstring called, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
 	discriminator := '0011'B,
 	tiOrSkip := {
diff --git a/msc/BSC_ConnectionHandler.ttcn b/msc/BSC_ConnectionHandler.ttcn
index 4351e06..3d7dc07 100644
--- a/msc/BSC_ConnectionHandler.ttcn
+++ b/msc/BSC_ConnectionHandler.ttcn
@@ -375,7 +375,8 @@
 	EST_TYPE_EMERG_CALL,
 	EST_TYPE_PAG_RESP,
 	EST_TYPE_MO_SMS,
-	EST_TYPE_SS_ACT
+	EST_TYPE_SS_ACT,
+	EST_TYPE_MO_CSD
 };
 
 /* helper function to fully establish a dedicated channel */
@@ -395,6 +396,9 @@
 	case (EST_TYPE_MO_CALL) {
 		l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, mi));
 		}
+	case (EST_TYPE_MO_CSD) {
+		l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, mi));
+		}
 	case (EST_TYPE_EMERG_CALL) {
 		l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_EMERG_CALL, mi));
 		}
@@ -951,6 +955,7 @@
 							   important to set the TI flag properly */
 	BearerCapability_TLV bearer_cap,		/* which bearer capabilities to claim */
 	boolean emergency,				/* is this an emergency call? */
+	boolean csd,					/* is this a circuit switched data call? */
 
 	/* MNCC related parameters */
 	uint32_t mncc_callref optional,			/* call reference on the MNCC side */
@@ -1538,6 +1543,8 @@
 
 	if (cpars.emergency) {
 		f_establish_fully(EST_TYPE_EMERG_CALL);
+	} else if (cpars.csd) {
+		f_establish_fully(EST_TYPE_MO_CSD);
 	} else {
 		f_establish_fully(EST_TYPE_MO_CALL);
 	}
@@ -1548,6 +1555,8 @@
 
 	if (cpars.emergency) {
 		BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_EMERG_SETUP(cpars.transaction_id)));
+	} if (cpars.csd) {
+		BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_SETUP(cpars.transaction_id, cpars.called_party, ts_Bcap_csd)));
 	} else {
 		BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_SETUP(cpars.transaction_id, cpars.called_party)));
 	}
diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index 666c6c1..9650b3e 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -7187,6 +7187,21 @@
 	f_TC_auth_options(11);
 }
 
+friend function f_tc_lu_and_mo_csd(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr {
+	f_init_handler(pars);
+	var CallParameters cpars := valueof(t_CallParams);
+	cpars.csd := true;
+	f_perform_lu();
+	f_mo_call(cpars);
+}
+testcase TC_lu_and_mo_csd() runs on MTC_CT {
+	var BSC_ConnHdlr vc_conn;
+	f_init();
+
+	vc_conn := f_start_handler(refers(f_tc_lu_and_mo_csd), 7);
+	vc_conn.done;
+}
+
 control {
 	execute( TC_cr_before_reset() );
 	execute( TC_lu_imsi_noauth_tmsi() );
@@ -7364,6 +7379,8 @@
 	execute( TC_auth_options_9() );
 	execute( TC_auth_options_10() );
 	execute( TC_auth_options_11() );
+
+	execute( TC_lu_and_mo_csd() );
 }