lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

October 2024

  • 1 participants
  • 1631 discussions
[S] Change in osmo-ttcn3-hacks[master]: testenv: podman: don't install GUI packages
by osmith 07 Oct '24

07 Oct '24
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38338?usp=email ) Change subject: testenv: podman: don't install GUI packages ...................................................................... testenv: podman: don't install GUI packages Install erlang-nox and use the pre-built rebar3 as linked from rebar3.org, instead of using the Debian package to avoid pulling in ~600 MB of GUI dependencies. Related: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1083096 Change-Id: I27f58d1f102cf85ff7ff301c52696b65150e2898 --- M _testenv/data/podman/Dockerfile 1 file changed, 9 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/38/38338/1 diff --git a/_testenv/data/podman/Dockerfile b/_testenv/data/podman/Dockerfile index 013c03d..294ea82 100644 --- a/_testenv/data/podman/Dockerfile +++ b/_testenv/data/podman/Dockerfile @@ -21,6 +21,7 @@ ca-certificates \ ccache \ cmake \ + erlang-nox \ flex \ gdb \ git \ @@ -62,7 +63,6 @@ procps \ psmisc \ python3-pip \ - rebar3 \ rsync \ source-highlight \ sqlite3 \ @@ -74,6 +74,14 @@ && \ apt-get clean +# Install rebar3 as described in https://rebar3.org/docs/getting-started/ +# instead of using the Debian package, as the latter pulls in ~600 MB of GUI +# dependencies that we don't need: +# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1083096 +RUN wget https://s3.amazonaws.com/rebar3/rebar3 -O /usr/bin/rebar3 && \ + chmod +x /usr/bin/rebar3 && \ + rebar3 --version + # Ccache is installed above so it can be optionally used when rebuilding the # testsuites inside the docker containers. Don't use it by default. ENV USE_CCACHE=0 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38338?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I27f58d1f102cf85ff7ff301c52696b65150e2898 Gerrit-Change-Number: 38338 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de>
1 0
0 0
[M] Change in osmo-ttcn3-hacks[master]: ggsn: testenv: replace dummy netdev with bridge
by osmith 07 Oct '24

07 Oct '24
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38340?usp=email ) Change subject: ggsn: testenv: replace dummy netdev with bridge ...................................................................... ggsn: testenv: replace dummy netdev with bridge Replace the dummy netdev that was used as network device reachable through the GTP tunnel that can answer ICMP, with a bridge device. The bridge device fulfils the same purpose, plus it can be used in a future patch to connect osmo-ggsn when it is running in QEMU with the testsuite. Change-Id: I102d5b9ed0b3cafc263ad489ed4d4652f5e6dac8 --- M _testenv/data/podman/Dockerfile A _testenv/data/scripts/add_remove_testenv0_bridge.sh M _testenv/testenv/requirements.py M ggsn_tests/open5gs/testenv.sh M ggsn_tests/osmo-ggsn/testenv.sh 5 files changed, 53 insertions(+), 38 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/40/38340/1 diff --git a/_testenv/data/podman/Dockerfile b/_testenv/data/podman/Dockerfile index 294ea82..13412a2 100644 --- a/_testenv/data/podman/Dockerfile +++ b/_testenv/data/podman/Dockerfile @@ -17,6 +17,7 @@ autoconf \ automake \ bison \ + bridge-utils \ build-essential \ ca-certificates \ ccache \ diff --git a/_testenv/data/scripts/add_remove_testenv0_bridge.sh b/_testenv/data/scripts/add_remove_testenv0_bridge.sh new file mode 100755 index 0000000..cb1b6a3 --- /dev/null +++ b/_testenv/data/scripts/add_remove_testenv0_bridge.sh @@ -0,0 +1,41 @@ +#!/bin/sh -e +# Call this as or from within a clean= script to add and remove a testenv0 +# bridge device, which can be used to talk to a SUT running in QEMU. +# Set env var EXTRA_IPS to add additional IP addresses to the device. +DEV="testenv0" +IP4="172.18.3.201/24" +IP6="fd02:db8:3::201/128" +set -x + +add_bridge() { + local ip + + sudo brctl addbr "$DEV" + sudo ip link set "$DEV" up + + for ip in $IP4 $IP6 $EXTRA_IPS; do + sudo ip addr add "$ip" dev "$DEV" + done +} + +del_bridge() { + if ip link ls dev "$DEV" >/dev/null 2>&1; then + sudo ip link set "$DEV" down + sudo brctl delbr "$DEV" + fi +} + +case "$TESTENV_CLEAN_REASON" in + prepare) + del_bridge + add_bridge + ;; + crashed|finished) + del_bridge + ;; + *) + set +x + echo "ERROR: unexpected TESTENV_CLEAN_REASON: $TESTENV_CLEAN_REASON" + exit 1 + ;; +esac diff --git a/_testenv/testenv/requirements.py b/_testenv/testenv/requirements.py index d65e436..7c39a7c 100644 --- a/_testenv/testenv/requirements.py +++ b/_testenv/testenv/requirements.py @@ -24,6 +24,7 @@ programs += [ "autoconf", "automake", + "brctl", "ccache", "dumpcap", "g++", diff --git a/ggsn_tests/open5gs/testenv.sh b/ggsn_tests/open5gs/testenv.sh index 9cc1c70..e06d771 100755 --- a/ggsn_tests/open5gs/testenv.sh +++ b/ggsn_tests/open5gs/testenv.sh @@ -1,5 +1,4 @@ #!/bin/sh -ex -DEV=ggsn_dummy check_usage() { if [ -z "$TESTENV_CLEAN_REASON" ]; then @@ -65,34 +64,21 @@ del_tun "ogstun46" } -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 -} - check_usage +# Add a bridge reachable through the GTP tunnel that can answer ICMP +# pings (for e.g. TC_pdp4_act_deact_gtpu_access). The bridge is also used to +# connect the SUT when it runs in QEMU. +add_remove_testenv0_bridge.sh + case "$TESTENV_CLEAN_REASON" in prepare) setcap_open5gs_upfd adjust_ttcn3_config - del_dummy_netdev del_tun_all - add_dummy_netdev add_tun_all ;; crashed|finished) - del_dummy_netdev del_tun_all ;; *) diff --git a/ggsn_tests/osmo-ggsn/testenv.sh b/ggsn_tests/osmo-ggsn/testenv.sh index d797d44..0275ad2 100755 --- a/ggsn_tests/osmo-ggsn/testenv.sh +++ b/ggsn_tests/osmo-ggsn/testenv.sh @@ -1,6 +1,5 @@ #!/bin/sh -ex CONFIG="$1" # all, v4_only, etc. -DEV=ggsn_dummy check_usage() { local valid="all|v4_only|v6_only|v4v6_only" @@ -41,21 +40,6 @@ 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 @@ -65,16 +49,18 @@ check_usage +# Add a bridge reachable through the GTP tunnel that can answer ICMP +# pings (for e.g. TC_pdp4_act_deact_gtpu_access). The bridge is also used to +# connect the SUT when it runs in QEMU. +add_remove_testenv0_bridge.sh + 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 ;; *) -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38340?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I102d5b9ed0b3cafc263ad489ed4d4652f5e6dac8 Gerrit-Change-Number: 38340 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de>
1 0
0 0
[XS] Change in osmo-ttcn3-hacks[master]: ggsn: osmo-ggsn.src.cfg: tweak log output
by osmith 07 Oct '24

