osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38265?usp=email )
(
1 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: ggsn: add testenv.cfgs for osmo-ggsn ......................................................................
ggsn: add testenv.cfgs for osmo-ggsn
Change-Id: I941b859261c1fbf27360673f14f8a79f0cf6f509 --- D ggsn_tests/osmo-ggsn.cfg A ggsn_tests/osmo-ggsn/osmo-ggsn-all.confmerge A ggsn_tests/osmo-ggsn/osmo-ggsn-v4_only.confmerge A ggsn_tests/osmo-ggsn/osmo-ggsn-v4v6_only.confmerge A ggsn_tests/osmo-ggsn/osmo-ggsn-v6_only.confmerge A ggsn_tests/osmo-ggsn/osmo-ggsn.src.cfg A ggsn_tests/osmo-ggsn/testenv.sh A ggsn_tests/testenv_osmo_ggsn_all.cfg A ggsn_tests/testenv_osmo_ggsn_v4_only.cfg A ggsn_tests/testenv_osmo_ggsn_v4v6_only.cfg A ggsn_tests/testenv_osmo_ggsn_v6_only.cfg 11 files changed, 253 insertions(+), 83 deletions(-)
Approvals: pespin: Looks good to me, but someone else must approve laforge: Looks good to me, approved Jenkins Builder: Verified
diff --git a/ggsn_tests/osmo-ggsn.cfg b/ggsn_tests/osmo-ggsn.cfg deleted file mode 100644 index 28284e7..0000000 --- a/ggsn_tests/osmo-ggsn.cfg +++ /dev/null @@ -1,83 +0,0 @@ -! -! OpenGGSN (0.94.1-adac) configuration saved from vty -!! -! -log gsmtap 127.0.0.1 - logging level set-all debug - logging filter all 1 -! -log stderr - logging filter all 1 - logging color 1 - logging print category 1 - logging timestamp 1 - logging print extended-timestamp 1 - logging level ip info - logging level tun info - logging level ggsn info - logging level sgsn notice - logging level icmp6 debug - logging level lglobal notice - logging level llapd notice - logging level linp notice - logging level lmux notice - logging level lmi notice - logging level lmib notice - logging level lsms notice - logging level lctrl notice - logging level lgtp info - logging level lstats notice - logging level lgsup notice - logging level loap notice - logging level lss7 notice - logging level lsccp notice - logging level lsua notice - logging level lm3ua notice - logging level lmgcp notice - logging level lgtp debug -! -stats interval 5 -! -line vty - no login - bind 0.0.0.0 -! -ggsn ggsn0 - gtp state-dir /tmp - gtp bind-ip 127.0.0.2 - timer gtp T3 1 - timer gtp T1003 2 - timer gtp X3 2 - apn internet - gtpu-mode tun - tun-device tun4 - type-support v4 - ip prefix dynamic 176.16.16.0/20 - ip dns 0 172.18.3.201 - ip dns 1 8.8.8.8 - ip ifconfig 176.16.16.0/20 - no shutdown - apn inet6 - gtpu-mode tun - tun-device tun6 - type-support v6 - ipv6 prefix dynamic 2001:780:44:2000:0:0:0:0/56 - ipv6 dns 0 fd02:db8:3::201 - ipv6 dns 1 2001:4860:4860::8844 - ipv6 ifconfig 2001:780:44:2000:0:0:0:0/56 - no shutdown - apn inet46 - gtpu-mode tun - tun-device tun46 - type-support v4v6 - ip prefix dynamic 176.16.32.0/20 - ip dns 0 172.18.3.201 - ip dns 1 8.8.8.8 - ip ifconfig 176.16.32.0/20 - ipv6 prefix dynamic 2001:780:44:2100:0:0:0:0/56 - ipv6 dns 0 fd02:db8:3::201 - ipv6 dns 1 2001:4860:4860::8844 - ipv6 ifconfig 2001:780:44:2100:0:0:0:0/56 - no shutdown - default-apn internet - no shutdown ggsn diff --git a/ggsn_tests/osmo-ggsn/osmo-ggsn-all.confmerge b/ggsn_tests/osmo-ggsn/osmo-ggsn-all.confmerge new file mode 100644 index 0000000..57dbd79 --- /dev/null +++ b/ggsn_tests/osmo-ggsn/osmo-ggsn-all.confmerge @@ -0,0 +1,34 @@ +ggsn ggsn0 + apn internet + gtpu-mode tun + tun-device tun4 + type-support v4 + ip prefix dynamic 176.16.16.0/20 + ip dns 0 172.18.3.201 + ip dns 1 8.8.8.8 + ip ifconfig 176.16.16.0/20 + no shutdown + apn inet6 + gtpu-mode tun + tun-device tun6 + type-support v6 + ipv6 prefix dynamic 2001:780:44:2000:0:0:0:0/56 + ipv6 dns 0 fd02:db8:3::201 + ipv6 dns 1 2001:4860:4860::8844 + ipv6 ifconfig 2001:780:44:2000:0:0:0:0/56 + no shutdown + apn inet46 + gtpu-mode tun + tun-device tun46 + type-support v4v6 + ip prefix dynamic 176.16.32.0/20 + ip dns 0 172.18.3.201 + ip dns 1 8.8.8.8 + ip ifconfig 176.16.32.0/20 + ipv6 prefix dynamic 2001:780:44:2100:0:0:0:0/56 + ipv6 dns 0 fd02:db8:3::201 + ipv6 dns 1 2001:4860:4860::8844 + ipv6 ifconfig 2001:780:44:2100:0:0:0:0/56 + no shutdown + default-apn internet + no shutdown ggsn diff --git a/ggsn_tests/osmo-ggsn/osmo-ggsn-v4_only.confmerge b/ggsn_tests/osmo-ggsn/osmo-ggsn-v4_only.confmerge new file mode 100644 index 0000000..a39a4d4 --- /dev/null +++ b/ggsn_tests/osmo-ggsn/osmo-ggsn-v4_only.confmerge @@ -0,0 +1,12 @@ +ggsn ggsn0 + apn internet + gtpu-mode tun + tun-device tun4 + type-support v4 + ip prefix dynamic 176.16.16.0/20 + ip dns 0 172.18.3.201 + ip dns 1 8.8.8.8 + ip ifconfig 176.16.16.0/20 + no shutdown + default-apn internet + no shutdown ggsn diff --git a/ggsn_tests/osmo-ggsn/osmo-ggsn-v4v6_only.confmerge b/ggsn_tests/osmo-ggsn/osmo-ggsn-v4v6_only.confmerge new file mode 100644 index 0000000..6351ebe --- /dev/null +++ b/ggsn_tests/osmo-ggsn/osmo-ggsn-v4v6_only.confmerge @@ -0,0 +1,16 @@ +ggsn ggsn0 + apn inet46 + gtpu-mode tun + tun-device tun46 + type-support v4v6 + ip prefix dynamic 176.16.32.0/20 + ip dns 0 172.18.3.201 + ip dns 1 8.8.8.8 + ip ifconfig 176.16.32.0/20 + ipv6 prefix dynamic 2001:780:44:2100:0:0:0:0/56 + ipv6 dns 0 fd02:db8:3::201 + ipv6 dns 1 2001:4860:4860::8844 + ipv6 ifconfig 2001:780:44:2100:0:0:0:0/56 + no shutdown + default-apn inet46 + no shutdown ggsn diff --git a/ggsn_tests/osmo-ggsn/osmo-ggsn-v6_only.confmerge b/ggsn_tests/osmo-ggsn/osmo-ggsn-v6_only.confmerge new file mode 100644 index 0000000..5e3f000 --- /dev/null +++ b/ggsn_tests/osmo-ggsn/osmo-ggsn-v6_only.confmerge @@ -0,0 +1,12 @@ +ggsn ggsn0 + apn inet6 + gtpu-mode tun + tun-device tun6 + type-support v6 + ipv6 prefix dynamic 2001:780:44:2000:0:0:0:0/56 + ipv6 dns 0 fd02:db8:3::201 + ipv6 dns 1 2001:4860:4860::8844 + ipv6 ifconfig 2001:780:44:2000:0:0:0:0/56 + no shutdown + default-apn inet6 + no shutdown ggsn diff --git a/ggsn_tests/osmo-ggsn/osmo-ggsn.src.cfg b/ggsn_tests/osmo-ggsn/osmo-ggsn.src.cfg new file mode 100644 index 0000000..e9dca06 --- /dev/null +++ b/ggsn_tests/osmo-ggsn/osmo-ggsn.src.cfg @@ -0,0 +1,50 @@ +! +! OpenGGSN (0.94.1-adac) configuration saved from vty +!! +! +log gsmtap 127.0.0.1 + logging level set-all debug + logging filter all 1 +! +log stderr + logging filter all 1 + logging color 1 + logging print category 1 + logging timestamp 1 + logging print extended-timestamp 1 + logging level ip info + logging level tun info + logging level ggsn info + logging level sgsn notice + logging level icmp6 debug + logging level lglobal notice + logging level llapd notice + logging level linp notice + logging level lmux notice + logging level lmi notice + logging level lmib notice + logging level lsms notice + logging level lctrl notice + logging level lgtp info + logging level lstats notice + logging level lgsup notice + logging level loap notice + logging level lss7 notice + logging level lsccp notice + logging level lsua notice + logging level lm3ua notice + logging level lmgcp notice + logging level lgtp debug +! +stats interval 5 +! +line vty + no login + bind 0.0.0.0 +! +ggsn ggsn0 + gtp state-dir /tmp + gtp bind-ip 127.0.0.2 + timer gtp T3 1 + timer gtp T1003 2 + timer gtp X3 2 diff --git a/ggsn_tests/osmo-ggsn/testenv.sh b/ggsn_tests/osmo-ggsn/testenv.sh new file mode 100755 index 0000000..d797d44 --- /dev/null +++ b/ggsn_tests/osmo-ggsn/testenv.sh @@ -0,0 +1,85 @@ +#!/bin/sh -ex +CONFIG="$1" # all, v4_only, etc. +DEV=ggsn_dummy + +check_usage() { + local valid="all|v4_only|v6_only|v4v6_only" + + if [ -z "$CONFIG" ]; then + set +x + echo "Do not run this script manually." + echo "Run 'testenv.py run ggsn' instead." + exit 1 + fi + + case "|$valid|" in + *"|$CONFIG|"*) + ;; + *) + set +x + echo "usage: testenv.sh $valid" + exit 1 + ;; + esac +} + +adjust_osmo_ggsn_config() { + osmo-config-merge \ + osmo-ggsn/osmo-ggsn.src.cfg \ + osmo-ggsn/osmo-ggsn-"$CONFIG".confmerge \ + > osmo-ggsn.cfg +} + +adjust_ttcn3_config() { + local config_upper="$(echo "$CONFIG" | tr "[:lower:]" "[:upper:]")" + + sed -i "s/^GGSN_Tests.m_ggsn_conf := .*/GGSN_Tests.m_ggsn_conf := GGSN_CONF_$config_upper/" \ + ../testsuite/GGSN_Tests.cfg +} + +setcap_osmo_ggsn() { + sudo setcap CAP_NET_ADMIN=+eip $(which osmo-ggsn) +} + +add_dummy_netdev() { + # Add a network device reachable through the GTP tunnel that can answer ICMP + # pings (for e.g. TC_pdp4_act_deact_gtpu_access) + sudo ip link add "$DEV" type dummy + sudo ip addr add "172.18.3.201" dev "$DEV" + sudo ip addr add "fd02:db8:3::201" dev "$DEV" + sudo ip link set "$DEV" up +} + +del_dummy_netdev() { + if ip link ls dev "$DEV" >/dev/null 2>&1; then + sudo ip link del "$DEV" + fi +} + +rename_junit_xml_classname() { + if [ "$CONFIG" != "all" ]; then + ( cd ../testsuite + rename_junit_xml_classname.sh "_$CONFIG" ) + fi +} + +check_usage + +case "$TESTENV_CLEAN_REASON" in + prepare) + adjust_osmo_ggsn_config + adjust_ttcn3_config + setcap_osmo_ggsn + del_dummy_netdev + add_dummy_netdev + ;; + crashed|finished) + del_dummy_netdev + rename_junit_xml_classname + ;; + *) + set +x + echo "ERROR: unexpected TESTENV_CLEAN_REASON: $TESTENV_CLEAN_REASON" + exit 1 + ;; +esac diff --git a/ggsn_tests/testenv_osmo_ggsn_all.cfg b/ggsn_tests/testenv_osmo_ggsn_all.cfg new file mode 100644 index 0000000..08f25c5 --- /dev/null +++ b/ggsn_tests/testenv_osmo_ggsn_all.cfg @@ -0,0 +1,11 @@ +[testsuite] +program=GGSN_Tests +config=GGSN_Tests.cfg + +[ggsn] +program=osmo-ggsn +make=osmo-ggsn +package=osmo-ggsn +copy=osmo-ggsn +clean=osmo-ggsn/testenv.sh all +vty_port=4260 diff --git a/ggsn_tests/testenv_osmo_ggsn_v4_only.cfg b/ggsn_tests/testenv_osmo_ggsn_v4_only.cfg new file mode 100644 index 0000000..c9adef7 --- /dev/null +++ b/ggsn_tests/testenv_osmo_ggsn_v4_only.cfg @@ -0,0 +1,11 @@ +[testsuite] +program=GGSN_Tests +config=GGSN_Tests.cfg + +[ggsn] +program=osmo-ggsn +make=osmo-ggsn +package=osmo-ggsn +copy=osmo-ggsn.src.cfg osmo-ggsn-v4_only.confmerge +clean=testenv.sh v4_only +vty_port=4260 diff --git a/ggsn_tests/testenv_osmo_ggsn_v4v6_only.cfg b/ggsn_tests/testenv_osmo_ggsn_v4v6_only.cfg new file mode 100644 index 0000000..cc23fcb --- /dev/null +++ b/ggsn_tests/testenv_osmo_ggsn_v4v6_only.cfg @@ -0,0 +1,11 @@ +[testsuite] +program=GGSN_Tests +config=GGSN_Tests.cfg + +[ggsn] +program=osmo-ggsn +make=osmo-ggsn +package=osmo-ggsn +copy=osmo-ggsn.src.cfg osmo-ggsn-v4v6_only.confmerge +clean=testenv.sh v4v6_only +vty_port=4260 diff --git a/ggsn_tests/testenv_osmo_ggsn_v6_only.cfg b/ggsn_tests/testenv_osmo_ggsn_v6_only.cfg new file mode 100644 index 0000000..6109595 --- /dev/null +++ b/ggsn_tests/testenv_osmo_ggsn_v6_only.cfg @@ -0,0 +1,11 @@ +[testsuite] +program=GGSN_Tests +config=GGSN_Tests.cfg + +[ggsn] +program=osmo-ggsn +make=osmo-ggsn +package=osmo-ggsn +copy=osmo-ggsn.src.cfg osmo-ggsn-v6_only.confmerge +clean=testenv.sh v6_only +vty_port=4260