hnodeb: Updates in HNBLLIF and HNBGW_COnnectioNHandler to support and test IuUP

Depends: osmo-hnodeb.git Change-Id Ibe356fa7b1abaca0091e368db8478e79c09c6cb0
Related: SYS#5516
Change-Id: I19612fce8190dfe14f98d346adb5db4e1c2a08d9
diff --git a/hnodeb/HNB_Tests.ttcn b/hnodeb/HNB_Tests.ttcn
index c801ee6..a58e203 100644
--- a/hnodeb/HNB_Tests.ttcn
+++ b/hnodeb/HNB_Tests.ttcn
@@ -56,6 +56,8 @@
 import from GTP_Templates all;
 import from GTP_Emulation all;
 
+import from IuUP_Types all;
+
 modulepar {
 	/* IP address at which the HNodeB can be reached */
 	charstring mp_hnodeb_ip := "127.0.0.1";
@@ -297,6 +299,10 @@
 	var PortNumber hnodeb_rtp_port;
 	timer Tu;
 	var uint32_t audio_conn_id;
+	var IuUP_FQC fqc := IuUP_FQC_GOOD;
+
+	rtp_payload := f_rnd_octstring(6);
+	f_HNBGW_rtpem_activate(rtp_payload);
 
 	f_handle_hnbap_hnb_register_req();
 
@@ -326,11 +332,22 @@
 		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "hnodeb RTP local address doesn't match expectations");
 	}
 	hnodeb_rtp_port := sd.data.u.audio.u.conn_establish.u.cnf.local_rtp_port;
-	rtp_payload := f_rnd_octstring(6);
-	f_HNBGW_rtpem_activate(rtp_payload, hnodeb_rtp_addr, hnodeb_rtp_port);
+	f_HNBGW_rtpem_connect(hnodeb_rtp_addr, hnodeb_rtp_port);
+
+	/* We should eventually receive some RTP/IUUP from the HNBGW once Init phase goes on: */
+	Tu.start(2.0);
+	alt {
+	[] LLSK.receive(f_llsk_rx(tr_HNBLLIF_AUDIO_CONN_DATA_IND(audio_conn_id, ?, enum2int(fqc), ?, rtp_payload)));
+	[] Tu.timeout {
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for Downlink speech frames");
+		}
+	}
+	Tu.stop;
+	f_rtpem_mode(RTPEM_CTRL, RTPEM_MODE_RXONLY);
+
 	/* Make sure that Uplink frames are received at the HNBGW */
 	RTPEM_DATA.clear;
-	LLSK.send(f_llsk_tx(ts_HNBLLIF_AUDIO_CONN_DATA_REQ(audio_conn_id, rtp_payload)));
+	LLSK.send(f_llsk_tx(ts_HNBLLIF_AUDIO_CONN_DATA_REQ(audio_conn_id, 1, enum2int(fqc), 0, rtp_payload)));
 	Tu.start(2.0);
 	alt {
 	[] RTPEM_DATA.receive(PDU_RTP:?) -> value rtp_pdu {
@@ -345,10 +362,9 @@
 		}
 	}
 	Tu.stop;
-	/* We should also have received some RTP from the HNBGW: */
-	LLSK.receive(f_llsk_rx(tr_HNBLLIF_AUDIO_CONN_DATA_IND(audio_conn_id, rtp_payload)));
 
 	f_rtpem_mode(RTPEM_CTRL, RTPEM_MODE_NONE);
+	f_sleep(0.5); /* give some time to RTP_Emu to stop sending RTP packets... */
 
 	LLSK.send(f_llsk_tx(ts_HNBLLIF_AUDIO_CONN_RELEASE_REQ(audio_conn_id)));