07 Oct '24
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38339?usp=email ) Change subject: ggsn: osmo-ggsn.src.cfg: tweak log output ...................................................................... ggsn: osmo-ggsn.src.cfg: tweak log output * Print log levels. * Don't print categories as hex. * Print the basename at the end of the line. * Remove "logging level lgtp debug", there already is "logging level lgtp info" further above, and this is a more sensible setting. With "debug" there are way too many log messages in e.g. TC_lots_of_concurrent_pdp_ctx. Change-Id: I771d07645ea6da91f2c93f0954d99a37c866629a --- M ggsn_tests/osmo-ggsn/osmo-ggsn.src.cfg 1 file changed, 3 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/39/38339/1 diff --git a/ggsn_tests/osmo-ggsn/osmo-ggsn.src.cfg b/ggsn_tests/osmo-ggsn/osmo-ggsn.src.cfg index e9dca06..23a21f4 100644 --- a/ggsn_tests/osmo-ggsn/osmo-ggsn.src.cfg +++ b/ggsn_tests/osmo-ggsn/osmo-ggsn.src.cfg @@ -9,9 +9,12 @@ log stderr logging filter all 1 logging color 1 + logging print category-hex 0 logging print category 1 logging timestamp 1 logging print extended-timestamp 1 + logging print file basename last + logging print level 1 logging level ip info logging level tun info logging level ggsn info @@ -34,7 +37,6 @@ logging level lsua notice logging level lm3ua notice logging level lmgcp notice - logging level lgtp debug ! stats interval 5 ! -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38339?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I771d07645ea6da91f2c93f0954d99a37c866629a Gerrit-Change-Number: 38339 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de>
1 0
0 0
[M] Change in osmo-ttcn3-hacks[master]: ggsn: testenv: run SUT on bridge instead of lo
by osmith 07 Oct '24

