Change in docker-playground[master]: ogt: Add support to build open5gs

pespin gerrit-no-reply at lists.osmocom.org
Wed Mar 31 09:51:28 UTC 2021


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/docker-playground/+/23562 )


Change subject: ogt: Add support to build open5gs
......................................................................

ogt: Add support to build open5gs

meson from open5gs requires debian10's version. physicial sysmocom OGT
setup already migrated to debian10, do the same here.

Related: SYS#4805
Change-Id: Id329726f93251b617219beeb674046065c30a436
---
M osmo-gsm-tester/Dockerfile
M osmo-gsm-tester/jenkins.sh
M osmo-gsm-tester/osmo-gsm-tester-master.sh
M osmo-gsm-tester/resources.conf
4 files changed, 106 insertions(+), 20 deletions(-)



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

diff --git a/osmo-gsm-tester/Dockerfile b/osmo-gsm-tester/Dockerfile
index 8dea613..dc8ba1b 100644
--- a/osmo-gsm-tester/Dockerfile
+++ b/osmo-gsm-tester/Dockerfile
@@ -1,5 +1,6 @@
 ARG	USER
 FROM	$USER/debian-buster-jenkins
+ARG	OGT_MASTER_ADDR="172.18.50.2"
 
 MAINTAINER Pau Espin Pedrol <pespin at sysmocom.de>
 
@@ -37,7 +38,8 @@
 		"git+https://github.com/podshumok/python-smpplib.git@master#egg=smpplib" \
 		pydbus \
 		pyusb \
-		pysispm
+		pysispm \
+		pymongo
 
 # Intall sshd:
 RUN	apt-get update && apt-get install -y openssh-server
@@ -51,13 +53,10 @@
                  /osmo-gsm-tester-srsenb \
                  /osmo-gsm-tester-srsepc \
                  /osmo-gsm-tester-trx \
-		 /osmo-gsm-tester-grbroker
+		 /osmo-gsm-tester-grbroker \
+		 /osmo-gsm-tester-open5gs
 RUN	chown -R jenkins:jenkins \
-                 /osmo-gsm-tester-srsue \
-                 /osmo-gsm-tester-srsenb \
-                 /osmo-gsm-tester-srsepc \
-                 /osmo-gsm-tester-trx \
-		 /osmo-gsm-tester-grbroker
+                 /osmo-gsm-tester-*
 
 # Set a UTF-8 locale
 RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
@@ -112,6 +111,45 @@
 		gnuradio && \
 	apt-get clean
 
+# install open5gs dependencies: (mongodb not available in Debian)
+# systemctl stuff: workaround for https://jira.mongodb.org/browse/SERVER-54386
+ADD	https://www.mongodb.org/static/pgp/server-4.4.asc /tmp/mongodb-server-4.4.asc
+RUN	apt-key add /tmp/mongodb-server-4.4.asc && \
+	echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.4 main" > /etc/apt/sources.list.d/mongodb-org-4.4.list
+RUN	apt-get update && \
+	systemctl_path=$(which systemctl) && \
+	mv $systemctl_path /tmp/systemctl && \
+	apt-get install -y --no-install-recommends mongodb-org && \
+	apt-get clean && \
+	mv /tmp/systemctl $systemctl_path && \
+	sed -i "s/127.0.0.1/$OGT_MASTER_ADDR/g" /etc/mongod.conf
+
+# install open5gs dependencies:
+RUN	apt-get update && \
+	apt-get install -y --no-install-recommends \
+		python3-pip \
+		python3-setuptools \
+		python3-wheel \
+		ninja-build \
+		build-essential \
+		flex \
+		bison \
+		git \
+		libsctp-dev \
+		libgnutls28-dev \
+		libgcrypt-dev \
+		libssl-dev \
+		libidn11-dev \
+		libmongoc-dev \
+		libbson-dev \
+		libyaml-dev \
+		libnghttp2-dev \
+		libmicrohttpd-dev \
+		libcurl4-gnutls-dev \
+		libnghttp2-dev \
+		meson && \
+	apt-get clean
+
 WORKDIR	/tmp
 
 ARG	OSMO_GSM_TESTER_BRANCH="master"
