S1AP_Emulation: Fix UeContextReleaseCmd not forwarded to users

We still want to forward it to the user so that it can:
1- validate the IUT sent the message
2- answer with a UeContextReleaseComplete

The f_assoc_id_by_s1ap_ids() function is modified to avoir a Dynamic
test error if the enb_ue_id is omit, which can happen if
UeContextRleaseCmd used choice "MME UE S1AP ID".

Change-Id: Iaf6a775d1cbc4f85f185bb26a0da1e5c9a4167a2
diff --git a/library/S1AP_Emulation.ttcn b/library/S1AP_Emulation.ttcn
index 401a26e..7d91c36 100644
--- a/library/S1AP_Emulation.ttcn
+++ b/library/S1AP_Emulation.ttcn
@@ -201,7 +201,8 @@
 runs on S1AP_Emulation_CT return integer {
 	var integer i;
 	for (i := 0; i < sizeof(S1apAssociationTable); i := i+1) {
-		if (match(S1apAssociationTable[i].enb_ue_s1ap_id, enb_id)) {
+		if (istemplatekind(enb_id, "omit") or
+		    match(S1apAssociationTable[i].enb_ue_s1ap_id, enb_id)) {
 			if (istemplatekind(mme_id, "omit")) {
 				return i;
 			} else {
@@ -484,8 +485,6 @@
 				if (isvalue(resp)) {
 					S1AP.send(t_S1AP_Send(g_s1ap_conn_id, valueof(resp)));
 				}
-			} else if (match(mrf.msg, tr_S1AP_UeContextReleaseCmd)) {
-				handle_S1AP_UeContextReleaseCmd(mrf.msg);
 			} else {
 				/* Ue-related S1AP message */
 				/* obtain MME + ENB UE S1AP ID */
@@ -520,6 +519,9 @@
 					f_s1ap_id_table_add(vc_conn, mme_ue_id, valueof(enb_ue_id));
 					S1AP_CLIENT.send(mrf.msg) to vc_conn;
 				}
+				if (match(mrf.msg, tr_S1AP_UeContextReleaseCmd)) {
+					handle_S1AP_UeContextReleaseCmd(mrf.msg);
+				}
 			}
 			}
 		[] S1AP.receive(tr_SctpAssocChange) { }