summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorStefan Sperling <ssperling@sysmocom.de>2018-07-27 17:20:38 +0200
committerStefan Sperling <ssperling@sysmocom.de>2018-07-27 17:20:38 +0200
commit23b45974ce6401638ce0e69d704effc9719b9712 (patch)
tree7af6f38bec80cf2ae52611ede0e638896397de7c /library
parentb0970093dd524d27e7bfff88aa1d075086676d1c (diff)
detect VTY TELNET port connection failures (attempt #2)
Pass the CTRL_DETECT_CONNECTION_ESTABLISHMENT_RESULT parameter to the TELNET port by default. This allows tests to make progress into an error handling path if they are started while the osmo-* program they want to connect on VTY is not running. Observed with osmo-ggsn tests, where if the one test runs into a VTY connection failure the subsequent test would get stuck forever in a map() call on the VTY TELNET port. Teach the function f_vty_wait_for_prompt() about connection reports by the TELNET module. We may now receive an integer which represents the socket file descriptor for the telnet connection. This case was not handled by the previous change made in commit cb111b21aba1d5881da1a1d3f19754cbd15b3779. As a result, BSC tests started failing with "VTY Timeout for prompt" because the alt-statement in f_vty_wait_for_prompt() would not progress past the integer sitting on the VTY port's receive queue. Change-Id: I56925f93af6c55e93f3f417099db135744da6a40 Related: OS#3149
Diffstat (limited to 'library')
-rw-r--r--library/Osmocom_VTY_Functions.ttcn9
1 files changed, 9 insertions, 0 deletions
diff --git a/library/Osmocom_VTY_Functions.ttcn b/library/Osmocom_VTY_Functions.ttcn
index 6e4eb74..427bd5c 100644
--- a/library/Osmocom_VTY_Functions.ttcn
+++ b/library/Osmocom_VTY_Functions.ttcn
@@ -46,6 +46,7 @@ module Osmocom_VTY_Functions {
/* wait for any of the permitted prompts; buffer + return all intermediate output */
function f_vty_wait_for_prompt(TELNETasp_PT pt) return charstring {
var charstring rx, buf := "";
+ var integer fd;
timer T := 2.0;
T.start;
@@ -57,6 +58,14 @@ module Osmocom_VTY_Functions {
testcase.stop(fail, "VTY: Unknown Command");
};
[] pt.receive(charstring:?) -> value rx { buf := buf & rx; repeat };
+ [] pt.receive(integer:?) -> value fd {
+ if (fd == -1) {
+ setverdict(fail, "VTY Telnet Connection Failure");
+ mtc.stop;
+ } else {
+ repeat; /* telnet connection succeeded */
+ }
+ }
[] T.timeout {
setverdict(fail, "VTY Timeout for prompt");
mtc.stop;