07 Oct '24
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38341?usp=email ) Change subject: ggsn: testenv: run SUT on bridge instead of lo ...................................................................... ggsn: testenv: run SUT on bridge instead of lo Adjust configs to run the SUT on 172.18.3.202 (testenv0 bridge) instead of 127.0.0.2 (lo). Later on when we can use QEMU with osmo-ggsn, it will run on this IP as well. So with this change we can use the same IP for both the QEMU and the non-QEMU case. Change-Id: Ib768603b0050fe62baff39cab982a850eb91f49a --- M ggsn_tests/GGSN_Tests.cfg M ggsn_tests/open5gs/freediameter.conf M ggsn_tests/open5gs/open5gs-smf.yaml M ggsn_tests/open5gs/open5gs-upf.yaml M ggsn_tests/open5gs/testenv.sh M ggsn_tests/osmo-ggsn/osmo-ggsn-all.confmerge M ggsn_tests/osmo-ggsn/osmo-ggsn-v4_only.confmerge M ggsn_tests/osmo-ggsn/osmo-ggsn-v4v6_only.confmerge M ggsn_tests/osmo-ggsn/osmo-ggsn-v6_only.confmerge M ggsn_tests/osmo-ggsn/osmo-ggsn.src.cfg M ggsn_tests/osmo-ggsn/testenv.sh M ggsn_tests/testenv_osmo_ggsn_all.cfg M ggsn_tests/testenv_osmo_ggsn_v4_only.cfg M ggsn_tests/testenv_osmo_ggsn_v4v6_only.cfg M ggsn_tests/testenv_osmo_ggsn_v6_only.cfg 15 files changed, 41 insertions(+), 37 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/41/38341/1 diff --git a/ggsn_tests/GGSN_Tests.cfg b/ggsn_tests/GGSN_Tests.cfg index 6b27bf6..b6811fb 100644 --- a/ggsn_tests/GGSN_Tests.cfg +++ b/ggsn_tests/GGSN_Tests.cfg @@ -9,19 +9,19 @@ [LOGGING] *.JUnitLogger.testsuite_name := "osmo-ttcn3-hacks/ggsn_tests" - [TESTPORT_PARAMETERS] +*.GGSNVTY.CTRL_HOSTNAME := "172.18.3.202" [MODULE_PARAMETERS] # our Own IP address -GGSN_Tests.m_bind_ip_gtpc := "127.0.0.1" -GGSN_Tests.m_bind_ip_gtpu := "127.0.0.1" +GGSN_Tests.m_bind_ip_gtpc := "172.18.3.201" +GGSN_Tests.m_bind_ip_gtpu := "172.18.3.201" # GGSN IP address -GGSN_Tests.m_ggsn_ip_gtpc := "127.0.0.2" -GGSN_Tests.m_ggsn_ip_gtpu := "127.0.0.2" # For open5gs: 127.0.0.222 +GGSN_Tests.m_ggsn_ip_gtpc := "172.18.3.202" +GGSN_Tests.m_ggsn_ip_gtpu := "172.18.3.202" # For open5gs: 172.18.3.203 # GGSN announced DNS address -GGSN_Tests.m_ggsn_ip4_dns1 := "172.18.3.201" -GGSN_Tests.m_ggsn_ip6_dns1 := "fd02:db8:3::201" +GGSN_Tests.m_ggsn_ip4_dns1 := "172.18.3.202" +GGSN_Tests.m_ggsn_ip6_dns1 := "fd02:db8:3::202" # local T3-RESPONSE timeout, seconds: GGSN_Tests.mp_t3_response := 1; diff --git a/ggsn_tests/open5gs/freediameter.conf b/ggsn_tests/open5gs/freediameter.conf index 6311878..af582a6 100644 --- a/ggsn_tests/open5gs/freediameter.conf +++ b/ggsn_tests/open5gs/freediameter.conf @@ -79,7 +79,7 @@ #ListenOn = "202.249.37.5"; #ListenOn = "2001:200:903:2::202:1"; #ListenOn = "fe80::21c:5ff:fe98:7d62%eth0"; -ListenOn = "127.0.0.2"; +ListenOn = "172.18.3.202"; ############################################################## @@ -259,8 +259,8 @@ # Examples: #ConnectPeer = "aaa.wide.ad.jp"; #ConnectPeer = "old.diameter.serv" { TcTimer = 60; TLS_old_method; No_SCTP; Port=3868; } ; -ConnectPeer = "pcrf.localdomain" { ConnectTo = "127.0.0.1"; Port = 3868; No_TLS; TcTimer = 2; }; -ConnectPeer = "ocs.localdomain" { ConnectTo = "127.0.0.1"; Port = 3869; No_TLS; TcTimer = 2; }; +ConnectPeer = "pcrf.localdomain" { ConnectTo = "172.18.3.201"; Port = 3868; No_TLS; TcTimer = 2; }; +ConnectPeer = "ocs.localdomain" { ConnectTo = "172.18.3.201"; Port = 3869; No_TLS; TcTimer = 2; }; ############################################################## diff --git a/ggsn_tests/open5gs/open5gs-smf.yaml b/ggsn_tests/open5gs/open5gs-smf.yaml index 0e26550..fd34c6a 100644 --- a/ggsn_tests/open5gs/open5gs-smf.yaml +++ b/ggsn_tests/open5gs/open5gs-smf.yaml @@ -10,24 +10,24 @@ smf: pfcp: server: - - address: 127.0.0.2 + - address: 172.18.3.202 client: upf: - - address: 127.0.0.222 + - address: 172.18.3.203 gtpc: server: - - address: 127.0.0.2 + - address: 172.18.3.202 option: - so_bindtodevice: lo + so_bindtodevice: testenv0 gtpu: server: - - address: 127.0.0.2 + - address: 172.18.3.202 port: 2152 option: - so_bindtodevice: lo + so_bindtodevice: testenv0 metrics: server: - - address: 127.0.0.2 + - address: 172.18.3.202 port: 9090 session: - subnet: 176.16.16.1/20 @@ -39,9 +39,9 @@ - subnet: 2001:780:44:2100:0:0:0:1/56 dnn: inet46 dns: - - 172.18.3.201 + - 172.18.3.202 - 8.8.8.8 - - fd02:db8:3::201 + - fd02:db8:3::202 - 2001:4860:4860::8844 mtu: 1400 ctf: diff --git a/ggsn_tests/open5gs/open5gs-upf.yaml b/ggsn_tests/open5gs/open5gs-upf.yaml index 7e38eea..a73f144 100644 --- a/ggsn_tests/open5gs/open5gs-upf.yaml +++ b/ggsn_tests/open5gs/open5gs-upf.yaml @@ -10,13 +10,13 @@ upf: pfcp: server: - - address: 127.0.0.222 + - address: 172.18.3.203 gtpu: server: - - address: 127.0.0.222 + - address: 172.18.3.203 port: 2152 option: - so_bindtodevice: lo + so_bindtodevice: testenv0 session: - subnet: 176.16.16.1/20 dnn: internet @@ -33,7 +33,7 @@ smf: pfcp: - - address: 127.0.0.2 + - address: 172.18.3.202 parameter: diff --git a/ggsn_tests/open5gs/testenv.sh b/ggsn_tests/open5gs/testenv.sh index e06d771..418ed3a 100755 --- a/ggsn_tests/open5gs/testenv.sh +++ b/ggsn_tests/open5gs/testenv.sh @@ -12,7 +12,7 @@ adjust_ttcn3_config() { sed -i 's/^GGSN_Tests.m_ggsn_impl := .*/GGSN_Tests.m_ggsn_impl := GGSN_IMPL_OPEN5GS/' \ ../testsuite/GGSN_Tests.cfg - sed -i 's/^GGSN_Tests.m_ggsn_ip_gtpu := .*/GGSN_Tests.m_ggsn_ip_gtpu := "127.0.0.222"/' \ + sed -i 's/^GGSN_Tests.m_ggsn_ip_gtpu := .*/GGSN_Tests.m_ggsn_ip_gtpu := "172.18.3.203"/' \ ../testsuite/GGSN_Tests.cfg } @@ -69,7 +69,7 @@ # Add a bridge reachable through the GTP tunnel that can answer ICMP # pings (for e.g. TC_pdp4_act_deact_gtpu_access). The bridge is also used to # connect the SUT when it runs in QEMU. -add_remove_testenv0_bridge.sh +EXTRA_IPS="172.18.3.202 172.18.3.203 fd02:db8:3::202" add_remove_testenv0_bridge.sh case "$TESTENV_CLEAN_REASON" in prepare) diff --git a/ggsn_tests/osmo-ggsn/osmo-ggsn-all.confmerge b/ggsn_tests/osmo-ggsn/osmo-ggsn-all.confmerge index 57dbd79..6ec0e34 100644 --- a/ggsn_tests/osmo-ggsn/osmo-ggsn-all.confmerge +++ b/ggsn_tests/osmo-ggsn/osmo-ggsn-all.confmerge @@ -4,7 +4,7 @@ tun-device tun4 type-support v4 ip prefix dynamic 176.16.16.0/20 - ip dns 0 172.18.3.201 + ip dns 0 172.18.3.202 ip dns 1 8.8.8.8 ip ifconfig 176.16.16.0/20 no shutdown @@ -13,7 +13,7 @@ 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 0 fd02:db8:3::202 ipv6 dns 1 2001:4860:4860::8844 ipv6 ifconfig 2001:780:44:2000:0:0:0:0/56 no shutdown @@ -22,11 +22,11 @@ tun-device tun46 type-support v4v6 ip prefix dynamic 176.16.32.0/20 - ip dns 0 172.18.3.201 + ip dns 0 172.18.3.202 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 0 fd02:db8:3::202 ipv6 dns 1 2001:4860:4860::8844 ipv6 ifconfig 2001:780:44:2100:0:0:0:0/56 no shutdown diff --git a/ggsn_tests/osmo-ggsn/osmo-ggsn-v4_only.confmerge b/ggsn_tests/osmo-ggsn/osmo-ggsn-v4_only.confmerge index a39a4d4..39c5e9b 100644 --- a/ggsn_tests/osmo-ggsn/osmo-ggsn-v4_only.confmerge +++ b/ggsn_tests/osmo-ggsn/osmo-ggsn-v4_only.confmerge @@ -4,7 +4,7 @@ tun-device tun4 type-support v4 ip prefix dynamic 176.16.16.0/20 - ip dns 0 172.18.3.201 + ip dns 0 172.18.3.202 ip dns 1 8.8.8.8 ip ifconfig 176.16.16.0/20 no shutdown diff --git a/ggsn_tests/osmo-ggsn/osmo-ggsn-v4v6_only.confmerge b/ggsn_tests/osmo-ggsn/osmo-ggsn-v4v6_only.confmerge index 6351ebe..1b58764 100644 --- a/ggsn_tests/osmo-ggsn/osmo-ggsn-v4v6_only.confmerge +++ b/ggsn_tests/osmo-ggsn/osmo-ggsn-v4v6_only.confmerge @@ -4,11 +4,11 @@ tun-device tun46 type-support v4v6 ip prefix dynamic 176.16.32.0/20 - ip dns 0 172.18.3.201 + ip dns 0 172.18.3.202 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 0 fd02:db8:3::202 ipv6 dns 1 2001:4860:4860::8844 ipv6 ifconfig 2001:780:44:2100:0:0:0:0/56 no shutdown diff --git a/ggsn_tests/osmo-ggsn/osmo-ggsn-v6_only.confmerge b/ggsn_tests/osmo-ggsn/osmo-ggsn-v6_only.confmerge index 5e3f000..4f6d53b 100644 --- a/ggsn_tests/osmo-ggsn/osmo-ggsn-v6_only.confmerge +++ b/ggsn_tests/osmo-ggsn/osmo-ggsn-v6_only.confmerge @@ -4,7 +4,7 @@ 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 0 fd02:db8:3::202 ipv6 dns 1 2001:4860:4860::8844 ipv6 ifconfig 2001:780:44:2000:0:0:0:0/56 no shutdown diff --git a/ggsn_tests/osmo-ggsn/osmo-ggsn.src.cfg b/ggsn_tests/osmo-ggsn/osmo-ggsn.src.cfg index 23a21f4..49e2811 100644 --- a/ggsn_tests/osmo-ggsn/osmo-ggsn.src.cfg +++ b/ggsn_tests/osmo-ggsn/osmo-ggsn.src.cfg @@ -2,7 +2,7 @@ ! OpenGGSN (0.94.1-adac) configuration saved from vty !! ! -log gsmtap 127.0.0.1 +log gsmtap 172.18.3.201 logging level set-all debug logging filter all 1 ! @@ -42,11 +42,11 @@ ! line vty no login - bind 0.0.0.0 + bind 172.18.3.202 ! ggsn ggsn0 gtp state-dir /tmp - gtp bind-ip 127.0.0.2 + gtp bind-ip 172.18.3.202 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 index 0275ad2..439ed7b 100755 --- a/ggsn_tests/osmo-ggsn/testenv.sh +++ b/ggsn_tests/osmo-ggsn/testenv.sh @@ -52,7 +52,7 @@ # Add a bridge reachable through the GTP tunnel that can answer ICMP # pings (for e.g. TC_pdp4_act_deact_gtpu_access). The bridge is also used to # connect the SUT when it runs in QEMU. -add_remove_testenv0_bridge.sh +EXTRA_IPS="172.18.3.202 fd02:db8:3::20" add_remove_testenv0_bridge.sh case "$TESTENV_CLEAN_REASON" in prepare) diff --git a/ggsn_tests/testenv_osmo_ggsn_all.cfg b/ggsn_tests/testenv_osmo_ggsn_all.cfg index 54660be..ca82fe1 100644 --- a/ggsn_tests/testenv_osmo_ggsn_all.cfg +++ b/ggsn_tests/testenv_osmo_ggsn_all.cfg @@ -9,3 +9,4 @@ copy=osmo-ggsn clean=osmo-ggsn/testenv.sh all vty_port=4260 +vty_host=172.18.3.202 diff --git a/ggsn_tests/testenv_osmo_ggsn_v4_only.cfg b/ggsn_tests/testenv_osmo_ggsn_v4_only.cfg index 3b55af2..881e9e8 100644 --- a/ggsn_tests/testenv_osmo_ggsn_v4_only.cfg +++ b/ggsn_tests/testenv_osmo_ggsn_v4_only.cfg @@ -9,3 +9,4 @@ copy=osmo-ggsn clean=osmo-ggsn/testenv.sh v4_only vty_port=4260 +vty_host=172.18.3.202 diff --git a/ggsn_tests/testenv_osmo_ggsn_v4v6_only.cfg b/ggsn_tests/testenv_osmo_ggsn_v4v6_only.cfg index da738f2..2ff3292 100644 --- a/ggsn_tests/testenv_osmo_ggsn_v4v6_only.cfg +++ b/ggsn_tests/testenv_osmo_ggsn_v4v6_only.cfg @@ -9,3 +9,4 @@ copy=osmo-ggsn clean=osmo-ggsn/testenv.sh v4v6_only vty_port=4260 +vty_host=172.18.3.202 diff --git a/ggsn_tests/testenv_osmo_ggsn_v6_only.cfg b/ggsn_tests/testenv_osmo_ggsn_v6_only.cfg index 4d65b73..4569874 100644 --- a/ggsn_tests/testenv_osmo_ggsn_v6_only.cfg +++ b/ggsn_tests/testenv_osmo_ggsn_v6_only.cfg @@ -9,3 +9,4 @@ copy=osmo-ggsn clean=osmo-ggsn/testenv.sh v6_only vty_port=4260 +vty_host=172.18.3.202 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38341?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: Ib768603b0050fe62baff39cab982a850eb91f49a Gerrit-Change-Number: 38341 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de>
1 0
0 0
[L] Change in osmo-ttcn3-hacks[master]: testenv: support running SUT in QEMU
by osmith 07 Oct '24

