stp: Add test scripts for executing m3ua-testtool and sua-testtool

You will need to have
* GNU/Linux with support for [network] namespaces
* the 'unshare' command line tool
* m3ua-testtool and sua-testtool repositories
  from git.osmocom.org/nplab installed adjacent to libosmo-sccp
* their requirements, i.e.
** guile
** guile-sctp from https://github.com/nplab/guile-sctp

When those are installed, you can do things like

(cd contrib/test && ./run-in-ns.sh test-m3ua.sh)
(cd contrib/test && ./run-in-ns.sh test-sua.sh)

to execute the test suite.

Change-Id: Ic36eafbb9868b2ec9ae2173f8d1b651b976ccf88
This commit is contained in:
Harald Welte 2017-05-14 22:59:33 +02:00
parent 872c6b2a8e
commit 4c9041b9d3
4 changed files with 123 additions and 0 deletions

48
contrib/test/osmo-stp.cfg Normal file
View File

@ -0,0 +1,48 @@
!
! osmo-stp (0.0.6.3.179-b248) configuration saved from vty
!!
!
log stderr
logging filter all 1
logging color 1
logging print category 1
logging timestamp 0
logging level all everything
logging level lglobal notice
logging level llapd notice
logging level linp info
logging level lmux notice
logging level lmi notice
logging level lmib notice
logging level lsms notice
logging level lctrl notice
logging level lgtp notice
logging level lstats notice
logging level lgsup notice
logging level loap notice
logging level lss7 debug
logging level lsccp debug
logging level lsua debug
logging level lm3ua debug
!
line vty
no login
!
cs7 instance 0
asp asp0 0 2905 m3ua
remote-ip 172.18.0.2
asp asp-s-0 0 14001 sua
remote-ip 172.18.0.3
as as0 m3ua
asp asp0
routing-key 23 0.2.7
as as-s-0 sua
asp asp-s-0
routing-key 24 0.3.0
route-table system
update route 0.2.7 0.2.7 linkset as0
update route 0.3.0 0.3.0 linkset as-s-0
listen m3ua 2905
local-ip 172.18.0.200
listen sua 14001
local-ip 172.18.0.200

13
contrib/test/run-in-ns.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
# small helper script to run the specified command inside a network
# namespace while remapping the real PID to root inside the namespace,
# so the program inside the namespace can do things like setting
# interface addresses
if [ $# -eq 0 ]; then
echo "You have to specify the command you want to execute in the new namespace"
exit 1
fi
unshare --map-root-user --user -i -m -p -f -u -U -n $1

31
contrib/test/test-m3ua.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/sh
# this script executes m3ua-testtool against osmo-stp. It assumes that
# it is called from within libosmo-sccp/contrib/test and also assumes
# that adjacent to the libosmo-sccp, there's a check-out of
# git://git.osmocom.org/nplab/m3ua-testtool
# the top of the libosmo-sccp git repository
TOPDIR=../../
# the directory in which we can find the osmo-stp binary
STP_DIR=$TOPDIR/stp
# the directory in which we can find the m3ua-testtool.git
M3UA_DIR=$TOPDIR/../m3ua-testtool
# osmo-stp config file, used from CWD
STP_CONFIG=./osmo-stp.cfg
# we're pesudo-root but inherit the path from a non-root user
PATH=/sbin:/usr/sbin:$PATH
# set up the ip addresses
ip link set lo up
ip addr add 172.18.0.2/32 dev lo
ip addr add 172.18.0.200/32 dev lo
$STP_DIR/osmo-stp -c $STP_CONFIG &
STP_PID=$!
(cd $M3UA_DIR && ./run-all-sgp-tests)
kill $!

31
contrib/test/test-sua.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/sh
# this script executes m3ua-testtool against osmo-stp. It assumes that
# it is called from within libosmo-sccp/contrib/test and also assumes
# that adjacent to the libosmo-sccp, there's a check-out of
# git://git.osmocom.org/nplab/m3ua-testtool
# the top of the libosmo-sccp git repository
TOPDIR=../../
# the directory in which we can find the osmo-stp binary
STP_DIR=$TOPDIR/stp
# the directory in which we can find the sua-testtool.git
SUA_DIR=$TOPDIR/../sua-testtool
# osmo-stp config file, used from CWD
STP_CONFIG=./osmo-stp.cfg
# we're pesudo-root but inherit the path from a non-root user
PATH=/sbin:/usr/sbin:$PATH
# set up the ip addresses
ip link set lo up
ip addr add 172.18.0.3/32 dev lo
ip addr add 172.18.0.200/32 dev lo
$STP_DIR/osmo-stp -c $STP_CONFIG &
STP_PID=$!
(cd $SUA_DIR && ./run-some-sua-sgp-tests)
kill $!