diff --git a/osmo-gsm-tester/jenkins.sh b/osmo-gsm-tester/jenkins.sh
index ae645e7..536e119 100755
--- a/osmo-gsm-tester/jenkins.sh
+++ b/osmo-gsm-tester/jenkins.sh
@@ -28,34 +28,45 @@
 SRS_LTE_BRANCH=${SRS_LTE_BRANCH:-master}
 SRS_LTE_REPO_PREFIX=${SRS_LTE_REPO_PREFIX:-git at github.com:srsLTE}
 SRS_LTE_REPO_NAME=${SRS_LTE_REPO_NAME:-srsLTE}
-have_repo_srslte() {
+OPEN5GS_REPO_PREFIX=${OPEN5GS_REPO_PREFIX:-git at github.com:open5gs}
+OPEN5GS_BRANCH=${OPEN5GS_BRANCH:-main}
+have_repo() {
+	repo_prefix=$1
+	repo_name=$2
+	branch=$3
 	echo "srsLTE inst not provided, fetching it now and it will be build in container"
-	if [ -d "${TRIAL_DIR}/${SRS_LTE_REPO_NAME}" ]; then
-		git fetch -C ${TRIAL_DIR}/${SRS_LTE_REPO_NAME}
+	if [ -d "${TRIAL_DIR}/${repo_name}" ]; then
+		git fetch -C ${TRIAL_DIR}/${repo_name}
 	else
 		mkdir -p ${TRIAL_DIR}
-		git clone "${SRS_LTE_REPO_PREFIX}/${SRS_LTE_REPO_NAME}" "${TRIAL_DIR}/${SRS_LTE_REPO_NAME}"
+		git clone "${repo_prefix}/${repo_name}" "${TRIAL_DIR}/${repo_name}"
 	fi
 	# Figure out whether we need to prepend origin/ to find branches in upstream.
 	# Doing this allows using git hashes instead of a branch name.
-	if git -C "${TRIAL_DIR}/${SRS_LTE_REPO_NAME}" rev-parse "origin/$SRS_LTE_BRANCH"; then
-	  SRS_LTE_BRANCH="origin/$SRS_LTE_BRANCH"
+	if git -C "${TRIAL_DIR}/${repo_name}" rev-parse "origin/$branch"; then
+	  branch="origin/$branch"
 	fi
 
-	git -C "${TRIAL_DIR}/${SRS_LTE_REPO_NAME}" checkout -B build_branch "$SRS_LTE_BRANCH"
-	rm -rf "${TRIAL_DIR:?}/${SRS_LTE_REPO_NAME}/*"
-	git -C "${TRIAL_DIR}/${SRS_LTE_REPO_NAME}" reset --hard "$SRS_LTE_BRANCH"
+	git -C "${TRIAL_DIR}/${repo_name}" checkout -B build_branch "$branch"
+	rm -rf "${TRIAL_DIR:?}/${repo_name}/*"
+	git -C "${TRIAL_DIR}/${repo_name}" reset --hard "$branch"
 }
-
 # If srsLTE trial not provided by user, fetch srsLTE git repo and let the container build it:
 if [ "x$(ls ${TRIAL_DIR}/srslte.*.tgz 2>/dev/null | wc -l)" = "x0" ]; then
-	have_repo_srslte
+	have_repo  $SRS_LTE_REPO_PREFIX $SRS_LTE_REPO_NAME $SRS_LTE_BRANCH
+fi
+
+# If open5gs trial not provided by user, fetch srsLTE git repo and let the container build it:
+if [ "x$(ls ${TRIAL_DIR}/open5gs.*.tgz 2>/dev/null | wc -l)" = "x0" ]; then
+	have_repo $OPEN5GS_REPO_PREFIX "open5gs" $OPEN5GS_BRANCH
+	have_repo "https://github.com/open5gs" "freeDiameter" "open5gs"
+	mv "${TRIAL_DIR}/freeDiameter" "${TRIAL_DIR}/open5gs/subprojects"
 fi
 
 . ../jenkins-common.sh
 IMAGE_SUFFIX="${IMAGE_SUFFIX:-master}"
 docker_images_require \
-	"debian-stretch-jenkins" \
+	"debian-buster-jenkins" \
 	"osmo-gsm-tester"
 
 set_clean_up_trap
diff --git a/osmo-gsm-tester/osmo-gsm-tester-master.sh b/osmo-gsm-tester/osmo-gsm-tester-master.sh
index 4a32376..ae300c9 100755
--- a/osmo-gsm-tester/osmo-gsm-tester-master.sh
+++ b/osmo-gsm-tester/osmo-gsm-tester-master.sh
@@ -34,11 +34,47 @@
         popd
 }
 
