Commit Graph

603 Commits

Author SHA1 Message Date
Pau Espin 7691f2d027 config: Fix reading empty yaml default-suites.conf
during config.read(), on empty file yaml.safe_load() returns None, which
was then later converted to string "None" by _standardize(), and
osmo-gsm-tester.py was not catching "not combination_strs" condition.

Change-Id: I07d7daab8f8f4238db140f0a0311f3d1d41e6cb0
2020-02-18 12:12:03 +01:00
Pau Espin c8b0f9359e Initial srsLTE support
2 tests (iperf3, ping) working against a full srs{UE,ENB,EPC} network
using ZeroMQ backend for RF (so no real RF support yet, that will come
next).

Related: OS##4295, OS#4296

Change-Id: I290c0d79258a9f94f00c7ff2e1c6c5579c0e32f4
2020-02-13 18:07:18 +01:00
Pau Espin 873dee391d powersupply_intellinet: Log target ip+dev_port
Change-Id: Iafd6e3aaf1d3b4d91ac6cf06f2a7fe94fd1203c3
2020-02-12 17:56:30 +01:00
Pau Espin 4983eb5367 Fix remote and process RemoteNetNSProcess
Change-Id: Icdc917968a1310e287dd98994420519a605be9c0
2020-02-11 19:16:26 +01:00
Pau Espin c852ad8813 iperf3: Support running iperf3 remotely
The new RunNode class is used and ip_address support will be dropped
eventually, replaced by the former.

Change-Id: Ib803d7774cb502c7d07443d7720a7b013684faa8
2020-02-11 17:46:52 +01:00
Pau Espin 7346472e5a util: Add helper setcap_netsys_admin()
This API was already added for RemoteHost but forgot to add it too for
local systems. It will be used by srsue once support for it is added.

Change-Id: I734e910af90fd25bed27c24b60346064b5fde67e
2020-02-11 17:46:52 +01:00
Pau Espin 116a2c45fe Inroduce RunNode class
This class will be used to hold information for a run node, that is, a
target system or environment were a process or task is run.
It superseeds in functionality the old ip_address resource, which will
eventually be droped in favor of RunNode.

Change-Id: I647bedf116aa9a570d925a5281c9491c9032e343
2020-02-11 17:45:50 +01:00
Pau Espin 7381e820a1 remote: Add more helpers to operate on remote hosts
Change-Id: I034314839675038762e00750b069eee8fcb70a5c
2020-02-11 14:41:09 +01:00
Pau Espin 180adfc3a6 remote: Improve wrapper script handling proper exit of ssh-remote processes
Improvements include:
* Avoid race condition between receiving signal and process not yet
  started
* Make sure process is killed with -9 if process is still alive a while after
  we killed it (SIGINT, SIGTERM). This is useful for processes which
  sometimes hang during shutdown like srsue in some conditions.

Change-Id: I3c656b008a3c2b2bb453a59e51d338cb272fa50b
2020-02-11 14:39:36 +01:00
Pau Espin 14022d31b0 Add handlers to run process under a specific netns on a remote host
It will be used later to run iiperf3-cli connected to srsue on another host.

Change-Id: I8d223fc302df42446f5876ba020cfbea94be09b9
2020-02-11 14:39:28 +01:00
Pau Espin f6d45adb05 Allow passing remote env to process running in remote host
Change-Id: Icc0ae8d79ca30ed0a289b67546735251fc46cb10
2020-02-11 14:39:15 +01:00
Pau Espin 2eafb03195 Introduce RemoteHost and refactor code to use it
Let's move code related to coping stuff to remote hosts and managing
remote processes under a class where relevant information is stored.
This simplifies parameters being passed all over and allows to reuse
more code.

Change-Id: Ifff5ded8fdb28e8ef267cebe6c5f30a910cae11a
2020-02-06 13:58:51 +00:00
Pau Espin dd71022af7 bts_osmotrx: Add support to run osmo-trx on LimeNet-micro
bts_osmotrx will check if target host can run the inst, and otherwise
run osmo-trx-lms already present in the system (installed by other
means). This way same class can be used both ways, since the only real
difference between the 2 scenarios is:
* copying inst vs not copying it.
* Running binary from inst vs running it from PATH.

This commit does not provide a mechanism to make sure the osmo-trx or its
dependencies are up-to-date in the target system. A solution for that
will be provided separately.

Related: SYS#4663
Change-Id: I6bd76f6d7e0cb2b6f7bdde971b6515846048a341
2019-11-26 14:33:11 +01:00
Pau Espin abf837d326 process: Allow passing no local inst to copy_inst_ssh
This will be useful in the event a user wants to run a binary already
available in the target which needs no copying, but still requires the
non-binary related items to be copied and set up, such as config files,
directory structure, etc.
This option will be used to run osmo-trx-lms in LimeNetMicro already
installed from an OBS repo, since cross-compiling all related
dependencies would require a lot of work to do now.

Change-Id: I6b0f2a19e493c7ac911c5db0ea08f5c0ab936d74
2019-11-26 14:28:33 +01:00
Pau Espin 12c5ea4a24 process: Return proc in function helpers
Caller may want to access the proc object after running the process, for
instance to check return code or inspect its stdout/stderr logs.

Change-Id: I60a18dcf699ebeaced951f7d5ff188f573772282
2019-11-26 14:25:35 +01:00
Pau Espin c18c5b82ca bts_osmotrx: Allow Setting Rx/TX paths through resources.conf
Change-Id: Iddb0f20366c3242098bdf869f39fc3e2244c13e7
2019-11-26 14:24:24 +01:00
Pau Espin 5eae2c50b0 Add a per-test log file
This way there's no need to go over hours of logging in the main log to
find information of a failing test.

Change-Id: I8cb79c7855e0bc14282d6728841e92ba22699eed
2019-09-18 18:57:11 +02:00
Pau Espin 7e1ee5044b Revert "resources.conf.prod: Use different ARFCN for sysmocell-5k"
This reverts commit 91199a3137.

Since we now support powercycling the SC5, we don't longer need to use a
different ARFCN for it.

Change-Id: Ie8b49c556c90b4a97a73695a93ac4108660a217f
2019-09-10 16:45:35 +02:00
Pau Espin 55cee160b0 Support SC5 power cycling through powersupply
* Add powersupply related code to bts_osmotrx.py to power cycle the
board.
* Each time the board is started, we need to unlock the RF (start TRX
implementation).

Change-Id: I8a1428c1ff90c9f5b42d7ffe86a6fc763819cba2
2019-09-10 16:45:35 +02:00
Pau Espin dd7bb2ca2d process: Introduce respawn_sync() method
Change-Id: Ifd1f553d9bead78bf1659f6c778c1b70888ba433
2019-09-10 13:44:39 +02:00
Pau Espin 922ce5ad31 process: respawn(): return process result
Change-Id: Ic6b57b8d0c2993a40ba39b87f45c7a524a8ca440
2019-09-10 13:44:20 +02:00
Pau Espin f11c4eea6d bts-trx: Improve logging and trap SIGTERM in ssh_sigkiller.sh
Trapping SIGTERM is done in order to get extra logging about that event.