07 Oct '24
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38343?usp=email ) Change subject: testenv: support running SUT in QEMU ...................................................................... testenv: support running SUT in QEMU Add two new arguments -C|--custom-kernel and -D|--debian-kernel. If any of these is set, pass an environment variable TESTENV_QEMU_KERNEL with the path to the kernel when running commands from testenv.cfg. These commands can then source the new qemu_functions.sh and use it to build an initramfs with the SUT and depending libraries on the fly, and start up QEMU to boot right to starting the SUT. All of that takes about ~1s on my system with kvm. Without kvm ~5s. A follow-up patch will adjust the ggsn testenv configs to optionally run osmo-ggsn in QEMU for testing kernel GTP-U. These scripts are based on scripts/kernel-tests from docker-playground. Related: osmo-ci Id64a1a778fa38eec20498c36b390332f75d7d3f5 Change-Id: Ic9cb7092fd029b7ba530fc755b5d4d73a9d86350 --- M .gitignore M _testenv/README.md M _testenv/data/podman/Dockerfile A _testenv/data/scripts/qemu/qemu_functions.sh A _testenv/data/scripts/qemu/qemu_ifup.sh A _testenv/data/scripts/qemu/qemu_init.sh A _testenv/data/scripts/qemu/qemu_wait.sh M _testenv/testenv/__init__.py M _testenv/testenv/cmd.py M _testenv/testenv/podman.py M _testenv/testenv/requirements.py M _testenv/testenv/testenv_cfg.py 12 files changed, 400 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/43/38343/1 diff --git a/.gitignore b/.gitignore index 241a1d2..94061e3 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ sms.db-wal __pycache__ tags +.linux diff --git a/_testenv/README.md b/_testenv/README.md index 7db3e24..3fed9c9 100644 --- a/_testenv/README.md +++ b/_testenv/README.md @@ -20,6 +20,24 @@ Additional packages get installed after starting the container, with a package cache mounted to avoid unnecessary downloads. +### QEMU + +For SUTs that interact with kernel drivers, it is desirable to run them with a +separate kernel in QEMU. This can be enabled by running `./testenv.py run` with +the `-D` (Debian kernel) or `-C` (custom kernel) arguments. See the `ggsn` +testsuite for reference. + +#### Custom kernel + +When using `-C`, testenv uses a `.linux` file in the `osmo-ttcn3-hacks` dir as +kernel. You can download a pre-built kernel from jenkins: + +$ wget -O .linux "https://jenkins.osmocom.org/jenkins/job/build-kernel-torvalds/lastSuccessfu…" +$ wget -O .linux "https://jenkins.osmocom.org/jenkins/job/build-kernel-net-next/lastSuccessfu…" + +Or build your own kernel, see: +https://gitea.osmocom.org/osmocom/osmo-ci/src/branch/master/scripts/kernel + ## testenv.cfg The `testenv.cfg` file has one `[testsuite]` section, typically with one or @@ -98,6 +116,11 @@ * `vty_host=`: optionally set the VTY host for the SUT component to be used when obtaining a talloc report. If this is not set, `127.0.0.1` is used. +* `qemu=`: set to `optional` to allow running this test component in QEMU. + Additional logic must be added to build an initrd with the test component and + actually run it in QEMU, this is done by sourcing `qemu_functions.sh` and + using functions from there. See the `ggsn` testsuite for reference. + ### Executables #### $PATH @@ -108,6 +131,7 @@ * The directory of the testsuite * The directory for binaries built from source * The directory `_testenv/data/scripts` (which has e.g. `respawn.sh`) +* The directory `_testenv/data/scripts/qemu` #### $PWD (current working dir) @@ -180,6 +204,11 @@ files. Jenkins sets this to `esc` instead of `esc256` for better contrast on white background. +* `TESTENV_NO_KVM`: + Do not mount /dev/kvm in podman. This is used in jenkins where /dev/kvm is + available but doesn't work in podman. QEMU runs a bit slower when this is + set. + ## Troubleshooting ### Timeout waiting for RESET-ACK after sending RESET diff --git a/_testenv/data/podman/Dockerfile b/_testenv/data/podman/Dockerfile index 13412a2..6f6c739 100644 --- a/_testenv/data/podman/Dockerfile +++ b/_testenv/data/podman/Dockerfile @@ -12,20 +12,29 @@ # Install packages from Debian repositories (alphabetic order) ENV DEBIAN_FRONTEND=noninteractive RUN set -x && \ + mkdir -p /etc/kernel/postinst.d && \ + touch /etc/kernel/postinst.d/initramfs-tools && \ apt-get update && \ - apt-get install -y --no-install-recommends \ + apt-get install \ + -y \ + --no-install-recommends \ + -o Dpkg::Options::="--force-confold" \ autoconf \ automake \ + bc \ bison \ bridge-utils \ build-essential \ + busybox-static \ ca-certificates \ ccache \ cmake \ + cpio \ erlang-nox \ flex \ gdb \ git \ + gzip \ iproute2 \ iputils-ping \ libbson-dev \ @@ -34,6 +43,8 @@ libcurl4-gnutls-dev \ libdbd-sqlite3 \ libdbi-dev \ + libelf-dev \ + libgcc-11-dev \ libgcrypt-dev \ libgnutls28-dev \ libidn11-dev \ @@ -57,13 +68,16 @@ libusb-1.0-0-dev \ libyaml-dev \ libzmq3-dev \ + linux-image-amd64 \ meson \ netcat-openbsd \ + pax-utils \ pcscd \ pkg-config \ procps \ psmisc \ python3-pip \ + qemu-system-x86 \ rsync \ source-highlight \ sqlite3 \ diff --git a/_testenv/data/scripts/qemu/qemu_functions.sh b/_testenv/data/scripts/qemu/qemu_functions.sh new file mode 100755 index 0000000..c0dd8cc --- /dev/null +++ b/_testenv/data/scripts/qemu/qemu_functions.sh @@ -0,0 +1,191 @@ +#!/bin/sh -ex +INITRD_DIR="$PWD/_initrd" + +# Add one or more files to the initramfs, with parent directories. +# usr-merge: resolve symlinks for /lib -> /usr/lib etc. so "cp --parents" does +# not fail with "cp: cannot make directory '/tmp/initrd/lib': File exists" +# $@: path to files +qemu_initrd_add_file() { + local i + + for i in "$@"; do + case "$i" in + /bin/*|/sbin/*|/lib/*|/lib64/*) + cp -a --parents "$i" "$INITRD_DIR"/usr + ;; + *) + cp -a --parents "$i" "$INITRD_DIR" + ;; + esac + done +} + +# Add kernel module files with dependencies +# $@: kernel module names +qemu_initrd_add_mod() { + if [ "$TESTENV_QEMU_KERNEL" != "debian" ]; then + # Assume all drivers are statically built into the kernel, when + # using a custom kernel + return + fi + + local kernel="$(basename /lib/modules/*)" + local files="$(modprobe \ + -a \ + --dry-run \ + --show-depends \ + --set-version="$kernel" \ + "$@" \ + | sort -u \ + | cut -d ' ' -f 2)" + + qemu_initrd_add_file $files + + # Save the list of modules + for i in $@; do + echo "$i" >> "$INITRD_DIR"/modules + done +} + +# Add binaries with depending libraries +# $@: paths to binaries +qemu_initrd_add_bin() { + local bin + local bin_path + local file + + for bin in "$@"; do + local bin_path="$(which "$bin")" + if [ -z "$bin_path" ]; then + echo "ERROR: file not found: $bin" + exit 1 + fi + + lddtree_out="$(lddtree -l "$bin_path")" + if [ -z "$lddtree_out" ]; then + echo "ERROR: lddtree failed on '$bin_path'" + exit 1 + fi + + for file in $lddtree_out; do + qemu_initrd_add_file "$file" + + # Copy resolved symlink + if [ -L "$file" ]; then + qemu_initrd_add_file "$(realpath "$file")" + fi + done + done +} + +# Add command to run inside the initramfs +# $@: commands +qemu_initrd_add_cmd() { + local i + + if ! [ -e "$INITRD_DIR"/cmd.sh ]; then + echo "#!/bin/sh -ex" > "$INITRD_DIR"/cmd.sh + chmod +x "$INITRD_DIR"/cmd.sh + fi + + for i in "$@"; do + echo "$i" >> "$INITRD_DIR"/cmd.sh + done +} + +qemu_initrd_init() { + mkdir "$INITRD_DIR" + + for dir in bin sbin lib lib64; do + ln -s usr/"$dir" "$INITRD_DIR"/"$dir" + done + + mkdir -p \ + "$INITRD_DIR"/dev/net \ + "$INITRD_DIR"/proc \ + "$INITRD_DIR"/sys \ + "$INITRD_DIR"/tmp \ + "$INITRD_DIR"/usr/bin \ + "$INITRD_DIR"/usr/sbin + + qemu_initrd_add_bin \ + busybox + + qemu_initrd_add_cmd \ + "export PATH='$PATH:\$PATH'" + + if [ "$TESTENV_QEMU_KERNEL" = "debian" ]; then + qemu_initrd_add_mod \ + virtio_net \ + virtio_pci + + qemu_initrd_add_file \ + /lib/modules/*/modules.dep + fi +} + +qemu_initrd_finish() { + cp "$TESTENV_QEMU_SCRIPTS"/qemu_init.sh "$INITRD_DIR"/init + + tree -a "$INITRD_DIR" + + ( cd "$INITRD_DIR"; find . -print0 \ + | cpio --quiet -o -0 -H newc \ + | gzip -1 > "$INITRD_DIR".gz ) +} + +qemu_initrd_exit_error() { + # Building the initrd is quite verbose, therefore put it in a log file + # and only output its contents on error (see e.g. osmo-ggsn/run.sh) + cat "$1" + set +x + echo + echo "ERROR: failed to build the initrd!" + echo + exit 1 +} + +qemu_random_mac() { + printf "52:54:" + date "+%c %N" | sha1sum | sed 's/\(.\{2\}\)/\1:/g' | cut -d: -f 1-4 +} + +qemu_run() { + local machine_arg + local kernel="$TESTENV_QEMU_KERNEL" + local kernel_cmdline=" + root=/dev/ram0 + console=ttyS0 + panic=-1 + init=/init + loglevel=8 + " + + if [ "$kernel" = "debian" ]; then + kernel="$(ls -1 /boot/vmlinuz*)" + fi + + if [ -e /dev/kvm ]; then + machine_arg="-machine pc,accel=kvm" + else + machine_arg="-machine pc" + fi + + # sudo is required to set up networking in qemu_ifup.sh + # </dev/null to deatch stdin, so qemu doesn't capture ^C + sudo sh -c " + qemu-system-x86_64 \ + $machine_arg \ + -smp 1 \ + -m 512M \ + -no-user-config -nodefaults -display none \ + -no-reboot \ + -kernel '$kernel' \ + -initrd '$INITRD_DIR.gz' \ + -append '$kernel_cmdline' \ + -serial stdio \ + -netdev 'tap,id=nettest,script=$TESTENV_QEMU_SCRIPTS/qemu_ifup.sh' \ + -device 'virtio-net-pci,netdev=nettest,mac=$(qemu_random_mac)' \ + </dev/null + " +} diff --git a/_testenv/data/scripts/qemu/qemu_ifup.sh b/_testenv/data/scripts/qemu/qemu_ifup.sh new file mode 100755 index 0000000..370bea5 --- /dev/null +++ b/_testenv/data/scripts/qemu/qemu_ifup.sh @@ -0,0 +1,10 @@ +#!/bin/sh -e +br="testenv0" +qemu_if="$1" + +echo "qemu_ifup.sh: $br, $qemu_if" +set -x + +ip link set "$qemu_if" up + +brctl addif "$br" "$qemu_if" diff --git a/_testenv/data/scripts/qemu/qemu_init.sh b/_testenv/data/scripts/qemu/qemu_init.sh new file mode 100755 index 0000000..1c8b39b --- /dev/null +++ b/_testenv/data/scripts/qemu/qemu_init.sh @@ -0,0 +1,36 @@ +#!/bin/busybox sh +echo "Running initrd-init.sh" +set -ex + +export HOME=/root +export LD_LIBRARY_PATH=/usr/local/lib +export PATH=/usr/local/bin:/usr/bin:/bin:/sbin:/usr/local/sbin:/usr/sbin +export TERM=screen + +/bin/busybox --install -s + +mknod /dev/null c 1 3 + +# Required for osmo-ggsn +mknod /dev/net/tun c 10 200 + +hostname qemu + +mount -t proc proc /proc +mount -t sysfs sys /sys + +# Load modules from qemu_initrd_add_mod() +if [ -e /modules ]; then + cat /modules | xargs -t -n1 modprobe +fi + +ip link set lo up +ip link set eth0 up + +echo "KERNEL_TEST_VM_IS_READY" + +# Use '|| true' to avoid "attempting to kill init" kernel panic on failure +/cmd.sh || true + +# Avoid kernel panic when init exits +poweroff -f diff --git a/_testenv/data/scripts/qemu/qemu_wait.sh b/_testenv/data/scripts/qemu/qemu_wait.sh new file mode 100755 index 0000000..fb45c7e --- /dev/null +++ b/_testenv/data/scripts/qemu/qemu_wait.sh @@ -0,0 +1,22 @@ +#!/bin/sh -e +if [ -z "$TESTENV_QEMU_KERNEL" ]; then + exit 0 +fi + +LOGFILE="$(basename "$PWD").log" + +i=0 +for i in $(seq 1 600); do + sleep 0.1 + if grep -q KERNEL_TEST_VM_IS_READY "$LOGFILE"; then + # Wait some more for SUT to become ready + sleep 1 + exit 0 + fi +done + +echo +echo "ERROR: Timeout while waiting for QEMU to become ready" +echo + +exit 1 diff --git a/_testenv/testenv/__init__.py b/_testenv/testenv/__init__.py index 2af83ed..eb687f3 100644 --- a/_testenv/testenv/__init__.py +++ b/_testenv/testenv/__init__.py @@ -13,6 +13,7 @@ src_dir = os.environ.get("TESTENV_SRC_DIR", os.path.realpath(f"{__file__}/../../../..")) data_dir = os.path.join(os.path.realpath(f"{__file__}/../.."), "data") +custom_kernel_path = os.path.join(os.path.realpath(f"{__file__}/../../.."), ".linux") distro_default = "debian:bookworm" cache_dir_default = os.path.join(os.path.expanduser("~/.cache"), "osmo-ttcn3-testenv") ccache_dir_default = os.path.join(cache_dir_default, "ccache") @@ -91,6 +92,29 @@ metavar="OBS_PROJECT", help="use binary packages from this Osmocom OBS project instead (e.g. osmocom:nightly)", ) + + group = sub_run.add_argument_group( + "QEMU options", + "For some tests, the SUT can or must run in QEMU, typically to use kernel GTP-U.", + ) + group = group.add_mutually_exclusive_group() + group.add_argument( + "-D", + "--debian-kernel", + action="store_const", + dest="kernel", + const="debian", + help="run SUT in QEMU with debian kernel", + ) + group.add_argument( + "-C", + "--custom-kernel", + action="store_const", + dest="kernel", + const="custom", + help=f"run SUT in QEMU with custom kernel ({custom_kernel_path})", + ) + group = sub_run.add_argument_group( "config file options", "Testsuite and test component configs" @@ -159,6 +183,15 @@ if args.binary_repo and not args.podman: raise NoTraceException("--binary-repo requires --podman") + if args.kernel == "debian" and not args.podman: + raise NoTraceException("--kernel-debian requires --podman") + + if args.kernel == "custom" and not os.path.exists(custom_kernel_path): + logging.critical( + "See _testenv/README.md for more information on downloading a pre-built kernel or building your own kernel." + ) + raise NoTraceException(f"For --kernel-custom, put a symlink or copy of your kernel to: {custom_kernel_path}") + ttcn3_hacks_dir_src = os.path.realpath(f"{__file__}/../../..") testsuite_dir = os.path.join(ttcn3_hacks_dir_src, args.testsuite) if not os.path.exists(testsuite_dir): diff --git a/_testenv/testenv/cmd.py b/_testenv/testenv/cmd.py index 6f502fc..5e651bd 100644 --- a/_testenv/testenv/cmd.py +++ b/_testenv/testenv/cmd.py @@ -49,6 +49,13 @@ else: env_extra["OSMO_DEV_MAKE_DIR"] = os.path.join(testenv.args.cache, "host", "make") + if testenv.args.kernel == "debian": + env_extra["TESTENV_QEMU_KERNEL"] = "debian" + elif testenv.args.kernel == "custom": + env_extra["TESTENV_QEMU_KERNEL"] = testenv.custom_kernel_path + if testenv.args.kernel: + env_extra["TESTENV_QEMU_SCRIPTS"] = os.path.join(testenv.data_dir, "scripts/qemu") + def exit_error_cmd(completed, error_msg): """:param completed: return from run_cmd() below""" @@ -62,6 +69,7 @@ def generate_env(env={}, podman=False): ret = dict(env_extra) path = os.path.join(testenv.data_dir, "scripts") + path += f":{os.path.join(testenv.data_dir, 'scripts/qemu')}" if testenv.testsuite.ttcn3_hacks_dir: path += f":{os.path.join(testenv.testsuite.ttcn3_hacks_dir, testenv.args.testsuite)}" diff --git a/_testenv/testenv/podman.py b/_testenv/testenv/podman.py index 60aecca..bd1e8d8 100644 --- a/_testenv/testenv/podman.py +++ b/_testenv/testenv/podman.py @@ -221,6 +221,13 @@ f"{osmo_dev_dir}:{osmo_dev_dir}", ] + if testenv.args.kernel: + if not os.environ.get("TESTENV_NO_KVM") and os.path.exists("/dev/kvm"): + cmd += ["--volume", "/dev/kvm:/dev/kvm"] + if os.path.islink(testenv.custom_kernel_path): + dest = os.readlink(testenv.custom_kernel_path) + cmd += ["--volume", "{dest}:{dest}:ro"] + cmd += [ "--volume", f"{testdir_topdir}:{testdir_topdir}", diff --git a/_testenv/testenv/requirements.py b/_testenv/testenv/requirements.py index 7c39a7c..4973f6e 100644 --- a/_testenv/testenv/requirements.py +++ b/_testenv/testenv/requirements.py @@ -36,6 +36,15 @@ "wget", ] + if testenv.args.kernel: + programs += [ + "busybox", + "cpio", + "gzip", + "lddtree", + "qemu-system-x86_64", + ] + abort = False for program in programs: if not shutil.which(program): diff --git a/_testenv/testenv/testenv_cfg.py b/_testenv/testenv/testenv_cfg.py index ba830a1..8bb4119 100644 --- a/_testenv/testenv/testenv_cfg.py +++ b/_testenv/testenv/testenv_cfg.py @@ -71,6 +71,39 @@ return host, port +def verify_qemu_cfgs(): + """Check if -C or -K is set, but any of the selected configs can't run with + QEMU.""" + if not testenv.args.kernel: + return + + for basename, cfg in cfgs.items(): + missing = True + + for section in cfg.keys(): + if "qemu" in cfg[section]: + missing = False + break + + if missing: + testsuite = testenv.args.testsuite + logging.critical(f"{testsuite}/{basename}: doesn't support running in QEMU") + exit_error_readme() + + +def verify_qemu_section(path, cfg, section): + """Verify that qemu= has proper values.""" + if "qemu" not in cfg[section]: + return + + valid = ["optional"] + value = cfg[section]["qemu"] + + if value not in valid: + logging.error(f"{path}: [{section}]: qemu={value} is invalid, must be one of: {valid}") + exit_error_readme() + + def verify(cfg, path): keys_valid_testsuite = [ "clean", @@ -85,6 +118,7 @@ "package", "prepare", "program", + "qemu", "setup", "vty_host", "vty_port", @@ -127,6 +161,8 @@ logging.error(msg) exit_error_readme() + verify_qemu_section(path, cfg, section) + if section not in ["DEFAULT", "testsuite"] and "make" not in cfg[section]: logging.error(f"{path}: missing make= in section [{section}].") logging.error("If this is on purpose, set make=no.") @@ -207,6 +243,7 @@ # No --config argument given, and there is only one testenv.cfg if not testenv.args.config: cfgs[basename] = cfg + verify_qemu_cfgs() return cfgs_all[basename] = cfg @@ -228,3 +265,5 @@ if not matched: raise_error_config_arg(config_paths, config_arg) + + verify_qemu_cfgs() -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38343?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: Ic9cb7092fd029b7ba530fc755b5d4d73a9d86350 Gerrit-Change-Number: 38343 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de>
1 0
0 0
[XS] Change in osmo-ttcn3-hacks[master]: testenv: osmo-dev: build with gtp_linux.opts
by osmith 07 Oct '24

