Commit Graph

22 Commits

Author SHA1 Message Date
Pau Espin be5156c5c1 open5gs: Pre-configure tun device for UPF
open5gs requires the tun device to be pre-created and pre-configured
before using it. A ticket was opened in order to allow upfd itself
configuring it in [1]

[1] https://github.com/open5gs/open5gs/issues/899

Change-Id: I3b1857f09017cacee1c86f41dae1463c11b50490
2021-05-12 19:36:18 +02:00
Andre Puschmann f093cb2c34 androidue: fix execute permissions for conn_chk and diag parser scripts
Change-Id: I755b65188a485a3c2f30488ab598f7a50cf80dc5
2021-05-10 21:51:31 +02:00
Andre Puschmann e98e1294eb osmo-gsm-tester_androidue_conn_chk.sh: improve error handling
fix check of $serial and check passed arguments.
exit when adb isn't installed on host

Change-Id: I6190a840dbc86838457da96d188afc17f83ab15f
2021-03-16 18:07:22 +01:00
Nils Fürste a8263f40e9 Introduce Android UEs as new modems
To expand the test capacities we would like to introduce
Android UEs as new modems. Currently the following tests
are supported:
- Ping
- iPerf3 DL/UL
- RRC Mobile MT Ping

In the following is a small description.

