When receiving commands for particular BSC, log BSC id known at the time
when request was made, not the one which is part of the reply.
Change-Id: I6acdfddb9a1132f978f2b55c769559b0c29eb3e8
Since the scripts are intended to be used as systemd services, there's
no need in separate logging via syslog: systemd will take care of
properly collecting and storing script output. Hence we can drop extra
options and function parameters.
Change-Id: Ifcad1877d45d43b3a2e617775a1c9b256e190591
Related: SYS#4399
* reorder imports to make pylint3 happy
* drop unused imports
* use proper spacing for list constants
* don't use reserved names for internal variables
The check was run as follows:
pylint3 -d C0103,C0301,C0410,C0326,R0913,R0901 ...
to disable useless warnings.
Change-Id: I5b90ee790f73dc509081401776911f25e43f1801
This allows to easy skip TRAP messages when we do not want to process
them (for example when waiting for REPLY to a single command). Update
documentation and version accordingly.
Change-Id: I51ce207c19a1ca96c3e2af7d5efd64f79b02fbb4
Due to changes getting out of sync, changes from
I44035323b70f04eb8f5dc12123cb708f53eba188 and
I21ff593be420a374a00073953c9254a013c43164 were overwritten by
I7b59f2dbded9074d15f2d2f40bf5a92ed02601e2 moving code to different
file. Fix this by re-applying those changes in new location.
Change-Id: I811f307ded63e7e1544243921ee07dceae81e295
The ctrl2cgi.py is heavily based upon soap.py - let's move all the
shared code into separate file to make further modifications easier.
Change-Id: I7b59f2dbded9074d15f2d2f40bf5a92ed02601e2
Related: SYS#4399
RSPRO (Remote Sim PROtocol) is used by osmo-remsim and basd on the IPA
multiplex. Let's add knowledge about this stream identifier to osmopy.
Change-Id: I5c0e674390c5672ee1083b1226c206557f6a980b
If the VTY/CTRL output contains trailing newlines, do not cause those to
trigger mismatch errors, rather drop those.
Rationale: in transcript scripts, the amount of empty lines between expected
results is ignored, to allow cosmetically arranging into sections. So trailing
newlines are dropped, and there is no way to preserve those.
Change-Id: I1930868451c5738b17e318a9807590d948210b9a
Because the VTY logging target currently prints '\n\r' instead of '\r\n', the
python splitlines() separates those as interleaving empty lines. Ignore '\r' to
allow verifying VTY logging output as well.
Change-Id: I8de9cebaa9aad275f65c3672985b7cbca343b5a6
twisted_ipa is a module expected to be used by other python scripts, so
move it to osmopy dir to be installed as a lib (in python path) so it
can be later used.
twisted_ipa has some features to use it standalone for testing purposes.
This feature can still be used from new installation path.
Change-Id: I33a0c4263297abd9e111bf43e6e9967c06474318
This helps with debugging of import-related issues - we know the version
under test before the test has a chance to hang.
Change-Id: If13cba60a19e9c15885355f85def4d134fa37993
Related: OS#2821
As of 577f2a95e4f01c58a0a4f4ccb3b70d9c048b626e in osmo-ci, the
contrib/jenkins.sh isused forinstallation. This causes the issue with
python3 because test coded use absolute import by default.
Fix this by adding relative path and import from ../osmopy to make
sure test code uses the current module and not the one which might be
already installed in the system.
Change-Id: I8ac3c0d45fb2e1d18646048703ac405be1c7e539
This script is actually not python 3 compatible yet despite passing
current tests. Let's not install it for python 3 until we can figure out
a way to catch this incompatibility with test code.
Change-Id: Ief11b75acc973dc7aeaac9c2298a21dc5390efe4
Related: OS#2821
* make parse() return command id in addition to variable name and value
* introduce parse_kv() wrapper which ignores that id and use it instead
of old parse()
* make parse() compatible with python3 where we got bytes, not string
from the socket so we have to decode it properly before using split()
* expand test_py3.py with simply asyn server which verifies that
osmo_ctrl.py works properly
Change-Id: I599f9f5a18109929f59386ab4416b8bfd75c74d1
The tools are so far badly under-documented. Alleviate that by comprehensive
description and examples shown by -h option output. Hint at that from the
README.
Change-Id: I94dcad257558b917cb54fc877122594cd164f496
After I30cdf0f85b2a60a235960911c9827f4129da40db,
* the osmo_interact_{vty,ctrl}.py can no longer import osmo_interact_common,
since it was moved to scripts/ in error.
* the osmo_verify_{vty,ctrl} scripts can no longer import osmo_interact_{vty,ctrl},
since it is also in scripts/. Notably, the osmo_interact_{vty,ctrl}.py also
served as scripts while being modules at the same time, which is not good.
Fix these issues by adding a new osmopy/osmo_interact/ submodule with
osmopy/osmo_interact/common.py, /vty.py and /ctrl.py as modules, and add in
scripts thin wrappers that invoke the modules' main().
Change-Id: I40a37b212274cb70ebb1e1d9d1b3743eb2d64d05
Having the scripts in the same directory with library code means that
it'll be installed unconditionally regardless of version check in
setup.py which makes it impossible to write separate tests for python 2
and 3. Fix this by moving the scripts into separate directory and
adjusting init and setup files accordingly.
This is necessary for implementing proper CI tests in follow-up patches.
Change-Id: I30cdf0f85b2a60a235960911c9827f4129da40db
According to https://docs.python.org/3/library/distutils.html the
setuptools are used in place of distutils anyway. Using it directly
allows us to make packaging more flexible: specify dependencies,
automatically find package name etc.
Change-Id: I39ee53f352001e47c6df055cbec52d638480253d
Nowadays bin/python usually points to python3, and this script is written
in python2, which means if run directly from terminal it will fail with
some print syntax errors.
Change-Id: I24a568fc2c3e69e7c9f7b9729bd023fe1f0691c7
Sometimes it is desirable to match any lines, just make sure that a given regex
does *not* exist in the command reply.
For example, during handover config tests, to verify that no handover config
exists, one would have to match an entire 'show running-config' output, which
is subject to change whenever the VTY changes.
Add a wildcard '... !' which allows passing a regex that must not be
encountered, e.g.:
OsmoBSC(config-net)# show running-config
...
network
... !handover
bts 0
...
handover 1
...
This checks that there is no handover config on the network level while bts 0
does have handover config.
Change-Id: I7c1ebb2e7f059047903a53de26a0ec1ce7fa9b98
Those are generic enough and can be used as advanced example of uzing
CTRL interface from python on top of osmo_ipa.
Change-Id: Ic4e1155d3bd546feaabab34a46e354c69058056e
Have common implementations in one place, and expose distinct command line
argument signatures to obtain the separate tasks as separate scripts.
osmo_interact_common.py implements the parts common to all VTY and CTRL
interactions.
osmo_interact_vty.py and osmo_interact_ctrl.py implement commands I/O but only
expose command line args to directly pipe commands and responses.
osmo_verify_transcript_vty.py and osmo_verify_transcript_ctrl.py act as before,
now implemented by importing osmo_interact_{vty,ctrl}.py, only exposing the
verifification command line arguments.
Change-Id: Ie0cbd5db85ebebc893df638a07f5568632563dc9
To retrieve the VTY reference XML from 'show online-help', which we need for
the osmo-gsm-manuals, it is useful to directly print the output of a single VTY
command.
I have also always wanted to be able to just type CTRL commands and get their
results.
Add --command and --output arguments to run specific commands and pipe to
stdout instead of verifying a transcript file, in a way that works generically
for both VTY and CTRL interface.
The scripts' names are now a bit of a misnomer, to be tweaked separately.
Change-Id: I2c31a87fa255092bcd06da239651cc50174c8faa
While adding VTY and CTRL tests to new programs like OsmoHLR, I wanted to have
a simple way to translate a VTY interaction transcript to a VTY python test. It
is fairly trivial to simply read in a transcript, extract both the commands to
send as well as the expected results, and to verify these without having to
write one line of application-specific code. From there it was just a little
step to allow the same for CTRL interaction.
With osmo_verify_transcript_vty.py and osmo_verify_transcript_ctrl.py, it is
possible to have a simple text file of a telnet VTY or CTRL interface
interaction and run it against a given application. With the --update option,
the scripts run the given command and rewrite the transcript file to whatever
the application currently produces as response. Backed by version control, it
is super easy to tweak commands, --update the test results and verify that only
the desired bits changed. A '...' wildcard can skip any number of lines in the
expected result and is usually preserved during --update.
This python3 implementation is independent from the previous obscvty
implementations.
Take the opportunity to clarify/fix a few aspects: for example, it is now
possible to verify the hints that the interactive VTY displays when the user
enters '?' in various places, and to evaluate the prompt character '>'/'#'.
Unitl now, code is duplicated/scattered across various vty_test_runner.py
scripts in different git repositories. Now, a VTY or CTRL transcript is enough
to put a complete test in place.
The simplest invocation is directly from the Makefile, feeding an application
commandline, the proper port number to contact it and e.g. a VTY prompt name.
This new code is also usable as python modules, to be able to build more
complex tests that require specialized intermediate actions, possibly
coordinating launch of applications or data manipulation.
The first repository to employ this is osmo-hlr.git. See change-ids
I42b3b70a0439a8f2e4964d7cc31e593c1f0d7537 for VTY and
Iff93abe370b8f3ecf42082d1d0eaa1fbeca5b122 for CTRL.
Change-Id: Id47331009910e651372b9c9c76e12f2e8964cc2c
At least now that openbsc.git has been split, the IPA and Ctrl API offered by
this file are used across multiple git repositories for python tests. Instead
of having a separate copy of ipa.py in each, have one here.
Rename to osmo_ipa.py to avoid any confusion between old and new files that
might be lying around in the python path.
Change-Id: Iaef955f04b97e8f266339b37b46d2523d1247cb9
When the binary has not been built in the source tree, it was impossible to
call osmodumpdoc.py despite the -p <config-path> option. Look for config files
in that config-path.
Make sure a relative config-path is adjusted when changing to the workdir.
Change-Id: I5427d354c289ec4602411c7059c8d80e2b451f7c
/proc/self/fd refers to the process opening the file. In this case
self will be "ls". Maybe it is better to look at the FDs open in
the test runner itself.
Change-Id: I638e94f16f4019a7b6026d1fae69e677870fb253
Each test run returns 1 on error, so instead of |=, why not count the number of
errors with +=. Also print the final error count.
Change-Id: I690dde3711555a3447e5ad4cc0a04a7a869a8296
When a test run encounters an Exception, the test config file name is printed,
but that may already be gone when done, so also print the complete actual test
config file contents, making it easy to reproduce the failure manually.
Change-Id: I9b00f170fb0cdceb35b9231eb1f2c545ba079d1d
Recent commit b59b677c9b called proc.terminate()
instead of killing right away, with a .1 second sleep. Reduce this sleep to
a minuscule first wait_time, remaining tolerant for processes that take longer.
Actually all of our current processes are very fast to terminate. This patch
was created while looking for a different problem, now that it's there we might
as well keep it.
Change-Id: I98849e4550116c5666fdf6f5d4cbb576ffa3e14a
The VTYInteract tests gave a constant sleep(1) grace period for the process to
startup. This caused the test to take minutes for no reason at all.
Add code to VTYInteract._connect_socket() to try and connect right away,
retrying up to three seconds in .1 second intervals. This flies through most
tests without any sleep() at all.
When TCP socket debugging is switched on, also print how many connection tries
it took to connect the VTY socket.
Note that the openbsc python tests also add some sleep()s that also need to be
removed to benefit from this.
Change-Id: Icc337f52a93d5fe31fc4ff235ccaf4e0fe75fa39
It appears that during some error conditions, the socket will not be in the tcp
socket debug tracking list, and on top of an exception this barfs as well.
Let's not care about the tcp debug list and avoid confusing error messages.
Change-Id: I8daa317fed8fc7e720dccb70fd5f7fc74fde423f
It appears that during some error conditions, the socket will not be in the tcp
socket debug tracking list, and on top of an exception this barfs as well.
Let's not care about the tcp debug list and avoid confusing error messages.
Change-Id: Ib7b0e45fa1f5551da2fc81b71dcc227eee533f44