07 Oct '24
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38342?usp=email ) Change subject: testenv: osmo-dev: build with gtp_linux.opts ...................................................................... testenv: osmo-dev: build with gtp_linux.opts Run the osmo-ggsn ./configure with --enable-gtp-linux, in preparation for testing kernel gtp-u with testenv too. Related: https://gitea.osmocom.org/osmocom/osmo-dev/src/branch/master/gtp_linux.opts Change-Id: Ia8ea5494597e0fedae93f501c8bc7d6115543f36 --- M _testenv/testenv/osmo_dev.py 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/42/38342/1 diff --git a/_testenv/testenv/osmo_dev.py b/_testenv/testenv/osmo_dev.py index 00782cd..d3f7a1c 100644 --- a/_testenv/testenv/osmo_dev.py +++ b/_testenv/testenv/osmo_dev.py @@ -82,6 +82,7 @@ testenv.src_dir, "default.opts", "ccache.opts", + "gtp_linux.opts", "iu.opts", "no_dahdi.opts", "no_doxygen.opts", -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38342?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: Ia8ea5494597e0fedae93f501c8bc7d6115543f36 Gerrit-Change-Number: 38342 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de>
1 0
0 0
[M] Change in osmo-ttcn3-hacks[master]: ggsn: testenv: support running osmo-ggsn in QEMU
by osmith 07 Oct '24

