S1AP Integration Tests
Current testing workflow for VM-only S1AP integration tests. We cover gateway-only tests and some general notes.
Our VM-only tests use 3 Vagrant-managed VMs hosted on the local device (laptop):
- magma, i.e. magma-dev or gateway
- magma_test, i.e. s1ap_tester
- magma_trfserver, i.e. an Iperf server to generate uplink/downlink traffic
Gateway-only tests
These tests use all 3 VMs listed above. The magma_test VM abstracts away the UE and eNodeB, the magma_trfserver emulates the Internet, while the magma VM acts as the gateway between magma_test and magma_trfserver.
Gateway VM setup
Spin up and provision the gateway VM, then make and start its services:
- From
magma/lte/gateway
on the host machine:vagrant up magma && vagrant ssh magma
- Now in the gateway VM:
cd $MAGMA_ROOT/lte/gateway && make run
Test VM setup
Spin up and provision the s1ap tester's VM, make, then make in the integ_tests directory.
- From
magma/lte/gateway
on the host machine:vagrant up magma_test && vagrant ssh magma_test
- Now in the magma_test VM:
cd $MAGMA_ROOT/lte/gateway/python && make
cd integ_tests && make
Run tests
From $MAGMA_ROOT/lte/gateway/python/integ_tests
on the magma_test VM, run
either individual tests or the full suite of tests. A safe, non-flaky test to
run is s1aptests/test_attach_detach.py
.
- Individual test(s):
make integ_test TESTS=<test(s)_to_run>
- All tests:
make integ_test
Note: The traffic tests will fail as traffic server is not running in this setup. Look at the section below on running traffic tests.
Running uplink/downlink traffic tests
On the magma VM, run,
disable-tcp-checksumming
On the magma_test VM,
disable-tcp-checksumming
Start the traffic server VM from the host,
vagrant up magma_trfserver && vagrant ssh magma_trfserver
From magma_trfserver VM, run
disable-tcp-checksumming && trfgen-server
Running make integ_test
in magma_test VM should succeed now.
Testing stateless Access Gateway
The Access Gateway by default runs a set of stateful services, which means that whenever the services are restarted, all previous state of UEs and eNodeBs, and they need to reconnect and re-register. Alternatively, we can switch the Access Gateway to be stateless, as shown below, so that all UE state is preserved across service restarts.
Note that this is a feature in development, so some tests from the integ_test suite may not pass.
All the tests below assume you have completed the Gateway Setup and Test VM Setup described above.
Testing one stateless service
Stateless MME
This section describes how to test whether MME service is persisting state to Redis.
On gateway VM:
- Disable Pipelined, Mobilityd, Sctpd and Sessiond from restarting when MME restarts.
cd /etc/systemd/system
comment out the line PartOf=magma@mme.service
from the following files
(you will need sudo privileges):
magma@mobilityd.service, magma@pipelined.service, magma@sessiond.service and sctpd.service
sudo systemctl daemon-reload
- In
/etc/magma/mme.yml
, setuse_stateless
to true - Clean up all the state in redis:
redis-cli -p 6380 FLUSHALL
. This might throw a "Could not connect" error if magma@redis service is not running. Start the redis service withsudo service magma@redis start
and then try again. cd $MAGMA_ROOT/lte/gateway; make restart
On test VM:
- Basic attach/detach test where MME is restarted mid-way:
make integ_test TESTS=s1aptests/test_attach_detach_with_mme_restart.py
- Attach with uplink UDP traffic, where MME is restarted while UDP traffic is flowing:
make integ_test TESTS=s1aptests/test_attach_ul_udp_data_with_mme_restart.py
, make sure traffic server VM is running (as described in traffic tests above) and TCP checksum is disabled on all VMs.
Stateless Mobilityd
This section describes how to test whether Mobilityd service is persisting state to Redis.
On gateway VM:
- Disable MME from restarting when Mobilityd restarts.
comment out the line PartOf=magma@mobilityd.service
from the MME system
service file /etc/systemd/system/magma@mme.service
(you will need sudo privileges):
sudo systemctl daemon-reload
In
/etc/magma/mobilityd.yml
, setpersist_to_redis
totrue
Clean up all the state in redis:
redis-cli -p 6380 FLUSHALL
. This might throw a "Could not connect" error if magma@redis service is not running. Start the redis service withsudo service magma@redis start
and then try again.cd $MAGMA_ROOT/lte/gateway; make restart
On test VM:
cd $MAGMA_ROOT/lte/gateway/python && make
cd integ_tests && make
- Basic attach/detach test where Mobilityd is restarted mid-way:
make integ_test TESTS=s1aptests/test_attach_detach_with_mobilityd_restart.py
- Test IP blocks are maintained across service restart
make integ_test TESTS=s1aptests/test_attach_detach_multiple_ip_blocks_mobilityd_restart.py
Stateless Pipelined
This section describes how to test whether Pipelined service is persisting state to Redis.
On gateway VM:
- Disable MME from restarting when Pipelined restarts.
comment out the line PartOf=magma@pipelined.service
from the MME system
service file /etc/systemd/system/magma@mme.service
(you will need sudo privileges):
sudo systemctl daemon-reload
In
/etc/magma/pipelined.yml
, setclean_restart
tofalse
Clean up all the state in redis:
redis-cli -p 6380 FLUSHALL
. This might throw a "Could not connect" error if magma@redis service is not running. Start the redis service withsudo service magma@redis start
and then try again.cd $MAGMA_ROOT/lte/gateway; make restart
On test VM:
cd $MAGMA_ROOT/lte/gateway/python && make
cd integ_tests && make
- UDP traffic test where Pipelined is restarted mid-way:
make integ_test TESTS=s1aptests/test_attach_ul_udp_data_with_pipelined_restart.py
Testing stateless gateway with all services
To test the gateway with all services being stateless,
On gateway VM, follow steps 1 and 2 for each of Stateless MME, Mobilityd and Pipelined as listed above
On test VM, you can run any of the test cases for individual service restarts listed above. Further, you can test attach with uplink UDP traffic, where multiple services are restarted while UDP traffic is flowing:
make integ_test TESTS=s1aptests/test_attach_ul_udp_data_with_multiple_service_restart.py
, make sure traffic server VM is running (as described in traffic tests above) and TCP checksum is disabled on all VMs.
Notes
- Restart the magma VM (
vagrant reload magma
) on an assertion error involvingENB_S1_SETUP_RESP.
This is a known issue. - See Bindings for Magma's REST API for notes on the Python bindings for our REST API generated by swagger-codegen.
- It may be cleaner to set the host using the configuration class. This is also where we can set SSL options.