From 51c4ef656e8540bd473df458bbf4a4db9bc19f3e Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 4 Mar 2020 23:16:48 +0000 Subject: WIP: try to fight super annoying arbitrary docker limitations ... giving up Change-Id: Ia44eed1e770b51c27038e4a64ad0759fe16b6fd0 --- jenkins-common.sh | 28 ++++++++++++++++++++-------- ttcn3-ergw-test/jenkins.sh | 32 +++++++++++++++++++++++--------- ttcn3-ergw-test/vpp/init.conf | 34 +++++++++++++++++----------------- 3 files changed, 60 insertions(+), 34 deletions(-) diff --git a/jenkins-common.sh b/jenkins-common.sh index 9fd3857..95fe31b 100644 --- a/jenkins-common.sh +++ b/jenkins-common.sh @@ -30,23 +30,35 @@ docker_images_require() { #kills all containers attached to network network_clean() { - docker network inspect $NET_NAME | grep Name | cut -d : -f2 | awk -F\" 'NR>1{print $2}' | xargs -rn1 docker kill + NAME=$1 + if [ -z "$NAME" ]; then + NAME="$NET_NAME" + fi + docker network inspect $NAME | grep Name | cut -d : -f2 | awk -F\" 'NR>1{print $2}' | xargs -rn1 docker kill } network_create() { NET=$1 - if docker network ls | grep -q $NET_NAME; then + NAME=$2 + if [ -z "$NAME" ]; then + NAME="$NET_NAME" + fi + if docker network ls | grep -q $NAME; then echo removing stale network and containers... - network_clean - network_remove + network_clean $NAME + network_remove $NAME fi - echo Creating network $NET_NAME - docker network create --internal --subnet $NET $NET_NAME + echo Creating network $NAME + docker network create --internal --subnet $NET $NAME } network_remove() { - echo Removing network $NET_NAME - docker network remove $NET_NAME + NAME=$1 + if [ -z "$NAME" ]; then + NAME="$NET_NAME" + fi + echo Removing network $NAME + docker network remove $NAME } fix_perms() { diff --git a/ttcn3-ergw-test/jenkins.sh b/ttcn3-ergw-test/jenkins.sh index aeae12b..d5419cb 100755 --- a/ttcn3-ergw-test/jenkins.sh +++ b/ttcn3-ergw-test/jenkins.sh @@ -4,7 +4,6 @@ IMAGE_SUFFIX="${IMAGE_SUFFIX:-master}" docker_images_require \ "debian-stretch-build" \ - "osmo-ggsn-$IMAGE_SUFFIX" \ "debian-stretch-titan" \ "ttcn3-ggsn-test" @@ -18,32 +17,45 @@ cp vpp/startup.conf $VOL_BASE_DIR/vpp/ mkdir $VOL_BASE_DIR/ergw cp ergw/sys.config $VOL_BASE_DIR/ergw/ -network_create 172.21.16.0/24 +# SGi + S5/S8-U + S5/S8-C +network_create 172.20.16.0/24 + +# PFCP Between PGW-U and PGW-C +NET_NAME_PFCP=$SUITE_NAME-pfcp +network_create 172.21.16.0/24 $NET_NAME_PFCP + +NET_NAME_SGI=$SUITE_NAME-sgi +network_create 172.20.15.0/24 $NET_NAME_SGI # start container with upf in background -docker run --cap-add=NET_ADMIN \ +docker create --cap-add=NET_ADMIN \ --device /dev/net/tun:/dev/net/tun \ --sysctl net.ipv6.conf.all.disable_ipv6=0 \ --rm \ - --network $NET_NAME --ip 172.21.16.3 \ + --network $NET_NAME_PFCP \ -v $VOL_BASE_DIR/vpp:/data \ - --name ${BUILD_TAG}-vpp -d \ + --name ${BUILD_TAG}-vpp \ --entrypoint="" \ quay.io/travelping/upf:feature-2001-upf_v20.01-141-g6864fd594_debug \ /bin/sh -c "/usr/bin/vpp -c /data/startup.conf >/data/vpp_console.log 2>&1" +docker network connect $NET_NAME_SGI ${BUILD_TAG}-vpp +docker network connect $NET_NAME ${BUILD_TAG}-vpp +docker start ${BUILD_TAG}-vpp # start container with ergw in background -docker run --cap-add=NET_ADMIN \ +docker create --cap-add=NET_ADMIN \ --device /dev/net/tun:/dev/net/tun \ --sysctl net.ipv6.conf.all.disable_ipv6=0 \ --rm \ - --network $NET_NAME --ip 172.21.16.2 \ + --network $NET_NAME_PFCP --ip 172.21.16.2 \ -v $VOL_BASE_DIR/ergw:/config/ergw-c-node \ -v $VOL_BASE_DIR/ergw:/data \ - --name ${BUILD_TAG}-ergw -d \ + --name ${BUILD_TAG}-ergw \ --entrypoint="" \ quay.io/travelping/ergw-c-node:master_2.2.0-52-g53265c1 \ /bin/sh -c "/docker-entrypoint.sh /opt/ergw-c-node/bin/ergw-c-node foreground >/data/ergw_console.log 2>&1" +docker network connect $NET_NAME --ip 172.20.16.23 ${BUILD_TAG}-ergw +docker start ${BUILD_TAG}-ergw echo "Press something to continue:" read line @@ -51,7 +63,7 @@ read line # start docker container with testsuite in foreground docker run --rm \ --sysctl net.ipv6.conf.all.disable_ipv6=0 \ - --network $NET_NAME --ip 172.21.16.202 \ + --network $NET_NAME --ip 172.20.16.202 \ -v $VOL_BASE_DIR/ggsn-tester:/data \ -e "TTCN3_PCAP_PATH=/data" \ --name ${BUILD_TAG}-ggsn-test \ @@ -61,5 +73,7 @@ docker run --rm \ docker container stop ${BUILD_TAG}-ergw docker container stop ${BUILD_TAG}-vpp +network_remove $NET_NAME_PFCP +network_remove $NET_NAME_SGI network_remove collect_logs diff --git a/ttcn3-ergw-test/vpp/init.conf b/ttcn3-ergw-test/vpp/init.conf index 3d33a5c..59f0126 100644 --- a/ttcn3-ergw-test/vpp/init.conf +++ b/ttcn3-ergw-test/vpp/init.conf @@ -3,26 +3,26 @@ ip table add 2 ip6 table add 1 ip6 table add 2 -create host-interface name ens224 -set interface mac address host-ens224 00:0c:29:46:1f:53 -set interface ip table host-ens224 1 -set interface ip6 table host-ens224 1 -set interface ip address host-ens224 172.20.16.105/24 -set interface state host-ens224 up +create host-interface name eth1 +set interface mac address host-eth1 00:0c:29:46:1f:53 +set interface ip table host-eth1 1 +set interface ip6 table host-eth1 1 +set interface ip address host-eth1 172.20.16.105/24 +set interface state host-eth1 up -create host-interface name ens161 -set interface mac address host-ens161 00:50:56:86:ed:f9 -set interface ip table host-ens161 2 -set interface ip6 table host-ens161 2 -set interface ip address host-ens161 172.20.16.106/24 -set interface state host-ens161 up +create host-interface name eth2 +set interface mac address host-eth2 00:50:56:86:ed:f9 +set interface ip table host-eth2 2 +set interface ip6 table host-eth2 2 +set interface ip address host-eth2 172.20.16.106/24 +set interface state host-eth2 up -create host-interface name sxb-u -set interface mac address host-sxb-u 02:fe:f5:6f:45:72 -set int ip address host-sxb-u 172.21.16.3/24 -set int state host-sxb-u up +create host-interface name eth0 +set interface mac address host-eth0 02:fe:f5:6f:45:72 +set int ip address host-eth0 172.21.16.3/24 +set int state host-eth0 up -ip route add 0.0.0.0/0 table 2 via 172.21.16.3 host-ens161 +ip route add 0.0.0.0/0 table 2 via 172.21.16.3 host-eth2 upf pfcp endpoint ip 172.21.16.3 vrf 0 -- cgit v1.2.3