diff --git a/CHANGELOG.md b/CHANGELOG.md index 10b0d68..ecd4971 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # RELEASE NOTES: # +## v1.4.0 -- July 2022 ## + +* Fix for handling S-NSSAI +* Add support for multiple slices via config file +* Allowed reusing GTPv1-U socket +* Fix GTPU offset sequence number +* Fix configurable number of DL threads for data path +* Official images produced by CI are pushed to `oaisoftwarealliance` Docker-Hub Team account +* Reduce image size +* Skipping release tag v1.3.0 to be in sync with OAI CN 5G network functions + ## v1.2.0 -- February 2022 ## * Obsolescence of Legacy OAI-MME diff --git a/build/scripts/build_helper b/build/scripts/build_helper index 437acd8..a883592 100644 --- a/build/scripts/build_helper +++ b/build/scripts/build_helper @@ -24,7 +24,7 @@ # author Laurent Thomas, Lionel GAUTHIER # ####################################### -SUPPORTED_DISTRO="Ubuntu 18.04, CentOS 8, RHEL 8" +SUPPORTED_DISTRO="Ubuntu 18.04, RHEL 8, UBI8-8.6" if [ ! -f /etc/os-release ]; then echo_fatal "No /etc/os-release file found. You're likely on an unsupported distro." fi @@ -33,7 +33,6 @@ OS_RELEASE=$(grep "^VERSION_ID=" /etc/os-release | sed "s/VERSION_ID=//" | sed " case "$OS_DISTRO" in fedora) OS_BASEDISTRO="fedora"; INSTALLER="dnf"; CMAKE="cmake" ;; rhel) OS_BASEDISTRO="fedora"; INSTALLER="yum"; CMAKE="cmake3" ;; - centos) OS_BASEDISTRO="fedora"; INSTALLER="yum"; CMAKE="cmake3" ;; debian) OS_BASEDISTRO="debian"; INSTALLER="apt-get"; CMAKE="cmake" ;; ubuntu) OS_BASEDISTRO="debian"; INSTALLER="apt-get"; CMAKE="cmake" ;; esac @@ -132,7 +131,8 @@ check_supported_distribution() { "rhel8.3") return 0 ;; "rhel8.4") return 0 ;; "rhel8.5") return 0 ;; - "centos8") return 0 ;; + "rhel8.6") return 0 ;; + esac return 1 } @@ -284,7 +284,7 @@ update_package_db() { check_enable_epel_repos() { # on Enterprise Linuxes, ensure EPEL repos are installed # (provides: libidn2-devel, vconfig, iperf, phpMyAdmin, dkms, ...) - if [[ "$OS_DISTRO" == "rhel" ]] || [[ "$OS_DISTRO" == "centos" ]]; then + if [[ "$OS_DISTRO" == "rhel" ]] ; then if rpm -q epel-release > /dev/null; then echo "EPEL repos already present. Good." else diff --git a/build/scripts/build_helper.spgw b/build/scripts/build_helper.spgw index a9034b6..7441eec 100644 --- a/build/scripts/build_helper.spgw +++ b/build/scripts/build_helper.spgw @@ -55,7 +55,7 @@ install_fmt() { git clone https://github.com/fmtlib/fmt.git ret=$?;[[ $ret -ne 0 ]] && return $ret cd fmt - cmake . + $CMAKE . ret=$?;[[ $ret -ne 0 ]] && return $ret make -j `nproc` ret=$?;[[ $ret -ne 0 ]] && return $ret @@ -139,11 +139,7 @@ install_nlohmann_from_git() { cd json && git checkout -f v3.10.3 ret=$?;[[ $ret -ne 0 ]] && popd && return $ret mkdir _build && cd _build - if [[ "$OS_BASEDISTRO" == "fedora" ]]; then - cmake3 -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DJSON_BuildTests=OFF .. - else - cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DJSON_BuildTests=OFF .. - fi + $CMAKE -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DJSON_BuildTests=OFF .. ret=$?;[[ $ret -ne 0 ]] && popd && return $ret make ret=$?;[[ $ret -ne 0 ]] && popd && return $ret @@ -195,7 +191,7 @@ check_install_spgwu_deps() { automake \ bison \ build-essential \ - cmake \ + $CMAKE \ doxygen \ flex \ gdb \ diff --git a/ci-scripts/Jenkinsfile-GitHub-Docker b/ci-scripts/Jenkinsfile-GitHub-Docker index 2483766..be3139d 100644 --- a/ci-scripts/Jenkinsfile-GitHub-Docker +++ b/ci-scripts/Jenkinsfile-GitHub-Docker @@ -52,6 +52,9 @@ def rem_rhel8_resource = params.PodmanContainers def spgwu_tag = 'develop' def spgwu_branch = 'develop' +// Docker Hub account to push to +def DH_Account = "oaisoftwarealliance" + //------------------------------------------------------------------------------- // Pipeline start pipeline { @@ -107,7 +110,6 @@ pipeline { echo "PR ID is ${env.ghprbPullId}" echo "PR LINK is ${env.ghprbPullLink}" echo "PR TITLE is ${env.ghprbPullTitle}" - sh "git fetch --prune --unshallow" shortenShaOne = sh returnStdout: true, script: 'git log -1 --pretty=format:"%h" ' + env.ghprbActualCommit shortenShaOne = shortenShaOne.trim() sh "./ci-scripts/doGitHubPullRequestTempMerge.sh --src-branch ${env.ghprbSourceBranch} --src-commit ${env.ghprbActualCommit} --target-branch ${env.ghprbTargetBranch} --target-commit ${GIT_COMMIT}" @@ -152,7 +154,10 @@ pipeline { myShCmd('docker image rm oai-spgwu-tiny:' + spgwu_tag + ' || true', rem_u18_host_flag, rem_u18_host_user, rem_u18_host) } myShCmd('docker image prune --force', rem_u18_host_flag, rem_u18_host_user, rem_u18_host) - myShCmd('docker build --no-cache --target oai-spgwu-tiny --tag oai-spgwu-tiny:' + spgwu_tag + ' --file docker/Dockerfile.ubuntu18.04 --build-arg EURECOM_PROXY="http://proxy.eurecom.fr:8080" . > archives/spgwu_docker_image_build.log 2>&1', rem_u18_host_flag, rem_u18_host_user, rem_u18_host) + myShCmd('docker build --no-cache --target oai-spgwu-tiny --tag oai-spgwu-tiny:' + spgwu_tag + ' --file docker/Dockerfile.ubuntu18.04 . > archives/spgwu_docker_image_build.log 2>&1', rem_u18_host_flag, rem_u18_host_user, rem_u18_host) + // Putting a place holder to try out on the flattening of image. + // If not satisfactory, we can remove it. + myShCmd('python3 ./ci-scripts/flatten_image.py --tag oai-spgwu-tiny:' + spgwu_tag, rem_u18_host_flag, rem_u18_host_user, rem_u18_host) myShCmd('docker image ls >> archives/spgwu_docker_image_build.log', rem_u18_host_flag, rem_u18_host_user, rem_u18_host) // We will keep also the TMP image in U18 case. if (env.ghprbPullId != null) { @@ -193,7 +198,10 @@ pipeline { myShCmd('cp /etc/pki/entitlement/*pem ./etc-pki-entitlement', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host) myShCmd('sudo cp /etc/rhsm/rhsm.conf ./rhsm-conf', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host) myShCmd('sudo cp /etc/rhsm/ca/*pem ./rhsm-ca', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host) - myShCmd('sudo podman build --no-cache --target oai-spgwu-tiny --tag oai-spgwu-tiny:' + spgwu_tag + ' --file docker/Dockerfile.rhel8 --build-arg EURECOM_PROXY="http://proxy.eurecom.fr:8080" . > archives/spgwu_podman_image_build.log 2>&1', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host) + myShCmd('sudo podman build --no-cache --target oai-spgwu-tiny --tag oai-spgwu-tiny:' + spgwu_tag + ' --file docker/Dockerfile.rhel8 . > archives/spgwu_podman_image_build.log 2>&1', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host) + // Putting a place holder to try out on the flattening of image. + // If not satisfactory, we can remove it. + myShCmd('python3 ./ci-scripts/flatten_image.py --tag oai-spgwu-tiny:' + spgwu_tag, rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host) myShCmd('sudo podman image ls >> archives/spgwu_podman_image_build.log', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host) if (env.ghprbPullId != null) { myShCmd('sudo podman image tag oai-spgwu-tiny:' + spgwu_tag + ' oai-spgwu-tiny:' + rhel_spgwu_tag, rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host) @@ -408,7 +416,7 @@ pipeline { always { script { copyArtifacts(projectName: params.CN_EPC_FED_PipelineName, - filter: 'test_results_oai_epc.html', + filter: 'test_results*.html', selector: lastCompleted()) } } @@ -437,7 +445,7 @@ pipeline { always { script { copyArtifacts(projectName: params.RHEL8_SanityCheck_PipelineName, - filter: 'test_results_magma_epc_rhel8.html', + filter: 'test_results*.html', selector: lastCompleted()) } } @@ -541,9 +549,9 @@ pipeline { [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.DockerHubCredentials}", usernameVariable: 'DH_Username', passwordVariable: 'DH_Password'] ]) { myShCmd("echo ${DH_Password} | docker login --username ${DH_Username} --password-stdin", rem_u18_host_flag, rem_u18_host_user, rem_u18_host) - myShCmd("docker image tag oai-spgwu-tiny:develop ${DH_Username}/oai-spgwu-tiny:develop", rem_u18_host_flag, rem_u18_host_user, rem_u18_host) - myShCmd("docker push ${DH_Username}/oai-spgwu-tiny:develop", rem_u18_host_flag, rem_u18_host_user, rem_u18_host) - myShCmd("docker rmi ${DH_Username}/oai-spgwu-tiny:develop", rem_u18_host_flag, rem_u18_host_user, rem_u18_host) + myShCmd("docker image tag oai-spgwu-tiny:develop ${DH_Account}/oai-spgwu-tiny:develop", rem_u18_host_flag, rem_u18_host_user, rem_u18_host) + myShCmd("docker push ${DH_Account}/oai-spgwu-tiny:develop", rem_u18_host_flag, rem_u18_host_user, rem_u18_host) + myShCmd("docker rmi ${DH_Account}/oai-spgwu-tiny:develop", rem_u18_host_flag, rem_u18_host_user, rem_u18_host) myShCmd("docker logout", rem_u18_host_flag, rem_u18_host_user, rem_u18_host) } } @@ -641,7 +649,6 @@ pipeline { sh "sed -i -e 's#TEMPLATE_TIME#${JOB_TIMESTAMP}#' ${htmlFile}" archiveArtifacts artifacts: htmlFile } - // Sending an email to the last committer. Maybe not the Pull Request's author. if (params.sendToCommitterEmail != null) { if (params.sendToCommitterEmail) { diff --git a/ci-scripts/checkCodingFormattingRules.sh b/ci-scripts/checkCodingFormattingRules.sh index 01b3671..d0ffff3 100755 --- a/ci-scripts/checkCodingFormattingRules.sh +++ b/ci-scripts/checkCodingFormattingRules.sh @@ -139,6 +139,16 @@ then exit 1 fi +# When running in a container, in /home folder +IS_CONTAINER=`egrep -c "docker|kubepods|podman|buildah|libpod" /proc/self/cgroup || true` +if [ $IS_CONTAINER -ne 0 ] +then + if [ $PWD = "/home/src" ] + then + git config --global --add safe.directory /home + fi +fi + # Merge request scenario MERGE_COMMMIT=`git log -n1 --pretty=format:%H` diff --git a/ci-scripts/flatten_image.py b/ci-scripts/flatten_image.py new file mode 100644 index 0000000..f43c270 --- /dev/null +++ b/ci-scripts/flatten_image.py @@ -0,0 +1,95 @@ +""" + Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The OpenAirInterface Software Alliance licenses this file to You under + the OAI Public License, Version 1.1 (the "License"); you may not use this file + except in compliance with the License. + You may obtain a copy of the License at + + http://www.openairinterface.org/?page_id=698 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +------------------------------------------------------------------------------- + For more information about the OpenAirInterface (OAI) Software Alliance: + contact@openairinterface.org +""" + +import argparse +import re +import subprocess +import sys + +def main() -> None: + args = _parse_args() + status = perform_flattening(args.tag) + sys.exit(status) + +def _parse_args() -> argparse.Namespace: + parser = argparse.ArgumentParser(description='Flattening Image') + + parser.add_argument( + '--tag', '-t', + action='store', + required=True, + help='Image Tag in image-name:image tag format', + ) + return parser.parse_args() + +def perform_flattening(tag): + # First detect which docker/podman command to use + cli = '' + image_prefix = '' + cmd = 'which podman || true' + podman_check = subprocess.check_output(cmd, shell=True, universal_newlines=True) + if re.search('podman', podman_check.strip()): + cli = 'sudo podman' + image_prefix = 'localhost/' + if cli == '': + cmd = 'which docker || true' + docker_check = subprocess.check_output(cmd, shell=True, universal_newlines=True) + if re.search('docker', docker_check.strip()): + cli = 'docker' + image_prefix = '' + if cli == '': + print ('No docker / podman installed: quitting') + return -1 + print (f'Flattening {tag}') + # Creating a container + cmd = cli + ' run --name test-flatten --entrypoint /bin/true -d ' + tag + print (cmd) + subprocess.check_output(cmd, shell=True, universal_newlines=True) + + # Export / Import trick + cmd = cli + ' export test-flatten | ' + cli + ' import ' + # Bizarro syntax issue with podman + if cli == 'docker': + cmd += ' --change "ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ' + else: + cmd += ' --change "ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ' + cmd += ' --change "WORKDIR /openair-spgwu-tiny" ' + cmd += ' --change "EXPOSE 2152/udp" ' + cmd += ' --change "EXPOSE 8805/udp" ' + cmd += ' --change "LABEL support-multi-sgwu-instances=\\"true\\"" ' + cmd += ' --change "LABEL support-nrf-fdqn=\\"true\\"" ' + cmd += ' --change "CMD [\\"/openair-spgwu-tiny/bin/oai_spgwu\\", \\"-c\\", \\"/openair-spgwu-tiny/etc/spgw_u.conf\\", \\"-o\\"]" ' + cmd += ' --change "ENTRYPOINT [\\"/bin/bash\\", \\"/openair-spgwu-tiny/bin/entrypoint.sh\\"]" ' + cmd += ' - ' + image_prefix + tag + print (cmd) + subprocess.check_output(cmd, shell=True, universal_newlines=True) + + # Remove container + cmd = cli + ' rm -f test-flatten' + print (cmd) + subprocess.check_output(cmd, shell=True, universal_newlines=True) + + # At this point the original image is a dangling image. + # CI pipeline will clean up (`image prune --force`) + return 0 + +if __name__ == '__main__': + main() diff --git a/ci-scripts/generateHtmlReport.py b/ci-scripts/generateHtmlReport.py index 5c9bcdc..9e91552 100644 --- a/ci-scripts/generateHtmlReport.py +++ b/ci-scripts/generateHtmlReport.py @@ -20,6 +20,7 @@ # */ #--------------------------------------------------------------------- +import glob import os import re import sys @@ -163,23 +164,21 @@ def generateHeader(self): self.file.write(buildSummary) cwd = os.getcwd() - test_reports = ['test_results_oai_epc', 'test_results_magma_epc_rhel8', \ - 'test_results_oai_cn5g_basic', 'test_results_oai_cn5g_mini', \ - 'test_results_oai_cn5g_oc', 'test_results_oai_cn5g_tutorials'] - for test in test_reports: - if os.path.isfile(cwd + '/' + test + '.html'): - newEpcReport = open(cwd + '/' + test + '_new.html', 'w') - buildSummaryDone = True - with open(cwd + '/' + test + '.html', 'r') as originalEpcReport: - for line in originalEpcReport: - result = re.search('Deployment Summary', line) - if (result is not None) and buildSummaryDone: - newEpcReport.write(buildSummary) - buildSummaryDone = False - newEpcReport.write(line) - originalEpcReport.close() - newEpcReport.close() - os.rename(cwd + '/' + test + '_new.html', cwd + '/' + test + '.html') + for reportFile in glob.glob('./test_results_*.html'): + if reportFile == './test_results_oai_spgwu.html': + continue + newEpcReport = open(cwd + '/' + str(reportFile) + '.new', 'w') + buildSummaryDone = True + with open(cwd + '/' + str(reportFile), 'r') as originalEpcReport: + for line in originalEpcReport: + result = re.search('Deployment Summary', line) + if (result is not None) and buildSummaryDone: + newEpcReport.write(buildSummary) + buildSummaryDone = False + newEpcReport.write(line) + originalEpcReport.close() + newEpcReport.close() + os.rename(cwd + '/' + str(reportFile) + '.new', cwd + '/' + str(reportFile)) def generateFooter(self): self.file.write('
End of Build Report -- Copyright 2020 OpenAirInterface. All Rights Reserved.
\n') @@ -748,7 +747,7 @@ def analyze_image_size_log(self, nfType): result = re.search('oai-spgwu-tiny *ci-temp', line) else: result = re.search('oai-spgwu-tiny *develop', line) - if result is not None: + if result is not None and not status: result = re.search('ago *([0-9 A-Z]+)', line) if result is not None: size = result.group(1) diff --git a/docker/Dockerfile.centos8 b/docker/Dockerfile.centos8 deleted file mode 100644 index 3c80768..0000000 --- a/docker/Dockerfile.centos8 +++ /dev/null @@ -1,101 +0,0 @@ -#/* -# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more -# * contributor license agreements. See the NOTICE file distributed with -# * this work for additional information regarding copyright ownership. -# * The OpenAirInterface Software Alliance licenses this file to You under -# * the OAI Public License, Version 1.1 (the "License"); you may not use this file -# * except in compliance with the License. -# * You may obtain a copy of the License at -# * -# * http://www.openairinterface.org/?page_id=698 -# * -# * Unless required by applicable law or agreed to in writing, software -# * distributed under the License is distributed on an "AS IS" BASIS, -# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# * See the License for the specific language governing permissions and -# * limitations under the License. -# *------------------------------------------------------------------------------- -# * For more information about the OpenAirInterface (OAI) Software Alliance: -# * contact@openairinterface.org -# */ -#--------------------------------------------------------------------- -# -# Dockerfile for the Open-Air-Interface SPGW-U-TINY service -# Valid for CentOS 8 -# -#--------------------------------------------------------------------- - -#--------------------------------------------------------------------- -# BUILDER IMAGE -#--------------------------------------------------------------------- -FROM centos:8 as oai-spgwu-tiny-builder - -ARG EURECOM_PROXY -ARG BUILD_FOR_CI -ARG CI_SRC_BRANCH -ARG CI_SRC_COMMIT -ARG CI_DEST_BRANCH - -RUN yum update -y \ - && yum install epel-release -y \ - && yum install dnf-plugins-core -y \ - && yum config-manager --set-enabled PowerTools \ - && yum install -y \ - psmisc \ - git \ - && yum clean all -y \ - && rm -rf /var/cache/yum - -# Some GIT configuration command quite useful -RUN /bin/bash -c "if [[ -v EURECOM_PROXY ]]; then git config --global http.proxy $EURECOM_PROXY; fi" -RUN git config --global https.postBuffer 123289600 -RUN git config --global http.sslverify false -# In normal case, we build out of the develop branch -RUN /bin/bash -c "if [[ -v CI_SRC_BRANCH ]]; then git clone https://github.com/OPENAIRINTERFACE/openair-spgwu-tiny.git -b $CI_SRC_BRANCH /openair-spgwu-tiny; else git clone https://github.com/OPENAIRINTERFACE/openair-spgwu-tiny.git -b develop /openair-spgwu-tiny; fi" -# For CI, especially for Pull/Merge Requests, we build out of temp merge -WORKDIR /openair-spgwu-tiny -RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git config --global user.name \"OAI CI\"; fi" -RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git config --global user.email ci@openairinterface.org; fi" -RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git checkout -f $CI_SRC_COMMIT; fi" -RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git merge --ff origin/$CI_DEST_BRANCH -m \"Temporary merge for CI\"; fi" - -# Installing and Building SPGW-C -WORKDIR /openair-spgwu-tiny/build/scripts -RUN ./build_spgwu --install-deps --force -RUN ./build_spgwu --clean --build-type Release --jobs --Verbose - -#--------------------------------------------------------------------- -# TARGET IMAGE -#--------------------------------------------------------------------- -FROM centos:8 as oai-spgwu-tiny -ENV TZ=Europe/Paris -# We install some debug tools for the moment in addition of mandatory libraries -RUN yum update -y \ - && yum install epel-release -y \ - && yum install dnf-plugins-core -y \ - && yum config-manager --set-enabled PowerTools \ - && yum install -y \ - tzdata \ - psmisc \ - net-tools \ - tcpdump \ - iptables \ - ethtool \ - glog \ - double-conversion \ - libconfig \ - libevent \ - boost-system \ - && yum clean all -y \ - && rm -rf /var/cache/yum - -# Copying executable and generated libraries -WORKDIR /openair-spgwu-tiny/bin -COPY --from=oai-spgwu-tiny-builder /openair-spgwu-tiny/build/spgw_u/build/spgwu oai_spgwu - -# Copying template configuration files -# The configuration folder will be flat -WORKDIR /openair-spgwu-tiny/etc -COPY --from=oai-spgwu-tiny-builder /openair-spgwu-tiny/etc/spgw_u.conf . - -WORKDIR /openair-spgwu-tiny diff --git a/docker/Dockerfile.debug.centos8 b/docker/Dockerfile.debug.centos8 deleted file mode 100644 index e343f50..0000000 --- a/docker/Dockerfile.debug.centos8 +++ /dev/null @@ -1,67 +0,0 @@ -#/* -# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more -# * contributor license agreements. See the NOTICE file distributed with -# * this work for additional information regarding copyright ownership. -# * The OpenAirInterface Software Alliance licenses this file to You under -# * the OAI Public License, Version 1.1 (the "License"); you may not use this file -# * except in compliance with the License. -# * You may obtain a copy of the License at -# * -# * http://www.openairinterface.org/?page_id=698 -# * -# * Unless required by applicable law or agreed to in writing, software -# * distributed under the License is distributed on an "AS IS" BASIS, -# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# * See the License for the specific language governing permissions and -# * limitations under the License. -# *------------------------------------------------------------------------------- -# * For more information about the OpenAirInterface (OAI) Software Alliance: -# * contact@openairinterface.org -# */ -#--------------------------------------------------------------------- -# -# Dockerfile for the Open-Air-Interface SPGW-U-TINY service -# Valid for CentOS 8 -# -#--------------------------------------------------------------------- - -#--------------------------------------------------------------------- -# BUILDER IMAGE -#--------------------------------------------------------------------- -FROM oai-spgwu-tiny:centos8-spgwu-debug-3rd-party as centos8-spgwu-debug - - -# Some GIT configuration command quite useful -RUN /bin/bash -c "if [[ -v HTTP_PROXY ]]; then git config --global http.proxy $HTTP_PROXY; fi" -RUN git config --global https.postBuffer 123289600 -RUN git config --global http.sslverify false -# In normal case, we build out of the develop branch - -COPY ./ /openair-spgwu-tiny - -# Installing and Building SPGW-U -WORKDIR /openair-spgwu-tiny/build/scripts -RUN ./build_spgwu --clean --build-type Debug --jobs --Verbose - -# Copying executable and generated libraries -WORKDIR /openair-spgwu-tiny/bin -RUN cp /openair-spgwu-tiny/build/spgw_u/build/spgwu oai_spgwu \ - && cp /openair-spgwu-tiny/scripts/entrypoint.sh . \ - && cp /openair-spgwu-tiny/build/spgw_u/build/spgwu /openair-spgwu-tiny/bin/oai_spgwu.deb - -# WORKDIR /openair-spgwu-tiny/build/scripts -# RUN ./build_spgwu --clean --build-type Release --jobs --Verbose && \ -# cp /openair-spgwu-tiny/build/spgw_u/build/spgwu /openair-spgwu-tiny/bin/oai_spgwu.rel && \ -# ./build_spgwu --clean --build-type RelWithDebInfo --jobs --Verbose && \ -# cp /openair-spgwu-tiny/build/spgw_u/build/spgwu /openair-spgwu-tiny/bin/oai_spgwu.red && \ -# ./build_spgwu --clean --build-type MinSizeRel --jobs --Verbose && \ -# cp /openair-spgwu-tiny/build/spgw_u/build/spgwu /openair-spgwu-tiny/bin/oai_spgwu.min - -WORKDIR /openair-spgwu-tiny - -# expose ports -EXPOSE 2152/udp 8805/udp 22/tcp - - -CMD ["/openair-spgwu-tiny/bin/oai_spgwu", "-c", "/openair-spgwu-tiny/etc/spgw_u.conf", "-o"] -ENTRYPOINT ["/openair-spgwu-tiny/bin/entrypoint.sh"] diff --git a/docker/Dockerfile.debug.centos8.3dparty b/docker/Dockerfile.debug.centos8.3dparty deleted file mode 100644 index 21f33ca..0000000 --- a/docker/Dockerfile.debug.centos8.3dparty +++ /dev/null @@ -1,73 +0,0 @@ -#/* -# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more -# * contributor license agreements. See the NOTICE file distributed with -# * this work for additional information regarding copyright ownership. -# * The OpenAirInterface Software Alliance licenses this file to You under -# * the OAI Public License, Version 1.1 (the "License"); you may not use this file -# * except in compliance with the License. -# * You may obtain a copy of the License at -# * -# * http://www.openairinterface.org/?page_id=698 -# * -# * Unless required by applicable law or agreed to in writing, software -# * distributed under the License is distributed on an "AS IS" BASIS, -# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# * See the License for the specific language governing permissions and -# * limitations under the License. -# *------------------------------------------------------------------------------- -# * For more information about the OpenAirInterface (OAI) Software Alliance: -# * contact@openairinterface.org -# */ -#--------------------------------------------------------------------- -# -# Dockerfile for the Open-Air-Interface SPGW-U-TINY service -# Valid for CentOS 8 -# -#--------------------------------------------------------------------- - -#--------------------------------------------------------------------- -# BUILDER IMAGE -#--------------------------------------------------------------------- -FROM centos:8 as centos8-spgwu-debug-3rd-party - -ARG HTTP_PROXY - -RUN yum update -y \ - && yum install epel-release -y \ - && yum install dnf-plugins-core -y \ - && yum config-manager --set-enabled powertools \ - && yum install -y \ - psmisc \ - git \ - iptables \ - ethtool \ - glog \ - double-conversion \ - libconfig \ - libevent \ - boost-system \ - # debugging - gdb \ - valgrind \ - diffutils \ - iputils \ - tree \ - tcpdump \ - wireshark-cli \ - net-tools \ - openssh-server \ - procps-ng \ - && yum clean all -y \ - && rm -rf /var/cache/yum - -# Some GIT configuration command quite useful -RUN /bin/bash -c "if [[ -v HTTP_PROXY ]]; then git config --global http.proxy $HTTP_PROXY; fi" -RUN git config --global https.postBuffer 123289600 -RUN git config --global http.sslverify false -# In normal case, we build out of the develop branch - -COPY ./ /openair-spgwu-tiny - -# Installing and Building SPGW-U -WORKDIR /openair-spgwu-tiny/build/scripts -RUN ./build_spgwu --install-deps --force diff --git a/docker/Dockerfile.rhel8 b/docker/Dockerfile.rhel8 index fd4b3b0..b30e028 100644 --- a/docker/Dockerfile.rhel8 +++ b/docker/Dockerfile.rhel8 @@ -46,7 +46,6 @@ RUN rm /etc/rhsm-host && \ subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms && \ yum update -y && \ yum -y install --enablerepo="codeready-builder-for-rhel-8-x86_64-rpms" \ - # diff, cmp and file are not in the ubi??? diffutils \ file \ psmisc \ @@ -81,7 +80,7 @@ RUN yum update -y && \ initscripts \ libevent && \ yum clean all -y && \ - rm -rf /var/cache/yum + rm -rf /var/cache/yum /var/cache/dnf # Copying executable and generated libraries WORKDIR /openair-spgwu-tiny/bin diff --git a/docker/Dockerfile.ubuntu18.04 b/docker/Dockerfile.ubuntu18.04 index 93c5796..5736e3b 100644 --- a/docker/Dockerfile.ubuntu18.04 +++ b/docker/Dockerfile.ubuntu18.04 @@ -75,8 +75,8 @@ RUN apt-get update && \ iproute2 \ ethtool \ iptables \ - tshark \ perl \ + libgssapi-krb5-2 \ libldap-2.4-2 \ libgoogle-glog0v5 \ libdouble-conversion1 \ @@ -93,6 +93,7 @@ COPY --from=oai-spgwu-tiny-builder \ WORKDIR /usr/local/lib COPY --from=oai-spgwu-tiny-builder \ /usr/lib/libboost_system.so.1.67.0 \ + /usr/lib/x86_64-linux-gnu/libnghttp2.so.14 \ /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4 \ /usr/lib/x86_64-linux-gnu/librtmp.so.1 \ /usr/lib/x86_64-linux-gnu/libpsl.so.5 \ diff --git a/etc/spgw_u.conf b/etc/spgw_u.conf index 511931e..35c63f7 100644 --- a/etc/spgw_u.conf +++ b/etc/spgw_u.conf @@ -115,22 +115,25 @@ SPGW-U = { # STRING, {"yes", "no"}, ENABLE_5G_FEATURES = "@ENABLE_5G_FEATURES@" # Set to 'yes' to support 5G Features - REGISTER_NRF = "@REGISTER_NRF@"; # Set to 'yes' if UPF resgisters to an NRF - USE_FQDN_NRF = "@USE_FQDN_NRF@"; # Set to 'yes' if UPF relies on a DNS/FQDN service to resolve NRF's FQDN - UPF_FQDN_5G = "@UPF_FQDN_5G@"; #Set FQDN of UPF + REGISTER_NRF = "@REGISTER_NRF@"; # Set to 'yes' if UPF resgisters to an NRF + USE_FQDN_NRF = "@USE_FQDN_NRF@"; # Set to 'yes' if UPF relies on a DNS/FQDN service to resolve NRF's FQDN + UPF_FQDN_5G = "@UPF_FQDN_5G@"; # Set FQDN of UPF NRF : { IPV4_ADDRESS = "@NRF_IPV4_ADDRESS@"; # YOUR NRF CONFIG HERE PORT = @NRF_PORT@; # YOUR NRF CONFIG HERE (default: 80) - HTTP_VERSION = @HTTP_VERSION@; #Set HTTP version for NRF (1 or 2)Default 1 + HTTP_VERSION = @HTTP_VERSION@; #Set HTTP version for NRF (1 or 2)Default 1 API_VERSION = "@NRF_API_VERSION@"; # YOUR NRF API VERSION HERE FQDN = "@NRF_FQDN@"; }; # Additional info to be sent to NRF for supporting Network Slicing UPF_INFO = ( - { NSSAI_SST = @NSSAI_SST_0@; NSSAI_SD = "@NSSAI_SD_0@"; DNN_LIST = ({DNN = "@DNN_0@";}); } + { NSSAI_SST = @NSSAI_SST_0@; NSSAI_SD = "@NSSAI_SD_0@"; DNN_LIST = ({DNN = "@DNN_0@";}); }, + { NSSAI_SST = @NSSAI_SST_1@; NSSAI_SD = "@NSSAI_SD_1@"; DNN_LIST = ({DNN = "@DNN_1@";}); }, + { NSSAI_SST = @NSSAI_SST_2@; NSSAI_SD = "@NSSAI_SD_2@"; DNN_LIST = ({DNN = "@DNN_2@";}); }, + { NSSAI_SST = @NSSAI_SST_3@; NSSAI_SD = "@NSSAI_SD_3@"; DNN_LIST = ({DNN = "@DNN_3@";}); } ); } }; diff --git a/openshift/README.md b/openshift/README.md index 7914ed8..3fa7ae7 100644 --- a/openshift/README.md +++ b/openshift/README.md @@ -1,4 +1,4 @@ -# Build and deploying OAI-SPGW-C in OpenShift cluster # +# Build and deploying OAI-SPGW-U in OpenShift cluster # ## Pre-requisite ## diff --git a/openshift/bc-base-builder.yaml b/openshift/bc-base-builder.yaml new file mode 100644 index 0000000..452a205 --- /dev/null +++ b/openshift/bc-base-builder.yaml @@ -0,0 +1,146 @@ +--- +apiVersion: build.openshift.io/v1 +kind: BuildConfig +metadata: + name: oai-spgwu-tiny-base-builder +spec: + output: + to: + kind: ImageStreamTag + name: "oai-spgwu-tiny-base-builder:oai-oc" + runPolicy: Serial + strategy: + type: Docker + source: + secrets: + - destinationDir: etc-pki-entitlement + secret: + name: etc-pki-entitlement + configMaps: + - configMap: + name: rhsm-conf + destinationDir: rhsm-conf + - configMap: + name: rhsm-ca + destinationDir: rhsm-ca + dockerfile: | + ################################################################ + # Builder Image (can also be used as developer's image) + ################################################################ + FROM registry.access.redhat.com/ubi8/ubi:latest as oai-spgwu-tiny-builder + + ARG FEATURES=mme_oai + ENV MAGMA_ROOT=/magma + ENV BUILD_TYPE=Debug + ENV C_BUILD=/build/c + ENV TZ=Europe/Paris + + # Entitlements and RHSM configurations are Open-Shift Secret and ConfigMaps + # It is pre-requisite + # Copy the entitlements + COPY ./etc-pki-entitlement /etc/pki/entitlement + + # Copy the subscription manager configurations + COPY ./rhsm-conf /etc/rhsm + COPY ./rhsm-ca /etc/rhsm/ca + + RUN rm /etc/rhsm-host && \ + yum repolist --disablerepo=* && \ + subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms \ + && yum update -y \ + && yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \ + && yum install dnf-plugins-core -y \ + && yum install -y --enablerepo="codeready-builder-for-rhel-8-x86_64-rpms" \ + # diff, cmp and file are not in the ubi??? + autoconf \ + automake \ + binutils-devel \ + bison \ + boost-devel \ + check \ + cmake \ + cppcheck \ + diffutils \ + double-conversion-devel \ + ethtool \ + file \ + flex \ + gcc-c++ \ + gdb \ + gflags-devel \ + git \ + glog-devel \ + gmp-devel \ + guile-devel \ + initscripts \ + iproute \ + iptables \ + libconfig-devel \ + libcurl-devel \ + libevent \ + libevent-devel \ + libgcrypt-devel \ + libidn-devel \ + libtool \ + libxml2 \ + libxml2-devel \ + lksctp-tools \ + lksctp-tools-devel \ + lz4-devel \ + make \ + net-tools \ + openssl \ + openssl-devel \ + pkgconfig \ + procps-ng \ + psmisc \ + python2 \ + tzdata \ + wget \ + zlib-devel + + WORKDIR / + + RUN wget --quiet --tries=3 --retry-connrefused https://github.com/google/googletest/archive/release-1.8.0.tar.gz \ + && tar zxf release-1.8.0.tar.gz \ + && rm -f release-1.8.0.tar.gz \ + && cd googletest-release-1.8.0 \ + && cmake . \ + && make \ + && make install + + RUN git clone https://github.com/facebook/folly.git \ + && cd folly \ + && git checkout -f v2019.06.17.00 \ + && echo 'diff --git a/build/fbcode_builder/CMake/FindGflags.cmake b/build/fbcode_builder/CMake/FindGflags.cmake' > patch.diff \ + && echo 'index 246ceac..3b96716 100644' >> patch.diff \ + && echo '--- a/build/fbcode_builder/CMake/FindGflags.cmake' >> patch.diff \ + && echo '+++ b/build/fbcode_builder/CMake/FindGflags.cmake' >> patch.diff \ + && echo '@@ -34,6 +34,9 @@ IF (LIBGFLAGS_INCLUDE_DIR)' >> patch.diff \ + && echo ' ENDIF ()' >> patch.diff \ + && echo '' >> patch.diff \ + && echo ' find_package(gflags CONFIG QUIET)' >> patch.diff \ + && echo '+get_filename_component (_LIB_PATH "${gflags_CONFIG}/../../../" ABSOLUTE)' >> patch.diff \ + && echo '+unset(gflags_LIBRARIES)' >> patch.diff \ + && echo '+find_library(gflags_LIBRARIES gflags PATHS ${_LIB_PATH})' >> patch.diff \ + && echo ' if (gflags_FOUND)' >> patch.diff \ + && echo ' if (NOT Gflags_FIND_QUIETLY)' >> patch.diff \ + && echo ' message(STATUS "Found gflags from package config ${gflags_CONFIG}")' >> patch.diff \ + && git apply patch.diff \ + && mkdir _build && cd _build \ + && cmake3 .. \ + && make -j $(nproc) \ + && make install + + RUN git clone https://github.com/gabime/spdlog.git \ + && cd spdlog && git checkout master \ + && sed -i "/#define SPDLOG_ENABLE_SYSLOG/s/^\/\///g" include/spdlog/tweakme.h + + RUN git clone https://github.com/nlohmann/json.git \ + && cd json && git checkout -f v3.10.3 \ + && mkdir _build && cd _build \ + && cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DJSON_BuildTests=OFF .. \ + && make \ + && make install + + diff --git a/openshift/bc-dev.yaml b/openshift/bc-dev.yaml new file mode 100644 index 0000000..7a37640 --- /dev/null +++ b/openshift/bc-dev.yaml @@ -0,0 +1,60 @@ +--- +apiVersion: build.openshift.io/v1 +kind: BuildConfig +metadata: + name: oai-spgwu-tiny-dev +spec: + output: + to: + kind: ImageStreamTag + name: "oai-spgwu-tiny-dev:oai-oc" + runPolicy: Serial + strategy: + type: Docker + source: + secrets: + - destinationDir: etc-pki-entitlement + secret: + name: etc-pki-entitlement + configMaps: + - configMap: + name: rhsm-conf + destinationDir: rhsm-conf + - configMap: + name: rhsm-ca + destinationDir: rhsm-ca + dockerfile: | + ################################################################ + # Builder Image (can also be used as developer's image) + ################################################################ + FROM image-registry.openshift-image-registry.svc:5000/oai4g/oai-spgwu-tiny-base-builder:oai-oc as oai-spgwu-tiny-builder + ENV TZ=Europe/Paris + + WORKDIR / + RUN git clone -b develop https://github.com/lionelgo/openair-spgwu-tiny.git + + WORKDIR /openair-spgwu-tiny/build/ext + RUN ln -s /spdlog /openair-spgwu-tiny/build/ext/spdlog \ + && ln -s /json /openair-spgwu-tiny/build/ext/json + WORKDIR /openair-spgwu-tiny/build/scripts + RUN ./build_spgwu --clean --build-type Release --jobs --Verbose \ + && ldd /openair-spgwu-tiny/build/spgw_u/build/spgwu \ + && mv /openair-spgwu-tiny/build/spgw_u/build/spgwu \ + /openair-spgwu-tiny/build/spgw_u/build/oai_spgwu \ + && mkdir /openair-spgwu-tiny/bin \ + && cp /openair-spgwu-tiny/build/spgw_u/build/oai_spgwu \ + /openair-spgwu-tiny/scripts/entrypoint.sh \ + /openair-spgwu-tiny/bin + + + RUN ldconfig && \ + ldd /openair-spgwu-tiny/bin/oai_spgwu + + WORKDIR /openair-spgwu-tiny + + # expose ports + EXPOSE 2152/udp 8805/udp + + CMD ["/openair-spgwu-tiny/bin/oai_spgwu", "-c", "/openair-spgwu-tiny/etc/spgw_u.conf", "-o"] + ENTRYPOINT ["/openair-spgwu-tiny/bin/entrypoint.sh"] + \ No newline at end of file diff --git a/openshift/bc-target.yaml b/openshift/bc-target.yaml new file mode 100644 index 0000000..6541d65 --- /dev/null +++ b/openshift/bc-target.yaml @@ -0,0 +1,79 @@ +--- +apiVersion: build.openshift.io/v1 +kind: BuildConfig +metadata: + name: oai-spgwu-tiny +spec: + output: + to: + kind: ImageStreamTag + name: "oai-spgwu-tiny:oai-oc" + runPolicy: Serial + strategy: + type: Docker + source: + secrets: + - destinationDir: etc-pki-entitlement + secret: + name: etc-pki-entitlement + configMaps: + - configMap: + name: rhsm-conf + destinationDir: rhsm-conf + - configMap: + name: rhsm-ca + destinationDir: rhsm-ca + dockerfile: | + ################################################################ + # Target Image + ################################################################ + FROM image-registry.openshift-image-registry.svc:5000/oai4g/oai-spgwu-tiny-dev:oai-oc as oai-spgwu-tiny-dev + FROM registry.access.redhat.com/ubi8/ubi:latest as spgwu + + ENV TZ=Europe/Paris + + # We install some debug tools for the moment in addition of mandatory libraries + RUN yum update -y && \ + yum -y install --enablerepo="ubi-8-codeready-builder" \ + tzdata \ + procps-ng \ + psmisc \ + net-tools \ + ethtool \ + iproute \ + iptables \ + initscripts \ + libevent && \ + yum clean all -y && \ + rm -rf /var/cache/yum /var/cache/dnf + + # Copying executable and generated libraries + WORKDIR /openair-spgwu-tiny/bin + COPY --from=oai-spgwu-tiny-dev \ + /openair-spgwu-tiny/build/spgw_u/build/oai_spgwu \ + /openair-spgwu-tiny/scripts/entrypoint.sh \ + ./ + + # Copying installed libraries from builder + COPY --from=oai-spgwu-tiny-dev \ + /lib64/libgflags.so.2.1 \ + /lib64/libglog.so.0 \ + /lib64/libdouble-conversion.so.1 \ + /lib64/libconfig++.so.9 \ + /lib64/libboost_system.so.1.66.0 \ + /lib64/ + RUN ldconfig && \ + ldd /openair-spgwu-tiny/bin/oai_spgwu + + # Copying template configuration files + # The configuration folder will be flat + WORKDIR /openair-spgwu-tiny/etc + COPY --from=oai-spgwu-tiny-dev /openair-spgwu-tiny/etc/spgw_u.conf . + + WORKDIR /openair-spgwu-tiny + + # expose ports + EXPOSE 2152/udp 8805/udp + + CMD ["/openair-spgwu-tiny/bin/oai_spgwu", "-c", "/openair-spgwu-tiny/etc/spgw_u.conf", "-o"] + ENTRYPOINT ["/openair-spgwu-tiny/bin/entrypoint.sh"] diff --git a/openshift/build-config.debug.centos8.3dparty.yml b/openshift/build-config.debug.centos8.3dparty.yml deleted file mode 100644 index 3181909..0000000 --- a/openshift/build-config.debug.centos8.3dparty.yml +++ /dev/null @@ -1,52 +0,0 @@ -#/* -# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more -# * contributor license agreements. See the NOTICE file distributed with -# * this work for additional information regarding copyright ownership. -# * The OpenAirInterface Software Alliance licenses this file to You under -# * the OAI Public License, Version 1.1 (the "License"); you may not use this file -# * except in compliance with the License. -# * You may obtain a copy of the License at -# * -# * http://www.openairinterface.org/?page_id=698 -# * -# * Unless required by applicable law or agreed to in writing, software -# * distributed under the License is distributed on an "AS IS" BASIS, -# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# * See the License for the specific language governing permissions and -# * limitations under the License. -# *------------------------------------------------------------------------------- -# * For more information about the OpenAirInterface (OAI) Software Alliance: -# * contact@openairinterface.org -# */ -#--------------------------------------------------------------------- -# -kind: BuildConfig -apiVersion: build.openshift.io/v1 -metadata: - name: "spgwu-tiny-debug-centos8-3dparty" -spec: - runPolicy: "Serial" - source: - git: - uri: "https://github.com/OPENAIRINTERFACE/openair-spgwu-tiny.git" - ref: "Dockerfile-centos8" - httpProxy: http://proxy.eurecom.fr:8080 - httpsProxy: https://proxy.eurecom.fr:8080 - secrets: - - secret: - name: etc-pki-entitlement - destinationDir: etc-pki-entitlement - configMaps: - - configMap: - name: rhsm-conf - destinationDir: rhsm-conf - - configMap: - name: rhsm-ca - destinationDir: rhsm-ca - strategy: - dockerStrategy: - dockerfilePath: "docker/Dockerfile.debug.centos8.3dparty" - output: - to: - kind: "ImageStreamTag" - name: "oai-spgwu-tiny:debug-centos8-3rd-party" diff --git a/openshift/build-config.debug.centos8.yml b/openshift/build-config.debug.centos8.yml deleted file mode 100644 index 0bd2a11..0000000 --- a/openshift/build-config.debug.centos8.yml +++ /dev/null @@ -1,55 +0,0 @@ -#/* -# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more -# * contributor license agreements. See the NOTICE file distributed with -# * this work for additional information regarding copyright ownership. -# * The OpenAirInterface Software Alliance licenses this file to You under -# * the OAI Public License, Version 1.1 (the "License"); you may not use this file -# * except in compliance with the License. -# * You may obtain a copy of the License at -# * -# * http://www.openairinterface.org/?page_id=698 -# * -# * Unless required by applicable law or agreed to in writing, software -# * distributed under the License is distributed on an "AS IS" BASIS, -# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# * See the License for the specific language governing permissions and -# * limitations under the License. -# *------------------------------------------------------------------------------- -# * For more information about the OpenAirInterface (OAI) Software Alliance: -# * contact@openairinterface.org -# */ -#--------------------------------------------------------------------- -# -kind: BuildConfig -apiVersion: build.openshift.io/v1 -metadata: - name: "spgwu-tiny-debug-centos8" -spec: - runPolicy: "Serial" - source: - git: - uri: "https://github.com/lionelgo/openair-spgwu-tiny.git" - ref: "multi-spgwu" - httpProxy: http://proxy.eurecom.fr:8080 - httpsProxy: https://proxy.eurecom.fr:8080 - secrets: - - secret: - name: etc-pki-entitlement - destinationDir: etc-pki-entitlement - configMaps: - - configMap: - name: rhsm-conf - destinationDir: rhsm-conf - - configMap: - name: rhsm-ca - destinationDir: rhsm-ca - strategy: - dockerStrategy: - dockerfilePath: "docker/Dockerfile.debug.centos8" - from: - kind: "ImageStreamTag" - name: "oai-spgwu-tiny:debug-centos8-3rd-party" - output: - to: - kind: "ImageStreamTag" - name: "oai-spgwu-tiny:multi-spgwu" diff --git a/openshift/build_image.debug.centos8 b/openshift/build_image.debug.centos8 deleted file mode 100755 index 0615c9c..0000000 --- a/openshift/build_image.debug.centos8 +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -################################################################################ -# Licensed to the OpenAirInterface (OAI) Software Alliance under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The OpenAirInterface Software Alliance licenses this file to You under -# the Apache License, Version 2.0 (the "License"); you may not use this file -# except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------- -# For more information about the OpenAirInterface (OAI) Software Alliance: -# contact@openairinterface.org -################################################################################ -# file build_image.debug.centos8 -# brief -# author Lionel Gauthier -# company Eurecom -# email: lionel.gauthier@eurecom.fr -# - -set -o pipefail - -THIS_SCRIPT_PATH=$(dirname $(readlink -f $0)) - -function main() -{ - oc apply -f $THIS_SCRIPT_PATH/build-config.debug.centos8.yml - if [[ $? -ne 0 ]]; then - echo "Error: oc apply -f $THIS_SCRIPT_PATH/build-config.debug.centos8.yml failed" - return 1 - fi - oc apply -f $THIS_SCRIPT_PATH/image-stream.debug.centos8.yml - if [[ $? -ne 0 ]]; then - echo "Error: oc apply -f $THIS_SCRIPT_PATH/image-stream.debug.centos8.yml failed" - return 1 - fi - - oc start-build spgwu-tiny-debug-centos8 --follow - return $? -} - -main "$@" diff --git a/openshift/build_image.debug.centos8.3dparty b/openshift/build_image.debug.centos8.3dparty deleted file mode 100755 index 6c52b63..0000000 --- a/openshift/build_image.debug.centos8.3dparty +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -################################################################################ -# Licensed to the OpenAirInterface (OAI) Software Alliance under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The OpenAirInterface Software Alliance licenses this file to You under -# the Apache License, Version 2.0 (the "License"); you may not use this file -# except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------- -# For more information about the OpenAirInterface (OAI) Software Alliance: -# contact@openairinterface.org -################################################################################ -# file build_image.debug.centos8.3dparty -# brief -# author Lionel Gauthier -# company Eurecom -# email: lionel.gauthier@eurecom.fr -# - -set -o pipefail - -THIS_SCRIPT_PATH=$(dirname $(readlink -f $0)) - -function main() -{ - oc apply -f $THIS_SCRIPT_PATH/build-config.debug.centos8.3dparty.yml - if [[ $? -ne 0 ]]; then - echo "Error: oc apply -f $THIS_SCRIPT_PATH/build-config.debug.centos8.3dparty.yml failed" - return 1 - fi - oc apply -f $THIS_SCRIPT_PATH/image-stream.debug.centos8.3dparty.yml - if [[ $? -ne 0 ]]; then - echo "Error: oc apply -f $THIS_SCRIPT_PATH/image-stream.debug.centos8.3dparty.yml failed" - return 1 - fi - - oc start-build spgwu-tiny-debug-centos8-3dparty --follow - return $? -} - -main "$@" diff --git a/openshift/oai-spgwu-tiny-image-stream.yml b/openshift/is-base.yml similarity index 87% rename from openshift/oai-spgwu-tiny-image-stream.yml rename to openshift/is-base.yml index b2f4d7b..43d35e6 100644 --- a/openshift/oai-spgwu-tiny-image-stream.yml +++ b/openshift/is-base.yml @@ -19,10 +19,13 @@ # * contact@openairinterface.org # */ # -apiVersion: v1 +apiVersion: image.openshift.io/v1 kind: ImageStream metadata: - name: oai-spgwu-tiny - namespace: oai + name: oai-spgwu-tiny-base-builder + namespace: oai4g status: - tag: onap-0.1.0 + tag: oai-oc +spec: + lookupPolicy: + local: true \ No newline at end of file diff --git a/openshift/image-stream.debug.centos8.3dparty.yml b/openshift/is-dev.yml similarity index 90% rename from openshift/image-stream.debug.centos8.3dparty.yml rename to openshift/is-dev.yml index 7c4f461..8bdf638 100644 --- a/openshift/image-stream.debug.centos8.3dparty.yml +++ b/openshift/is-dev.yml @@ -19,14 +19,13 @@ # * contact@openairinterface.org # */ # -apiVersion: v1 +apiVersion: image.openshift.io/v1 kind: ImageStream metadata: - name: oai-spgwu-tiny - namespace: oai + name: oai-spgwu-tiny-dev + namespace: oai4g status: - tag: debug-centos8-3rd-party + tag: oai-oc spec: lookupPolicy: - local: true - \ No newline at end of file + local: true \ No newline at end of file diff --git a/openshift/image-stream.debug.centos8.yml b/openshift/is-target.yml similarity index 92% rename from openshift/image-stream.debug.centos8.yml rename to openshift/is-target.yml index 99b78df..ff24df8 100644 --- a/openshift/image-stream.debug.centos8.yml +++ b/openshift/is-target.yml @@ -19,13 +19,13 @@ # * contact@openairinterface.org # */ # -apiVersion: v1 +apiVersion: image.openshift.io/v1 kind: ImageStream metadata: name: oai-spgwu-tiny - namespace: oai + namespace: oai4g status: - tag: multi-spgwu + tag: oai-oc spec: lookupPolicy: - local: true + local: true \ No newline at end of file diff --git a/openshift/oai-spgwu-tiny-build-config.yml b/openshift/oai-spgwu-tiny-build-config.yml deleted file mode 100644 index d2eaca0..0000000 --- a/openshift/oai-spgwu-tiny-build-config.yml +++ /dev/null @@ -1,52 +0,0 @@ -#/* -# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more -# * contributor license agreements. See the NOTICE file distributed with -# * this work for additional information regarding copyright ownership. -# * The OpenAirInterface Software Alliance licenses this file to You under -# * the OAI Public License, Version 1.1 (the "License"); you may not use this file -# * except in compliance with the License. -# * You may obtain a copy of the License at -# * -# * http://www.openairinterface.org/?page_id=698 -# * -# * Unless required by applicable law or agreed to in writing, software -# * distributed under the License is distributed on an "AS IS" BASIS, -# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# * See the License for the specific language governing permissions and -# * limitations under the License. -# *------------------------------------------------------------------------------- -# * For more information about the OpenAirInterface (OAI) Software Alliance: -# * contact@openairinterface.org -# */ -#--------------------------------------------------------------------- -# -kind: BuildConfig -apiVersion: build.openshift.io/v1 -metadata: - name: "oai-spgwu-tiny-build-config" -spec: - runPolicy: "Serial" - source: - git: - uri: "https://github.com/OPENAIRINTERFACE/openair-spgwu-tiny.git" - ref: "develop" - httpProxy: http://proxy.eurecom.fr:8080 - httpsProxy: https://proxy.eurecom.fr:8080 - secrets: - - secret: - name: etc-pki-entitlement - destinationDir: etc-pki-entitlement - configMaps: - - configMap: - name: rhsm-conf - destinationDir: rhsm-conf - - configMap: - name: rhsm-ca - destinationDir: rhsm-ca - strategy: - dockerStrategy: - dockerfilePath: "docker/Dockerfile.rhel8" - output: - to: - kind: "ImageStreamTag" - name: "oai-spgwu-tiny:onap-0.1.0" diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index b901774..df6c8a5 100755 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -24,6 +24,16 @@ NRF_FQDN=${NRF_FQDN:-gw.openairinterface.org} NSSAI_SST_0=${NSSAI_SST_0:-1} NSSAI_SD_0=${NSSAI_SD_0:-2} DNN_0=${DNN_0:-default} +NSSAI_SST_1=${NSSAI_SST_1:-130} +NSSAI_SD_1=${NSSAI_SD_1:-130} +DNN_1=${DNN_1:-test1} +NSSAI_SST_2=${NSSAI_SST_2:-131} +NSSAI_SD_2=${NSSAI_SD_2:-131} +DNN_2=${DNN_2:-test2} +NSSAI_SST_3=${NSSAI_SST_3:-132} +NSSAI_SD_3=${NSSAI_SD_3:-132} +DNN_3=${DNN_3:-test3} + UPF_FQDN_5G=${UPF_FQDN_5G:-oai-spgwu-tiny-svc} HTTP_VERSION=${HTTP_VERSION:-1} diff --git a/src/common/3gpp_23.003.h b/src/common/3gpp_23.003.h index 3c6812b..35d3e8a 100644 --- a/src/common/3gpp_23.003.h +++ b/src/common/3gpp_23.003.h @@ -28,4 +28,7 @@ #ifndef FILE_3GPP_23_003_SEEN #define FILE_3GPP_23_003_SEEN +#define SST_MAX_STANDARDIZED_VALUE 127 +#define SD_NO_VALUE 0xFFFFFF + #endif /* FILE_3GPP_23_003_SEEN */ diff --git a/src/gtpv1u/gtpu.h b/src/gtpv1u/gtpu.h index 88352ba..254600c 100644 --- a/src/gtpv1u/gtpu.h +++ b/src/gtpv1u/gtpu.h @@ -31,6 +31,12 @@ #include #include +#define GTPU_MESSAGE_PN_MASK 0x1 +#define GTPU_MESSAGE_SN_MASK 0x2 +#define GTPU_MESSAGE_EXT_HEADER_MASK 0x4 +#define GTPU_MESSAGE_PT_MASK 0x10 +#define GTPU_MESSAGE_VERSION_MASK 0xE + struct gtpuhdr { #if __BYTE_ORDER == __LITTLE_ENDIAN unsigned int pn : 1; @@ -90,4 +96,4 @@ struct gtpu_extn_pdu_session_container { // Next Extension Header Type - This field defines the type of Extension // Header that follows this field in the GTP-PDU uint8_t next_ext_type; -}; \ No newline at end of file +}; diff --git a/src/spgwu/simpleswitch/pfcp_switch.cpp b/src/spgwu/simpleswitch/pfcp_switch.cpp index 58ecfc2..ba632ad 100644 --- a/src/spgwu/simpleswitch/pfcp_switch.cpp +++ b/src/spgwu/simpleswitch/pfcp_switch.cpp @@ -74,7 +74,7 @@ void pfcp_switch::pdn_worker( if (iov->msg_iov.iov_base) { pfcp_session_look_up_pack_in_core( (const char*) iov->msg_iov.iov_base, iov->msg_iov.iov_len); - free_pool_->write(iov); + free_pool_->blockingWrite(iov); } else { free(iov); std::cout << "exit DL w" << id << " " << count << std::endl; @@ -89,12 +89,14 @@ void pfcp_switch::pdn_worker( } //------------------------------------------------------------------------------ void pfcp_switch::pdn_read_loop( - int sock_r, const util::thread_sched_params& sched_params) { + int sock_r, util::thread_sched_params sched_params) { uint64_t count = 0; uint64_t errors = 0; iovec_q_item_t* iov = nullptr; // struct sockaddr_in sin = {}; + // Producer should not interfere with consumer for not de-sequence IP packets + sched_params.sched_priority -=1; sched_params.apply(TASK_NONE, Logger::pfcp_switch()); while (1) { @@ -123,7 +125,7 @@ void pfcp_switch::pdn_read_loop( ++count; // std::cout << "pdn" << count << " " << nread << " bytes" << std::endl; iov->msg_iov.iov_len = nread; - work_pool_->write(iov); + work_pool_->blockingWrite(iov); iov = nullptr; } else { ++errors; @@ -386,7 +388,7 @@ pfcp_switch::pfcp_switch() threads_(16), socks_r(16), sock_w(0) { - num_threads_ = 8; + num_threads_ = spgwu_cfg.sgi.thread_rd_sched_params.thread_pool_size; int num_blocks = num_threads_ * 16; free_pool_ = new folly::MPMCQueue(num_blocks); work_pool_ = new folly::MPMCQueue(num_blocks); diff --git a/src/spgwu/simpleswitch/pfcp_switch.hpp b/src/spgwu/simpleswitch/pfcp_switch.hpp index 8557489..d77b5c6 100644 --- a/src/spgwu/simpleswitch/pfcp_switch.hpp +++ b/src/spgwu/simpleswitch/pfcp_switch.hpp @@ -97,7 +97,7 @@ class pfcp_switch { // moodycamel::ConcurrentQueue create_session_q; void pdn_worker(const int id, const util::thread_sched_params& sched_params); - void pdn_read_loop(int sock_r, const util::thread_sched_params& sched_params); + void pdn_read_loop(int sock_r, util::thread_sched_params sched_params); int create_pdn_socket( const char* const ifname, const bool promisc, int& if_index); int create_pdn_socket(const char* const ifname); diff --git a/src/spgwu/simpleswitch/spgwu_s1u.cpp b/src/spgwu/simpleswitch/spgwu_s1u.cpp index f78798c..d7307d3 100644 --- a/src/spgwu/simpleswitch/spgwu_s1u.cpp +++ b/src/spgwu/simpleswitch/spgwu_s1u.cpp @@ -124,7 +124,12 @@ void spgwu_s1u::handle_receive( if (gtpuh->message_type == GTPU_G_PDU) { uint8_t gtp_flags = recv_buffer[GTPU_MESSAGE_FLAGS_POS_IN_UDP_PAYLOAD]; std::size_t gtp_payload_offset = GTPV1U_MSG_HEADER_MIN_SIZE; - if (gtp_flags == 0x34) gtp_payload_offset += 4; + if ((((gtp_flags & GTPU_MESSAGE_VERSION_MASK)) && + (gtp_flags & GTPU_MESSAGE_PT_MASK)) && + ((gtp_flags & GTPU_MESSAGE_EXT_HEADER_MASK) || + (gtp_flags & GTPU_MESSAGE_SN_MASK) || + (gtp_flags & GTPU_MESSAGE_PN_MASK))) + gtp_payload_offset += 4; std::size_t gtp_payload_length = be16toh(gtpuh->message_length); if (gtp_flags & 0x07) { gtp_payload_offset += 4; diff --git a/src/spgwu/spgwu_config.cpp b/src/spgwu/spgwu_config.cpp index 74ec399..f28da21 100644 --- a/src/spgwu/spgwu_config.cpp +++ b/src/spgwu/spgwu_config.cpp @@ -803,16 +803,19 @@ void spgwu_config::display() { upf_5g_features.nrf_addr.fqdn.c_str()); if (upf_5g_features.upf_info.snssai_upf_info_list.size() > 0) { - Logger::spgwu_app().debug(" UPF Info:"); - } - for (auto s : upf_5g_features.upf_info.snssai_upf_info_list) { - // Logger::spgwu_app().debug(" Parameters supported by the - // UPF:"); - Logger::spgwu_app().debug( - " SNSSAI (SST %d, SD %s)", s.snssai.sST, - s.snssai.sD.c_str()); - for (auto d : s.dnn_upf_info_list) { - Logger::spgwu_app().debug(" DNN %s", d.dnn.c_str()); + Logger::spgwu_app().info(" UPF Info:"); + + for (auto s : upf_5g_features.upf_info.snssai_upf_info_list) { + // Logger::spgwu_app().debug(" Parameters supported by the UPF:"); + if (s.snssai.sD.compare(std::to_string(SD_NO_VALUE))) + Logger::spgwu_app().info( + " SNSSAI (SST %d, SD %s)", s.snssai.sST, + s.snssai.sD.c_str()); + else + Logger::spgwu_app().info(" SNSSAI (SST %d)", s.snssai.sST); + for (auto d : s.dnn_upf_info_list) { + Logger::spgwu_app().info(" DNN %s", d.dnn.c_str()); + } } } } diff --git a/src/spgwu/spgwu_config.hpp b/src/spgwu/spgwu_config.hpp index d08a9bb..5f2c389 100644 --- a/src/spgwu/spgwu_config.hpp +++ b/src/spgwu/spgwu_config.hpp @@ -31,6 +31,7 @@ #include "3gpp_29.244.h" #include "3gpp_29.510.h" +#include "3gpp_23.003.h" #include "gtpv1u.hpp" #include "pfcp.hpp" #include "thread_sched.hpp" diff --git a/src/spgwu/spgwu_profile.cpp b/src/spgwu/spgwu_profile.cpp index 48627b1..5023793 100644 --- a/src/spgwu/spgwu_profile.cpp +++ b/src/spgwu/spgwu_profile.cpp @@ -372,4 +372,4 @@ void spgwu_profile::handle_heartbeart_timeout(uint64_t ms) { "Handle heartbeart timeout profile %s, time %d", nf_instance_id.c_str(), ms); set_nf_status("SUSPENDED"); -} +} \ No newline at end of file diff --git a/src/spgwu/spgwu_profile.hpp b/src/spgwu/spgwu_profile.hpp index 257df94..4c199ed 100644 --- a/src/spgwu/spgwu_profile.hpp +++ b/src/spgwu/spgwu_profile.hpp @@ -38,6 +38,7 @@ #include "logger.hpp" #include "3gpp_29.510.h" +#include "3gpp_23.003.h" namespace spgwu { diff --git a/src/udp/udp.cpp b/src/udp/udp.cpp index 89df6e5..e1b5d34 100644 --- a/src/udp/udp.cpp +++ b/src/udp/udp.cpp @@ -135,6 +135,15 @@ int udp_server::create_socket( return errno; } + int on = 1; + if (setsockopt(sd, SOL_SOCKET, SO_REUSEPORT, &on, sizeof(on)) < 0) { + /* + * Reuse port has failed... + */ + Logger::udp().error("Socket option reuse port failed (%s)\n", strerror(errno)); + return errno; + } + addr.sin_family = AF_INET; addr.sin_port = htons(port); addr.sin_addr.s_addr = address.s_addr;