Change in osmo-ttcn3-hacks[master]: detect VTY TELNET port connection failures (attempt #2)

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Stefan Sperling gerrit-no-reply at lists.osmocom.org
Fri Jul 27 15:26:52 UTC 2018


Stefan Sperling has uploaded this change for review. ( https://gerrit.osmocom.org/10196


Change subject: detect VTY TELNET port connection failures (attempt #2)
......................................................................

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
---
M bsc/BSC_Tests.default
M bts/BTS_Tests.default
M ggsn_tests/GGSN_Tests.default
M hlr/HLR_Tests.default
M library/Osmocom_VTY_Functions.ttcn
M msc/MSC_Tests.default
M sccp/SCCP_Tests.default
M sgsn/SGSN_Tests.default
M sip/SIP_Tests.default
9 files changed, 17 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/96/10196/1

diff --git a/bsc/BSC_Tests.default b/bsc/BSC_Tests.default
index c13f7b0..8818359 100644
--- a/bsc/BSC_Tests.default
+++ b/bsc/BSC_Tests.default
@@ -15,6 +15,7 @@
 *.BSCVTY.CTRL_DETECT_SERVER_DISCONNECTED := "yes"
 *.BSCVTY.CTRL_READMODE := "buffered"
 *.BSCVTY.CTRL_CLIENT_CLEANUP_LINEFEED := "yes"
+*.BSCVTY.CTRL_DETECT_CONNECTION_ESTABLISHMENT_RESULT := "yes"
 *.BSCVTY.PROMPT1 := "OsmoBSC> "
 
 [MODULE_PARAMETERS]
diff --git a/bts/BTS_Tests.default b/bts/BTS_Tests.default
index 502c17f..f254993 100644
--- a/bts/BTS_Tests.default
+++ b/bts/BTS_Tests.default
@@ -12,6 +12,7 @@
 *.BTSVTY.CTRL_DETECT_SERVER_DISCONNECTED := "yes"
 *.BTSVTY.CTRL_READMODE := "buffered"
 *.BTSVTY.CTRL_CLIENT_CLEANUP_LINEFEED := "yes"
+*.BTSVTY.CTRL_DETECT_CONNECTION_ESTABLISHMENT_RESULT := "yes"
 *.BTSVTY.PROMPT1 := "OsmoBTS> "
 *.PCU.socket_type := "SEQPACKET"
 
diff --git a/ggsn_tests/GGSN_Tests.default b/ggsn_tests/GGSN_Tests.default
index ff0cd97..4d52e24 100644
--- a/ggsn_tests/GGSN_Tests.default
+++ b/ggsn_tests/GGSN_Tests.default
@@ -8,6 +8,7 @@
 *.GGSNVTY.CTRL_DETECT_SERVER_DISCONNECTED := "yes"
 *.GGSNVTY.CTRL_READMODE := "buffered"
 *.GGSNVTY.CTRL_CLIENT_CLEANUP_LINEFEED := "yes"
+*.GGSNVTY.CTRL_DETECT_CONNECTION_ESTABLISHMENT_RESULT := "yes"
 *.GGSNVTY.PROMPT1 := "OsmoGGSN> "
 
 [MODULE_PARAMETERS]
diff --git a/hlr/HLR_Tests.default b/hlr/HLR_Tests.default
index f458479..84d4ff3 100644
--- a/hlr/HLR_Tests.default
+++ b/hlr/HLR_Tests.default
@@ -9,6 +9,7 @@
 *.VTY.CTRL_DETECT_SERVER_DISCONNECTED := "yes"
 *.VTY.CTRL_READMODE := "buffered"
 *.VTY.CTRL_CLIENT_CLEANUP_LINEFEED := "yes"
+*.VTY.CTRL_DETECT_CONNECTION_ESTABLISHMENT_RESULT := "yes"
 *.VTY.PROMPT1 := "OsmoHLR> "
 
 [MODULE_PARAMETERS]
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 @@
 	/* 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 @@
 				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;
diff --git a/msc/MSC_Tests.default b/msc/MSC_Tests.default
index bcaae06..a24fa38 100644
--- a/msc/MSC_Tests.default
+++ b/msc/MSC_Tests.default
@@ -20,6 +20,7 @@
 *.MSCVTY.CTRL_DETECT_SERVER_DISCONNECTED := "yes"
 *.MSCVTY.CTRL_READMODE := "buffered"
 *.MSCVTY.CTRL_CLIENT_CLEANUP_LINEFEED := "yes"
+*.MSCVTY.CTRL_DETECT_CONNECTION_ESTABLISHMENT_RESULT := "yes"
 *.MSCVTY.PROMPT1 := "OsmoMSC> "
 
 
diff --git a/sccp/SCCP_Tests.default b/sccp/SCCP_Tests.default
index 7d16e5b..95e0d2f 100644
--- a/sccp/SCCP_Tests.default
+++ b/sccp/SCCP_Tests.default
@@ -15,6 +15,7 @@
 *.SCCP_DEMO_USER_VTY.CTRL_DETECT_SERVER_DISCONNECTED := "yes"
 *.SCCP_DEMO_USER_VTY.CTRL_READMODE := "buffered"
 *.SCCP_DEMO_USER_VTY.CTRL_CLIENT_CLEANUP_LINEFEED := "yes"
+*.SCCP_DEMO_USER_VTY.CTRL_DETECT_CONNECTION_ESTABLISHMENT_RESULT := "yes"
 *.SCCP_DEMO_USER_VTY.PROMPT1 := "sccp-demo-user> "
 
 [MODULE_PARAMETERS]
diff --git a/sgsn/SGSN_Tests.default b/sgsn/SGSN_Tests.default
index bac5fdd..3957e82 100644
--- a/sgsn/SGSN_Tests.default
+++ b/sgsn/SGSN_Tests.default
@@ -15,6 +15,7 @@
 *.SGSNVTY.CTRL_DETECT_SERVER_DISCONNECTED := "yes"
 *.SGSNVTY.CTRL_READMODE := "buffered"
 *.SGSNVTY.CTRL_CLIENT_CLEANUP_LINEFEED := "yes"
+*.SGSNVTY.CTRL_DETECT_CONNECTION_ESTABLISHMENT_RESULT := "yes"
 *.SGSNVTY.PROMPT1 := "OsmoSGSN> "
 
 
diff --git a/sip/SIP_Tests.default b/sip/SIP_Tests.default
index 2576b33..4434a1a 100644
--- a/sip/SIP_Tests.default
+++ b/sip/SIP_Tests.default
@@ -13,6 +13,7 @@
 *.SIPVTY.CTRL_DETECT_SERVER_DISCONNECTED := "yes"
 *.SIPVTY.CTRL_READMODE := "buffered"
 *.SIPVTY.CTRL_CLIENT_CLEANUP_LINEFEED := "yes"
+*.SIPVTY.CTRL_DETECT_CONNECTION_ESTABLISHMENT_RESULT := "yes"
 *.SIPVTY.PROMPT1 := "OsmoSIPcon> "
 
 *.SIP.local_sip_port := "5060"

-- 
To view, visit https://gerrit.osmocom.org/10196
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I56925f93af6c55e93f3f417099db135744da6a40
Gerrit-Change-Number: 10196
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling <ssperling at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180727/f4dcef7b/attachment.htm>


More information about the gerrit-log mailing list