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
This commit is contained in:
Neels Hofmeyr 2021-08-16 17:05:51 +00:00
parent f1312f9818
commit 9eb8c9f0d7
4 changed files with 303 additions and 1 deletions

View File

@ -349,6 +349,24 @@ then
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])],,

View File

@ -65,6 +65,7 @@ static int daemonize = 0;
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 @@ static void print_help()
"\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,9 @@ static void handle_long_options(const char *prog_name, const int long_option)
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:
vty_test_mode = true;
break;
default:
fprintf(stderr, "%s: error parsing cmdline options\n", prog_name);
exit(2);
@ -140,6 +146,7 @@ static void handle_options(int argc, char **argv)
{ "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 +306,8 @@ int bts_main(int argc, char **argv)
handle_options(argc, argv);
fprintf(stderr, "((*))\n |\n / \\ OsmoBTS\n");
if (vty_test_mode)
fprintf(stderr, "--- VTY test mode: not connecting to BSC, not exiting ---\n");
g_bts = gsm_bts_alloc(tall_bts_ctx, 0);
if (!g_bts) {
@ -396,6 +405,16 @@ int bts_main(int argc, char **argv)
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);

View File

@ -22,12 +22,38 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac
echo ' [$(PACKAGE_URL)])'; \
} >'$(srcdir)/package.m4'
EXTRA_DIST = testsuite.at $(srcdir)/package.m4 $(TESTSUITE)
EXTRA_DIST = \
testsuite.at \
$(srcdir)/package.m4 \
$(TESTSUITE) \
osmo-bts.vty \
$(NULL)
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)
$(MAKE) $(AM_MAKEFLAGS) python-tests
installcheck-local: atconfig $(TESTSUITE)
$(SHELL) '$(TESTSUITE)' AUTOTEST_PATH='$(bindir)' \

239
tests/osmo-bts.vty Normal file
View File

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