pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/docker-playground/+/27690 )

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

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
---
M ttcn3-pgw-test/jenkins.sh
D ttcn3-pgw-test/ogstun-setup.sh
M ttcn3-pgw-test/open5gs-smf.yaml
M ttcn3-pgw-test/open5gs-upf.yaml
A ttcn3-pgw-test/upfd-setup.sh
A ttcn3-pgw-test/upfd.sh
6 files changed, 40 insertions(+), 15 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, approved



diff --git a/ttcn3-pgw-test/jenkins.sh b/ttcn3-pgw-test/jenkins.sh
index 7205af2..f336e1b 100755
--- a/ttcn3-pgw-test/jenkins.sh
+++ b/ttcn3-pgw-test/jenkins.sh
@@ -16,7 +16,8 @@
 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 @@
                --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 \
diff --git a/ttcn3-pgw-test/ogstun-setup.sh b/ttcn3-pgw-test/ogstun-setup.sh
deleted file mode 100755
index 58693fd..0000000
--- a/ttcn3-pgw-test/ogstun-setup.sh
+++ /dev/null
@@ -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
diff --git a/ttcn3-pgw-test/open5gs-smf.yaml b/ttcn3-pgw-test/open5gs-smf.yaml
index ee88407..57a145e 100644
--- a/ttcn3-pgw-test/open5gs-smf.yaml
+++ b/ttcn3-pgw-test/open5gs-smf.yaml
@@ -339,7 +339,9 @@
       - 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
diff --git a/ttcn3-pgw-test/open5gs-upf.yaml b/ttcn3-pgw-test/open5gs-upf.yaml
index 735d121..28092a5 100644
--- a/ttcn3-pgw-test/open5gs-upf.yaml
+++ b/ttcn3-pgw-test/open5gs-upf.yaml
@@ -155,7 +155,11 @@
       - 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:
diff --git a/ttcn3-pgw-test/upfd-setup.sh b/ttcn3-pgw-test/upfd-setup.sh
new file mode 100755
index 0000000..8c0687b
--- /dev/null
+++ b/ttcn3-pgw-test/upfd-setup.sh
@@ -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
diff --git a/ttcn3-pgw-test/upfd.sh b/ttcn3-pgw-test/upfd.sh
new file mode 100755
index 0000000..efbabfb
--- /dev/null
+++ b/ttcn3-pgw-test/upfd.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+set -e
+set -x
+/data/upfd-setup.sh
+su - osmocom -c "open5gs-upfd $*"

--
To view, visit https://gerrit.osmocom.org/c/docker-playground/+/27690
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: I94219abbeb5e004ce707407b5aa5ee8ad6c3a80e
Gerrit-Change-Number: 27690
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to