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
This commit is contained in:
Pau Espin 2024-03-01 18:41:09 +01:00 committed by laforge
parent 988fe310e7
commit 78d8eb2f4a
3 changed files with 37 additions and 1 deletions

View File

@ -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"

23
ttcn3-epdg-test/epdg.sh Executable file
View File

@ -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

View File

@ -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