Related: OS#4151
Change-Id: I2c7649dee8f5ecdaa08274806ccd8948d197ffdb
2019-08-14 12:32:25 +02:00
Pau Espin c93707ff6c bts-trx: Drop deprecated -t parameter
Parameter was dropped a while ago in osmo-bts, since it's calculated
dynamically from VTY config. So let's drop it to avoid a deprecation
warning message in osmo-bts log file.

Change-Id: Ia17a2528e091d4691c511732ed251e472d1270eb
2019-08-05 21:00:30 +02:00
Pau Espin 91199a3137 resources.conf.prod: Use different ARFCN for sysmocell-5k
Due to a bug in sysmocell-5K's TRX implementation, it may keep polluting
the air transmitting after the BTS is disconnected. This could cause
interferences with other tests. Correct fix would be to RF lock it after
test finishes (through ccli), but let's simply use a different ARFCN for
now.

Related: OS#4129
Change-Id: I6d5555aa8740b262ee92110987189c076db44f76
2019-07-26 11:47:43 +00:00
Pau Espin 0cde25f1d9 Introduce and use osmo-bts-trx VTY cmd max_trxd_version on sysmocell-5K
Force TRXDv0 when using sysmocell-5k as a TRX, since its implementation
(different than osmo-trx) doesn't support higher versions. Furthermore,
it will crash upon receival of SETFORMAT string. By forcing maximum TRXD
version to 0, osmo-bts-trx won't sent any SETFORMAT message since 0 is
the initial version to use.

Depends: osmo-bts.git I5eb1fdc002f9d7f4acf475356d8fc998dc8f6326
Related: OS#4006
Change-Id: Ic95c38d91dba354ae64c5edbfcea3fbbf34a7de3
2019-07-24 20:53:03 +02:00
Pau Espin b5f37ff935 tests: voice: Add voice call test with Osmux enabled
Change-Id: Ie4f360a77f6fcbc74f140a7fcb5feef2d94ac734
2019-06-19 18:57:13 +02:00
Pau Espin fed578e873 Introduce osmux support for msc,bsc,mgw
Change-Id: Ief3518e77650f2cddb48357b07fe95346e46ee1b
2019-06-19 17:37:07 +02: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
Pau Espin fcc04f88dd powersupply: Add support for Intellinet PDU
Based on original pdutool code from Joachim Steiger.

Change-Id: Iab4f7aec1c50f47da4cd734441bb36fa09d171a3
2019-04-12 17:02:10 +02:00
Pau Espin f0cbe0599b Revert "modem: workaround ofono crash"
We already updated our ofono branch to current master (after 1.28),
and this fix is not longer required, as stated in ticket OS#3064.

Related: OS#3064
This reverts commit f8d12196f0.

Change-Id: I884f6d4f3df4f3b4e2ac05e4dba2ad8704697521
2019-04-08 21:09:44 +02:00
Pau Espin 3a479c212d processes: Fix kill of processes run under sudo
sudo drops forwarding of signals sent by processes of the same
process group, which means by default will drop signals from
parent and children processes. By moving it to another group, we
will later be able to kill it.
Note: sudo documentation is wrong, since it states it only drops
signals from children.

See following link for more information:
https://stackoverflow.com/questions/34337840/cant-terminate-a-sudo-process-created-with-python-in-ubuntu-15-10

Change-Id: I25990234aaa496c501ff45ad7f7fd549d6f188da
2019-04-05 20:12:12 +02:00
Pau Espin 0409655e64 process: Early return during process termination if no proc running
This avoids extra unneeded logging about killing with signal when
actually no signal is being sent.

Change-Id: I5b5dd78fe3301d8eef2ab93da3b37029268ae198
2019-04-04 17:48:30 +02:00
Pau Espin 806aae8830 suite: Make _processes an empty list during init time
It simplifies the code because we don't need to check if it is a list or
not.

Change-Id: I634901a1f4ba3a6b7294666012ea679ae148ff08
2019-04-04 17:44:37 +02:00
Pau Espin 4c8cd7b9a5 modem: Move modem iface to its netns before using it
We used to do that once after ofono startup for all iface
(modem-netns-setup.py), but then if a modem crashes the interface is
re-created on the default netns, and tests fail until manual re-run of
modem-netns-setup.py.

This way now we always make sure the iface is moved to the expected
netns before it is used.

Related: OS#3881
Change-Id: I506309c424aa46684c4516a1a0217343ecbf32c6
2019-04-04 16:10:14 +02:00
Pau Espin b27827b7bc util: use launch_sync API instead of manual wait
The API is available so no need to manually craft all steps in there.

Change-Id: I4afedb185f6e864929155981e8a2ec2df90110c3
2019-04-04 15:59:10 +02:00
Pau Espin e159cd206d process: Prevent NetNSProcess alive forever after SIGKILL
NetNSProcess are run in the following process tree:
osmo-gsm-tester -> sudo -> bash (osmo-gsm-tester_netns_exec.sh) ->
tcpdump.

Lots of osmo-gsm-tester_netns_exec.sh scripts with tcpdump child process
were spotted in prod setup of osmo-gsm-tester. Apparently that happens
because sometimes tcpdump doesn't get killed in time with SIGTERM and
SIGINT, and as a result SIGKILL is sent by osmo-gsm-tester as usual
termination procedure. When SIGKILL is sent, the parent sudo process is
instantly killed without possibility to forward the signal to its
children, leaving the bash script and tcpdump alive.

In order to fix it, catch SIGKILL for this process class and send
instead SIGUSR1. Then, modify the script under sudo to handle SIGUSR1 as
if it was a SIGKILL towards its children to make sure child process in
the netns terminates.

Change-Id: I2bf389c47bbbd75f46af413e7ba897be5be386e1
2019-04-03 17:53:57 +02:00
Pau Espin 17a4ed9029 process: add signal to NetNSProcess kill path
This allows to easily differentiate different calls to kill in order to
terminate the process when looking at the logs.

Change-Id: Ida88f2674b0ed1802f20c519aa4e3cbe81e0def8
2019-04-03 17:10:33 +02:00
Pau Espin feb66e714a Integrate osmo-{bts,pcu}-oc2g
Change-Id: I446e27039f75e63c2870d751c190a4fd76947000
2019-03-27 13:50:41 +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 Hans Peter Freyther 10501ccc8e resource: Add a mobile resource for the virtual test
Add a new resource and make a reservation in the suite.

Change-Id: Ic26aa63cad62323bb85f952640672eb28af0eadc
2019-03-07 09:39:39 +00:00
Pau Espin e02158fd16 Log signals from VoiceCall dbus objects
Change-Id: I0def02b9063f75ec32c8b9382bdb12d65e1fb9eb
2019-03-05 20:29:19 +01:00
Holger Hans Peter Freyther 48c83a8939 resource: Introduce a base class for the modem
Extract IMSI, KI and authentication algorithm into a base class.