07 Oct '24
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38344?usp=email ) Change subject: ggsn: testenv: support running osmo-ggsn in QEMU ...................................................................... ggsn: testenv: support running osmo-ggsn in QEMU Change-Id: I3f9db4325d5928c809cc99bc82d9cb82bf9e71eb --- A ggsn_tests/osmo-ggsn/run.sh M ggsn_tests/osmo-ggsn/testenv.sh M ggsn_tests/testenv_osmo_ggsn_all.cfg M ggsn_tests/testenv_osmo_ggsn_v4_only.cfg M ggsn_tests/testenv_osmo_ggsn_v4v6_only.cfg M ggsn_tests/testenv_osmo_ggsn_v6_only.cfg 6 files changed, 73 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/44/38344/1 diff --git a/ggsn_tests/osmo-ggsn/run.sh b/ggsn_tests/osmo-ggsn/run.sh new file mode 100755 index 0000000..6cbe10b --- /dev/null +++ b/ggsn_tests/osmo-ggsn/run.sh @@ -0,0 +1,39 @@ +#!/bin/sh -ex +if [ -z "$TESTENV_QEMU_KERNEL" ]; then + exec osmo-ggsn "$@" +fi + +build_initrd() { + qemu_initrd_init + + qemu_initrd_add_mod \ + gtp \ + tun + + qemu_initrd_add_bin \ + osmo-ggsn + + qemu_initrd_add_file \ + osmo-ggsn.cfg + + # Enable dynamic_debug + qemu_initrd_add_cmd \ + "mount -t debugfs none /sys/kernel/debug || true" \ + "echo -n 'module gtp +p' > /sys/kernel/debug/dynamic_debug/control || true" + + qemu_initrd_add_cmd \ + "ip addr add 172.18.3.202/24 brd 172.18.3.255 dev eth0" \ + "ip route add default via 172.18.3.1 dev eth0" \ + "sysctl net.ipv4.ip_forward=1" \ + "osmo-ggsn" + + qemu_initrd_finish +} + +. qemu_functions.sh + +if ! build_initrd >build_initrd.log 2>&1; then + qemu_initrd_exit_error "build_initrd.log" +fi + +qemu_run diff --git a/ggsn_tests/osmo-ggsn/testenv.sh b/ggsn_tests/osmo-ggsn/testenv.sh index 439ed7b..52a0d1f 100755 --- a/ggsn_tests/osmo-ggsn/testenv.sh +++ b/ggsn_tests/osmo-ggsn/testenv.sh @@ -22,11 +22,24 @@ esac } +check_usage_qemu() { + if [ -n "$TESTENV_QEMU_KERNEL" ] && [ "$CONFIG" = "all" ]; then + set +x + echo "ERROR: '--config osmo_ggsn_all' uses multiple APNs, which is currently not supported with kernel" \ + "gtp-u! (OS#6106)" + exit 1 + fi +} + adjust_osmo_ggsn_config() { osmo-config-merge \ osmo-ggsn/osmo-ggsn.src.cfg \ osmo-ggsn/osmo-ggsn-"$CONFIG".confmerge \ > osmo-ggsn.cfg + + if [ -n "$TESTENV_QEMU_KERNEL" ]; then + sed -i "s/gtpu-mode tun/gtpu-mode kernel-gtp/" osmo-ggsn.cfg + fi } adjust_ttcn3_config() { @@ -37,7 +50,9 @@ } setcap_osmo_ggsn() { - sudo setcap CAP_NET_ADMIN=+eip $(which osmo-ggsn) + if [ -z "$TESTENV_QEMU_KERNEL" ]; then + sudo setcap CAP_NET_ADMIN=+eip $(which osmo-ggsn) + fi } rename_junit_xml_classname() { @@ -52,10 +67,15 @@ # Add a bridge reachable through the GTP tunnel that can answer ICMP # pings (for e.g. TC_pdp4_act_deact_gtpu_access). The bridge is also used to # connect the SUT when it runs in QEMU. -EXTRA_IPS="172.18.3.202 fd02:db8:3::20" add_remove_testenv0_bridge.sh +if [ -n "$TESTENV_QEMU_KERNEL" ]; then + add_remove_testenv0_bridge.sh +else + EXTRA_IPS="172.18.3.202 fd02:db8:3::20" add_remove_testenv0_bridge.sh +fi case "$TESTENV_CLEAN_REASON" in prepare) + check_usage_qemu adjust_osmo_ggsn_config adjust_ttcn3_config setcap_osmo_ggsn diff --git a/ggsn_tests/testenv_osmo_ggsn_all.cfg b/ggsn_tests/testenv_osmo_ggsn_all.cfg index ca82fe1..3b7e1cf 100644 --- a/ggsn_tests/testenv_osmo_ggsn_all.cfg +++ b/ggsn_tests/testenv_osmo_ggsn_all.cfg @@ -3,7 +3,9 @@ config=GGSN_Tests.cfg [ggsn] -program=osmo-ggsn +qemu=optional +program=osmo-ggsn/run.sh +setup=qemu_wait.sh make=osmo-ggsn package=osmo-ggsn libosmocore-utils copy=osmo-ggsn diff --git a/ggsn_tests/testenv_osmo_ggsn_v4_only.cfg b/ggsn_tests/testenv_osmo_ggsn_v4_only.cfg index 881e9e8..f897964 100644 --- a/ggsn_tests/testenv_osmo_ggsn_v4_only.cfg +++ b/ggsn_tests/testenv_osmo_ggsn_v4_only.cfg @@ -3,7 +3,9 @@ config=GGSN_Tests.cfg [ggsn] -program=osmo-ggsn +qemu=optional +program=osmo-ggsn/run.sh +setup=qemu_wait.sh make=osmo-ggsn package=osmo-ggsn libosmocore-utils copy=osmo-ggsn diff --git a/ggsn_tests/testenv_osmo_ggsn_v4v6_only.cfg b/ggsn_tests/testenv_osmo_ggsn_v4v6_only.cfg index 2ff3292..9bc02a5 100644 --- a/ggsn_tests/testenv_osmo_ggsn_v4v6_only.cfg +++ b/ggsn_tests/testenv_osmo_ggsn_v4v6_only.cfg @@ -3,7 +3,9 @@ config=GGSN_Tests.cfg [ggsn] -program=osmo-ggsn +qemu=optional +program=osmo-ggsn/run.sh +setup=qemu_wait.sh make=osmo-ggsn package=osmo-ggsn libosmocore-utils copy=osmo-ggsn diff --git a/ggsn_tests/testenv_osmo_ggsn_v6_only.cfg b/ggsn_tests/testenv_osmo_ggsn_v6_only.cfg index 4569874..32f7f96 100644 --- a/ggsn_tests/testenv_osmo_ggsn_v6_only.cfg +++ b/ggsn_tests/testenv_osmo_ggsn_v6_only.cfg @@ -3,7 +3,9 @@ config=GGSN_Tests.cfg [ggsn] -program=osmo-ggsn +qemu=optional +program=osmo-ggsn/run.sh +setup=qemu_wait.sh make=osmo-ggsn package=osmo-ggsn libosmocore-utils copy=osmo-ggsn -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38344?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I3f9db4325d5928c809cc99bc82d9cb82bf9e71eb Gerrit-Change-Number: 38344 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de>
1 0
0 0
[S] Change in ...pyosmocom[master]: tlv/cosmetic: improve import of osmocom functions
by dexter 07 Oct '24

