From 9220f6336e0716849ab4ebaa35b71adfe179da8d Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 23 May 2018 20:27:02 +0200 Subject: Print more self-explanatory error message on bind/connect failures When sockets cannot be bound or connected, the existing TTCN-3 code prints the following rather cryptic error messages: "IPA-CTRL-IPA(47)@f70ff1fd5cfd: Dynamic test case error: Using the value of an optional field containing omit. (Transport endpoint is not connected)" The "Transport endpoint is not connected" sort-of gives it away, but let's make it more explicit by introducing explicit checks for the res.connId and manual setverdict(fail) statements with proper error message. Change-Id: Id22a1b5189d81c4fca03d5e7aff60ffdd1ad56bf --- mgw/MGCP_Test.ttcn | 4 ++++ mgw/RTP_Endpoint.ttcn | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'mgw') diff --git a/mgw/MGCP_Test.ttcn b/mgw/MGCP_Test.ttcn index c1ff3fc9..1892a423 100644 --- a/mgw/MGCP_Test.ttcn +++ b/mgw/MGCP_Test.ttcn @@ -68,6 +68,10 @@ module MGCP_Test { * source/destionation ip/port and store the connection id in g_mgcp_conn_id * */ res := MGCP_CodecPort_CtrlFunct.f_IPL4_connect(MGCP, mp_remote_ip, mp_remote_udp_port, mp_local_ip, mp_local_udp_port, 0, { udp := {} }); + if (not ispresent(res.connId)) { + setverdict(fail, "Could not connect MGCP, check your configuration"); + self.stop; + } g_mgcp_conn_id := res.connId; for (var integer i := 0; i < sizeof(vc_RTPEM); i := i+1) { diff --git a/mgw/RTP_Endpoint.ttcn b/mgw/RTP_Endpoint.ttcn index d33423aa..3c939a22 100644 --- a/mgw/RTP_Endpoint.ttcn +++ b/mgw/RTP_Endpoint.ttcn @@ -109,8 +109,10 @@ module RTP_Endpoint { res := f_IPL4_connect(RTP, sub.remote_name, sub.remote_port, sub.local_name, sub.local_port, sub.connection_id, { udp := {} }); - /* FIXME: Check for success (no res.errorCode) */ - + if (not ispresent(res.connId)) { + setverdict(fail, "Could not connect RTP, check your configuration"); + self.stop; + } /* connect without previous bind: save conenction id allocated by IPL4asp */ if (sub.connection_id == -1) { sub.connection_id := res.connId; @@ -132,7 +134,10 @@ module RTP_Endpoint { var Result res; rtp_endpoint_sub_close(RTP, sub); res := f_IPL4_listen(RTP, sub.local_name, sub.local_port, { udp := {} }); - /* FIXME: Check for success (no res.errorCode) */ + if (not ispresent(res.connId)) { + setverdict(fail, "Could not listen to RTP, check your configuration"); + self.stop; + } sub.connection_id := res.connId; } -- cgit v1.2.3