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
diff --git a/library/MGCP_Emulation.ttcn b/library/MGCP_Emulation.ttcn
index aaef39e..e2f79b3 100644
--- a/library/MGCP_Emulation.ttcn
+++ b/library/MGCP_Emulation.ttcn
@@ -237,7 +237,10 @@
} else {
res := MGCP_CodecPort_CtrlFunct.f_IPL4_connect(MGCP, p.callagent_ip, p.callagent_udp_port, p.mgw_ip, p.mgw_udp_port, -1, { udp:={} });
}
-
+ if (not ispresent(res.connId)) {
+ setverdict(fail, "Could not connect MGCP socket, check your configuration");
+ self.stop;
+ }
g_mgcp_conn_id := res.connId;
while (true) {
@@ -268,6 +271,10 @@
/* we aren't yet connected to the remote side port, let's fix this */
p.callagent_udp_port := mrf.remPort;
res := MGCP_CodecPort_CtrlFunct.f_IPL4_connect(MGCP, p.callagent_ip, p.callagent_udp_port, p.mgw_ip, p.mgw_udp_port, g_mgcp_conn_id, { udp:={} });
+ if (not ispresent(res.connId)) {
+ setverdict(fail, "Could not connect MGCP socket, check your configuration");
+ self.stop;
+ }
}
if (ischosen(mrf.msg.command)) {
cmd := mrf.msg.command;