Change-Id: Id547cdcc241a307a2ea59b5fbac6b8d7a9d95639
2019-03-05 13:19:41 +00:00
Holger Hans Peter Freyther 7424301034 resource: Use a factory to initiate a modem
Change-Id: I4baa791c92196cda477b2d969d4f67dfbe1152af
2019-03-05 09:46:57 +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 54b4fa928e process: Make killing processes non-sequential
Change-Id: Icf1ac6774ea11880542012fd6c6ac73302bb74f5
2019-03-05 03:53:10 +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 93a89424d0 resource: Introduce a type attribute to the resource definition
Change-Id: Ie1fd10ec878311b7347118badb1b9dce5b49e976
2019-03-05 02:52:44 +00:00
Holger Hans Peter Freyther 0d714c976d process: Make sending signals (kill) externally visible
Change-Id: I87bba8a8c467ba5936e0b6604d8abb9432e5e7a8
2019-03-04 06:53:51 +00:00
Holger Hans Peter Freyther 20b52c1ee3 process: Speed-up terminating lots of processes by batching it
Introduce a strategy to terminate processes and begin with an
implementation for parallel (that has no degree of parallelism
right now).

Change-Id: I7dd4a7e26aca758198aa08a434eaf5f3f5af632d
2019-03-04 06:53:51 +00:00
Holger Hans Peter Freyther f922a998cb pyflakes: Rename local variable to not shadow import
Change-Id: Ib70130dbbeeeb9813eaea707bf66f1db91088b92
2019-02-27 08:09:21 +00:00
Holger Hans Peter Freyther 1ea4e52f9f pyflakes: Remove occurrences of using undefined variables
Mention the attribute right away and remove a method that looks
to have been broken (more vs. more_rules).

Change-Id: Iba18a96ff804780e66c69b459e112f9d42b7b2ff
2019-02-27 08:09:21 +00:00
Holger Hans Peter Freyther 34dce0edb1 pyflakes: Remove assigned but unread variables
Change-Id: Ie257ac051739ea6f846d1aac2c8f778638b5f8a6
2019-02-27 08:09:21 +00:00
Holger Hans Peter Freyther 91067239c1 pyflakes: Remove imports of unused modules
Change-Id: I7496030e5857078cd66a36a5e46c9a50217ce6e3
2019-02-27 08:09:17 +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 ae0dae821c modem: Do not connect to the systembus until a modem is in use
In case of the "virtual" tests we:

* Don't use ofono based modems (they are physical for now).
* Run in an environment that doesn't naturally run a dbus-daemon

Modify the code to memoize the bus by hand.

Change-Id: Ieae4bf819903402f7f715eb489e0a96ed59dc3f8
2019-02-20 20:38:46 +00:00
Pau Espin 4d7f7709d5 modem: Log once dbus returns call was answered
Change-Id: Ia277b2eecdbf9969d77a688638837f9d9e1a44b6
2019-02-13 19:30:38 +01:00
Pau Espin 32e9d8c26e modem: print call ID during log of call state
Change-Id: I33d0153b3e89aa1924129b8068ef068c08059958
2019-02-13 17:40:31 +01: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 d2db10d80e ms_driver: Add a virtual bts and make use of it
It's very close to the osmo-bts-trx but without osmo-trx. Modify
the suite to make use of this BTS.

Change-Id: I9f5a2501eb4473ccf2287c902ee207c6a45a1bc5
2018-12-13 10:17:02 +00:00
Holger Hans Peter Freyther d51c2ea58d md_driver: Store the virtphy unix sockets in the temp directory
Storing them inside the testrun directory will most likely violate
the file length limit of the AF_UNIX files. This has happened on
the jenkins test run and can not be mitigated by picking shorter
paths in the code. We are already storing the event server in a
tmp directory and can add subdirs+files there.

Change-Id: I9ba4cd5c3e220ec10fc7c3160d7211daa821358f
2018-12-04 09:29:14 +00:00
Holger Hans Peter Freyther 6bf882260a ms_driver: Do the existance check with the path
Change the existance test to use the full path and not just the
binary name.

Change-Id: Ibe28514df03efb7c302ac30411761a8d1a6dcf5d
2018-12-04 09:29:14 +00:00
Holger Hans Peter Freyther 51ae2b5f5c Fix and use the right member variable
Change-Id: Ib5d50322ecd30c7724eef8452d22845450e9c633
2018-12-02 16:09:37 +00:00
Pau Espin 14e3e50b6e nanobts: Use -G parameter of ipaccess-config to avoid need to restart nanoBTS
If OML IP doesn't need to be changed because it's the one already
configured, then there's no need to set + restart the nanoBTS, which
means we can speed up a test running a nanoBTS by aprox 2 minutes per
nanoBTS used.

Requires osmo-bsc.git 5c2485dcff35996fce328798351af79c0ff4474c, which
fixes json generation in ipaccess-config after -G -q was implemented.

Related: OS#3624
Change-Id: I2871dee3de11512250445127f0b807a8990fd4c6
2018-11-29 17:14:44 +01:00
Holger Hans Peter Freyther bdc18d97e1 ms_driver: Consult the suite to get the binaries
Change-Id: I7fbb04cf67fe21378aacefcf1a15533d20d10d49
2018-11-24 12:09:12 +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
Pau Espin 9ea9c65b39 templates: bsc/nitb: Remove explicit no force-combined-si
It's always been the default anyway, so no need to explicitly state it.
Furthermore, recently (osmobsc 167cb828665b91ed7d28007abd4a1862ebbb78c9)
force-combined-si was enabled by default for nanoBTS due to issues with
some MS not registering when it's not enabled, so let's osmo-bsc decide
were should it be enabled.

Related: OS#3063
Change-Id: I97b10406a4a0048c66a47aa7d32a113f0c0366d1
2018-11-21 20:23:09 +01:00
Pau Espin 0fc74370b0 tests: iperf3: Support testing parallel iperf3 clients in test
Since tests running a single MS and several of them are really similar,
generic code handling the test for N concurrent iperf3 sessions is
writen an moved to testlib, and existing and new test use that code.

Change-Id: I57799fde49e6845379cca332eec0a1f70aaecd2b
2018-11-19 09:40:24 +00:00
Pau Espin 0df6317d1f iperf3: implement str() method in iperf3 server
This way it can be logged easily during test runs.

Change-Id: I699f0a9a8d263ac9f02ea9594a28ca9fd8d48db6
2018-11-19 09:40:24 +00:00
Pau Espin cf6a360efe iperf3: Allow changing port of iperf3 server
This way several servers can run sharing same IP address.

default port variable is moved inside class to be available to tests.

Change-Id: Id4eae7cefbb1a18ecf2676f9cb22c60cc91cec7c
2018-11-19 09:40:24 +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
Pau Espin b656432701 templates: osmo-pcu-sysmo: Set log level from dbg to info
Otherwise there's too much output. With debug enabled, iperf3 test from
gprs testsuite generates a 111MB osmo-pcu.log.

Change-Id: I687361f3d6ede9a77531cd71204b1b07e0d1af42
2018-11-14 12:43:41 +01:00
Pau Espin c977547ea1 templates: osmo-pcu: Set log level from dbg to info
Otherwise there's too much output. With debug enabled, iperf3 test from
gprs testsuite generates a 96MB osmo-pcu.log. With log level set to
info, size drops to 1.4M, which is a lot less after compressing in an
archive.

