Change in osmo-bts[master]: add VTY transcript testing

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/.

neels gerrit-no-reply at lists.osmocom.org
Mon Aug 16 18:43:33 UTC 2021


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/25198 )


Change subject: add VTY transcript testing
......................................................................

add VTY transcript testing

This is not as trivial as with OsmoBSC or OsmoMSC, because normally the
osmo-bts process exits right away when there is no BSC. Hence add
--vty-test option to main.

Use 'osmo-bts-virtual --vty-test' for testing. The other BTS models
require dependencies / configure switches to be built.

Essentially copied from osmo-bsc.git:
configure.ac: add --enable-external-tests
tests/Makefile.am: add 'vty-test' target

Add osmo-bts.vty, some trivial VTY node testing.

This prepares for adding VTY tests for T timer configuration added in a
subsequent patch.

Related: SYS#5559
Change-Id: I730daf548a3a9bb116aa8b6d5772ca9af0ada08f
---
M configure.ac
M src/common/main.c
M tests/Makefile.am
A tests/osmo-bts.vty
4 files changed, 297 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/98/25198/1

diff --git a/configure.ac b/configure.ac
index 2b5a316..1b4c6e7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -349,6 +349,24 @@
 	AC_SUBST([OSMO_GSM_MANUALS_DIR])
 fi
 
