Skip to content

Commit

Permalink
Release v1.4.0
Browse files Browse the repository at this point in the history
* 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
arora-sagar authored Jul 7, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 52f4353 + 16bd4d8 commit 924e55a
Showing 36 changed files with 527 additions and 579 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions build/scripts/build_helper
Original file line number Diff line number Diff line change
@@ -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
10 changes: 3 additions & 7 deletions build/scripts/build_helper.spgw
Original file line number Diff line number Diff line change
@@ -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 \
25 changes: 16 additions & 9 deletions ci-scripts/Jenkinsfile-GitHub-Docker
Original file line number Diff line number Diff line change
@@ -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) {
10 changes: 10 additions & 0 deletions ci-scripts/checkCodingFormattingRules.sh
Original file line number Diff line number Diff line change
@@ -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`
95 changes: 95 additions & 0 deletions ci-scripts/flatten_image.py
Original file line number Diff line number Diff line change
@@ -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:
[email protected]
"""

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()
35 changes: 17 additions & 18 deletions ci-scripts/generateHtmlReport.py
Original file line number Diff line number Diff line change
@@ -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(' <div class="well well-lg">End of Build Report -- Copyright <span class="glyphicon glyphicon-copyright-mark"></span> 2020 <a href="http://www.openairinterface.org/">OpenAirInterface</a>. All Rights Reserved.</div>\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)
101 changes: 0 additions & 101 deletions docker/Dockerfile.centos8

This file was deleted.

67 changes: 0 additions & 67 deletions docker/Dockerfile.debug.centos8

This file was deleted.

73 changes: 0 additions & 73 deletions docker/Dockerfile.debug.centos8.3dparty

This file was deleted.

3 changes: 1 addition & 2 deletions docker/Dockerfile.rhel8
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion docker/Dockerfile.ubuntu18.04
Original file line number Diff line number Diff line change
@@ -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 \
13 changes: 8 additions & 5 deletions etc/spgw_u.conf
Original file line number Diff line number Diff line change
@@ -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@";}); }
);
}
};
2 changes: 1 addition & 1 deletion openshift/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Build and deploying OAI-SPGW-C in OpenShift cluster #
# Build and deploying OAI-SPGW-U in OpenShift cluster #

## Pre-requisite ##

146 changes: 146 additions & 0 deletions openshift/bc-base-builder.yaml
Original file line number Diff line number Diff line change
@@ -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
60 changes: 60 additions & 0 deletions openshift/bc-dev.yaml
Original file line number Diff line number Diff line change
@@ -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"]
79 changes: 79 additions & 0 deletions openshift/bc-target.yaml
Original file line number Diff line number Diff line change
@@ -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"]
52 changes: 0 additions & 52 deletions openshift/build-config.debug.centos8.3dparty.yml

This file was deleted.

55 changes: 0 additions & 55 deletions openshift/build-config.debug.centos8.yml

This file was deleted.

50 changes: 0 additions & 50 deletions openshift/build_image.debug.centos8

This file was deleted.

50 changes: 0 additions & 50 deletions openshift/build_image.debug.centos8.3dparty

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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

local: true
Original file line number Diff line number Diff line change
@@ -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
52 changes: 0 additions & 52 deletions openshift/oai-spgwu-tiny-build-config.yml

This file was deleted.

10 changes: 10 additions & 0 deletions scripts/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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}

3 changes: 3 additions & 0 deletions src/common/3gpp_23.003.h
Original file line number Diff line number Diff line change
@@ -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 */
8 changes: 7 additions & 1 deletion src/gtpv1u/gtpu.h
Original file line number Diff line number Diff line change
@@ -31,6 +31,12 @@
#include <endian.h>
#include <stdint.h>

#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;
};
};
10 changes: 6 additions & 4 deletions src/spgwu/simpleswitch/pfcp_switch.cpp
Original file line number Diff line number Diff line change
@@ -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<iovec_q_item_t*>(num_blocks);
work_pool_ = new folly::MPMCQueue<iovec_q_item_t*>(num_blocks);
2 changes: 1 addition & 1 deletion src/spgwu/simpleswitch/pfcp_switch.hpp
Original file line number Diff line number Diff line change
@@ -97,7 +97,7 @@ class pfcp_switch {
// moodycamel::ConcurrentQueue<pfcp::pfcp_session*> 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);
7 changes: 6 additions & 1 deletion src/spgwu/simpleswitch/spgwu_s1u.cpp
Original file line number Diff line number Diff line change
@@ -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;
23 changes: 13 additions & 10 deletions src/spgwu/spgwu_config.cpp
Original file line number Diff line number Diff line change
@@ -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());
}
}
}
}
1 change: 1 addition & 0 deletions src/spgwu/spgwu_config.hpp
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 1 addition & 1 deletion src/spgwu/spgwu_profile.cpp
Original file line number Diff line number Diff line change
@@ -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");
}
}
1 change: 1 addition & 0 deletions src/spgwu/spgwu_profile.hpp
Original file line number Diff line number Diff line change
@@ -38,6 +38,7 @@

#include "logger.hpp"
#include "3gpp_29.510.h"
#include "3gpp_23.003.h"

namespace spgwu {

9 changes: 9 additions & 0 deletions src/udp/udp.cpp
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit 924e55a

Please sign in to comment.