Change-Id: I008234024b9369db42c90ef5d59a013fd2d22718
2018-11-13 13:32:59 +00:00
Pau Espin 1444f55643 nanobts: ipacces-config: Use process.launch_sync helper
Change-Id: I986ba81d766240d4f11c079d90b126bf96d776b9
2018-11-12 18:23:34 +01:00
Pau Espin 78087beaa9 process: launch_sync: allow non success return
Change-Id: I0617335b594ba565cf2e5ffd0edfb8bffa398c48
2018-11-12 18:21:21 +01:00
Pau Espin 79df739c07 process: Move standalone run_local_sync as method of Process
Change-Id: Ib2b3fd39db5400a93a8caabae367dac3e3250247
2018-11-12 18:15:30 +01:00
Pau Espin 64f0b1b114 iperf3: Fix parsing of incorrect json from iperf3
Change-Id: I759d99857c17de061e6d7c1ae1c38f6b15172131
2018-11-12 09:14:19 +00:00
Pau Espin 8cfa10f01d osmo-trx: Add support for dev-args cfg parameter
Change-Id: I3cff225e378e187779bf2b0c7d65bd6b97217104
2018-11-09 13:34:18 +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 d6d3206b0a ms_driver: Initialize event_server_sk_tmp_dir in ctor
Change-Id: I9f39a25f292262cf335df371f434995e58c9ae93
2018-11-06 13:15:59 +00:00
Pau Espin 4f23ab58ad Add support to enable EGPRS
Change-Id: I682f0c1b4cb97b704d646f18f54e748baaefd677
2018-10-31 09:59:45 +01:00
Pau Espin 8a72586835 Introduce iperf3 testing infrastructure
Change-Id: I6ff6bef14feb535d98ca41b9788700d699e1ef1e
2018-10-31 09:59:45 +01:00
Pau Espin 772b2b14bb pcap_recorder: Add support to run in netns
Change-Id: Ie1c848254f221f26c59e7f4bd8c079fe3e7bdfc2
2018-10-31 09:59:02 +01:00
Pau Espin fd4c144049 Add support to test gprs IPv4 data plane
Since the modem iface and the GGSN iface are on the same host/netns,
it's really difficult to conveniently test data plane without getting
routing loops. As a result, either GGSN or modem iface must be moved to
a different namespace. The decision after a few discussions was finally
to move modem interfaces to a different netns.

Expected setup:
* ofono is patched to avoid removing modem if it detects
through udev that its net iface was removed (due to for instance, net
iface being moved to another netns and thus not being reachable anymore
by systemd-udev process running in root netns).
* After ofono is started (and successfully configured all the modems and
detected its net ifaces through syfs/udev), script "modem-netns-setup.py
start" which creates a netns for each modem, naming it after its usb
path ID. net ifaces for that modem are moved into its netns.
* Modem is configured to use 802-3 data format, and as a result the net
iface is configured through DHCP (DHCP req only replied AFTER pdp ctx is
activated!).
* Since osmo-gsm-tester knowns the modem USB path ID (available in
resources.conf), it can run required steps (ifup, DHCP) to configure the
interface. The interface name is provided by ofono to osmo-gsm-tester.
* As a result, any process willing to transmit data through the modem
must be in the modem netns.

Related: OS#2308
Change-Id: Icb06bdfcdd37c797be95ab5addb28da2d9f6681c
2018-10-31 09:59:02 +01:00
Holger Hans Peter Freyther b484aab683 Create a "ms_driver" stub for the testsuite
All config parameters are hardcoded for now and it should push
subscribers into the test (which should be a base class but not
a specific test).

Change-Id: I586b6d532c6e6395b4e6f2cf2128372237d05a7d
2018-10-30 21:28:43 +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
Pau Espin 8aca1f37d6 process: Make sure sync process is terminated if ogt is stopped
Change-Id: Iecdac96ea576a312be2a6c6b6799e249074687ef
2018-10-26 10:24:59 +00:00
Holger Hans Peter Freyther d03acdf38a First round of clean-ups of imports and unused variables
Run pyflakes src/osmo_gsm_tester and then address the first
round of problems.

Change-Id: I02f1d89078dfdf37d53e2e20811bf36fb14ec3b0
2018-10-25 16:26:49 +00:00
Pau Espin f6166144b5 ttcn3: Support running tests without PCU socket avail
Change-Id: I902af460b798ffdba09d77d457bac672db606368
2018-10-15 17:55:12 +02:00
Pau Espin e789f0c088 osmo-bts-trx: Add support for osmo-trx-lms
Change-Id: I44db0fe4592109ecb665e1880806d90379da64f7
2018-10-10 09:39:58 +00:00
Pau Espin 16abefb35c bsc: Record RSL traffic in case rsl_ip and oml_ip differs
This change allows recording all interesting traffic for TTCN3 tests,
having GSMTAP and RSL together, because osmo-bsc is configured to pass
the RSL IP of the TTCN3 testsuite emulating a BSC.

Change-Id: I6bd1d1bec8e7b698d12aa886acc21d92532d9e6c
2018-10-09 18:55:30 +02:00
Pau Espin cef9c0dee8 Drop unused sysmobts-mgr.cfg.tmpl
Change-Id: I09632a6b4d3a431f1699d00843b9d7ee257a8b4c
2018-10-03 14:56:32 +02:00
Pau Espin 1b11c5916c templates: Update .cfg files to use logging level set-all
VTY cmd "logging level all" is deprecated in favour of "logging level
set-all", but the required behaviour in this case is "logging level
set-all".

Change-Id: Ice54fca6be86f05a02ce4ae783e6e42e6958b95d
2018-10-03 14:56:32 +02:00
Pau Espin 1ff03766be osmo-trx: Enable multi_arfcn for B200 and only in multiTRX setup
Change-Id: I6a29e1813f0603b00b49b7b7c805be23a72cf0e3
2018-10-02 15:58:32 +02:00
Pau Espin f2e5972ffc bts_osmo: Only check for socket path in ready_for_pcu()
Previous implementation was done due to osmo-pcu dying if failed to
connect to not-yet prepared BTS. This is no longer the case, so we can
start osmo-pcu as soon as the socket exists.

Change-Id: I3aa6bef0c4893bdcac668002ca018af019f666a3
2018-10-02 14:55:50 +02:00
Pau Espin 302c7563ef osmotrx: Make sure remote process stops after ssh session is closed
First of all, it was found that vty allocation must be forced (-t -t)
during ssh session creation to make sure SIGHUP is forwarded when
session is closed.

Second, since osmo-trx ignores SIGHUP (osmo_init_ignore_signals()), we
must add a wrapper script which converts received SIGHUP into a SIGINT
to stop osmo-trx.

Change-Id: Ic334a54b1a1827d74fe0b453ac32bb77b8616147
2018-10-02 14:52:53 +02:00
Pau Espin a9006dffd9 osmotrx: Allow running osmo-trx from remote host
Change-Id: Ia31ac8eb41e02eda28d9f6f56774679300244ee8
2018-10-02 13:10:36 +02:00
Pau Espin e4358a9a36 Make code copying inst through ssh generic
It can later on be used by other classes that need to run binaries in
inst remotely.

