aboutsummaryrefslogtreecommitdiffstats
path: root/library/IPA_Emulation.ttcnpp
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-05-23 20:27:02 +0200
committerHarald Welte <laforge@gnumonks.org>2018-05-23 20:27:02 +0200
commit9220f6336e0716849ab4ebaa35b71adfe179da8d (patch)
tree4031eeb1f917c10527226bca4dd03cbae1f05173 /library/IPA_Emulation.ttcnpp
parent898a7e06cc94de19bde28e9823a0bec6ca92a5c0 (diff)
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
Diffstat (limited to 'library/IPA_Emulation.ttcnpp')
-rw-r--r--library/IPA_Emulation.ttcnpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/library/IPA_Emulation.ttcnpp b/library/IPA_Emulation.ttcnpp
index be64dd17..41a3968d 100644
--- a/library/IPA_Emulation.ttcnpp
+++ b/library/IPA_Emulation.ttcnpp
@@ -201,6 +201,10 @@ function f_connect(charstring remote_host, IPL4asp_Types.PortNumber remote_port,
var IPL4asp_Types.Result res;
res := IPA_CodecPort_CtrlFunct.f_IPL4_connect(IPA_PORT, remote_host, remote_port,
local_host, local_port, 0, { tcp:={} });
+ if (not ispresent(res.connId)) {
+ setverdict(fail, "Could not connect IPA socket, check your configuration");
+ self.stop;
+ }
g_ipa_conn_id := res.connId;
g_ccm_pars := ccm_pars;
g_is_bsc_mgw := true;
@@ -212,6 +216,10 @@ function f_bind(charstring local_host, IPL4asp_Types.PortNumber local_port,
var IPL4asp_Types.Result res;
res := IPA_CodecPort_CtrlFunct.f_IPL4_listen(IPA_PORT,
local_host, local_port, { tcp:={} });
+ if (not ispresent(res.connId)) {
+ setverdict(fail, "Could not listen IPA socket, check your configuration");
+ self.stop;
+ }
g_ipa_conn_id := res.connId;
g_ccm_pars := ccm_pars;
g_is_bsc_mgw := false;