+AC_ARG_ENABLE([external_tests],
+		AC_HELP_STRING([--enable-external-tests],
+				[Include the VTY/CTRL tests in make check [default=no]]),
+		[enable_ext_tests="$enableval"],[enable_ext_tests="no"])
+if test "x$enable_ext_tests" = "xyes" ; then
+	AC_CHECK_PROG(PYTHON3_AVAIL,python3,yes)
+	 if test "x$PYTHON3_AVAIL" != "xyes" ; then
+		AC_MSG_ERROR([Please install python3 to run the VTY/CTRL tests.])
+	fi
+	AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
+	 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
+		AC_MSG_ERROR([Please install git://osmocom.org/python/osmo-python-tests to run the VTY/CTRL tests.])
+	fi
+fi
+AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
+AC_MSG_RESULT([$enable_ext_tests])
+AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
+
 # https://www.freedesktop.org/software/systemd/man/daemon.html
 AC_ARG_WITH([systemdsystemunitdir],
      [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
diff --git a/src/common/main.c b/src/common/main.c
index bc5cf3b..ac1df23 100644
--- a/src/common/main.c
+++ b/src/common/main.c
@@ -65,6 +65,7 @@
 static int rt_prio = -1;
 static char *gsmtap_ip = 0;
 extern int g_vty_port_num;
+static bool vty_test_mode = false;
 
 static void print_help()
 {
@@ -80,6 +81,8 @@
 		"\nVTY reference generation:\n"
 		"	--vty-ref-mode MODE	VTY reference generation mode (e.g. 'expert').\n"
 		"	--vty-ref-xml		Generate the VTY reference XML output and exit.\n"
+		"\nRegression testing:\n"
+		"       --vty-test		VTY test mode. Do not connect to BSC, do not exit.\n"
 		);
 	bts_model_print_help();
 }
@@ -103,6 +106,10 @@
 			get_value_string(vty_ref_gen_mode_desc, vty_ref_mode));
 		vty_dump_xml_ref_mode(stdout, (enum vty_ref_gen_mode) vty_ref_mode);
 		exit(0);
+	case 3:
+		fprintf(stderr, "Starting in VTY test mode, no connecting to BSC\n");
+		vty_test_mode = true;
+		break;
 	default:
 		fprintf(stderr, "%s: error parsing cmdline options\n", prog_name);
 		exit(2);
@@ -140,6 +147,7 @@
 			{ "realtime", 1, 0, 'r' },
 			{ "vty-ref-mode", 1, &long_option, 1 },
 			{ "vty-ref-xml", 0, &long_option, 2 },
+			{ "vty-test", 0, &long_option, 3 },
 			{ 0, 0, 0, 0 }
 		};
 
@@ -299,6 +307,8 @@
 	handle_options(argc, argv);
 
 	fprintf(stderr, "((*))\n  |\n / \\ OsmoBTS\n");
+	if (vty_test_mode)
+		fprintf(stderr, "--- VTY test mode ---\n");
 
 	g_bts = gsm_bts_alloc(tall_bts_ctx, 0);
 	if (!g_bts) {
@@ -396,6 +406,16 @@
 	signal(SIGUSR2, &signal_handler);
 	osmo_init_ignore_signals();
 
+	if (vty_test_mode) {
+		/* Just select-loop without connecting to the BSC, don't exit. This allows running tests on the VTY
+		 * telnet port. */
+		while (!quit) {
+			log_reset_context();
+			osmo_select_main(0);
+		}
+		return EXIT_SUCCESS;
+	}
+
 	if (abis_open(g_bts, "osmo-bts") != 0)
 		exit(1);
 
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 57687ee..d125ddc 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -26,6 +26,26 @@
 TESTSUITE = $(srcdir)/testsuite
 DISTCLEANFILES = atconfig
 
+if ENABLE_EXT_TESTS
+python-tests: $(BUILT_SOURCES)
+	$(MAKE) vty-test
+else
+python-tests: $(BUILT_SOURCES)
+	echo "Not running python-based tests (determined at configure-time)"
+endif
+
+# Run a specific test with: 'make vty-test VTY_TEST=foo.vty'
+VTY_TEST ?= *.vty
+
+# To update the VTY script from current application behavior,
+# pass -u to vty_script_runner.py by doing:
+#   make vty-test U=-u
+vty-test:
+	osmo_verify_transcript_vty.py -v \
+		-n OsmoBTS -p 4241 \
+		-r "$(top_builddir)/src/osmo-bts-virtual/osmo-bts-virtual --vty-test -c $(top_srcdir)/doc/examples/virtual/osmo-bts-virtual.cfg" \
+		$(U) $(srcdir)/$(VTY_TEST)
+
 check-local: atconfig $(TESTSUITE)
 	$(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS)
 
diff --git a/tests/osmo-bts.vty b/tests/osmo-bts.vty
new file mode 100644
index 0000000..4983967
--- /dev/null
+++ b/tests/osmo-bts.vty
@@ -0,0 +1,239 @@
+OsmoBTS> list
+...
+  show bts [<0-255>]
+  show trx [<0-255>] [<0-255>]
+  show timeslot [<0-255>] [<0-255>] [<0-7>]
+  show lchan [<0-255>] [<0-255>] [<0-7>] [<0-7>]
+  show lchan summary [<0-255>] [<0-255>] [<0-7>] [<0-7>]
+  show bts <0-255> gprs
+...
+  show e1_driver
+  show e1_line [<0-255>] [stats]
+  show e1_timeslot [<0-255>] [<0-31>]
+...
+OsmoBTS> ?
+...
+  show      Show running system information
+...
+
+OsmoBTS> show ?
+...
+  bts             Display information about a BTS
+  trx             Display information about a TRX
+  timeslot        Display information about a TS
+  lchan           Display information about a logical channel
+  e1_driver       Display information about available E1 drivers
+  e1_line         Display information about a E1 line
+  e1_timeslot     Display information about a E1 timeslot
+...
+OsmoBTS> show bts ?
+  [<0-255>]  BTS Number
+  <0-255>    BTS Number
+OsmoBTS> show bts 0 ?
+  gprs  GPRS/EGPRS configuration
+  <cr>  
+OsmoBTS> show trx ?
+  [<0-255>]  BTS Number
+OsmoBTS> show trx 0 ?
+  [<0-255>]  TRX Number
+OsmoBTS> show timeslot ?
+  [<0-255>]  BTS Number
+OsmoBTS> show timeslot 0 ?
+  [<0-255>]  TRX Number
+OsmoBTS> show timeslot 0 0 ?
+  [<0-7>]  Timeslot Number
+OsmoBTS> show lchan ?
+  [<0-255>]  BTS Number
+  summary    Short summary
+OsmoBTS> show lchan 0 ?
+  [<0-255>]  TRX Number
+OsmoBTS> show lchan 0 0 ?
+  [<0-7>]  Timeslot Number
+OsmoBTS> show lchan 0 0 0 ?
+  [<0-7>]  Logical Channel Number
+OsmoBTS> show lchan summary ?
+  [<0-255>]  BTS Number
+OsmoBTS> show lchan summary 0 ?
+  [<0-255>]  TRX Number
+OsmoBTS> show lchan summary 0 0 ?
+  [<0-7>]  Timeslot Number
+OsmoBTS> show lchan summary 0 0 0 ?
+  [<0-7>]  Logical Channel Number
+OsmoBTS> show e1_driver ?
+  <cr>  
+OsmoBTS> show e1_line ?
+  [<0-255>]  E1 Line Number
+OsmoBTS> show e1_line 0 ?
+  [stats]  Include statistics
+OsmoBTS> show e1_timeslot ?
+  [<0-255>]  E1 Line Number
+OsmoBTS> show e1_timeslot 0 ?
+  [<0-31>]  E1 Timeslot Number
+
+OsmoBTS> enable
+OsmoBTS# list
+...
+  show bts [<0-255>]
+  show trx [<0-255>] [<0-255>]
+  show timeslot [<0-255>] [<0-255>] [<0-7>]
+  show lchan [<0-255>] [<0-255>] [<0-7>] [<0-7>]
+  show lchan summary [<0-255>] [<0-255>] [<0-7>] [<0-7>]
+  show bts <0-255> gprs
+...
+  bts <0-0> trx <0-255> ts <0-7> (lchan|shadow-lchan) <0-7> rtp jitter-buffer <0-10000>
+  test send-failure-event-report <0-255>
+  bts <0-255> c0-power-red <0-6>
+  show e1_driver
+  show e1_line [<0-255>] [stats]
+  show e1_timeslot [<0-255>] [<0-31>]
+...
+
+OsmoBTS# ?
+...
+  show       Show running system information
+...
+
+OsmoBTS# show ?
+...
+  bts             Display information about a BTS
+  trx             Display information about a TRX
+  timeslot        Display information about a TS
+  lchan           Display information about a logical channel
+  e1_driver       Display information about available E1 drivers
+  e1_line         Display information about a E1 line
+  e1_timeslot     Display information about a E1 timeslot
+...
+OsmoBTS# show bts ?
+  [<0-255>]  BTS Number
+  <0-255>    BTS Number
+OsmoBTS# show bts 0 ?
+  gprs  GPRS/EGPRS configuration
+  <cr>  
+OsmoBTS# show trx ?
+  [<0-255>]  BTS Number
+OsmoBTS# show trx 0 ?
+  [<0-255>]  TRX Number
+OsmoBTS# show timeslot ?
+  [<0-255>]  BTS Number
+OsmoBTS# show timeslot 0 ?
+  [<0-255>]  TRX Number
+OsmoBTS# show timeslot 0 0 ?
+  [<0-7>]  Timeslot Number
+OsmoBTS# show lchan ?
+  [<0-255>]  BTS Number
+  summary    Short summary
+OsmoBTS# show lchan 0 ?
+  [<0-255>]  TRX Number
+OsmoBTS# show lchan 0 0 ?
+  [<0-7>]  Timeslot Number
+OsmoBTS# show lchan 0 0 0 ?
+  [<0-7>]  Logical Channel Number
+OsmoBTS# show lchan summary ?
+  [<0-255>]  BTS Number
+OsmoBTS# show lchan summary 0 ?
+  [<0-255>]  TRX Number
+OsmoBTS# show lchan summary 0 0 ?
+  [<0-7>]  Timeslot Number
+OsmoBTS# show lchan summary 0 0 0 ?
+  [<0-7>]  Logical Channel Number
+OsmoBTS# show e1_driver ?
+  <cr>  
+OsmoBTS# show e1_line ?
+  [<0-255>]  E1 Line Number
+OsmoBTS# show e1_line 0 ?
+  [stats]  Include statistics
+OsmoBTS# show e1_timeslot ?
+  [<0-255>]  E1 Line Number
+OsmoBTS# show e1_timeslot 0 ?
+  [<0-31>]  E1 Timeslot Number
+
+OsmoBTS# configure terminal
+OsmoBTS(config)# list
+...
+  bts BTS_NR
+...
+  phy <0-255>
+  e1_input
+...
+OsmoBTS(config)# ?
+...
+  bts        Select a BTS to configure
+...
+  phy        Select a PHY to configure
+  e1_input   Configure E1/T1/J1 TDM input
+...
+OsmoBTS(config)# bts ?
+  BTS_NR  BTS Number
+OsmoBTS(config)# phy ?
+  <0-255>  PHY number
+
+OsmoBTS(config)# bts 0
+OsmoBTS(bts)# list
+...
+  ipa unit-id <0-65534> <0-255>
+  oml remote-ip A.B.C.D
+  no oml remote-ip A.B.C.D
+  rtp jitter-buffer <0-10000> [adaptive]
+  rtp port-range <1-65534> <1-65534>
+  rtp ip-dscp <0-63>
+  rtp socket-priority <0-255>
+  band (450|GSM450|480|GSM480|750|GSM750|810|GSM810|850|GSM850|900|GSM900|1800|DCS1800|1900|PCS1900)
+  description .TEXT
+  no description
+  paging queue-size <1-1024>
+  paging lifetime <0-60>
+  agch-queue-mgmt default
+  agch-queue-mgmt threshold <0-100> low <0-100> high <0-100000>
+  min-qual-rach <-100-100>
+  min-qual-norm <-100-100>
+  max-ber10k-rach <0-10000>
+  pcu-socket PATH
+  supp-meas-info toa256
+  no supp-meas-info toa256
+  smscb queue-max-length <1-60>
+  smscb queue-target-length <1-30>
+  smscb queue-hysteresis <0-30>
+  gsmtap-remote-host [HOSTNAME]
+  no gsmtap-remote-host
+  gsmtap-sapi (enable-all|disable-all)
+  gsmtap-sapi (bcch|ccch|rach|agch|pch|sdcch|tch/f|tch/h|pacch|pdtch|ptcch|cbch|sacch)
+  no gsmtap-sapi (bcch|ccch|rach|agch|pch|sdcch|tch/f|tch/h|pacch|pdtch|ptcch|cbch|sacch)
+  trx <0-254>
+...
+OsmoBTS(bts)# ?
+...
+  ipa                 ip.access RSL commands
+  oml                 OML Parameters
+  no                  Negate a command or set its defaults
+  rtp                 RTP parameters
+  band                Set the frequency band of this BTS
+  description         Save human-readable description of the object
+  paging              Paging related parameters
+  agch-queue-mgmt     AGCH queue mgmt
+  min-qual-rach       Set the minimum link quality level of Access Bursts to be accepted
+  min-qual-norm       Set the minimum link quality level of Normal Bursts to be accepted
+  max-ber10k-rach     Set the maximum BER for valid RACH requests
+  pcu-socket          Configure the PCU socket file/path name
+  supp-meas-info      Configure the RSL Supplementary Measurement Info
+  smscb               SMSCB (SMS Cell Broadcast) / CBCH configuration
+  gsmtap-remote-host  Enable GSMTAP Um logging (see also 'gsmtap-sapi')
+  gsmtap-sapi         Enable/disable sending of UL/DL messages over GSMTAP
+  trx                 Select a TRX to configure
+...
+OsmoBTS(bts)# trx 0
+OsmoBTS(trx)# list
+...
+  user-gain <-100000-100000> (dB|mdB)
+  power-ramp max-initial <-10000-100000> (dBm|mdBm)
+  power-ramp step-size <1-100000> (dB|mdB)
+  power-ramp step-interval <1-100>
+  ms-power-control (dsp|osmo)
+  phy <0-255> instance <0-255>
+...
+OsmoBTS(trx)# ?
+...
+  user-gain         Inform BTS about additional, user-provided gain or attenuation at TRX output
+  power-ramp        Power-Ramp settings
+  ms-power-control  Mobile Station Power Level Control
+  phy               Configure PHY Link+Instance for this TRX
+...

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/25198
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I730daf548a3a9bb116aa8b6d5772ca9af0ada08f
Gerrit-Change-Number: 25198
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210816/c3977d30/attachment.htm>


More information about the gerrit-log mailing list