Change-Id: I838b999528695207e1147cfe76e6f7aaf3b1dd53
2018-10-02 13:10:36 +02:00
Pau Espin 94eab26bf3 osmo-trx: Add multi_arfcn support
2nd TRX arfcn is changed in defaults.conf because multi_arfcn requires
them to be alocated in steps of 4 starting from TRX0.

It is not enabled by default yet on B200 (it must use it to support
several TRX) because current host running osmo-gsm-tester is not
performant enough and cannot keep up with timers due to multi-arfcn CPU
overhead.

Change-Id: I096df82ad1f4cbb41dfbd6a78466a845f34be385
2018-09-18 11:29:12 +00:00
Pau Espin 44b7ea18ca osmo-bts-trx: Add multiTRX support
Support is limited to 1 osmo-trx with 1 phy and multiple instances.

Change-Id: If2bda5ec7ac9fa3fe6bc5d71f323c3ccc2a70158
2018-09-18 11:29:12 +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
Pau Espin 4aeb4300b1 Build and use osmo-bsc_mgcp from openbsc.git instead of osmo-mgw.git
In osmo-mgw.git 31b4729f2731c747b8b33c4646dd5ade2ace29bc, osmo-bsc_mgcp
was dropped and the one from openbsc.git must be used.

Change-Id: Ib1c46baf4d36ab18f8064a2234a0ba28a1e7d2c2
2018-09-13 12:20:43 +02: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
Pau Espin 0d45504267 osmo-bts-trx: Big refactor and cleanup of osmo-trx related code
* This commit is a preparation for future commits to add support for
different osmo-trx devices and backends like osmo-trx-lms.

* Drop deprecated osmo-trx-* cmd line params and use VTY cfg to set them.

* As number of osmo-trx related osmo-gsm-tester attributes grow, group
them togther in an "osmo_trx" dictionary.

Change-Id: I77d29413c9e3b600b796627ba366f80c3281b7e1
2018-08-29 12:30:48 +02:00
Pau Espin 5dc245938b osmo-bsc: Parametrize codec-list VTY cfg
Change-Id: I1678aba43e8d399ecad192cbc416698373e3c0a0
2018-08-29 10:18:05 +00:00
Pau Espin c264d3df9d suite: Fix generation of config() dictionary
suite.config() hasn't been activetly used anywere. New upcoming patches
will start using it to set and overlay config parameters for objects
which are not necessarily allocated as resources.

Since these options don't apply to specific resources, there's no sense
in running replicate_times() on them.

Change-Id: I5fcdc9151d1663e738f5c8abe588a42ab51c8f6e
2018-08-29 10:18:05 +00:00
Pau Espin 722e94e833 Add channel_allocator cfg attr to bts resources
Change-Id: I682809d4aeb91a36e3a35fc481e8d40d0b084fa0
2018-08-22 11:59:09 +02:00
Pau Espin 568228701c osmo-bsc,msc: Set mgw local-ip in cfg.tmpl
Change-Id: Id46aa337f12756f80d492bf3102db5b1449e2027
2018-08-21 18:30:24 +02:00
Pau Espin aab56921f1 Introduce scenario modifiers
Before this patch, scenarios were only used to select resources with
specific attributes. This commit introduces "modifiers" in scenarios,
which allows setting or modifing config attributes of resources once
they have been reserved. This way same test can be run selecting same
resources but modifying its configuration, allowing for instance running
different number of TRX, different timeslot configuration, etc.

Modifiers are described by placing a "modifiers" dictionary in any
scenario file, similar to the current "resources" one used to select
requird resources. The "modifiers" dictionary is overlaid on top of the
"resources" one resulting from combining all the "resources" dictionary
of all scenario files.

Change-Id: If8c422c67d9a971d9ce2c72594f55cde2db7550d
2018-08-21 16:48:02 +02:00
Pau Espin 635f4c8d8f osmo-hlr.cfg.tmpl: Add ussd routing prefix for *#100# and fix expected answer format
Since osmo-hlr.git I1d09fab810a6bb9ab02904de72dbc9e8a414f9f9, USSD
processing has been moved to osmo-hlr and prefix routing needs to be
configured, otherwise USSD requested are answered back to the MS with an
error "ss-NotAvailable (18)".

