bts: Verify PCU socket can disconnect + re-connect
Change-Id: Ic69c3f34405012d42319bd9752f875071aae2243
Related: OS#4023
diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 2885628..6786d68 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -3921,6 +3921,26 @@
Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
}
+/* Ensure that PCUIF socket can disconnect + reconnect */
+testcase TC_pcu_socket_reconnect() runs on test_CT {
+ /* this (among other things) establishes the first connection to the PCUIF socket */
+ f_init();
+
+ f_sleep(1.0);
+
+ f_pcuif_close(PCU, g_pcu_conn_id);
+ g_pcu_conn_id := -1;
+
+ f_sleep(1.0);
+
+ /* re-connect */
+ PCU.clear;
+ f_init_pcu(PCU, testcasename(), g_pcu_conn_id, g_pcu_last_info);
+ setverdict(pass);
+
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
+}
+
/***********************************************************************
* Osmocom Style Dynamic Timeslot Support
@@ -5230,6 +5250,7 @@
execute( TC_pcu_oml_alert() );
execute( TC_pcu_rr_suspend() );
execute( TC_pcu_socket_connect_multi() );
+ execute( TC_pcu_socket_reconnect() );
} else {
log("PCU socket path not available, skipping PCU tests");
}
diff --git a/library/PCUIF_CodecPort.ttcn b/library/PCUIF_CodecPort.ttcn
index 91f9bf9..3d6ceac 100644
--- a/library/PCUIF_CodecPort.ttcn
+++ b/library/PCUIF_CodecPort.ttcn
@@ -94,6 +94,11 @@
return -23;
}
+function f_pcuif_close(PCUIF_CODEC_PT pt, integer id)
+{
+ pt.send(UD_close:{id := id});
+}
+
function f_pcuif_listen(PCUIF_CODEC_PT pt, charstring sock) return integer {
var UD_listen_result res;
var UD_connected udc;