Commit Graph

45 Commits

Author SHA1 Message Date
Pau Espin 34b26aa97b osmo_ms_driver: Store Mobile and VirtPhy content under test rundir
Change-Id: I89223e0d77bcb3e6921be683d705161009630a2c
2023-04-12 16:55:00 +02:00
Pau Espin a442cb8e5f Update obj classes in obj/ to use testenv instead of suite_run
Change-Id: Idf41243a497de7bc507b9f1cd1b38640f456f815
2020-05-05 13:56:01 +02:00
Pau Espin 045245d5ae check_dependencies: Import modules dynamically and find related debian packages
This way we don't need to manually add new imports here or drop unusued
ones. It also makes sure local imports in all our py files is correct.
For instance, running the script already caught an issue which is added
to this patch (osmo_ms_driver/__main__.py).

This new version of the script also allows specifying subsets of
features to skip when checking for dependencies. This way, for instance
somebody not willing to use a sispm powersupply can stil check all the
needed dependencies are fine.

This new tool will make it easier to slowly make some dependencies only
used by some object test classes optional (for instance, python-smpplib
if user doesn't want to run an ESME node).

It also allows to retrieve the required debian/manually installed
packages when run with "-p" option:
"""
Debian packages:
        libpython3.5-minimal:amd64
        python3-gi
        python3-six
        libpython3.5-stdlib:amd64
        python3-pygments
        python3-yaml
        python3-mako
        python3-numpy
        python3-markupsafe

Modules without debian package (pip or setuptools?):
        usb                  [dpkg-query: no path found matching pattern /usr/local/lib/python3.5/dist-packages/usb/_interop.py]
        pydbus               [dpkg-query: no path found matching pattern /usr/local/lib/python3.5/dist-packages/pydbus/proxy.py]
        smpplib              [dpkg-query: no path found matching pattern /usr/local/lib/python3.5/dist-packages/smpplib/command_codes.py]
        sispm                [dpkg-query: no path found matching pattern /usr/local/lib/python3.5/dist-packages/sispm/__init__.py]
"""

Change-Id: I29ddf8971837754abd930d847bd1036e8e510de6
2020-04-17 19:44:24 +02:00
Pau Espin e8bbcbf5b8 Create core directory to contain most of code not in object classes used by tests
Change-Id: I9aec6c55ccd71894182057d36e0025b69925d314
2020-04-11 19:15:53 +02:00
Pau Espin 990b520b1f osmo_ms_driver: Store cfg files and logs in correct test rundir
This way all the content is available as an artifact when we run it
inside osmo-gsm-tester.

Change-Id: I3ab493e6aafef90bb0c5d98e552840fd11c43079
2020-03-12 18:04:15 +01:00
Holger Hans Peter Freyther dbb16e869e virtual: Make mass tests be able to activate themselves
We will need to enable/disable generation of lua script code
depending on the subscriber and mass test.

Change-Id: Ide4d788543d910356efe9f61e789b3975f7bc558
2019-05-08 05:16:27 +01:00
Holger Hans Peter Freyther 2e7e84358e virtual: Make it possible to add tests to the ms driver
Introduce an Executor that forwards all testcase related methods to
a list of testcases. Allow to instantiate them by name and use the
result to access the statistics.

Change-Id: Ia65ee53987e92b24e6b8c40e1376bc74dc260180
2019-05-08 05:16:18 +01:00
Holger Hans Peter Freyther 75c9cc75ea virtual: Introduce a base class for test cases
Introduce a base class with the intended life cycle and use it.

Change-Id: I97968fb02436d5ac8248fc8020539e1af547b030
2019-05-04 13:50:49 +01:00
Holger Hans Peter Freyther f16a8f7aaf virtual: Move the starter code into the starter module
There is nothing location update specific in the file. Let's move
it into the starter file.

Change-Id: I0cd5705eaf53a14523feacece9446331a53b3e59
2019-05-04 13:49:45 +01:00
Holger Hans Peter Freyther 92cc0c9b69 virtual: Separate starting virtphy/mobile from the test
Move the starting code out of the Update Location "test". In the mid
term we can have a SMS test run in addition to waiting the Update
Location tests.

A mass-test testcase will have a life-cycle of:

 * Creation
 * Configure (number of subscribers, probably all subs)
 * Pre-Start trigger (same as configure so it can be omitted)
 * Post-Start (all processes run)
 * Query if the test has completed

The next step is an actual implementation to send SMS.

Change-Id: Ie15f5123775d11dd44243b2741d047ed93f318f9
2019-04-30 22:11:31 +01:00
Holger Hans Peter Freyther 41cd68146d ms_driver: Catch up with the new MS baseclass
Change-Id: Id8de8b3ee76b515c49e5ea52acaa326a2283b0e1
2019-04-30 10:54:48 +01:00
Holger Hans Peter Freyther 61f28773bf virtual: Have a single result class that can store data
We want to have LU, SMS and other tests run at the same time. Begin
by creating a single result where testcases can store additional data.

Move the stats code into the UL test case handling and out of the
suite.

Change-Id: Ie99351bee1515de8cf6870467f08256a53701907
2019-04-28 15:53:24 +01:00
Holger Hans Peter Freyther e524f2ca59 virtual: Unify the lua script into a single one
In the quest to support multiple testcases we will use a single
script. Parts can be enabled/disabled depending on which tests
we want/need to run.

Change-Id: I8a093671173976eba9215c00a7aea0f6cab467c6
2019-04-28 15:51:58 +01:00
Holger Hans Peter Freyther 337141fc1b nitb_netreg_mass: Add code to declare a run successful/failure
Change-Id: If26047f0635db8c7209af143fbd1da4c9b2312d1
2019-03-07 10:05:48 +00:00
Holger Hans Peter Freyther 5e67ed467c nitb_netreg_mass: Allow a suite to configure num subscriber
Remove hardcoded configuration and replace it with a reservation in
the suite.

Change-Id: Ic9fd560c2924731e4fd6eea5aaf3ad565cb4ef52
2019-03-07 09:40:42 +00:00
Holger Freyther 44128f91d2 Revert "nitb_netreg_mass: Add code to declare a run successful/failure"
This reverts commit b4ad8d7243.

Reason for revert: There was a true dependency on earlier changes (len(mobiles)). Rollback until the resource configuration is merged.

Change-Id: If0f5e24cec2f0d1d144b464180b341cacbdf0ebb
2019-03-05 09:44:37 +00:00
Holger Hans Peter Freyther b4ad8d7243 nitb_netreg_mass: Add code to declare a run successful/failure
Change-Id: I49a821e8e4656466259e519ef901726cbb76ef86
2019-03-05 03:07:41 +00:00
Holger Hans Peter Freyther 77d6d55e90 ms_driver: Rename method to hopefully be more clear
This is finding min/max in a dataset. Call it like this and update
the caller.

Change-Id: Ic7f5cd34639f897e460ca1edcb4f9b6df44683e9
2019-02-23 15:44:37 +00:00
Holger Hans Peter Freyther 82feeff1c5 mobile: Switch from removed cli option to vty port
Bind the mobile's to a random (chosen by the kernel) VTY port. The
CLI option was removed and I added a new VTY command to be able to
specify the port in addition to the address.


Change-Id: Ie40a2ba156ba5674d37a15eb30e5b2527e75fbe7
2018-12-30 12:31:29 +00:00
Holger Hans Peter Freyther 792614f12b ms_driver: use the util.Dir and create one dir per instance
Change-Id: Ie0f2fe99f6a6640606eb4e69fb1a2d22eae9b2c8
2018-11-24 12:07:52 +00:00
Holger Hans Peter Freyther f743afb669 ms_driver: Switch to process.Process from subprocess
Use a single tmp/rundir for all these instances. In the next step
we can create separate directories.

Change-Id: Icf4d4e161ac4283a63ed4e0745b375e7e6a25004
2018-11-14 21:03:54 +00:00
Holger Hans Peter Freyther f658b83b07 ms_driver: Allow to specify env and binary name/path
For the proper trial/suite integration we can't assume that the
virtphy/mobile are in the PATH and that they can be executed
directly (e.g. need a LD_LIBRARY_PATH to be applied).

Introduce BinaryOptions to pass the name/path of the two executables
and the env to use. Default this to virtphy/mobile and an empty
environment.

Change-Id: I79a57e53bc20613ac061453c24fd29a6d05e1721
2018-11-14 21:03:23 +00:00
Holger Hans Peter Freyther 799fe6286b ms_driver: Fix subject in the header
Change-Id: I47e688b9fe3aef6679e3c82c641393ab041cbec3
2018-11-07 03:50:33 +00:00
Holger Hans Peter Freyther b5e86b7e11 ms_driver: Use terminate not kill and initialize in ctor
Change-Id: Ib0102569cfb64a2f85ff33b93dd4ffc8ec59171b
2018-11-06 13:17:49 +00:00
Holger Hans Peter Freyther b697b3bb86 Always initialize the _started in the test
We don't know at which state the termiation routine will be
called and it is best to have a fully initialized object. In
prepare we start with a fresh list just to be sure.

Change-Id: I675772c89e32620da5695aa4793b735cc266684c
2018-10-30 21:26:20 +00:00
Holger Hans Peter Freyther 99a6a419a2 Keep track of all mobiles and copy them to unstarted later
At all times have a list of mobiles that were created. Make a shallow
copy and use it as the unstarted list.

This will be used by the upcoming gsm tester integration to build a list
of subscribers to be added into the HLR/AuC database.

Change-Id: Id72b7ce8821cf53ac0d5e4a141b9a2b66242e2a3
2018-09-15 09:27:22 +00:00
Holger Hans Peter Freyther 8ae38a6b85 Allow to access imsi/ki from the OsmoMobile instances
Change-Id: Ib1b5f51e93d67e1dbde6f1ab4701e539d3cabec0
2018-08-31 15:19:33 +01:00
Holger Hans Peter Freyther a7b61f39fb Generate imsi/ki on OsmoMobile construction
Take an IMSI/KI when creating the OsmoMobile and not when starting
it. This will allow other code to know which IMSIs will be used
before the system starts (e.g. to add it to the HLR/nitb db).

Change-Id: I79e259e948aa797c13118143ecd64bb7e29d274b
2018-08-31 08:03:20 +00:00
Holger Hans Peter Freyther 1dc9a04bc1 ms: Make the total test duration configurable
Change-Id: I5598d5dfd51e224e13835307ad20d108a5aa3935
2018-07-21 23:21:46 +01:00
Holger Hans Peter Freyther 874b4b4269 ms: Remove unused imports
Change-Id: Idd428d1bbd937a26a320eb69b1031856e49d3e4b
2018-07-21 23:21:46 +01:00
Holger Hans Peter Freyther af522fd601 ms: Only use completed tests for min/max handling
Remove non completed results before calculating the min/max. We will
need to check success/failure based on completion ratio.

Change-Id: Icaf9e90dd729b2339e409b3ec1593f456969fd19
2018-07-21 23:21:46 +01:00
Holger Hans Peter Freyther 6926c5763f ms: Simplify starting of the test and combine loop and wait
This will make it easier to strt different kind of tests. The cost
of calling step_once is hopefully neglectable as it simplifies the
test.

Change-Id: I3708ac382c0a34e17cf147d18f03603946437a53
2018-07-21 23:21:46 +01:00
Holger Hans Peter Freyther 0f6e41089b ms: Quit early when all tests concluded..
And fix the the detection if everything has completed.

Change-Id: I3575ee7618c35e3b66d25fa31844d267489d9179
2018-07-21 23:21:41 +01:00
Holger Hans Peter Freyther 574e62f0f9 ms: Begin to refactor and be able to share functionality
Change-Id: I840af0396f08744ce8ee6a2967f880d5cb7f815f
2018-07-05 20:30:42 +00:00
Holger Hans Peter Freyther 94da045c20 ms: Attempt to stop all mobile/virtphy instances on exit
We leave mobile/virtphy running after the test. Attempt to gracefully
exit and kill all of them. I experimented with both os.setpgrp and the
prctl(PR_SET_DEATH_SIG) but that didn't improve the situation.

Change-Id: I6cec050db7d4c355fb6678b2d84309fbbe5587b3
2018-07-04 20:26:13 +00:00
Holger Hans Peter Freyther 0f0ebd85db ms: Make the outer variables configurable
Do the easy part for making these variables configurable.

Change-Id: If8bbedcf672f6481a12c30d3669564704063626c
2018-07-04 20:24:41 +00:00
Holger Hans Peter Freyther 89dbf6db21 ms: Remove debug left over for the test
Change-Id: I17aa97a99cb1b1f9205b3a951370fe5ad49ae3dc
2018-07-04 20:24:30 +00:00
Holger Hans Peter Freyther 05895a912d ms: Use the new API to pass credentials to the event server
We are using the "autobind" feature of Linux to get a special
socket address. This allows us to have roughly 2^20 clients on
the system.

Change-Id: Ie9b9ac6267f40345baf7dbb3becaecf264a5df5f
2018-06-25 20:27:41 +00:00
Holger Hans Peter Freyther c490cdeebd ms: Add a main function to start all of it
Add a main file to start everything. All parameters need to
be made configurable. Composition of testcase and IMSI ranges
need to be configurable as well. This is left for future
commits. Right now it can execute a single UL test.

Start with:
export PATH=../osmocom-bb/src/host/layer23/src/mobile:$PATH
export PATH=../osmocom-bb/src/host/virt_phy/src/:$PATH
export PYTHONPATH=$PWD/src

python3 -mosmo_ms_driver

Change-Id: I58c938500a067eebb213750e56d8bf4d8af43df2
2018-04-04 15:35:12 +01:00
Holger Hans Peter Freyther 30cc021af5 ms: Add a first test to use all parts of the system
This is an interim solution but is bringing all parts together.
We will need to:

 * Abstract this into a base class
 * Be able to mix different tests without interfering with each
   other (e.g. 10k LU tests, 2k SMS sending)
 * The event loop will need to handle multiple timers/timeouts
 * Stats printing should print more information and test pass/fail
 * The test should quit early if everything has already passed

Change-Id: Id3277ed0f0f9ee734569bedd4752564eb68c9cfd
2018-04-04 15:35:12 +01:00
Holger Hans Peter Freyther ff19a5e7c2 ms: Create a starter for virtphy and mobile application
In the long run we might not want to start the virtphy but
for now virtphy+mobile belong together. Start virtphy first
as mobile will not handle a missing socket gracefully.

Change-Id: I5c6d742842d7f3e0a1858436ef3f8634d8c0582d
2018-04-04 15:35:12 +01:00
Holger Hans Peter Freyther 4a62bb0086 ms: Add lua script support utilities
Add a JSON encoder and a small module to sent registration and
other events per unix datagram socket.

json.lua fetched using:
$ wget -O src/osmo_ms_driver/lua/json.lua \
https://raw.githubusercontent.com/rxi/json.lua/master/json.lua

Change-Id: I43ae84a944c7f33e41d5de0880d4aaab3378809b
2018-04-04 15:35:12 +01:00
Holger Hans Peter Freyther e7ae51fcaa ms: Create an event server to handle Unix datagram messages
Create an EventServer that will create a unix domain socket and
dispatch incoming datagram messages. The lua remotes are not
passing credentials so this is a one way communication channel
for now. Tests can register to handle the message.

Change-Id: Ida97c570e8e741410f2dba4a231a8058ca96da25
2018-04-04 15:35:11 +01:00
Holger Hans Peter Freyther b7749a72b4 ms: Create a simple epoll (or kqueue) based event loop
Create a C-like single process event loop. It could be powered by
select/epoll or kqueue. It should scale to many open fds but we
will not have that many.

Change-Id: Iea06f33870cab9f21e9a1a1feb9758467343dd29
2018-04-04 15:35:11 +01:00
Holger Hans Peter Freyther 38adaa96bf ms: Create a cumulative distribution function class
We are using the CDF to decide which percentage of the jobs should
be running at a given point. The x-axis is time and the y-axis the
percentage of how many jobs should be running.

There are three functions to do this. The first one is a constant
which would result in everything being started right now, one to
start them linearly and the last (formula from Qt/3rdparty) to first
accelerate and decelerate slowly.

Change-Id: I9e3064f4c3c4c7af5d3491f850090516e541f4d3
2018-04-04 15:34:09 +01:00