Log the basic location-state trap triggering request and command reply
as info level - that way we can receive useful information without
turning on full debug output.
Change-Id: If8eae9f36292930571954becf6613fada43d301c
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
Manual acquire()/release() of semaphore does not limit number of
concurrent requests when combined with explicit yield. Fix this by using
semaphore.run() and removing inilineCallbacks decorator.
Change-Id: I47b8b9f5b726ca0905bb7c023d63b325c7f7d85f
Related: SYS#4399
Previously command-line arguments without defaults took precedence over
config file variables while values from config file which had
command-line counterparts with default value were silently ignored.
Let's fix this by making config file option mandatory values and
removing overlap between command-line and config file parameters.
Change-Id: I471b5a6497eadce6456e835233fdaba88a593324
Related: SYS#4399
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
Previously handle_reply() was marked as deferred callback unlike soap.py
where it's synchronous function. This seems to be causing issues where
some of the callbacks are not yield properly. Let's move to the
known-to-work semantics of soap.py where async functions are limited to
Trap() class.
Change-Id: Ib2c28dd7f79cbd28d475de93750703659ddd18f1
Related: SYS#4399
Sometimes when we set variable we might receive arbitrary number of TRAP
messages before we get SET_REPLY. Those could be either separate
messages or combined together with SET_REPLY depending on tcp buffering
at server side. Let's handle this gracefully by skipping over all TRAP
messages.
An example command which often triggers this behavior:
./osmo_ctrl.py -s -d 127.0.0.1 -p 4249 bts.0.location (date +%s)",fix2d,1,2,3"
Change-Id: Ia6de02c2f13a56f0381c97a9ab02c6c7a31cc32f
Related: SYS#4399
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
After further testing it turns out that Trap() have too many
implementation details which makes it cumbersome to be shared. Instead,
it's easier to make it into wrapper over shared functions.
Change-Id: I8a3c62bcdf4286f8127c5b6d8dee6d740aca23b9
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
systemd errors due to executabl path not being absolute:
systemd[1]: [/lib/systemd/system/osmo-ctrl2cgi.service:7] Executable path is not absolute, ignoring: python3 /usr/bin/ctrl2cgi.py
systemd[1]: osmo-ctrl2cgi.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Change-Id: I8e3d695951fb36d53c112b6dce10a275b757ca5a
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
This scripts implements a similar proxy to the one already available in
soapy.py, but aiming at converting CTRl into a regular HTTP POST Request
to be handled by a CGI script in the HTTP server.
Furthermore, it includes several improvements over the soapy.py script,
such as using a token to authenticate users and capability to read some
parameters from a cfg file.
Change-Id: I7a83ecb379835e295c8cb4c27c39883783746544
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 allows us to package osmopy as debian package.
The package currently includes both the library as well as the
executables/scripts. It might make sense to separate that into
a pure library package and an "utils" package
Related: SYS#3028
Change-Id: I332fb82d0e8dd09c5cf53caafa6a63297a8e3881
If older incompatible version of osmopython is already available, it
might be chosen fori mport instead of current version. Fix this by
explicitly prepending the proper version to path.
Change-Id: Icbe2af1e3815406213be29e0c0360432dc9fd6fb
Related: OS#2821
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 simple tool dump all the rate counters available via ctrl interface
to cvs file (or stdout).
Change-Id: I12b369434e4ee9b38f92872f297e1f3d4f0698c2
Fixes: OS#2550
We usually do only space indenting in our py code, replace tabs with spaces.
Change to one script path per line for easier patch reading in the future.
Add a vim expandtab comment.
Change-Id: I8a501715127c2583a630b1efb0d5316574eea173
Install these scripts as py2 only.
These scripts were added to py3 in error by commit "Improve python3
compatibility", I80e5850a8978d78cda793e2192ef4bd3fd54a121, which only addresses
print() compatibility but not encoding.
Recent patch Ief11b75acc973dc7aeaac9c2298a21dc5390efe4 removes osmotestvty.py
from py3 installation. osmodumpdoc.py and osmotestconfig.py are still py2 for
the same reasons and are also likely to fail when run as python3.
Related: OS#2821
Change-Id: Ibf8fc488ae2c022f75f0ca63483d80ed701e8c40
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
Use proper print() function to make scripts compatible with both python
2 and 3. This paves the way to deprecating python 2 support altogether.
Change-Id: I80e5850a8978d78cda793e2192ef4bd3fd54a121
* 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
It's a standalone script illustrating the use of ctrl protocol from
python. Since it's not used as a library and nothing depends on it, we
can safely switch to python3.
Change-Id: I2461dd9af67771beed5306116e8a1b0ee2285aa8
Move the libs/scripts that they (possibly) replace below the new additions and
mention that they are superseded.
Change-Id: Ic50e15d6cb6e94b6e171d954d75b94e09b22d548
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
To allow running the scripts from within the scripts/ dir without having to
install osmopy on the system first, place a symlink to the osmopy module dir.
This allows testing modifications without having to run setup.py all the time.
Change-Id: I880c8afa8d02ef112a80cb54f649ec71902bbd4c