+build_open5gs() {
+        git_repo_dir="/tmp/trial/open5gs"
+        if [ ! -d "$git_repo_dir" ]; then
+                echo "No external trial nor git repo provided for Open5GS!"
+                exit 1
+        fi
+        pushd "/tmp/trial"
+        rm -rf sysroot && mkdir sysroot
+        rm -rf build && mkdir build && cd build || exit 1
+        meson "${git_repo_dir}" --prefix="/tmp/trial/sysroot" --libdir="lib"
+        set +x; echo; echo; set -x
+        ninja "-j$(nproc)"
+        set +x; echo; echo; set -x
+        ninja install
+        find "/tmp/trial/sysroot/lib" -depth -type f -name "lib*.so.*" -exec patchelf --set-rpath '$ORIGIN/' {} \;
+        cd ..
+        this="open5gs.build-${BUILD_NUMBER-$(date +%Y-%m-%d_%H_%M_%S)}"
+        tar="${this}.tgz"
+        tar czf "/tmp/trial/$tar" -C "/tmp/trial/sysroot" .
+        rm -rf build sysroot
+        md5sum "$tar" >>checksums.md5
+        popd
+}
+
 # Build srsLTE.git if not provided by host system:
 if [ "x$(ls /tmp/trial/srslte.*.tgz 2>/dev/null | wc -l)" = "x0" ]; then
         build_srslte
 fi
 
+# Build open5gs.git if not provided by host system:
+if [ "x$(ls /tmp/trial/open5gs.*.tgz 2>/dev/null | wc -l)" = "x0" ]; then
+        build_open5gs
+fi
+
+# If open5gs is available, start mongodb in the background:
+if [ "x$(ls /tmp/trial/open5gs.*.tgz 2>/dev/null | wc -l)" != "x0" ]; then
+        echo "Starting mongodb in the background..."
+        /usr/bin/mongod --fork --config /etc/mongod.conf --logpath /data/mongodb.log
+        chown "${HOST_USER_ID}:${HOST_GROUP_ID}" /data/mongodb.log
+fi
+
 # Make trial dir avaialable to jenkins user inside container:
 chown -R jenkins /tmp/trial/
 
diff --git a/osmo-gsm-tester/resources.conf b/osmo-gsm-tester/resources.conf
index d10cc1e..1a8f2a7 100644
--- a/osmo-gsm-tester/resources.conf
+++ b/osmo-gsm-tester/resources.conf
@@ -56,7 +56,8 @@
   rf_dev_type: zmq
   imsi: '001010123456789'
   ki: '00112233445566778899aabbccddeeff'
-  auth_algo: 'xor'
+  opc: '63BFA50EE6523365FF14C1F45F88737D'
+  auth_algo: 'milenage'
   features: ['4g']
   run_node:
     run_type: ssh

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

Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: Id329726f93251b617219beeb674046065c30a436
Gerrit-Change-Number: 23562
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210331/29f4ef1b/attachment.htm>


More information about the gerrit-log mailing list