mesage received for extension resolution (*#100#) had its format change,
so update to new format (carriage return at the end was dropped).

Change-Id: I5f75eff0df2d20d7f9b39e69184cffb0e635713d
2018-08-13 14:36:14 +02:00
Pau Espin 58603671c2 Cleanup of class scoped variables
After bug described in OS#3456 and fixed in last commit, let's
categorize and place variables in its correct plac to avoid similar
issus. We leave under the class keyword (class scoped variables) the
attributes which are to be used as static class attributes. All other
ones are initialized during __init__(). This way w avoid scenarios in
which while using an object from an instance attribute we end up reading
a class scoped variable which is shared among all instances.

Change-Id: I5ad4cac34a9f49eaf42966c01c9c5a4d3f3e9dc8
2018-08-13 07:51:58 +00:00
Pau Espin 926a4b81be bts_nanobts: Fix pwsup_list increasing its size every new test
variables under class section are shared among all instances, and are
used unless the specific class instance attribute is set. As a result,
the same pwsup_list object was being re-used.

Take the chance to do the same with the _pcu var, since we want same
behavior for it.

See for reference: https://stackoverflow.com/a/1716730

Fixes: OS#3456
Change-Id: I3f6a9d64b35aec33430e90872f41c3d046653ce6
2018-08-09 13:01:17 +02:00
Pau Espin f6a0712282 nanobts: Support multiTRX
num_trx is left for now by default to 1, but it has been tested to work
properly (current tests pass and both trx are configured) with
num_trx=2.

Change-Id: Ib3962f824a804e2aa582601475a8514c6cb0d8e7
2018-07-27 16:24:31 +02:00
Pau Espin 698ad4ce50 bts: Recreate resources.conf trx_list with len based on num_trx
We are already doing this for defaults.cfg, but not for resources.conf.
As a result, if we have a trx_list with 2 trx but we have set num_trx=1
(default), parsing will fail later in bsc.cfg.tmpl because
conf_for_bsc_prepare() will pass a trx_list with 2 trx.

Change-Id: I28ed34abeedaa0ee2e7862ced45a46042192d831
2018-07-27 16:21:11 +02:00
Pau Espin bc1ed88304 Add ttcn3-bts-test env
Change-Id: I3251a49503dc823f0ef1fe8ef5d68236a584dad4
2018-07-25 16:38:30 +02: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
Pau Espin c81e26504d hlr: Get hlr.sql from new path
As of osmo-hlr edca4f88a653cc688bc1c46611a9f0bc880637e2, hlr.sql file
has been moved to an sql subdir.

Change-Id: I1cbbe46edc6121476cd2422074a9f3cfc2d8e5ef
2018-07-03 11:56:07 +02: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
Pau Espin 99efe820e4 ggsn: Bind VTY and CTRL ifaces to assigned ip addr
Change-Id: I26735a21cd53183dfe0a75e5bd24954d583c354f
2018-06-22 12:13:52 +02:00
Holger Hans Peter Freyther 5eb4f0e6a2 osmo_ms_driver: Use the two new config options for the mobile
Avoid being stuck in c7 state and use the c7-any-timeout with a low
value. Do not attempt to store SMS in the home directory (if they
are received).

Change-Id: I4bb59130a04852bc43af9ef3602b129f40e9e170
2018-06-06 19:19:54 +01:00
Pau Espin e523665e9c event_loop: Log parameters during wait timeout exception
Change-Id: I1cf104392bfd11ad263264738eb4d8fa60550a5d
2018-05-28 14:01:12 +02:00
Pau Espin 7f4807a4bc powersupply_sispm: Add port number to log name
This way it can easily be spotted which port is being triggered in case
someone wants to manually test it.

Change-Id: Ibd2c70170d97a786e37b6838b1ed6d4eb637ad8b
2018-05-28 13:04:42 +02:00
Pau Espin e974944496 osmo-bsc.cfg.tmpl: Remove unused nd recently removed option dest
This VTY cmd has been removed in osmo-bsc.git
68e4be9c845e25f53aea511b1c57340a9da5825c.

Change-Id: I48c0b8a7b2a0088887f1309efc40bcf1da0f1626
2018-05-28 13:04:42 +02:00
Pau Espin b1526b9979 Add option to expect bts/pcu failures and respawn its processes
Some tests may want to reproduce some scenarios in which it is expected
that a BTS process is stopped, for instance if the BSC link is dropped.
Provide a keepalive parameter to start() for bts and pcu objects to
inform suite that failures are expected and that it should keep them
alive in case that ocurrs by respawning the BTS process.

Change-Id: Ia2a7539f9fad457125ac9b60a52a52999e885ba8
2018-05-25 12:31:20 +02:00
Pau Espin 06ada458cf process: Move cleanup log inside cleanup method
Change-Id: I72ad453e9dc8340946d7e7d041643fe8ef97439f
2018-05-25 12:31:20 +02:00
Pau Espin 63f2d47b3e bsc: Add API to mock BSC RSL IP addr
Change-Id: I9ca67964e656943b50967a27a88054fd3e484672
2018-05-25 12:31:20 +02:00
Pau Espin 58cd83c3ec templates: osmo-bts: Use BTS assigned IP addr to bind CTRL and VTY iface
Change-Id: Ib1c3022a6c531ef8c6a5ba31927762806abc37ac
2018-05-25 12:31:20 +02:00
Pau Espin 878b2c6619 testenv: Provide tests with access to process module
Some tests may want to start/stop/manages processes themselves. By using
the process module from osmo-gsm-tester, we make that possible easily,
providing with useful features such as requesting a suite to stop it on
cleanup.

Change-Id: I8e018107cbec81299ec2228bfff933fb3b0bb6cd
2018-05-18 15:59:06 +02:00
Pau Espin f32c41519e util: Fix unloading of suite lib import path
Change-Id: Iac81151f5baec092a3d15bbe6541b5bc007e6a03
2018-05-14 15:34:40 +02:00
Pau Espin 155a355e01 Unload suite local modules after suite exit to avoid collisions
Since sys.path is modified idynamically to load modules from "lib" subdir of each suite, from python env point of view all those modules share a namespace. As a result, there can be name collisions.

If a name collision appears (eg test1 loads "testlib.py" and test2
afterwards also loads its own "testlib.py"), then python interpreter
thinks the testlib.py module is already loaded, so test2 ends up using
"testlib.py" from test1.

The way to solve this is to make suite local
modules to live only through the scope of the suite, and unload the
modules once the suite is finished.

Change-Id: I4efe815f85bc4ec2ca91aa9c2d3a369048f21571
2018-05-09 11:24:25 +02:00
Pau Espin 7e02d20b46 suite: Set suite subdir lib part of syspath so tests can import their own modules
Change-Id: I3307c3ab314bb7a88d3c22c7c270c9f05fe6e03e
2018-05-08 15:28:48 +02:00
Pau Espin 39df7f4668 bts: Allow setting amount of TRX and timeslot in cfg and from test at runtime
The num_trx attribute for a given BTS states the number of TRX to be
used by that BTS. If more than num_trx are configured in trx_list in the
cfg file, then only up to num_trx are taken into account. If a num_trx
value higher than max_trx is specified throuygh config file or at
runtime by the test, an exception is raised explaining the issue.

The num/max_trx attributes are overlayed along the config levels
(generic -> bsc_bts -> specific bts-type -> specific resource object).
This way we can specify a long list of trx+timeslot config in the
generic config (bsc_bts), and tune for each model and specific BTS which
is the desired default number of TRX, as well as the maximum supported
per type.

Change-Id: I7f46eaf7a16f03268653299c93600c0443f691ac
2018-05-08 14:55:12 +02:00
Pau Espin e699912a23 bts: Move conf_for_bsc_prepare from bts_osmo to bts
nanobts inherits directly from bts.Bts, so we need to move
conf_for_bsc_prepare there to make nanobts work again.

Fixes: 530681fd86
Change-Id: I4305eefb4056ed7614118532e271efe780f4a87f
2018-05-08 14:50:32 +02:00
Pau Espin e519462d60 bts: Pass defaults config name at construct time
It will be needed later at construction time when resolving the num of
trx.

Change-Id: I2c6a46ead14010f714897ea178917327215823e7
2018-05-07 13:37:02 +02:00
Pau Espin 530681fd86 bts: Refactor conf_for_bsc_osmo
Move duplicated code into a method in the superclass.

Change-Id: Ie27932f94142f667c3fb8c054b77e04afa0d5cbb
2018-05-07 11:20:23 +02:00
Pau Espin c9b6376796 Check physical channel configs
Change-Id: I5894678e0d6f306173cc550dd6806a7d6f8a4c11
2018-05-07 11:20:22 +02:00
Pau Espin 7d4bdf2daf bts_osmotrx: Don't use binary name as inst name
Change-Id: Iee20738f2aa750aa9035a9e54ad667d8753ea12e
2018-05-07 11:00:30 +02:00
Pau Espin 553eda638c osmo-trx binary is now called osmo-trx-uhd
Change-Id: Ibf111ba89b24964127b9c1db7102953e1dba3181
2018-05-07 00:47:40 +02:00
Pau Espin ccb1bc686d modem: Catch exception: call removed while waiting to become active
This can happen while in a test we use:
wait(ms_mo.call_is_active, mo_cid)

And then answer fails for whatever reason, after a timeout ofono will
remove the call object:
/sierra_2: DBG: 'org.ofono.VoiceCallManager'.CallRemoved() -> /sierra_2/voicecall01

As a result, during next call o call_is_active() will try to get the
call object, but it doesn't exist anymore and an exception will be
created in method call_state during call to systembus_get().

Change-Id: I02b7e76425754372756493761819f18f1e3106c1
2018-04-22 14:35:33 +02:00
Pau Espin b6ab1da0af event_loop: Avoid leaking active timeouts on poll exception
It was spotted that when an error ocurred during poll generating an
exception to finish the test (osmo-msc ended prematurely), then the
active wait() condition was kept being checked for later tests, making
all followup tests fail.

That's because in case of exception we were not making sure the timeout
is removed and it kept firing forever.

Change-Id: I5c93cd67b2b83c0ecee96fbc6c4200b419bdf73f
2018-04-07 17:27:54 +02: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 6af1c18b17 ms: Create template for the osmocom-bb mobile application
Change-Id: I9296f42edfab57762f8dd317d63231298cda5430
2018-04-04 15:35:12 +01:00
Holger Hans Peter Freyther 28bcaf0f2c ms: Lua part of location update testing
The lua part to start the MS and then signal the first
successful Location Update.

Change-Id: Ica5aa0c2f86d0e5d8a2bc4dc0652de18762dd156
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
Pau Espin 48fce86b3e nanobts: Attempt at fixing race condition using ipaccess-config after power up
It seems there's a period of time in between the nanoBTS starts
announcing itself and it can actually be managed by the BSC
(ipaccess-config in this case). If ipaccess-config is called quickly
after nanoBTS it first announced, its TCP conn will be rejected with a
TCO RST, and ipaccess-config will fail. Let's see if waiting a few
seconds is enough to have this working more reliably.

Change-Id: Iec8adb2cd13d808a6ca1843dc95b81bd1a97d1c0
2018-04-04 12:48:26 +02:00
Pau Espin 9a4631c789 Drop event_loop global functions and import MainLoop
Take the chance to identify and drop modules importing event_loop but
not using it.

Change-Id: Ifa1940cd00138ebc72fbcfd45a0e28246f7a5ed9
2018-04-04 12:38:09 +02:00
Pau Espin bf176e420e event_loop: Use glib as mainloop impl and move modem to use event_loop
Several benefits:
- We can add APIs to poll on fds in the future (for smpp socket for
  instance) instead of using busy polling.
- During wait(), we now block in the glib mainloop instead of sleeping
  0.1 secs and not handling events during that time.
- We remove glib mainloop specific bits from modem.py

Change-Id: I8c3bc44bbe443703077110cdc67207e9cbb43767
2018-04-04 12:38:08 +02:00
Pau Espin 2c0ae6288d templates: osmo-bsc: Remove no longer available cfgs
osmo-bsc c74a5616bf1c77ac40ddd92f4927dca7a1b45bc8 removed these cfg
options as they are dead code.

Change-Id: I2fb63d31d5d7424b48ed2cfc694d09db072db485
2018-04-03 00:38:18 +02:00
Pau Espin fef9c1c5cf nanobts: Add support to run nanobts on the 900 band
Change-Id: I13b494630ea835f4bed38ccc77f6a4d5e18326af
2018-03-27 19:20:47 +02:00
Pau Espin 05a838e259 schema: Accept band GSM-900
Change-Id: I274c3010f33776b2967ee01de027c44b794cc5d4
2018-03-27 19:15:41 +02:00
Pau Espin a238ed9931 nanobts: Bind to specific addr instead of specific iface
This way root access is not required.

Change-Id: I02f6fc9e1cb1ea1e1d950eafe22c231a18100f98
2018-03-27 14:51:51 +02:00
Pau Espin 1b28a584ed Introduce ip.access nanobts support
Change-Id: Ibaea025b3a503dfe897d36701234445de6d49f82
2018-03-15 19:54:42 +01:00
Pau Espin 19c508c304 Introduce PowerSupply interface and PowerSupplySispm
File powersupply.py defines the interface to be used by child classes
implementing it. It also provides helpers to allocate a child class
based on configuration provided ('type' field).

File powersupply_sispm.py is an implementation using pysispm [1], as it's
the one used to control the programmable power socket we have right now.

This kind of class will be used in later commits by Nanobts class, as we
want to poweroff the Nanobts completelly when not in use.

Using it requires the following extra dependencies:
$ apt-get install python3-usb
$ pip3 install pysispm

Related: OS#3040

[1] https://github.com/xypron/pysispm

Change-Id: I981c260eca1a61657147e6d83b4226618088223c
2018-03-15 19:54:36 +01:00
Pau Espin 651cdc9b0f pcu.py: Introduce PcuDummy class
It will be used in later commits by BTS without proper PCU control such
as NanoBts.

Change-Id: I37ba38f7d81134e5f0ca28fa684fdb09c753bb04
2018-03-15 11:29:35 +01:00
Pau Espin 52ad3a66d2 Create Bts abstract class and make OsmoBts inherit from it
This base class will be used to describe the required accessors for all
BTS objects, be it an osmocom BTS or not.

It is introduced in this commit and will be further used in the future
when adding a NanoBts object.

Change-Id: Ic13133e61abda73a8b507c1a1bd7b98c677460f9
2018-03-15 11:29:35 +01:00
Pau Espin 4fbdc35e95 bts_osmo.py: ready_for_pcu is of public access from tests, move it accordingly
Change-Id: Ie8978854404897ae5de7e3100d55d86c7a5c1df1
2018-03-15 11:29:34 +01:00
Pau Espin 150abb48d0 Create Pcu abstract class and make OsmoPcu inherit from it
This base class will be used to describe the required accessors for all
PCU objects.

It is introduced in this commit and will be further used in the future
when adding a Dummy PCU object which will be used by NanoBts object.

Change-Id: Ia3fd4551d1f2932362f99f7d44d65f8ae4fd1979
2018-03-15 11:29:34 +01:00
Pau Espin f8d12196f0 modem: workaround ofono crash
Since commit bfd0b2310c, the IMSI is
retreived from ofono. To get the IMSI, the modme must be powered ON
previously. The imsi() method is called before calling connect() in
order to set up the IMSI in the HLR. As a result, the following
behaviour occurs:
- Powered=true (in imsi())
- SimManager.GetProperties() (several of them)
- Powered=false (power_cycle() in connect()

It seems powering off the modem immediately after using the SIM service
makes ofono crash. Proof of it is that crashes were seen mainly on tests
using only 1 MS, in which we don't spend that much time between
SimManager.GetProperties() and Powered=false for the same modem.

Let's workaround the crash for now increasing the time between using the
SIM services and powering the modem off.

Related: OS#3064

Change-Id: Ief052cac5a862d6ef9391d40c294ba017387506c
2018-03-14 19:20:07 +01:00
Pau Espin bfd0b2310c modem: get IMSI from ofono
There's no need to specify the IMSI manually in resource config
and it's also prone to errors. Let's take it from ofono.
Add a 'sim' feature to allow modem to auto-discover it,
otherwise if not supported leave that feature out of the config for that
modem and an imsi can still be manually providen.

Change-Id: I20f9e8d97775293925205e4ea576d814214bf1a8
2018-03-13 18:32:59 +01:00
Pau Espin edcc8d2624 osmo-trx: Add cfg template
Since commit 3da1f8352e337fb032bf7a58c2909d3ba918e237, osmo-trx requires
a cfg file to start successfully.

Change-Id: I8f0e0d0a9fa849f41c3cccc4059431f62f956eac
2018-03-04 20:17:26 +01:00
Pau Espin 86ea02f305 osmo-msc: Use osmo-mgw instead of osmo-bsc_mgcp
osmo-msc now requires osmo-mgw and it's not expected to work properly
anymore with old mgcp code.

Change-Id: I93033f7b6133a4914f12f37511ad870b3dea3201
2018-02-26 12:14:48 +01:00
Pau Espin 2c48c34998 pcap_recorder: log printing pcap file name as dbg
The log message is quite long and makes it difficult to read the log
even with debug disabled.

Change-Id: I593c0ce02bf7a3a9d26cf1fcc7d523a313cb72eb
2018-02-23 17:25:41 +01:00
Pau Espin e25cf04aeb modem: Identify modems by sysfs path instead of ofono dbus path
ofono dbus paths are non-deterministic and can change over time for a
given modem. For instance when ofono is restartd or if a modem crashes
and the object is destroyed and re-announced by udev.

Requires at least ofono 1df92289d4e09a1e2db0b189b5153a4c238f98f1, which
implemented the feature to export the sysfs path to modem properties.

Related: OS#2509

Change-Id: Ibc45a196abadded2706dc9d57b6a3a796b43a201
2018-02-23 17:14:37 +01:00
Pau Espin cdac297b89 modem: Remove ctx after deactivating it
Change-Id: Ib0e2a8ae8d9885fa44c9cc1f7dc7c7948abd683c
2018-02-16 15:14:32 +01:00
Pau Espin b05aa3cea2 modem: deactive_context: Log when context is successfully deactivated
Change-Id: Ibe40a954aa4548e54b48c444014d7dbd2da9d956
2018-02-16 15:03:50 +01:00
Pau Espin b17295bb21 templates: osmo-msc: Remove unused option auth policy
Commit osmo-msc 098aa71e83a86200a18088927b4753909f5ed518 removes this
option from default configuration as it is really not used in osmo-msc,
it comes from osmo-nitb times.

Change-Id: I928379ebabfc776f33b9f345d92a7a4a533fe25f
2018-02-14 11:26:43 +01:00
Pau Espin 342694150e templates: osmo-msc: Remove unused option reject cause
Commit osmo-msc 27b40c601c41fde70446ad553629494234c07662 removes this
option from default configuration as it is really not used in osmo-msc,
it comes from osmo-nitb times.

Change-Id: Iac1948113514414e7573f3bbfb3ce82e6c49adb6
2018-02-14 11:26:11 +01:00
Pau Espin 263dd3b600 modem: deactivate_context: Fix dbg message
Change-Id: Ib3cb72ebcbfbf53693a2d76ca1592ef7d394dd87
2018-02-13 22:27:46 +01:00
Holger Hans Peter Freyther 257ee10967 log: Use sys._getframe() to avoid stat(2) calls
The Osmo MS driver is launching many many processes and I would
like to use the logging framework for the code as well.
Unfortunately the inspect/traceback code will use a linecache which
will execute stat(2) on one or more python files.

Related: OS#2927
Change-Id: I8f6bacadcf74d3aa25db1e1f41644f64aa19cf92
2018-02-13 10:49:00 +00:00
Harald Welte ab4a1f7074 osmo-bsc.cfg.tmpl: Remove bogus VTY commands
There are plenty of VTY commands that were inherited from OsmoNITB,
but which make no sense in a BSC.  Upstream OsmoBSC has removed them in
change-ids Ib626f43a3a3ca69dfc127afe5832eb58f7fb6a38,
c499e5c62e9bef0db219e4658ffeb3292d6e6a5b and
8311a81bae85618302273c3f769275893161a7d7

Change-Id: I79ff48983d9cb7b875c1859870d5e3bce2c0ef22
2017-12-19 18:55:26 +01:00
Neels Hofmeyr 0af893c79d osmo_hlr.py: fix auth algo mapping, properly indicate COMP128v1
So far the resources.conf says we're using XOR, but we wrongly map 'xor' to 1,
which is actually comp128v1 in enum osmo_auth_algo from libosmocore (which
osmo-hlr uses to interpret the numbers from the hlr.db).

This explains why our "xor" tests are succeeding even though libosmocore
doesn't support XOR at all: we were using comp128v1 all the while.

Fix the auth algo mapping:
- define correct mappings, copying enum osmo_auth_algo, in util.py
- add a function to get the enum value from name, in util.py
- use this in osmo_hlr.py

Change subscriber_add() API to take the algorithm string instead of a number.
The number is libosmocore internal and we should not expose it within our API
beyond above dict. There are no callers using this parameter yet anyway.

Adjust resources.conf to indicate COMP128v1 which we are actually using and
which means we're still using algorithm number 1 after this change.

BTW, osmo-nitb uses the ctrl interface which interprets the names, so is not
vulnerable to mapping wrong numbers and needs no fix. (If osmo-hlr featured
similar CTRL, which it doesn't yet, this code could be more robust.)

Related: OS#2758
Change-Id: I7a6ce92468a6ae46136ad4f62381da261fd196c8
2017-12-18 02:28:58 +00:00
Pau Espin b05e36aa38 modem: activate_context: print protocol too in dbg log
Change-Id: I5c2df196b924bb0cf74aadabb4544ca1fecc1eba
2017-12-15 12:40:18 +01:00
Pau Espin 6641994d8d Set osmo-ggsn ipv6 link-local addr and enable ipv6 ctx activate test
osmo-ggsn requires a link-local IPv6 address to be added to the
tun interface, otherwise the apn will not be configured correctly and it
won't be able to allocate addresses from the ipv6 pool later on.
Some OS don't support autoconfiguring link-local IPv6 addresses when the
interface is brought up (some linux versions are known to fail at it).
This is the case for our Prod osmo-gsm-tester setup (running debian8
with kernel 3.16.51).

Make sure we configure correctly the interface by forcing osmo-ggsn to
set on the interface and use a specific IPv6 link-local address. This is
done by using the "ipv6 link-local" vty cmd in osmo-ggsn.

After this modification, we can re-enable ipv6 gprs context creation as
it will work in Prod setup.

Related: OS#2746

Change-Id: Ib291c02a3c57a4189f9c4b1b856109be97ad2a34
2017-12-15 12:08:47 +01:00
Pau Espin c1b3278af8 bts_osmo: Use correct parameters for create_pcu
Commit c9817a50ff moved code from
different BTS into a shared base class, and create_pcu method was
created to be implemented by subclasses to get a new pcu object.
However, parameters where wrongly copied over from pcu() method during
refactoring. create_pcu() has no parameters.

Change-Id: I1e95f2e658a870f86dd9d9d25f446b8efa4107a4
2017-12-15 11:49:04 +01:00
Pau Espin 81aaeefb7b cosmetic: bts_sysmo: Sort members according to scope
Change-Id: Ifc19b34660cc8d20b8db2dcf245eeb2173cd7a6a
2017-12-14 19:18:58 +01:00
Pau Espin 2e54295bbf cosmetic: bts_osmotrx: Sort members according to scope
Change-Id: I2a0771331a98b377a79aa0770c753d04a1e88db1
2017-12-14 19:18:58 +01:00
Pau Espin 4b475be9d8 cosmetic: bts_octphy: Sort members according to scope
Change-Id: I42c19bf6f5a2f9d13d60e6ce8f1bbc1cad159b4b
2017-12-14 19:18:57 +01:00