07 Oct '24
Attention is currently required from: fixeria, laforge. dexter has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/python/pyosmocom/+/38288?usp=email ) Change subject: tlv/cosmetic: improve import of osmocom functions ...................................................................... Patch Set 4: (1 comment) Commit Message: https://gerrit.osmocom.org/c/python/pyosmocom/+/38288/comment/a1a5fecc_4053… : PS1, Line 9: We can import osmocom and then reference > > This must also be merged *before* tagging 0.0.5 […] I am sorry for this. I have overlooked this because I thought that this patch was no longer important since we did no longer use any of the TLV stuff to fix the ASN.1 problem. I guess this now means that we merge this patch now and tag a new version 0.0.6 then. -- To view, visit https://gerrit.osmocom.org/c/python/pyosmocom/+/38288?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: python/pyosmocom Gerrit-Branch: master Gerrit-Change-Id: I6ce3cffbce9b276de7b223d88268d35cf2706d6a Gerrit-Change-Number: 38288 Gerrit-PatchSet: 4 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Mon, 07 Oct 2024 10:08:07 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: laforge <laforge(a)osmocom.org> Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
1 0
0 0
[S] Change in osmo-upf[master]: pfcp-tool: n-sessions [1/4]: add generators for TEID and UE IP
by pespin 07 Oct '24

