OsmoCtrl cleanup: get_var(), set_var(), get_trap()

CTRL interface interaction was mostly inherited from the first legacy
implementation of osmo-gsm-tester, and it was a pain to look at from the
start. Now, while I'm close to the topic, I want this to improve:

Properly match a GET_REPLY/SET_REPLY to a sent GET/SET by the message
ID.

Completely drop the do_get() and do_set(), which were not useful for
correct handling of the CTRL request and response messaging. The API to
use by callers is set_var(), get_var()/get_int_var() and get_trap().
These call the internal _sendrecv() (or for TRAP only _recv())
functions. Make it so that tese work both on an already connected
OsmoCtrl, as well as one that needs to establish a (short) connection,
so that both are trivially possible:

    # one CTRL connection stays open
    with OsmoCtrl(...) as ctrl:
  	ctrl.get_var('var1')
  	ctrl.get_var('var2')
  	ctrl.get_var('var3')

and

  # get_var() opens a connection, does the GET and closes again
  OsmoCtrl(...).get_var('var1')

Do away with doubling the instances OsmoCtrl and e.g. OsmoBscCtrl.
Rather make OsmoBscCtrl a child class of OsmoCtrl, which means that we
no longer have bsc.ctrl().ctrl(), just bsc.ctrl().

Have VERB_* constants instead of dup'd strings.

Apply to / simplify all callers of OsmoCtrl.

Some of these changes are similar to recently added OsmoVty.

Change-Id: Id561e5a55d8057a997a8ec9e7fa6f94840194df1
4 files changed
tree: 646c226367a48948bc91310d5fd96ca2d3b40cf7
  1. contrib/
  2. doc/
  3. selftest/
  4. src/
  5. sysmocom/
  6. utils/
  7. .gitignore
  8. .gitreview
  9. COPYING
  10. Makefile
  11. README.md
README.md

About Osmo-GSM-Tester

Osmo-GSM-Tester is a software to run automated tests on real hardware, initially foremost to verify that ongoing Osmocom software development continues to work with various BTS models, while being flexibly configurable and extendable to work for other technologies, setups and projects. It can nowadays also be used to run 4G networks with components from different providers.

Find Osmo-GSM-Tester issue tracker and wiki online at https://osmocom.org/projects/osmo-gsm-tester

Simple configuration setups can be found under doc/examples/ directory. A Osmocom's public Osmo-Gsm-Tester configuration setup is also maintained here under sysmocom/ as a reference for others.

Ansible scripts to set up hosts to be used as Osmo-GSM-Tester Main Units or/and Slave Units on the above mentioned setup can be found at https://git.osmocom.org/osmo-ci/tree/ansible, which actually install sample system configuration files from utils/ directory in this same repository.

A sample Docker setup is also maintained publicly at https://git.osmocom.org/docker-playground/tree/osmo-gsm-tester.

For the complete documentation, please refer to Osmo-GSM-Tester User manual, available in sources under doc/manuals/ under this same repository, and prebuilt in pdf form at http://ftp.osmocom.org/docs/latest/osmo-gsm-tester-manual.pdf