Prerequisites:
    - Android UE
        - Rooted (Ping, iPerf, RRC Idle MT Ping)
        - Qualcomm baseband with working diag_mdlog (RRC Idle MT Ping)
        - iPerf3
        - Dropbear
    - OGT Slave Unit
        - Android SDK Platform-Tools
	  (https://developer.android.com/studio/releases/platform-tools#downloads)
        - Pycrate (https://github.com/P1sec/pycrate)
        - SCAT
            clone https://github.com/bedrankara/scat/ & install dependencies
            checkout branch ogt
            symlink scat (ln -s ~/scat/scat.py /usr/local/bin/scat)

Infrastructure explaination:
The Android UEs are connected to the OGT Units via USB. We
activate tethering and set up a SSH server (with Dropbear).
We chose tethering over WiFi to have a more stable route
for the ssh connection. We forward incoming connections to
the OGT unit hosting the Android UE(s) on specific ports
to the UEs via iptables. This enables OGT to issue commands
directly to the UEs. In case of local execution we use ADB
to issue commands to the AndroidUE. The set up was tested
with 5 Android UEs connected in parallel but it should be
scalable to the number of available IPs in the respective
subnet. Furthermore, we need to cross compile Dropbear
and iPerf3 to use them on the UEs. These tools have to be
added to the $PATH variable of the UEs.

Examplary set up:
In this example we have two separate OGT units (master
and slave) and two Android UEs that are connected to the
slave unit. An illustration may be found here: https://ibb.co/6BXSP2C

On UE 1:
ip address add 192.168.42.130/24 dev rndis0
ip route add 192.168.42.0/24 dev rndis0 table local_network
dropbearmulti dropbear -F -E -p 130 -R -T /data/local/tmp/authorized_keys  -U 0 -G 0 -N root -A

On UE 2:
ip address add 192.168.42.131/24 dev rndis0
ip route add 192.168.42.0/24 dev rndis0 table local_network
dropbearmulti dropbear -F -E -p 131 -R -T /data/local/tmp/authorized_keys  -U 0 -G 0 -N root -A

On OGT slave unit:
sudo ip link add name ogt type bridge
sudo ip l set eth0 master ogt
sudo ip l set enp0s20f0u1 master ogt
sudo ip l set enp0s20f0u2 master ogt
sudo ip a a 192.168.42.1/24 dev ogt
sudo ip link set ogt up

Now we have to manually connect to every UE from OGT Master
to set up SSH keys and verify that the setup works.
Therefore, use:
ssh -p [UE-PORT] root@[OGT SLAVE UNIT's IP]

Finally, to finish the setup procedure create the
remote_run_dir for Android UEs on the slave unit like
following:
mkdir /osmo-gsm-tester-androidue
chown jenkins /osmo-gsm-tester-androidue

Example for modem in resource.conf:
- label: mi5g
  type: androidue
  imsi: '901700000034757'
  ki: '85E9E9A947B9ACBB966ED7113C7E1B8A'
  opc: '3E1C73A29B9C293DC5A763E42C061F15'
  apn:
    apn: 'srsapn'
    mcc: '901'
    mnc: '70'
    select: 'True'
    auth_algo: 'milenage'
  features: ['4g', 'dl_qam256', 'qc_diag']
  run_node:
    run_type: ssh
    run_addr: 100.113.1.170
    ssh_user: jenkins
    ssh_addr: 100.113.1.170
    ue_ssh_port: 130
    adb_serial_id: '8d3c79a7'
  scat_parser:
    run_type: local
    run_addr: 127.0.0.1
    adb_serial_id: '8d3c79a7'

Example for default-suites.conf:
- 4g:ms-label@mi5g+srsenb-rftype@uhd+mod-enb-nprb@25+mod-enb-txmode@1

Change-Id: I79a5d803e869a868d4dac5e0d4c2feb38038dc5c
2021-01-13 19:45:56 +01:00
Pau Espin d6deb2824f Copy gnuradio zmq broker at runtime
The remotely run script is moved into a new subdir called "external",
where external utils to be used by osmo-gsm-tester (exernal to its own
process) are placed.
It needs to be in another directory because python files in obj/ are
loaded at startup of osmo-gsm-tester to dynamically load schemas.

Change-Id: I633a85294694f2c6efd58535729e9b8af166b3ff
2020-10-22 11:28:26 +02:00
Pau Espin 410912333e 4g: Introduce ZMQ GnuRadio stream broker
srsENB currently creates 1 zmq stream (1 tx, 1 rx) for each cell (2 if
MIMO is enabled). Each cell transceives on a given EARFCN (and several
cells can transmit on same EARFCN).

However, for handover test purposes, we want to join all cells operating
on the same EARFCN to transceive on the same ZMQ conn, so that an srsUE
can interact with them at the same time (same as if the medium was shared).
Furthermore, we want to set different gains on each of those paths
before merging them in order to emulate RF conditions like handover.

In order to do so, a new element called the Broker is introduced, which
is placed in between ENBs and UEs ZMQ conenctions, multiplexing the
connections on the ENB side towards the UE side.

A separate process for the broker is run remotely (ENB run host) which
listens on a ctrl socket for commands. An internal Broker class is used
in osmo-gsm-tester to interact with the remote script, for instance to
configure the ports, start and stop the remote process, send commands to
it, etc.
On each ENB, when the rfemu "gnuradio_zmq" rfemu implementation is selected
in configuration, it will configure its zmq connections and the UE ones to
go over the Broker.

As a result, that means the UE zmq port configuration is expected to be
different than when no broker is in used, since there's the multiplexing
per EARFCN in between.

In this commit, only 1 ENB is supported, but multi-enb support is
planned in the future.

The handover test passes in the docker setup with this config:
"""
OSMO_GSM_TESTER_OPTS="-T -l dbg -s 4g:srsue-rftype@zmq+srsenb-rftype@zmq+" \
	"mod-enb-nprb@6+mod-enb-ncells@2+mod-enb-cells-2ca+suite-4g@10,2+" \
	"mod-enb-meas-enable -t =handover.py"
"""

and in resources.conf (or scenario), added:
"""
enb:
  ...
  cell_list:
    - dl_rfemu:
       type: gnuradio_zmq
    - dl_rfemu:
        type: gnuradio_zmq
"""

Note that since the broker is used, there's not need for mod-srsue-ncarriers@2
since the broker is joining the 2 enb cells into 1 stream on the UE side.

Change-Id: I6282cda400558dcb356276786d91e6388524c5b1
2020-10-15 12:34:36 +00:00
Pau Espin f96d590703 amarisoft_ltemme_ifup.sh: use ip cmd instead of ifconfig
ifconfig is deprecated and not available in newer distros.

Change-Id: I93e4b7f3c9bee2563c0e01a1ff7e832e5098cf1f
2020-07-13 18:19:23 +02:00
Pau Espin 69a6f668b9 Get rid of install top directory
Some content there is out of date, or should be mvoed to utils/ with the
rest of installable stuff.

Change-Id: I17ee94b175deb88faff71e7788c482093693f8a8
2020-04-10 17:29:10 +02:00
Pau Espin 23e60e5b37 amarisoft_ue: Implement data plane
Use the ifup script to set up the netns + configure the tun device
created by lteue. Use it also as a hook to know when the UE is attached.
Since tun setup is done by arch-optimized lte-avx(2) binaries, we also
need to give capabilitites to them (instead of allowing inheritance of
caps in general in the setcap script).

Change-Id: I1e228b1296eac8e4cb183c2faa735b0468abe124
2020-04-08 15:16:52 +02:00
Pau Espin 80855498f1 utils/bin: Support passing several bin files to setcap helper scripts
Change-Id: Ifa43f895ae0796d086f35778263aaba07f2e1b7a
2020-04-08 15:16:10 +02:00
Pau Espin da2e31f929 Introduce support for AmarisoftEPC
* A new abstract generic base class EPC is created
* srsEPC and AmarisoftEPC inherit from that class
* options are loaded from defaults.conf in cascade. First generic "epc",
  afterwards the specific enb type.
* A new scenario is added to select the EPC type to use. srsEPC is the
  default unless stated by an scenario.
* AmarisoftEPC delegates setup of the tun IP address to an "ifup"
  script. As a result, since we run without root permissions (ony with
  CAP_NET_ADMIN), the ifup script itself is unablet o set the IP
  address. To solve this, we introduce a new osmo-gsm-tester helper
  script which must be installed in the slave node which can be called
  through sudo to increase privileges to do so.

With this commit, I can already get srsUE<->amarisoftENB<->amarisoftEPC
to pass ping and iperf3 4g tests.

Change-Id: Ia50ea6a74b63b2d688c8d683aea11416ad40a6d3
2020-03-31 19:18:18 +02:00
Pau Espin 63685d719a utils: Add limits.d dir with sample config files
Same as the ones described in osmo-gsm-tester User Manual and same as
ones deployed by ansible scripts. Let's rather keep them here.

Change-Id: I8b124a8a1637666536772439b920e7b91e61533c
2020-03-03 09:22:17 +00:00
Pau Espin 69b2cf3ce2 srsue: Create netns on demand
Already existing script osmo-gsm-tester_netns_setup.sh is modified to
support only creating the entns without moving an iface to it.

Change-Id: I1b7e186b0146f932fe37fbea68e4dfa3120b7a74
2020-02-24 10:59:05 +01:00
Pau Espin 31a4aee92f util: Add sudoers.d/ example directory
Change-Id: Ib9ab4d88bf2fb94d04240169e0203b72616f58b0
2020-02-11 15:57:51 +01:00
Pau Espin 49ebbf5ed3 utils: Move shell script helpers to subdir
Change-Id: I86ed3b0bb779c50e57912cf6c2f1ee9fa6e5f557
2020-02-11 15:57:51 +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 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 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 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
Pau Espin 0aaf8e1c1b utils: Add osmo-gsm-tester_setcap_net_*.sh scripts
This scripts were already being used by osmo-gsm-tester for a while, but
were not avaialable in this repository. Let's put them here to easy find
them and have all this kind of helper scripts together with code using
it.

Change-Id: Ib88a1b7818155fc608cc6ff763300fbd0e03a07a
2018-10-31 08:57:27 +00:00
Pau Espin e972828a01 utils: Introduce modem-netns-setup.py
Used to quickly set modem net interfaces into their own net namespace
(named after modem USB ID path).

The idea is that since osmo-gsm-tester ofono modem.py knowns the USB
path from a modem (path yml attr), it can infer the netns from it and
run a ping process inside it.

Related: OS#2308
Change-Id: Iadb2df2974e132044fba1f1bc2db8b559912e4e1
2018-10-31 08:57:27 +00:00
Alexander Couzens 2decdba7e5 utils: Introduce show_usb_device.py
This is a small script written by Alexander Couzens that is useful to
list modems and its properties in a quick and easy way in
osmo-gsm-tester setup.

Change-Id: Iec049e2d56d61ecd50b65b64d95d69641fa0f8be
2018-10-31 08:57:27 +00:00