diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2024-03-01 18:41:09 +0100 |
---|---|---|
committer | laforge <laforge@osmocom.org> | 2024-03-04 19:06:06 +0000 |
commit | 78d8eb2f4a83e3519454cd8acedced373e7b63cf (patch) | |
tree | 4616efbc5c2822842fa7f514cd0dc642886ab569 | |
parent | 988fe310e73e2c9ede87bf8e59d401a8fd791c85 (diff) |
ttcn3-epdg: Test GTP-U userplane
Set the assigned IP address for the UE in the EPDG docker container on
the eth0 interface. This way the emulated UPF (ttcn3) can test
decaps+encaps of osmo-epdg tun by pinging the UE IP address and
expecting a pong back.
Related: OS#6235
Change-Id: Icc5710b42e5a5374aade6b952e1c543565ffad2e
-rw-r--r-- | osmo-epdg-master/Dockerfile | 8 | ||||
-rwxr-xr-x | ttcn3-epdg-test/epdg.sh | 23 | ||||
-rwxr-xr-x | ttcn3-epdg-test/jenkins.sh | 7 |
3 files changed, 37 insertions, 1 deletions
diff --git a/osmo-epdg-master/Dockerfile b/osmo-epdg-master/Dockerfile index a5e9b14..cdef31e 100644 --- a/osmo-epdg-master/Dockerfile +++ b/osmo-epdg-master/Dockerfile @@ -4,6 +4,14 @@ FROM $USER/$DISTRO-erlang # Arguments used after FROM must be specified again ARG DISTRO +# $distro-erlang switched to user build, but we need to install more stuff beforehand: +USER root +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + iproute2 && \ + apt-get clean +USER build + WORKDIR /tmp ARG OSMO_EPDG_BRANCH="master" diff --git a/ttcn3-epdg-test/epdg.sh b/ttcn3-epdg-test/epdg.sh new file mode 100755 index 0000000..2614bf9 --- /dev/null +++ b/ttcn3-epdg-test/epdg.sh @@ -0,0 +1,23 @@ +#!/bin/bash +set +e +set -x + +EPDG_TUN="gtp0" +UE_IFACE="ue" +UE_SUBNET="192.168.0.0/16" +UE_ADDR="192.168.0.2/16" + +ip link add $UE_IFACE type dummy +ip addr add $UE_ADDR dev $UE_IFACE +ip link set $UE_IFACE up +ip rule add from $UE_SUBNET table 45 +ERL_FLAGS='-config /data/osmo-epdg.config' /tmp/osmo-epdg/_build/default/bin/osmo-epdg & +MYPID=$! + +# We cannot set a route for the interface until it is created by osmo-epdg... +echo "Waiting for interface ${EPDG_TUN}..." +/data/pipework --wait -i ${EPDG_TUN} +echo "Adding src ${UE_SUBNET} default route to ${EPDG_TUN}" +ip route add default dev $EPDG_TUN table 45 + +wait $MYPID diff --git a/ttcn3-epdg-test/jenkins.sh b/ttcn3-epdg-test/jenkins.sh index a4d029b..cdd3a5e 100755 --- a/ttcn3-epdg-test/jenkins.sh +++ b/ttcn3-epdg-test/jenkins.sh @@ -15,6 +15,8 @@ write_mp_osmo_repo "$VOL_BASE_DIR/epdg-tester/EPDG_Tests.cfg" mkdir $VOL_BASE_DIR/epdg cp osmo-epdg.config $VOL_BASE_DIR/epdg/ +cp epdg.sh $VOL_BASE_DIR/epdg/ +cp ../common/pipework $VOL_BASE_DIR/epdg/ network_create network_replace_subnet_in_configs @@ -32,7 +34,10 @@ docker run --rm \ -v $VOL_BASE_DIR/epdg:/data \ --name ${BUILD_TAG}-epdg -d \ $DOCKER_ARGS \ - $REPO_USER/osmo-epdg-$IMAGE_SUFFIX + --sysctl net.ipv4.conf.all.rp_filter=0 \ + --sysctl net.ipv4.conf.default.rp_filter=0 \ + $REPO_USER/osmo-epdg-$IMAGE_SUFFIX \ + /bin/sh -c "/data/epdg.sh >/data/osmo-epdg.log 2>&1" # Give some time to osmo-epdg to be fully started; it's a bit slow... sleep 2 |