07 Oct '24
Attention is currently required from: laforge, neels. pespin has posted comments on this change by neels. ( https://gerrit.osmocom.org/c/osmo-upf/+/37757?usp=email ) Change subject: pfcp-tool: n-sessions [1/4]: add generators for TEID and UE IP ...................................................................... Patch Set 2: (1 comment) Patchset: PS2: > @pespin what is your strategy about those pending patches as you now moved the tools to a new repo? I was not really remembering that these patches were here tbh. I see those were part of the long bunch of commits (some of them quick follow-up wip commits) in osmo-upf.git branch "neels/gtplab". So they are already included in the commits I submitted to upf-benchmark.git Afaiu these commits should be abandonned and at some point I'll probably submit a patch to remove osmo-pfcp-tool from there (unless we really conclude it's useful to keep an osmo-pfcp-tool there specificially for osmo-upf). -- To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/37757?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-upf Gerrit-Branch: master Gerrit-Change-Id: Iec164a222782d382aefe8d0342f398ebba1eac05 Gerrit-Change-Number: 37757 Gerrit-PatchSet: 2 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Comment-Date: Mon, 07 Oct 2024 09:00:52 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
1 0
0 0
[L] Change in upf-benchmark[master]: Introduce osmo-udp-responder
by pespin 07 Oct '24

07 Oct '24
Attention is currently required from: laforge, neels. pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/upf-benchmark/+/38328?usp=email ) Change subject: Introduce osmo-udp-responder ...................................................................... Patch Set 1: (1 comment) File src/osmo-udp-responder/udp_responder.c: https://gerrit.osmocom.org/c/upf-benchmark/+/38328/comment/cb1d6fd2_de25410… : PS1, Line 55: st > also, as we are about to introduce more tools here: why is that parser not in a separate .c/. […] I did not write that part, this was done by Neels so he may want to provide some insight. In general all in for using gtopt_long instead. But as mentioned, let's imho merge what we have so far as an initial commit and submit patches on top of it. -- To view, visit https://gerrit.osmocom.org/c/upf-benchmark/+/38328?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: upf-benchmark Gerrit-Branch: master Gerrit-Change-Id: I9edc2e3e1e41767673bcf96f1fe97fa4bf6d60f7 Gerrit-Change-Number: 38328 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Comment-Date: Mon, 07 Oct 2024 08:53:43 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • ...
  • 164
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.