cbc: Test ETWS msg over CBSP

So far only non-emergency CBS messages were tested, which require a
slighlty idfferent encoding on the protocol side.

Related: OS#4945
Change-Id: Ie22a00120218a205db11a5622274dcc67435f5de
diff --git a/library/CBSP_Templates.ttcn b/library/CBSP_Templates.ttcn
index 6ff2742..bcbb7be 100644
--- a/library/CBSP_Templates.ttcn
+++ b/library/CBSP_Templates.ttcn
@@ -381,6 +381,19 @@
 	ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind);
 	return ts_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies);
 }
+function ts_CBSP_WRITE_EMERG_COMPL(uint16_t msg_id, uint16_t new_ser_nr,
+				 template (omit) BSSMAP_FIELD_CellIdentificationList cell_list)
+return template (value) CBSP_PDU {
+	var template (value) CBSP_IEs ies := {
+		ts_CbspMsgId(msg_id),
+		ts_NewSerNo(new_ser_nr)
+	};
+	if (not istemplatekind(cell_list, "omit")) {
+		ies[lengthof(ies)] := ts_CbspCellList(valueof(cell_list));
+	}
+	return ts_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies);
+}
+
 function tr_CBSP_WRITE_CBS_COMPL(template uint16_t msg_id, template uint16_t new_ser_nr,
 				 template BSSMAP_FIELD_CellIdentificationList cell_list,
 				 template uint8_t channel_ind)
@@ -397,8 +410,23 @@
 	} else if (not istemplatekind(cell_list, "omit")) {
 		ies[lengthof(ies)] := tr_CbspCellList(cell_list);
 	}
-	if (not istemplatekind(channel_ind, "omit")) {
-		ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind);
+	ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind);
+	return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies);
+}
+function tr_CBSP_WRITE_EMERG_COMPL(template uint16_t msg_id, template uint16_t new_ser_nr,
+				 template BSSMAP_FIELD_CellIdentificationList cell_list)
+return template CBSP_PDU {
+	var template CBSP_IEs ies := {
+		tr_CbspMsgId(msg_id),
+		tr_NewSerNo(new_ser_nr)
+	};
+	if (istemplatekind(cell_list, "*")) {
+		testcase.stop("TITAN > 6.5.0 doesn't support this");
+		//ies[lengthof(ies)] := tr_CbspCellList ifpresent;
+	} else if (istemplatekind(cell_list, "?")) {
+		ies[lengthof(ies)] := tr_CbspCellList(?);
+	} else if (not istemplatekind(cell_list, "omit")) {
+		ies[lengthof(ies)] := tr_CbspCellList(cell_list);
 	}
 	return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies);
 }
@@ -421,6 +449,19 @@
 	ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind);
 	return ts_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies);
 }
+function ts_CBSP_REPLACE_EMERG_COMPL(uint16_t msg_id, uint16_t new_ser_nr, uint16_t old_ser_nr,
+				   template (omit) BSSMAP_FIELD_CellIdentificationList cell_list)
+return template (value) CBSP_PDU {
+	var template (value) CBSP_IEs ies := {
+		ts_CbspMsgId(msg_id),
+		ts_NewSerNo(new_ser_nr),
+		ts_OldSerNo(old_ser_nr)
+	};
+	if (not istemplatekind(cell_list, "omit")) {
+		ies[lengthof(ies)] := ts_CbspCellList(valueof(cell_list));
+	}
+	return ts_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies);
+}
 function tr_CBSP_REPLACE_CBS_COMPL(template uint16_t msg_id, template uint16_t new_ser_nr,
 				   template uint16_t old_ser_nr,
 				   template CBSP_IE_NumBcastComplList compl_list,
@@ -454,6 +495,26 @@
 	}
 	return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies);
 }
+function tr_CBSP_REPLACE_EMERG_COMPL(template uint16_t msg_id, template uint16_t new_ser_nr,
+				   template uint16_t old_ser_nr,
+				   template BSSMAP_FIELD_CellIdentificationList cell_list)
+return template CBSP_PDU {
+	var template CBSP_IEs ies := {
+		tr_CbspMsgId(msg_id),
+		tr_NewSerNo(new_ser_nr),
+		tr_OldSerNo(old_ser_nr)
+	};
+
+	if (istemplatekind(cell_list, "*")) {
+		testcase.stop("TITAN > 6.5.0 doesn't support this");
+		//ies[lengthof(ies)] := tr_CbspCellList ifpresent;
+	} else if (istemplatekind(cell_list, "?")) {
+		ies[lengthof(ies)] := tr_CbspCellList(?);
+	} else if (not istemplatekind(cell_list, "omit")) {
+		ies[lengthof(ies)] := tr_CbspCellList(cell_list);
+	}
+	return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies);
+}
 
 
 /* 8.1.3.3 WRITE-REPLACE FAILURE */