ttcn3-pgw-tests: use same bootstrap for upfd as in ttcn-ggsn-tests-ogs

This approach has several benefits:
* We end up with ip/tun setup output in the same log file as
  open5gs-upfd process output.
* We configure all ip/tun *before* the open5gs-upfd process starts.

Furthermore, we have same procedure as in ttcn3-ggsn-tests-ogs, which
simplifies maintainment/use.

The IP address pool for UEs is still different in pgw-tests and
ggsn-tests-ogs. We can make them the same in subsequent patches.

Change-Id: I94219abbeb5e004ce707407b5aa5ee8ad6c3a80e
This commit is contained in:
Pau Espin 2022-04-07 20:08:38 +02:00
parent 6acec0cbd1
commit 5c9182751c
6 changed files with 40 additions and 15 deletions

View File

@ -16,7 +16,8 @@ cp osmo-uecups-daemon.cfg $VOL_BASE_DIR/osmo-uecups/
mkdir $VOL_BASE_DIR/pgw
cp freeDiameter-smf.conf $VOL_BASE_DIR/pgw/
cp open5gs-*.yaml $VOL_BASE_DIR/pgw/
cp ogstun-setup.sh $VOL_BASE_DIR/pgw/
cp upfd.sh $VOL_BASE_DIR/pgw/
cp upfd-setup.sh $VOL_BASE_DIR/pgw/
SUBNET=18
network_create $SUBNET
@ -42,10 +43,7 @@ docker run --cap-add=NET_ADMIN \
--name ${BUILD_TAG}-upf -d \
$DOCKER_ARGS \
$REPO_USER/open5gs-$IMAGE_SUFFIX \
/bin/sh -c "open5gs-upfd -c /data/open5gs-upf.yaml >/data/open5gs-upfd.out 2>&1"
# configure the 'ogstun' device for open5gs-upfd
docker exec ${BUILD_TAG}-upf /data/ogstun-setup.sh
/bin/sh -c "/data/upfd.sh -c /data/open5gs-upf.yaml >/data/open5gs-upfd.out 2>&1"
# start container with open5gs-smfd in background
docker run --cap-add=NET_ADMIN \

View File

@ -1,10 +0,0 @@
#!/bin/sh
if ! grep "ogstun" /proc/net/dev > /dev/null; then
ip tuntap add name ogstun mode tun
fi
ip addr del 10.45.0.1/16 dev ogstun 2> /dev/null
ip addr add 10.45.0.1/16 dev ogstun
ip addr del cafe::1/64 dev ogstun 2> /dev/null
ip addr add cafe::1/64 dev ogstun
ip link set ogstun up

View File

@ -339,7 +339,9 @@ smf:
- addr: 172.18.18.4
subnet:
- addr: 10.45.0.1/16
dnn: internet
- addr: cafe::1/64
dnn: internet
dns:
- 8.8.8.8
- 8.8.4.4

View File

@ -155,7 +155,11 @@ upf:
- addr: 172.18.18.7
subnet:
- addr: 10.45.0.1/16
dnn: internet
dev: ogstun46
- addr: cafe::1/64
dnn: internet
dev: ogstun46
#
# smf:

26
ttcn3-pgw-test/upfd-setup.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/sh
create_tun() {
name="$1"
if ! grep "$name" /proc/net/dev > /dev/null; then
ip tuntap add name $name mode tun
fi
}
add_addr() {
name="$1"
addr="$2"
ip addr del "$addr" dev "$name" 2> /dev/null
ip addr add "$addr" dev "$name"
}
create_tun "ogstun4"
create_tun "ogstun6"
create_tun "ogstun46"
add_addr "ogstun46" "10.45.0.1/16"
add_addr "ogstun46" "cafe::1/64"
ip link set ogstun4 up
ip link set ogstun6 up
ip link set ogstun46 up

5
ttcn3-pgw-test/upfd.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
set -e
set -x
/data/upfd-setup.sh
su - osmocom -c "open5gs-upfd $*"