Harald Welte has uploaded this change for review. ( 
https://gerrit.osmocom.org/12986


Change subject: PCU: Add osmo-pcu-master + ttcn3-pcu-test containers
......................................................................

PCU: Add osmo-pcu-master + ttcn3-pcu-test containers

This will enable us to run the PCU testsuite automatically by
jenkins, just like for other Osmocom projects.

Change-Id: Ia8e2ed2e7d03b8afdc7b1e068f94b0544a8112c7
Related: OS#2890
---
A osmo-pcu-master/.release
A osmo-pcu-master/Dockerfile
A osmo-pcu-master/Makefile
A osmo-pcu-master/Release.key
A osmo-pcu-master/osmo-pcu.cfg
A osmo-pcu-master/respawn.sh
A ttcn3-pcu-test/.release
A ttcn3-pcu-test/Dockerfile
A ttcn3-pcu-test/Makefile
A ttcn3-pcu-test/PCU_Tests.cfg
A ttcn3-pcu-test/jenkins.sh
A ttcn3-pcu-test/osmo-pcu.cfg
12 files changed, 204 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/docker-playground 
refs/changes/86/12986/1

diff --git a/osmo-pcu-master/.release b/osmo-pcu-master/.release
new file mode 100644
index 0000000..49b830d
--- /dev/null
+++ b/osmo-pcu-master/.release
@@ -0,0 +1,2 @@
+release=0.0.0
+tag=osmo-pcu-master-0.0.0
diff --git a/osmo-pcu-master/Dockerfile b/osmo-pcu-master/Dockerfile
new file mode 100644
index 0000000..867f534
--- /dev/null
+++ b/osmo-pcu-master/Dockerfile
@@ -0,0 +1,43 @@
+ARG    USER
+FROM   $USER/debian-jessie-build
+
+MAINTAINER Harald Welte <[email protected]>
+
+ARG    
OSMOCOM_REPO="http://download.opensuse.org/repositories/network:/osmocom:/nightly/Debian_8.0/";
+
+COPY   Release.key /tmp/Release.key
+
+RUN    apt-key add /tmp/Release.key && \
+       rm /tmp/Release.key && \
+       echo "deb " $OSMOCOM_REPO " ./" > 
/etc/apt/sources.list.d/osmocom-nightly.list
+
+ADD    $OSMOCOM_REPO/Release /tmp/Release
+RUN    apt-get update && \
+       apt-get install -y --no-install-recommends \
+               telnet \
+               libosmocore-dev && \
+       apt-get clean
+
+ADD    respawn.sh /usr/local/bin/respawn.sh
+
+WORKDIR        /tmp
+
+ARG    OSMO_PCU_BRANCH="master"
+
+RUN    git clone git://git.osmocom.org/osmo-pcu.git
+ADD    http://git.osmocom.org/osmo-pcu/patch?h=$OSMO_PCU_BRANCH 
/tmp/commit-osmo-pcu
+
+RUN    cd osmo-pcu && \
+       git fetch && git checkout -f -B $OSMO_PCU_BRANCH 
origin/$OSMO_PCU_BRANCH && \
+       autoreconf -fi && \
+       ./configure --enable-trx && \
+       make -j8 install
+
+VOLUME /data
+
+COPY   osmo-pcu.cfg /data/osmo-pcu.cfg
+
+WORKDIR        /data
+CMD    ["/usr/local/bin/osmo-pcu", "-i", "172.18.0.230"]
+
+#EXPOSE
diff --git a/osmo-pcu-master/Makefile b/osmo-pcu-master/Makefile
new file mode 100644
index 0000000..87350c2
--- /dev/null
+++ b/osmo-pcu-master/Makefile
@@ -0,0 +1,3 @@
+RUN_ARGS?=--rm --network sigtran --ip 172.18.0.211 -v pcu-vol:/data
+
+include ../make/Makefile
diff --git a/osmo-pcu-master/Release.key b/osmo-pcu-master/Release.key
new file mode 100644
index 0000000..e656238
--- /dev/null
+++ b/osmo-pcu-master/Release.key
@@ -0,0 +1,20 @@
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1.4.5 (GNU/Linux)
+
+mQENBFJBt/wBCADAht3d/ilNuyzaXYw/QwTRvmjyoDvfXw+H/3Fvk1zlDZoiKPPc
+a1wCVBINUZl7vYM2OXqbJwYa++JP2Q48xKSvC6thbRc/YLievkbcvTemf7IaREfl
+CTjoYpoqXHa9kHMw1aALDm8CNU88jZmnV7v9L6hKkbYDxie+jpoj7D6B9JlxgNJ4
+5dQyRNsFGVcIl4Vplt1HyGc5Q5nQI/VgS2rlF/IOXmhRQBc4LEDdU8R2IKnkU4ee
+S7TWanAigGAQhxGuCkS39/CWzc1DhLhjlNhBl/+RTPejkqJtAy00ZLps3+RqUN1Y
+CU/Fsr7aRlYVGqQ/BlptwV0XQ2VVYJX2oEBBABEBAAG0MG5ldHdvcmsgT0JTIFBy
+b2plY3QgPG5ldHdvcmtAYnVpbGQub3BlbnN1c2Uub3JnPokBPAQTAQIAJgUCWmMc
+aQIbAwUJDEAUbQYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEGLrGgkXKA3fjsoI
+ALSXmXzFCpTxg8a6tvXkqddY/qAmeBMNUf7hslI9wN3leNmCrnuHS8TbHWYJZgtw
+8M5fKL3aRQYaIiqqm1XOUF0OqwYNDj5V3y38mM68NYOkzgSP7foMwZp9Y0TlGhtI
+L8weA+2RUjB4hwwGMAYMqkRZyKW3NhPqdlGGoXac1ilwEyGXFHdOLbkhtyS+P2yb
+/EvaKIN5cMLzRZKeYgdp9WuAirV+yV/SDbgvabW098lrWhGLltlRRDQgMV883p8I
+ERMI1wlLFZGnHL3mfBWGeQ24M/DaBOdXQDtfBLCJ9nGztmDBUb8i6GFWU7nD2TGi
+8mYUsED1ZDwO/0jdvJ4gSluIRgQTEQIABgUCUkG3/AAKCRA7MBG3a51lIzhdAJ9v
+d6XPffMZRcCGgDEY5OaTn/MsCQCgrXbeZpFJgnirSrc8rRonvzYFiF4=
+=Gvly
+-----END PGP PUBLIC KEY BLOCK-----
diff --git a/osmo-pcu-master/osmo-pcu.cfg b/osmo-pcu-master/osmo-pcu.cfg
new file mode 100644
index 0000000..9a5db59
--- /dev/null
+++ b/osmo-pcu-master/osmo-pcu.cfg
@@ -0,0 +1,10 @@
+line vty
+ no login
+ bind 0.0.0.0
+pcu
+ flow-control-interval 10
+ cs 2
+ alloc-algorithm dynamic
+ alpha 0
+ gamma 0
+ pcu-socket /data/pcu_bts
diff --git a/osmo-pcu-master/respawn.sh b/osmo-pcu-master/respawn.sh
new file mode 100755
index 0000000..ae5cf60
--- /dev/null
+++ b/osmo-pcu-master/respawn.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+trap "kill 0" EXIT
+
+while [ -e /etc/passwd ]; do
+       $* &
+       LAST_PID=$!
+       wait $LAST_PID
+done
diff --git a/ttcn3-pcu-test/.release b/ttcn3-pcu-test/.release
new file mode 100644
index 0000000..adac371
--- /dev/null
+++ b/ttcn3-pcu-test/.release
@@ -0,0 +1,2 @@
+release=0.0.0
+tag=ttcn3-pcu-test-0.0.0
diff --git a/ttcn3-pcu-test/Dockerfile b/ttcn3-pcu-test/Dockerfile
new file mode 100644
index 0000000..2cfacce
--- /dev/null
+++ b/ttcn3-pcu-test/Dockerfile
@@ -0,0 +1,33 @@
+ARG    USER
+FROM   $USER/debian-stretch-titan
+
+RUN    mkdir /root/projects && (cd /root/projects && ln -sf / git)
+RUN    git clone git://git.osmocom.org/osmo-ttcn3-hacks.git
+
+RUN    cd osmo-ttcn3-hacks && \
+       git checkout -f -B master origin/master && \
+       make deps
+
+RUN    git config --global user.email [email protected] && \
+       git config --global user.name "Dock Er"
+
+ARG    OSMO_TTCN3_BRANCH="laforge/gb-sns"
+
+ADD    http://git.osmocom.org/osmo-ttcn3-hacks/patch?h=$OSMO_TTCN3_BRANCH 
/tmp/commit
+RUN    cd osmo-ttcn3-hacks && \
+       git fetch && \
+       git checkout -f -B $OSMO_TTCN3_BRANCH origin/$OSMO_TTCN3_BRANCH && \
+       make pcu
+
+VOLUME /data
+
+RUN    ln -s /osmo-ttcn3-hacks/ttcn3-tcpdump-start.sh / && \
+       ln -s /osmo-ttcn3-hacks/ttcn3-tcpdump-stop.sh /
+
+COPY   PCU_Tests.cfg /data/PCU_Tests.cfg
+
+CMD    cd /data && \
+       /osmo-ttcn3-hacks/start-testsuite.sh /osmo-ttcn3-hacks/pcu/PCU_Tests; \
+       exit_code=$?; \
+       /osmo-ttcn3-hacks/log_merge.sh PCU_Tests --rm; \
+       exit $exit_code
diff --git a/ttcn3-pcu-test/Makefile b/ttcn3-pcu-test/Makefile
new file mode 100644
index 0000000..b172280
--- /dev/null
+++ b/ttcn3-pcu-test/Makefile
@@ -0,0 +1,3 @@
+RUN_ARGS?=--sysctl net.ipv6.conf.all.disable_ipv6=0 --rm --network sigtran 
--ip 172.18.1.202 -v pcu-test-vol:/data
+
+include ../make/Makefile
diff --git a/ttcn3-pcu-test/PCU_Tests.cfg b/ttcn3-pcu-test/PCU_Tests.cfg
new file mode 100644
index 0000000..07af661
--- /dev/null
+++ b/ttcn3-pcu-test/PCU_Tests.cfg
@@ -0,0 +1,23 @@
+[ORDERED_INCLUDE]
+"/osmo-ttcn3-hacks/Common.cfg"
+"/osmo-ttcn3-hacks/pcu/PCU_Tests.default"
+
+[LOGGING]
+
+[TESTPORT_PARAMETERS]
+
+[MODULE_PARAMETERS]
+PCU_Tests_RAW.mp_pcu_sock_path := "/data/unix/pcu_bts"
+PCU_Tests.mp_nsconfig := {
+       local_ip := "172.18.13.10",
+       local_udp_port := 23000,
+       remote_ip := "172.18.13.101",
+       remote_udp_port := 23000,
+       nsvci := 1234,
+       nsei := 1234
+}
+
+[MAIN_CONTROLLER]
+
+[EXECUTE]
+PCU_Tests_RAW.control
diff --git a/ttcn3-pcu-test/jenkins.sh b/ttcn3-pcu-test/jenkins.sh
new file mode 100755
index 0000000..bee539d
--- /dev/null
+++ b/ttcn3-pcu-test/jenkins.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+. ../jenkins-common.sh
+IMAGE_SUFFIX="${IMAGE_SUFFIX:-master}"
+docker_images_require \
+       "debian-jessie-build" \
+       "osmo-pcu-$IMAGE_SUFFIX" \
+       "debian-stretch-titan" \
+       "ttcn3-pcu-test"
+
+network_create 172.18.13.0/24
+
+mkdir $VOL_BASE_DIR/pcu-tester
+mkdir $VOL_BASE_DIR/pcu-tester/unix
+cp PCU_Tests.cfg $VOL_BASE_DIR/pcu-tester/
+
+mkdir $VOL_BASE_DIR/pcu
+mkdir $VOL_BASE_DIR/pcu/unix
+cp osmo-pcu.cfg $VOL_BASE_DIR/pcu/
+
+mkdir $VOL_BASE_DIR/unix
+
+echo Starting container with PCU
+docker run     --rm \
+               --network $NET_NAME --ip 172.18.13.101 \
+               -v $VOL_BASE_DIR/pcu:/data \
+               -v $VOL_BASE_DIR/unix:/data/unix \
+               --name ${BUILD_TAG}-pcu -d \
+               $REPO_USER/osmo-pcu-$IMAGE_SUFFIX \
+               /usr/local/bin/respawn.sh osmo-pcu -c /data/osmo-pcu.cfg
+
+echo Starting container with PCU testsuite
+docker run     --rm \
+               --network $NET_NAME --ip 172.18.13.10 \
+               -e "TTCN3_PCAP_PATH=/data" \
+               -v $VOL_BASE_DIR/pcu-tester:/data \
+               -v $VOL_BASE_DIR/unix:/data/unix \
+               --name ${BUILD_TAG}-ttcn3-pcu-test \
+               $REPO_USER/ttcn3-pcu-test
+
+echo Stopping containers
+docker container kill ${BUILD_TAG}-pcu
+
+network_remove
+rm -rf $VOL_BASE_DIR/unix
+collect_logs
diff --git a/ttcn3-pcu-test/osmo-pcu.cfg b/ttcn3-pcu-test/osmo-pcu.cfg
new file mode 100644
index 0000000..918beea
--- /dev/null
+++ b/ttcn3-pcu-test/osmo-pcu.cfg
@@ -0,0 +1,10 @@
+line vty
+ no login
+ bind 0.0.0.0
+pcu
+ flow-control-interval 10
+ cs 2
+ alloc-algorithm dynamic
+ alpha 0
+ gamma 0
+ pcu-socket /data/unix/pcu_bts

--
To view, visit https://gerrit.osmocom.org/12986
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia8e2ed2e7d03b8afdc7b1e068f94b0544a8112c7
Gerrit-Change-Number: 12986
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <[email protected]>

Reply via email to