[MERGED] libosmo-sccp[master]: stp: Add test scripts for executing m3ua-testtool and sua-te...

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed May 17 13:56:16 UTC 2017


Harald Welte has submitted this change and it was merged.

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


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
---
A contrib/test/osmo-stp.cfg
A contrib/test/run-in-ns.sh
A contrib/test/test-m3ua.sh
A contrib/test/test-sua.sh
4 files changed, 123 insertions(+), 0 deletions(-)

Approvals:
  Max: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/contrib/test/osmo-stp.cfg b/contrib/test/osmo-stp.cfg
new file mode 100644
index 0000000..bf059a9
--- /dev/null
+++ b/contrib/test/osmo-stp.cfg
@@ -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
diff --git a/contrib/test/run-in-ns.sh b/contrib/test/run-in-ns.sh
new file mode 100755
index 0000000..a961f78
--- /dev/null
+++ b/contrib/test/run-in-ns.sh
@@ -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
diff --git a/contrib/test/test-m3ua.sh b/contrib/test/test-m3ua.sh
new file mode 100755
index 0000000..0f81fe8
--- /dev/null
+++ b/contrib/test/test-m3ua.sh
@@ -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 $!
diff --git a/contrib/test/test-sua.sh b/contrib/test/test-sua.sh
new file mode 100755
index 0000000..0cb4e35
--- /dev/null
+++ b/contrib/test/test-sua.sh
@@ -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 $!

-- 
To view, visit https://gerrit.osmocom.org/2611
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic36eafbb9868b2ec9ae2173f8d1b651b976ccf88
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list