laforge has submitted this change. ( https://gerrit.osmocom.org/c/docker-playground/+/36138?usp=email )
Change subject: ttcn3-epdg: Test GTP-U userplane ......................................................................
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 --- M osmo-epdg-master/Dockerfile A ttcn3-epdg-test/epdg.sh M ttcn3-epdg-test/jenkins.sh 3 files changed, 52 insertions(+), 1 deletion(-)
Approvals: osmith: Looks good to me, but someone else must approve daniel: Looks good to me, but someone else must approve laforge: Looks good to me, approved Jenkins Builder: Verified
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 @@ # 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 @@
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 @@ -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