OSMUX_Emulation: Use Misc_Helpers.f_shutdown() everywhere

Change-Id: Id8f104a4123fcfbc96ab07f2e9343369946e3334
This commit is contained in:
Pau Espin 2022-08-12 17:42:21 +02:00 committed by laforge
parent d079b3fa33
commit ef046b39bf
1 changed files with 24 additions and 22 deletions

View File

@ -54,6 +54,7 @@ module OSMUX_Emulation {
import from General_Types all;
import from Osmocom_Types all;
import from IPL4asp_Types all;
import from Misc_Helpers all;
import from OSMUX_Types all;
import from OSMUX_CodecPort all;
import from OSMUX_CodecPort_CtrlFunct all;
@ -289,26 +290,26 @@ function f_osmuxem_stats_err_check(OsmuxemStats s) {
/* Check if there was some activity at either on the RX or on the
* TX side, but complete silence would indicate some problem */
if (s.num_pkts_tx < 1 and s.num_pkts_rx < 1) {
setverdict(fail, "no Osmux packet activity detected (packets)");
mtc.stop;
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
"no Osmux packet activity detected (packets)");
}
if (s.bytes_payload_tx < 1 and s.bytes_payload_rx < 1) {
setverdict(fail, "no Osmux packet activity detected (bytes)");
mtc.stop;
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
"no Osmux packet activity detected (bytes)");
}
/* Check error counters */
if (s.num_pkts_rx_err_seq != 0) {
setverdict(fail, "Osmux packet sequence number errors occurred");
mtc.stop;
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
"Osmux packet sequence number errors occurred");
}
if (s.num_pkts_rx_err_disabled != 0) {
setverdict(fail, "Osmux packets received while RX was disabled");
mtc.stop;
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
"Osmux packets received while RX was disabled");
}
if (s.num_pkts_rx_err_payload != 0) {
setverdict(fail, "Osmux packets with mismatching payload received");
mtc.stop;
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
"Osmux packets with mismatching payload received");
}
}
@ -336,8 +337,9 @@ private function f_rxhandle_get_by_cid(OsmuxCID cid) runs on OSMUX_Emulation_CT
return RxHandleTable[i].vc_conn;
}
}
setverdict(fail, "No Component for CID ", cid);
mtc.stop;
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
log2str("No Component for CID ", cid));
return RxHandleTable[0].vc_conn; /* make compiler happy, not reached */
}
private function f_rxhandle_cid_add(OsmuxRxHandle hdl) runs on OSMUX_Emulation_CT {
@ -349,8 +351,8 @@ private function f_rxhandle_cid_add(OsmuxRxHandle hdl) runs on OSMUX_Emulation_C
return;
}
}
testcase.stop("No Space in RxHandleTable for ", hdl.cid);
mtc.stop;
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
log2str("No Space in RxHandleTable for ", hdl.cid));
}
private function f_txhandle_cid_add(OsmuxTxHandle hdl) runs on OSMUX_Emulation_CT {
@ -361,8 +363,8 @@ private function f_txhandle_cid_add(OsmuxTxHandle hdl) runs on OSMUX_Emulation_C
return;
}
}
testcase.stop("No Space in TxHandleList for ", hdl.cid);
mtc.stop;
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
log2str("No Space in TxHandleList for ", hdl.cid));
}
function f_osmux_gen_expected_rx_rtp_payload(INT4b amr_ft, octetstring tx_fixed_payload) return octetstring {
@ -459,8 +461,8 @@ function f_main() runs on OSMUX_Emulation_CT
res := OSMUX_CodecPort_CtrlFunct.f_IPL4_listen(OSMUX, g_local_host,
g_local_port, {udp:={}});
if (not ispresent(res.connId)) {
setverdict(fail, "Could not listen on Osmux socket, check your configuration");
mtc.stop;
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
"Could not listen on Osmux socket, check your configuration");
}
g_osmux_conn_id := res.connId;
tr_osmux_amr.connId := g_osmux_conn_id;
@ -474,8 +476,8 @@ function f_main() runs on OSMUX_Emulation_CT
g_local_host, g_local_port,
g_osmux_conn_id, {udp:={}});
if (not ispresent(res.connId)) {
setverdict(fail, "Could not connect to Osmux socket, check your configuration");
mtc.stop;
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
"Could not connect to Osmux socket, check your configuration");
}
g_tx_connected := true;
CTRL.reply(OsmuxEM_connect:{g_remote_host, g_remote_port});
@ -569,8 +571,8 @@ function f_main() runs on OSMUX_Emulation_CT
/* fail on any unexpected messages */
[] OSMUX.receive {
setverdict(fail, "Received unexpected type from Osmux");
mtc.stop;
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
"Received unexpected msg type from Osmux");
}
}
}