Commit e3855a16 authored by Raphael Defosseux's avatar Raphael Defosseux

Merge branch 'vpp-upf' into 'develop'

For Public Release

See merge request oai/cn5g/oai-cn5g-upf-vpp!1
parents 727099f2 a58a0358
......@@ -59,7 +59,14 @@ The OpenAirInterface CN UPF software is composed of the following parts:
<pre>
openair-cn5g-upf-vpp
├── ci-scripts: Directory containing the script files for CI framework.
└── src: Source files of UPF.
├── common: Common header files
├── build
│   └── scripts
├── ci-scripts
├── docker
├── docs
│   └── images
└── scripts
├── patches
├── tests
└── upf_conf
</pre>
################################################################################
# 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
################################################################################
# file build_helper
# brief
# author Laurent Thomas, Lionel GAUTHIER, Rohan KHARADE
#
#######################################
SUPPORTED_DISTRO="Ubuntu 18.04, Ubuntu 20.04"
#SUPPORTED_DISTRO="Ubuntu 18.04, Ubuntu 20.04, CentOS 7, RHEL 7"
#SUPPORTED_DISTRO="Ubuntu 18.04"
if [ ! -f /etc/os-release ]; then
echo_fatal "No /etc/os-release file found. You're likely on an unsupported distro."
fi
OS_DISTRO=$(grep "^ID=" /etc/os-release | sed "s/ID=//" | sed "s/\"//g")
OS_RELEASE=$(grep "^VERSION_ID=" /etc/os-release | sed "s/VERSION_ID=//" | sed "s/\"//g")
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
IS_CONTAINER=`egrep -c "docker|kubepods" /proc/self/cgroup`
if [ $IS_CONTAINER -eq 0 ]
then
SUDO='sudo -S -E'
else
SUDO=''
fi
###############################
## echo and family
###############################
black='\E[30m'
red='\E[31m'
green='\E[32m'
yellow='\E[33m'
blue='\E[1;34m'
magenta='\E[35m'
cyan='\E[36m'
white='\E[37m'
reset_color='\E[00m'
COLORIZE=1
#-------------------------------------------------------------------------------
cecho() {
# Color-echo
# arg1 = message
# arg2 = color
local default_msg="No Message."
message=${1:-$default_msg}
color=${2:-$green}
[ "$COLORIZE" = "1" ] && message="$color$message$reset_color"
echo -e "$message"
return
}
echo_error() { cecho "$*" $red ;}
echo_fatal() { cecho "$*" $red; exit -1 ;}
echo_warning() { cecho "$*" $yellow ;}
echo_success() { cecho "$*" $green ;}
echo_info() { cecho "$*" $blue ;}
#-------------------------------------------------------------------------------
# From https://stackoverflow.com/questions/4023830/how-to-compare-two-strings-in-dot-separated-version-format-in-bash
# arg1 is a dotted (or not) version number (ex 4.10.6.56-ubunutu)
# arg2 is a dotted (or not) version number (ex 4.10.6.56-ubunutu)
# return 0 if $1 lower or equal $2, else 1
version_le() {
[ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]
}
# From https://stackoverflow.com/questions/4023830/how-to-compare-two-strings-in-dot-separated-version-format-in-bash
version_lt() {
[ "$1" = "$2" ] && return 1 || version_le $1 $2
}
# From https://stackoverflow.com/questions/4023830/how-to-compare-two-strings-in-dot-separated-version-format-in-bash
version_ge() {
[ "$1" = "`echo -e "$1\n$2" | sort -V | tail -n1`" ]
}
# From https://stackoverflow.com/questions/4023830/how-to-compare-two-strings-in-dot-separated-version-format-in-bash
version_gt() {
[ "$1" = "$2" ] && return 1 || version_ge $1 $2
}
########################
# distribution helpers #
########################
#-------------------------------------------------------------------------------
# This function return a string to identify the distribution we are running
# If we can't check the distribution, it returns "Unknown"
# This function return always true as exit code by design
# Examples:
# ubuntu18.04
# debian8.5
get_distribution_release() {
if [[ ! -z "$OS_DISTRO$OS_RELEASE" ]]; then
echo -n "$OS_DISTRO$OS_RELEASE"
else
echo -n Unknown
fi
}
check_supported_distribution() {
echo_info "Detected OS release - $OS_DISTRO $OS_RELEASE"
local distribution=$(get_distribution_release)
case "$distribution" in
"ubuntu18.04") return 0 ;;
"ubuntu20.04") return 0 ;;
#"rhel7") return 0 ;;
#"centos7") return 0 ;;
esac
return 1
}
###################################
# Compilers
###################################
# From https://stackoverflow.com/a/20473191
# test if a list include item
# arg1 is list, ex "item1 item2 ..."
# arg2 is item
function list_include_item {
local list="$1"
local item="$2"
if [[ $list =~ (^|[[:space:]])"$item"($|[[:space:]]) ]] ; then
# yes, list include item
result=0
else
result=1
fi
return $result
}
# arg 1 Build directory OPENAIR_DIR/build/?/build
# arg 2 Executable target name
# arg 3 Executable name (no path)
# arg 4 Verbose (1 or 0)
compilations() {
echo_info "Compilation log for $1 is here: $dlog/$2.txt"
cd $OPENAIRCN_DIR/$1/
{
make build
if grep -q "@@ Installing vpp @@" "/home/rohan/gitrepo/oai-cn5g-upf-vpp/build/log/vpp.txt" ; then
echo_success "##### VPP Compiled Successfully #####"
else
echo_error "##### VPP not compiled #####"
fi
}
}
################################
# set_openair_env
###############################
#-------------------------------------------------------------------------------
set_openair_env(){
fullpath=`readlink -f $BASH_SOURCE`
[ -f "/.$fullpath" ] || fullpath=`readlink -f $PWD/$fullpath`
openair_path=${fullpath%/build/*}
openair_path=${openair_path%/scripts/*}
openair_path=${openair_path%/docker*}
export OPENAIRCN_DIR=$openair_path
}
################################################################################
# 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
################################################################################
# file build_helper.upf
# brief
# author Rohan Kharade
#
#######################################
################################
# include helper functions
################################
SCRIPT=$(readlink -f ${BASH_SOURCE})
THIS_SCRIPT_PATH=`dirname $SCRIPT`
source $THIS_SCRIPT_PATH/build_helper
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
check_install_vpp_upf_deps() {
if [ $1 -gt 0 ]; then
OPTION="-y"
else
OPTION=""
fi
if [ $2 -eq 0 ]; then
debug=0
else
debug=1
fi
echo "Check supported distribution"
check_supported_distribution
[[ $? -ne 0 ]] && return $?
# prevent lock on /var/lib/dpkg/lock
if [[ $OS_DISTRO == "ubuntu" ]]; then
#$SUDO systemctl mask apt-daily.service
#$SUDO systemctl mask apt-daily.timer
#$SUDO systemctl mask apt-daily-upgrade.service
#$SUDO systemctl mask apt-daily-upgrade.timer
$SUDO sed -i 's/1/0/g' /etc/apt/apt.conf.d/10periodic
fi
# Compilers, generators, ...
if [[ $OS_DISTRO == "ubuntu" ]]; then
PACKAGE_LIST="\
libhyperscan-dev \
wget \
make \
build-essential \
sudo \
gdb \
git"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\ # To Do this section
libhyperscan-dev \
wget \
make \
build-essential \
sudo \
gdb \
git"
else
echo_fatal "$OS_DISTRO is not a supported distribution."
fi
echo "Install build tools"
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST
ret=$?;[[ $ret -ne 0 ]] && return $ret
check_install_vpp_upf_source_deps
return 0
}
#-------------------------------------------------------------------------------
check_install_vpp_upf_deps() {
echo_info "Cloning fdio VPP $OPENAIRCN_DIR/"
if [ -d "$OPENAIRCN_DIR/vpp" ]; then
echo_error "clone failed : - vpp source is already present at $OPENAIRCN_DIR/... use option -w to wipe out vpp source"
fi
install_dep
}
#-------------------------------------------------------------------------------
install_dep(){
GIT_URL=https://github.com/fdio/vpp.git
GIT_BRANCH=stable/2101
pushd $OPENAIRCN_DIR/
git clone -b $GIT_BRANCH $GIT_URL
# echo "APT::Get::Assume-Yes "true";" >> /etc/apt/apt.conf.d/90forceyes
# echo "APT::Get::force-yes "true";" >> /etc/apt/apt.conf.d/90forceyes
cd vpp && make install-ext-dep
return 0
}
remove_vpp_source(){
rm -rf $OPENAIRCN_DIR/vpp/
echo_fatal "Removed vpp source $OPENAIRCN_DIR/vpp"
}
#-------------------------------------------------------------------------------
add_Travelping_upf_plugin(){
GIT_URL=https://github.com/travelping/upg-vpp.git
GIT_BRANCH=master
echo_info "Cloning Travelping UPG plugin"
pushd $OPENAIRCN_DIR/
git clone -b $GIT_BRANCH $GIT_URL
mkdir -p -- $OPENAIRCN_DIR/vpp/patches
cp -rf $OPENAIRCN_DIR/upg-vpp/upf/ $OPENAIRCN_DIR/vpp/src/plugins/
cp -rf $OPENAIRCN_DIR/upg-vpp/vpp-patches/* $OPENAIRCN_DIR/vpp/patches
rm -rf $OPENAIRCN_DIR/upg-vpp
apply_patches
}
#-------------------------------------------------------------------------------
apply_patches(){
echo_info "Applying patches to VPP UPG"
cp -r $OPENAIRCN_DIR/scripts/patches/* $OPENAIRCN_DIR/vpp/patches
cd $OPENAIRCN_DIR/vpp/patches
find . -iname '*.patch' -execdir sh -c 'patch -p1 -N -d $OPENAIRCN_DIR/vpp/ < $0' {} \;
}
#-------------------------------------------------------------------------------
vpp_upf_init(){
echo_info "VPP UPG initializing"
cp $OPENAIRCN_DIR/scripts/upf_conf/* $OPENAIRCN_DIR/vpp
cp $OPENAIRCN_DIR/scripts/run.sh $OPENAIRCN_DIR/vpp
echo_info "Installing VPP"
sudo cp -rf $OPENAIRCN_DIR/vpp/build-root/install-vpp_debug-native/vpp/lib/ /usr/lib/x86_64-linux-gnu/vpp_plugins/
}
#!/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 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
################################################################################
# file build_vpp_upf
# brief
# author Rohan Kharade
# company Eurecom
# email: rohan.kaharde@openairinterface.org
#
set -o pipefail
INSTALL_DIR=/usr/local/bin
################################
# include helper functions
################################
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
source $THIS_SCRIPT_PATH/build_helper.upf
function help()
{
echo_error " "
echo_error "Usage: build_vpp_upf [OPTION]..."
echo_error "Build the VPP executable with Travelping upf plugin."
echo_error " "
echo_error "Options:"
echo_error "Mandatory arguments to long options are mandatory for short options too."
# echo_error " -b, --build-type Build type as defined in Makefile, allowed values are: Debug Release"
echo_error " -c, --clean Clean the build generated files: config, object, executable files (build from scratch)"
echo_error " -f, --force No interactive script for installation of software packages."
echo_error " -h, --help Print this help."
echo_error " -I, --install-deps Check installed software necessary to build and run VPP UPF (support $SUPPORTED_DISTRO)."
echo_error " -V, --verbose Build process verbose."
echo_error " -w, --wipe Wipe out vpp source directory."
echo_error " "
}
function main()
{
local -i clean=0
local -i force=0
local -i debug=0
local -i verbose=0
local -i wipe=0
local -i var_check_install_min_deps=0
local -i var_check_install_deps=0
local cmake_args=" "
export make_args=" "
until [ -z "$1" ]
do
case "$1" in
-a | --auto-test)
cmake_args="$cmake_args -DSGW_AUTOTEST=1"
shift;
;;
-b | --build-type)
list_include_item "Debug Release" $2
[[ $? -ne 0 ]] && echo_error "Build type $2 not recognized" && return $?
cmake_args="$cmake_args -DCMAKE_BUILD_TYPE=$2"
list_include_item "Debug" $2
[[ $? -ne 0 ]] && debug=1
shift 2;
;;
-c | --clean)
clean=1
echo "Clean the build generated files (build from scratch)"
shift;
;;
-f | --force)
force=1
echo "Force set (no interactive)"
shift;
;;
-h | --help)
help
shift;
return 0
;;
-I | --install-deps)
echo "Check installed software necessary to build and run VPP UPF (support $SUPPORTED_DISTRO):"
set_openair_env
var_check_install_deps=1
shift;
;;
-v | --verbose)
echo "Make build process verbose"
cmake_args="$cmake_args -DCMAKE_VERBOSE_MAKEFILE=ON"
make_args="VERBOSE=1 $make_args"
verbose=1
shift;
;;
-V | --Verbose)
echo "CMake build process verbose"
verbose=1
shift;
;;
-w | --wipe)
echo "Wipe out vpp source"
wipe=1
shift;
;;
*)
echo "Unknown option $1"
help
return 1
;;
esac
done
if [ ! -d /usr/local/etc/oai ]; then
$SUDO mkdir -m 777 -p /usr/local/etc/oai
fi
set_openair_env
local dlog=$OPENAIRCN_DIR/build/log
local dext=$OPENAIRCN_DIR/build/ext
mkdir -m 777 -p $dlog
mkdir -m 777 -p $dext
if [ $var_check_install_deps -gt 0 ];then
disable_ipv6
check_install_vpp_upf_deps $force $debug
if [[ $? -ne 0 ]]; then
echo_error "Error: VPP UPF deps installation failed"
return 1
else
echo_success "VPP UPF deps installation successful"
echo_warning "VPP UPF not compiled, to compile it, re-run ./build_vpp_upf without -I option"
return 0
fi
fi
cmake_args="$cmake_args -DBUILD_SHARED_LIBS=OFF"
##############################################################################
# Wipe
##############################################################################
cd $OPENAIRCN_DIR/
if [ $wipe -ne 0 ]; then
remove_vpp_source
fi
##############################################################################
# Clean
##############################################################################
cd $OPENAIRCN_DIR/
if [ $clean -ne 0 ]; then
if [[ $verbose -eq 1 ]]; then
echo_warning "Cleaning VPP_UPF: generated configuration files, obj files, executable"
fi
make wipe -C $OPENAIRCN_DIR/vpp 2>&1
fi
##############################################################################
# Compile VPP_UPF
##############################################################################
cd $OPENAIRCN_DIR/
if [ ! -d ./build ]; then
mkdir -m 777 -p -v build
fi
cd ./vpp
add_Travelping_upf_plugin
compilations vpp vpp $OPENAIRCN_DIR/vpp $verbose
vpp_upf_init
ret=$?;[[ $ret -ne 0 ]] && return $ret
return 0
}
main "$@"
#/*
# * 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 VPP-UPG service
# Valid for RHEL 8.2
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM registry.access.redhat.com/ubi7/ubi:latest AS vpp-upg-builder
ARG NEEDED_GIT_PROXY
COPY tmp/ca/redhat-uep.pem /etc/rhsm/ca
COPY tmp/entitlement/*.pem /etc/pki/entitlement
RUN rm -f /etc/rhsm-host && \
subscription-manager repos --enable rhel-server-rhscl-7-rpms && \
subscription-manager repos --enable rhel-7-server-optional-rpms && \
yum update -y && \
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm &&\
yum install -y \
python3 \
psmisc \
git \
make \
patch \
sudo \
wget && \
rm -rf /var/lib/apt/lists/*
# Some GIT configuration command quite useful
RUN /bin/bash -c "if [[ -v NEEDED_GIT_PROXY ]]; then git config --global http.proxy $NEEDED_GIT_PROXY; fi"
RUN git config --global https.postBuffer 123289600 && \
git config --global http.sslverify false
RUN wget http://repo.openfusion.net/centos7-x86_64/hyperscan-devel-5.3.0-1.of.el7.x86_64.rpm \
http://repo.openfusion.net/centos7-x86_64/hyperscan-5.3.0-1.of.el7.x86_64.rpm \
&& rpm -i *.rpm
WORKDIR /vpp-upf
COPY scripts/ /vpp-upf/scripts
# Applying vpp patches
RUN git clone -b stable/2101 https://github.com/fdio/vpp.git && \
git clone https://github.com/travelping/upg-vpp.git && \
# For the moment let us fix a given commit
cd upg-vpp && \
git checkout -f 4d32e1721c1e9a1bd7ea861658f502a64f9b4073 && \
cd .. && \
mv upg-vpp/upf/ vpp/src/plugins/ && \
mv upg-vpp/vpp-patches/* scripts/patches/ && \
mv upg-vpp/vpp.spec / && \
./scripts/apply_vpp_patches.sh
RUN make install-dep build-release -C vpp/
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM registry.access.redhat.com/ubi7/ubi:latest as oai-upf-vpp
# We install some debug tools for the moment in addition of mandatory libraries
RUN yum repolist --disablerepo=* && \
yum update -y && \
yum install -y \
net-tools \
iputils \
tshark \
iproute \
wget && \
wget http://repo.openfusion.net/centos7-x86_64/hyperscan-devel-5.3.0-1.of.el7.x86_64.rpm \
http://repo.openfusion.net/centos7-x86_64/hyperscan-5.3.0-1.of.el7.x86_64.rpm && \
rpm -i *.rpm && \
rm *.rpm && \
yum remove -y wget && \
rm -rf /var/lib/apt/lists/*
WORKDIR /openair-upf/bin
COPY --from=vpp-upg-builder /vpp-upf/scripts/entrypoint.sh .
COPY --from=vpp-upg-builder /vpp-upf/vpp/build-root/install-vpp-native/vpp/bin/vpp .
COPY --from=vpp-upg-builder /vpp-upf/vpp/build-root/install-vpp-native/vpp/bin/vppctl .
WORKDIR /openair-upf/etc
COPY --from=vpp-upg-builder /vpp-upf/scripts/upg_conf/init.conf .
COPY --from=vpp-upg-builder /vpp-upf/scripts/upg_conf/startup_debug.conf .
WORKDIR /usr/lib64
COPY --from=vpp-upg-builder /vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/ .
RUN ldconfig
RUN groupadd vpp
WORKDIR /openair-upf
COPY --from=vpp-upg-builder /vpp-upg/scripts/run.sh .
#expose
EXPOSE 8085/udp 2152/udp
ENTRYPOINT ["/openair-upg/bin/entrypoint.sh"]
CMD ["/openair-upf/run.sh"]
# * 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 VPP-UPF service
# Valid for Ubuntu-18.04 (bionic)
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM ubuntu:18.04 AS vpp-upf-builder
ARG NEEDED_GIT_PROXY
ENV DEBIAN_FRONTEND=noninteractive
# Installing hyperscan library for upf plugin
RUN apt update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \
git \
sudo \
wget \
make \
build-essential \
libhyperscan-dev \
&& rm -rf /var/lib/apt/lists/*
# Some GIT configuration commands quite useful
RUN /bin/bash -c "if [[ -v NEEDED_GIT_PROXY ]]; then git config --global http.proxy $NEEDED_GIT_PROXY; fi"
RUN git config --global https.postBuffer 123289600 && \
git config --global http.sslverify false
WORKDIR /vpp-upf
COPY scripts/ /vpp-upf/scripts
# Applying vpp patches
RUN git clone -b stable/2101 https://github.com/fdio/vpp.git && \
git clone https://github.com/travelping/upg-vpp.git && \
# For the moment let us fix a given commit
cd upg-vpp && \
git checkout -f 4d32e1721c1e9a1bd7ea861658f502a64f9b4073 && \
cd .. && \
mv upg-vpp/upf/ vpp/src/plugins/ && \
mv upg-vpp/vpp-patches/* scripts/patches/ && \
mv upg-vpp/vpp.spec / && \
./scripts/apply_vpp_patches.sh && \
touch /etc/apt/apt.conf.d/90forceyes && \
echo "APT::Get::Assume-Yes "true";" >> /etc/apt/apt.conf.d/90forceyes && \
echo "APT::Get::force-yes "true";" >> /etc/apt/apt.conf.d/90forceyes
# To Do - remove unnecessary pulgin build to optimise build time e.g. ipsec, dpdk etc.
# Build vpp with travelping upf plugin
RUN make install-dep build-release -C vpp
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as oai-upf-vpp
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Paris
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \
net-tools \
tshark \
tzdata\
openssl \
libhyperscan-dev \
iproute2 \
iputils-ping \
vim \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /openair-upf/bin/
COPY --from=vpp-upf-builder /vpp-upf/scripts/entrypoint.sh /openair-upf/bin/entrypoint.sh
COPY --from=vpp-upf-builder /vpp-upf/vpp/build-root/install-vpp-native/vpp/bin/vpp vpp
COPY --from=vpp-upf-builder /vpp-upf/vpp/build-root/install-vpp-native/vpp/bin/vppctl vppctl
WORKDIR /openair-upf/etc
COPY --from=vpp-upf-builder /vpp-upf/scripts/upf_conf/init.conf /openair-upf/etc/init.conf
COPY --from=vpp-upf-builder /vpp-upf/scripts/upf_conf/startup_debug.conf /openair-upf/etc/startup_debug.conf
WORKDIR /usr/lib/x86_64-linux-gnu/
COPY --from=vpp-upf-builder /vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/ .
RUN ldconfig
RUN groupadd vpp
WORKDIR /openair-upf/
COPY --from=vpp-upf-builder /vpp-upf/scripts/run.sh /openair-upf/run.sh
#expose
#EXPOSE 8085/udp 2152/udp
ENTRYPOINT ["/openair-upf/bin/entrypoint.sh"]
CMD ["/openair-upf/run.sh"]
# 1. Retrieve the proper code version #
```bash
$ git clone https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-upf-vpp.git
$ cd oai-cn5g-upf-vpp
$ git checkout develop
```
# 2. Generic Parameters #
Here in our network configuration, we need to pass the "GIT PROXY" configuration.
* If you do not need, remove the `--build-arg NEEDED_GIT_PROXY=".."` option.
* If you do need it, change with your proxy value.
# 3. Build vpp-upf image #
## 3.1 On a Ubuntu 18.04 Host ##
```bash
$ docker build --target vpp-upg --tag vpp-upg:develop \
--file docker/Dockerfile.upf-vpp.ubuntu18 \
--build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" .
```
## 3.2 On a RHEL 7 Host ##
```bash
$ docker build --target vpp-upg --tag vpp-upg:develop \
--file docker/Dockerfile.upf-vpp.rhel7 \
--build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" .
```
<table style="border-collapse: collapse; border: none;">
<tr style="border-collapse: collapse; border: none;">
<td style="border-collapse: collapse; border: none;">
<a href="http://www.openairinterface.org/">
<img src="./images/oai_final_logo.png" alt="" border=3 height=50 width=150>
</img>
</a>
</td>
<td style="border-collapse: collapse; border: none; vertical-align: center;">
<b><font size = "5">OpenAirInterface Core Network Docker Deployment Home Page</font></b>
</td>
</tr>
</table>
**Table of Contents**
1. [Pre-requisites](https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-fed/-/blob/master/docs/DEPLOY_PRE_REQUESITES.md)
2. [Installing VPP-UPF on host](./INSTALL_ON_HOST.md)
3. [Building the Docker Image](./BUILD_IMAGE.md)
4. [About network configuration](./VPP_NETWORKING.md)
5. [About VPP-UPF configuration](./VPP_UPF_CONFIG.md)
User Plane Gateway (UPG) based on VPP
=====================================
UPG implements a GTP-U user plane based on [3GPP TS 23.214][TS23214]
and [3GPP TS 29.244][TS29244] Release 15 & 16. It is implemented as an
out-of-tree plugin for [FD.io VPP][VPP].
UPG is project by Travelping GmbH and more official information please visit [UPG github page](https://github.com/travelping/upg-vpp)
* VPP_BRANCH = stable/2101
* VPP_RELEASE = v21.01
#### Supported Features
* PFCP protocol
* en/decoding of most IEs
* heartbeat
* node related messages
* session related messages
* Uplink and Downlink Packet Detection Rules (PDR) and
Forward Action Rules (FAR) -- (some parts)
* IPv4 -- inner and outer
* IPv6 -- inner and outer
* Usage Reporting Rules (URR)
* PFCP Session Reports
* Linked Usage Reports
* GTP Extension Header (partial)
No yet working
--------------
* Buffer Action Rules (BAR)
* QoS Enforcement Rule (QER)
Limitations
-----------
* FAR action with destination LI are not implemented
* Ethernet bearer support
# VPP-UPF Native Installation
Tested and validated on Ubuntu Bionic arch amd64.
## Download OAI UPF (VPP-UPF) source code
```bash
$ git clone https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-upf-vpp.git
$ cd oai-cn5g-upf-vpp
$ git checkout develop
```
## Install VPP-UPF
### Install VPP-UPF software dependencies
```bash
$ cd oai-cn5g-upf-vpp/
/oai-cn5g-upf-vpp$ cd ./build/scripts
/oai-cn5g-upf-vpp/build/scripts$ ./build_vpp_upf -I -f
```
### Build VPP-UPF
```bash
/oai-cn5g-upf-vpp/build/scripts$ ./build_vpp_upf -c -V
```
### Wipe VPP source
```bash
/oai-cn5g-upf-vpp/build/scripts$ ./build_vpp_upf -w
```
<br/>
<br/>
<br/>
UPF sould have at least three host or veth interfaces for viz. access, core and sgi (or N3, N4 and N6/N9 respectively).
Here we have three interfaces to docker container. We rename them just for sec of simplicity. There is
additional route added for UE traffic 10.10.10.0/24 network via sgi interface as gateway.<br/>
<br/>
Below is sample interfaces configuration for host machine/container -
<br/>
```bash
ip link set eth0 down
ip link set eth0 name access
ip link set access up
ip link set eth1 down
ip link set eth1 name core
ip link set core up
ip link set eth2 down
ip link set eth2 name sgi
ip link set sgi up
ip route add 10.10.10.0/24 via 192.168.63.198 dev sgi
ip route add 192.168.61.0/24 dev core
ip route add 192.168.62.0/24 dev access
ip route add 192.168.63.0/24 dev sgi
```
<br/>
<br/>
<br/>
We need create/use a host interface that will attach to a linux AF_PACKET interface, one side of a veth pair. The veth pair or host interaface must already exist. Once created, a new host interface will exist in VPP with the name &#39;<em>host-<ifname></em>&#39;, where &#39;<em><ifname></em>&#39; is the name of the specified veth pair. Use the &#39;<em>show interface</em>&#39; command to display host interface details. <br/>
<br/>
Below is sample vpp-upf configuration. We use at least three veth-pairs as UPF interfaces (e.g. N3, N4, N6/N9 etc). <br/>
<br/>
```bash
ip table add 1
ip table add 2
####### Create N4 interface
create host-interface name core
set interface ip table host-core 0
set interface ip address host-core 192.168.61.201/24
set interface state host-core up
####### Create N3 interface
create host-interface name access
set interface ip table host-access 1
set interface ip address host-access 192.168.62.201/24
set interface state host-access up
####### Create N6 interface
create host-interface name sgi
set interface ip table host-sgi 2
set interface ip address host-sgi 192.168.63.201/24
set interface state host-sgi up
####### Add ip routes
ip route add 0.0.0.0/0 table 0 via 192.168.61.196 host-core
ip route add 0.0.0.0/0 table 1 via 192.168.62.210 host-access
ip route add 0.0.0.0/0 table 2 via 192.168.63.194 host-sgi
####### Configure PFCP enpoint
upf pfcp endpoint ip 192.168.61.201 vrf 0
####### Add network instance
upf nwi name core vrf 0
upf nwi name access vrf 1
upf nwi name sgi vrf 2
####### Add fqdn
upf node-id fqdn gwu1.vpp.upg.node.epc.mnc095.mcc208.3gppnetwork.org
####### Specify release for TS 3GPP 29.244 (15 or 16)
upf specification release 16
trace add af-packet-input 100
upf gtpu endpoint ip 192.168.62.201 nwi access teid 0x000004d2/2
```
#!/usr/bin/env bash
cd scripts/patches/
find . -iname '*.patch' -execdir sh -c 'patch -p1 -N -d ../../vpp < $0' {} \;
#!/usr/bin/env bash
# files are common to docker and native installation
#____________
# init.conf => upf config
# startup_debug.conf => vpp config (To Do -> sed location of init.conf file)
# run_sh => run vpp
#____________
set -euo pipefail
CONFIG_DIR="/openair-upf/etc"
###############################
# UPF Config
###############################
for c in ${CONFIG_DIR}/*.conf; do
# grep variable names (format: ${VAR}) from template to be rendered
VARS=$(grep -oP '@[a-zA-Z0-9_]+@' ${c} | sort | uniq | xargs)
# create sed expressions for substituting each occurrence of ${VAR}
# with the value of the environment variable "VAR"
EXPRESSIONS=""
for v in ${VARS}; do
NEW_VAR=`echo $v | sed -e "s#@##g"`
if [[ "${!NEW_VAR}x" == "x" ]]; then
echo "Error: Environment variable '${NEW_VAR}' is not set." \
"Config file '$(basename $c)' requires all of $VARS."
exit 1
fi
EXPRESSIONS="${EXPRESSIONS};s|${v}|${!NEW_VAR}|g"
done
EXPRESSIONS="${EXPRESSIONS#';'}"
# render template and inline replace config file
sed -i "${EXPRESSIONS}" ${c}
done
###############################
# VPP Routes
###############################
# Assumption ->
# UPF has only three interfaces viz. n3 (access) eth0, n4 (core) eth1, n6 (sgi) eth2
# Near future we will have multiple interfaces (e.g. two n6 interface for edge computing case)
# We define in this order in docker-compose -> it is alphabetical order
#
SGI_IPV4=$(ifconfig $INTERFACE_SGI | grep "inet " | awk '{print $2}')
ip link set $INTERFACE_ACCESS down
ip link set $INTERFACE_ACCESS name access
ip link set access up
ip link set $INTERFACE_CORE down
ip link set $INTERFACE_CORE name core
ip link set core up
ip link set $INTERFACE_SGI down
ip link set $INTERFACE_SGI name sgi
ip link set sgi up
ip route add $NETWORK_UE_IP via $SGI_IPV4 dev sgi
echo "Done setting the configuration"
exec "$@"
--- a/src/plugins/upf/upf_gtpu_encap.c 2021-03-07 13:19:40.937167871 +0000
+++ b/src/plugins/upf/upf_gtpu_encap.c 2021-03-07 15:27:03.082328061 +0000
@@ -604,6 +604,7 @@
ip6_header_t *ip6_0;
udp_header_t *udp0;
gtpu_header_t *gtpu0;
+ gtpu_ext_header_t *gtpu0_ext;
u64 *copy_src0, *copy_dst0;
u32 *copy_src_last0, *copy_dst_last0;
u16 new_l0;
@@ -636,6 +637,9 @@
next0 = peer0->next_dpo.dpoi_next_node;
vnet_buffer (b0)->ip.adj_index[VLIB_TX] =
peer0->next_dpo.dpoi_index;
+
+ upf_buffer_opaque (b0)->gtpu.ext_hdr_len = 0x08;
+ vlib_buffer_advance (b0, -upf_buffer_opaque (b0)->gtpu.ext_hdr_len);
if (PREDICT_FALSE ((upf_buffer_opaque (b0)->gtpu.hdr_flags & GTPU_E_S_PN_BIT) != 0))
vlib_buffer_advance (b0, -upf_buffer_opaque (b0)->gtpu.ext_hdr_len);
@@ -681,9 +685,19 @@
new_l0 =
clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b0) -
sizeof (*ip4_0) - sizeof (*udp0) -
- GTPU_V1_HDR_LEN);
+// GTPU_V1_HDR_LEN);
+ GTPU_V1_HDR_LEN + GTPU_V1_EXT_HDR_LEN);
gtpu0->length = new_l0;
- gtpu0->ver_flags |= (upf_buffer_opaque (b0)->gtpu.hdr_flags & GTPU_E_S_PN_BIT);
+// gtpu0->ver_flags |= (upf_buffer_opaque (b0)->gtpu.hdr_flags & GTPU_E_S_PN_BIT);
+ gtpu0->ver_flags = GTPU_EXT_HDR_PRESENT;
+ gtpu0->pdu_number = 0x00;
+ gtpu0->sequence = 0x00;
+ gtpu0->next_ext_type = GTPU_EXT_HDR_PDU_SESSION_CONTAINER;
+
+ gtpu0_ext = (gtpu_ext_header_t *) (gtpu0 + 1);
+ gtpu0_ext->type = 0x01;
+ gtpu0_ext->len = 0x00;
+ gtpu0_ext->pad = GTPU_QFI;
}
else /* ip6 path */
--- a/src/plugins/upf/upf.h 2021-03-07 13:19:40.937167871 +0000
+++ b/src/plugins/upf/upf.h 2021-03-07 12:51:36.726939875 +0000
@@ -167,7 +167,8 @@
}) gtpu_ie_recovery_t;
/* *INDENT-ON* */
-#define GTPU_V1_HDR_LEN 8
+#define GTPU_V1_HDR_LEN 8
+#define GTPU_V1_EXT_HDR_LEN 8
#define GTPU_VER_MASK (7<<5)
#define GTPU_PT_BIT (1<<4)
@@ -187,6 +188,11 @@
#define GTPU_IE_RECOVERY 14
+#define GTPU_EXT_HDR_PRESENT 52
+#define GTPU_EXT_HDR_PDU_SESSION_CONTAINER 133
+#define GTPU_NO_MORE_EXT_HDR 0
+#define GTPU_QFI 6
+
/* *INDENT-OFF* */
typedef CLIB_PACKED(struct
{
--- a/Makefile 2021-06-03 13:13:38.123080239 +0200
+++ b/Makefile 2021-06-03 13:15:58.138016487 +0200
@@ -279,9 +279,9 @@
else ifneq ("$(wildcard /etc/redhat-release)","")
ifeq ($(OS_ID),rhel)
@sudo -E yum-config-manager --enable rhel-server-rhscl-7-rpms
- @sudo -E yum groupinstall $(CONFIRM) $(RPM_DEPENDS_GROUPS)
- @sudo -E yum install $(CONFIRM) $(RPM_DEPENDS)
- @sudo -E debuginfo-install $(CONFIRM) glibc openssl-libs mbedtls-devel zlib
+ @sudo -E yum groupinstall -y $(RPM_DEPENDS_GROUPS)
+ @sudo -E yum install -y $(RPM_DEPENDS)
+ @sudo -E debuginfo-install -y glibc openssl-libs mbedtls-devel zlib
else ifeq ($(OS_ID)-$(OS_VERSION_ID),centos-8)
@sudo -E dnf install $(CONFIRM) dnf-plugins-core epel-release
@sudo -E dnf config-manager --set-enabled \
--- a/src/CMakeLists.txt 2020-04-12 19:33:54.160008000 +0000
+++ b/src/CMakeLists.txt 2020-04-12 19:35:51.608027000 +0000
@@ -53,7 +53,7 @@
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
if (CMAKE_BUILD_TYPE)
- set(CMAKE_C_FLAGS "-g -fPIC -Werror -Wall ${CMAKE_C_FLAGS}")
+ set(CMAKE_C_FLAGS "-g -fPIC -Wall ${CMAKE_C_FLAGS}")
endif()
if (compiler_flag_no_address_of_packed_member)
#!/bin/sh -x
if [ $(id -u) -ne 0 ]; then
exec sudo -E "$0" "$@"
fi
base=$(dirname $0)
APP="$base/bin/vpp"
ARGS="-c $base/etc/startup_debug.conf"
USAGE="Usage: run.sh [-r] [ debug ]
debug: executes vpp under gdb"
while getopts ":r" opt; do
case $opt in
r)
APP="$base/bin/vpp"
ARGS="-c $base/etc/startup.conf"
;;
\?)
echo "Invalid option: -$OPTARG\n" >&2
echo "$USAGE" >&2
exit 1
;;
esac
done
shift $((OPTIND-1))
if test -z "$1"; then
$APP $ARGS
elif test "$1" = "debug"; then
shift
gdb -ex 'set print pretty on' -ex 'run' --args $APP $ARGS $@
else
echo "$USAGE" >&2
exit 1
fi
version: '3.8'
services:
mysql:
container_name: mysql
image: mysql:5.7
volumes:
- ./oai_db.sql:/docker-entrypoint-initdb.d/oai_db.sql
- ./mysql-healthcheck.sh:/tmp/mysql-healthcheck.sh
environment:
- TZ=Europe/Paris
- MYSQL_DATABASE=oai_db
- MYSQL_USER=test
- MYSQL_PASSWORD=test
- MYSQL_ROOT_PASSWORD=linux
healthcheck:
test: /bin/bash -c "/tmp/mysql-healthcheck.sh"
interval: 10s
timeout: 5s
retries: 5
networks:
public_net:
ipv4_address: 192.168.74.200
oai-smf:
image: oai-smf:vpp-upf
depends_on: [oai-vpp]
container_name: oai-smf
privileged: true
networks:
public_net:
ipv4_address: 192.168.74.196
environment:
INSTANCE: 1
PID_DIRECTORY: /var/run
SMF_INTERFACE_NAME_FOR_N4: eth0
SMF_INTERFACE_NAME_FOR_SBI: eth0
SMF_INTERFACE_PORT_FOR_SBI: 80
SMF_INTERFACE_HTTP2_PORT_FOR_SBI: 8080
SMF_API_VERSION: v1
DEFAULT_DNS_IPV4_ADDRESS: 8.8.8.8
DEFAULT_DNS_SEC_IPV4_ADDRESS: 8.8.4.4
UE_IP_ADDRESS_POOL: '10.1.1.2 - 10.1.1.200'
AMF_IPV4_ADDRESS: 192.168.74.195
AMF_PORT: 80
AMF_API_VERSION: v1
UDM_IPV4_ADDRESS: 192.168.74.194
UDM_PORT: 80
UDM_API_VERSION: v1
UPF_IPV4_ADDRESS: 192.168.74.202
USE_NETWORK_INSTANCE: 'yes'
DISCOVER_UPF: 'no'
NRF_API_VERSION: 'v1'
NRF_IPV4_ADDRESS: '127.0.0.1'
NRF_PORT: '8080'
REGISTER_NRF: 'no'
healthcheck:
test: /bin/bash -c "pgrep oai_smf"
interval: 10s
timeout: 5s
retries: 5
extra_hosts:
- "gw1.vppupf.node.5gcn.mnc95.mcc208.3gppnetwork.org:192.168.74.202"
oai-amf:
image: oai-amf:develop
depends_on: [oai-smf, mysql]
container_name: oai-amf
privileged: true
networks:
public_net:
ipv4_address: 192.168.74.195
environment:
INSTANCE: 1
PID_DIRECTORY: /var/run
MCC: '208'
MNC: '95'
REGION_ID: '128'
AMF_SET_ID: 1
SERVED_GUAMI_MCC_0: '208'
SERVED_GUAMI_MCC_1: '460'
SERVED_GUAMI_MNC_0: '95'
SERVED_GUAMI_MNC_1: '11'
SERVED_GUAMI_REGION_ID_0: '95'
SERVED_GUAMI_REGION_ID_1: '11'
SERVED_GUAMI_AMF_SET_ID_0: '1'
SERVED_GUAMI_AMF_SET_ID_1: '1'
PLMN_SUPPORT_MCC: '208'
PLMN_SUPPORT_MNC: '95'
PLMN_SUPPORT_TAC: '0xa000'
SST_0: '222'
SST_1: '1'
SD_0: '123'
SD_1: '12'
SMF_SELECTION: 'no'
SMF_INSTANCE_ID_0: 1
SMF_INSTANCE_ID_1: 2
SMF_IPV4_ADDR_0: 192.168.74.196
SMF_IPV4_ADDR_1: 127.0.0.1
SMF_HTTP_VERSION_0: v1
SMF_HTTP_VERSION_1: v1
AMF_INTERFACE_NAME_FOR_NGAP: eth0
AMF_INTERFACE_NAME_FOR_N11: eth0
AUSF_IPV4_ADDRESS: 192.168.74.205
AUSF_API_VERSION: 'v1'
AUSF_PORT: 80
NRF_IPV4_ADDRESS: 192.168.74.206
NRF_API_VERSION: 'v1'
NRF_PORT: 80
MYSQL_SERVER: 192.168.74.200
MYSQL_USER: 'root'
MYSQL_PASS: 'linux'
MYSQL_DB: 'oai_db'
OPERATOR_KEY: '63bfa50ee6523365ff14c1f45f88737d'
NF_REGISTRATION: 'no'
healthcheck:
test: /bin/bash -c "pgrep oai_amf"
interval: 10s
timeout: 5s
retries: 5
oai-vpp:
image: vpp-upg:develop
privileged: true
container_name: vpp-upf
networks:
public_net_access:
ipv4_address: 192.168.75.197
public_net:
ipv4_address: 192.168.74.197
public_net_sgi_lan:
ipv4_address: 192.168.76.197
environment:
NWI_CORE : "core.oai"
NWI_ACCESS : "access.oai"
NWI_SGI : "sgi.oai"
GW_ID: "1"
MNC03: "95"
MCC : "208"
REALM: "3gppnetwork.org"
NETWORK_UE_IP: "12.1.1.0/24"
N3_IPV4_ADDRESS_REMOTE: "192.168.75.198"
N3_IPV4_ADDRESS_LOCAL : "192.168.75.202"
N4_IPV4_ADDRESS_REMOTE: "192.168.74.196"
N4_IPV4_ADDRESS_LOCAL : "192.168.74.202"
N6_IPV4_ADDRESS_REMOTE: "192.168.76.205"
N6_IPV4_ADDRESS_LOCAL : "192.168.76.202"
VPP_MAIN_CORE : 0
VPP_CORE_WORKER: 1
# VPP_PLUGIN_PATH: "/usr/lib64/vpp_plugins/" # RHEL7
VPP_PLUGIN_PATH: "/usr/lib/x86_64-linux-gnu/vpp_plugins/" # Ubntu18.04
INTERFACE_ACCESS: "eth0"
INTERFACE_CORE: "eth1"
INTERFACE_SGI: "eth2"
healthcheck:
test: /bin/bash -c "pgrep vpp"
interval: 10s
timeout: 5s
retries: 5
oai-nat:
image: ubuntu:bionic
privileged: true
container_name: oai-nat
networks:
public_net:
ipv4_address: 192.168.74.205
public_net_sgi_lan:
ipv4_address: 192.168.76.205
entrypoint: /bin/bash -c \
"apt update; apt install -y iptables iproute2 iputils-ping net-tools python iperf3;"\
"iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;"\
"ip route add 12.1.1.0/24 via 192.168.76.202 dev eth1; sleep infinity"
gnbsim:
image: gnbsim:latest
depends_on: [oai-amf]
privileged: true
container_name: gnbsim
environment:
MCC: 208
MNC: 95
GNBID: 1
TAC: '0x00a000'
SST: '222'
SD: '00007b'
PagingDRX: 'v32'
RANUENGAPID: 0
IMEISV: '35609204079514'
MSIN: '0000000031'
RoutingIndicator: 1234
ProtectionScheme: 'null'
KEY: '0C0A34601D4F07677303652C0462535B'
OPc: '63bfa50ee6523365ff14c1f45f88737d'
DNN: 'default'
URL: 'http://192.168.76.205:8000'
NRCellID: 1
NGAPPeerAddr: '192.168.74.195'
GTPuLocalAddr: '192.168.75.198'
GTPuIFname: 'eth0'
networks:
public_net:
ipv4_address: 192.168.74.198
public_net_access:
ipv4_address: 192.168.75.198
healthcheck:
test: /bin/bash -c "ifconfig gtp-gnb"
interval: 10s
timeout: 5s
retries: 5
networks:
public_net:
name: oai-public-net
ipam:
config:
- subnet: 192.168.74.0/24
public_net_access:
name: oai-public-access
ipam:
config:
- subnet: 192.168.75.0/24
public_net_sgi_lan:
name: oai-public-sgi-lan
ipam:
config:
- subnet: 192.168.76.0/24
#!/bin/bash
set -eo pipefail
if [ "$MYSQL_ROOT_PASSWORD" ] && [ -z "$MYSQL_USER" ] && [ -z "$MYSQL_PASSWORD" ]; then
echo >&2 'Healthcheck error: cannot determine root password (and MYSQL_USER and MYSQL_PASSWORD were not set)'
exit 0
fi
host="$(hostname --ip-address || echo '127.0.0.1')"
user="${MYSQL_USER:-root}"
export MYSQL_PWD="${MYSQL_PASSWORD:-$MYSQL_ROOT_PASSWORD}"
args=(
# force mysql to not use the local "mysqld.sock" (test "external" connectivity)
-h"$host"
-u"$user"
--silent
)
STATUS=0
if command -v mysqladmin &> /dev/null; then
if mysqladmin "${args[@]}" ping > /dev/null; then
database_check=$(mysql -u$user -D oai_db --silent -e "SELECT * FROM users;")
if [[ -z $database_check ]]; then
echo "Healthcheck error: oai_db not populated"
STATUS=1
fi
STATUS=0
else
echo "Healthcheck error: Mysql port inactive"
STATUS=1
fi
else
if select="$(echo 'SELECT 1' | mysql "${args[@]}")" && [ "$select" = '1' ]; then
database_check=$(mysql -u$user -D oai_db --silent -e "SELECT * FROM users;")
if [[ -z $database_check ]]; then
echo "Healthcheck error: oai_db not populated"
STATUS=1
fi
STATUS=0
else
echo "Healthcheck error: Mysql port inactive"
STATUS=1
fi
fi
exit $STATUS
This diff is collapsed.
NWI_CORE=core.oai.org
NWI_ACCESS=access.oai.org
NWI_SGI=sgi.oai.org
GW_ID=1
MNC03=95
MCC=208
REALM=3gppnetwork.org
NETWORK_UE_IP=12.1.1.0/24
N3_IPV4_ADDRESS_REMOTE=192.168.75.198
N3_IPV4_ADDRESS_LOCAL=192.168.75.202
N4_IPV4_ADDRESS_REMOTE=192.168.74.196
N4_IPV4_ADDRESS_LOCAL=192.168.74.202
N6_IPV4_ADDRESS_REMOTE=192.168.76.205
N6_IPV4_ADDRESS_LOCAL=192.168.76.202
VPP_MAIN_CORE=0
VPP_CORE_WORKER=1
INTERFACE_CORE=eth1
INTERFACE_ACCESS=eth0
INTERFACE_SGI=eth2
ip table add 1
ip table add 2
create host-interface name sgi
set interface mtu 1500 host-sgi
set interface ip table host-sgi 1
set interface ip address host-sgi @N6_IPV4_ADDRESS_LOCAL@/24
set interface state host-sgi up
create host-interface name core
set interface mtu 1500 host-core
set interface ip table host-core 0
set interface ip address host-core @N4_IPV4_ADDRESS_LOCAL@/24
set interface state host-core up
create host-interface name access
set interface mtu 1500 host-access
set interface ip table host-access 2
set interface ip address host-access @N3_IPV4_ADDRESS_LOCAL@/24
set interface state host-access up
ip route add 0.0.0.0/0 table 2 via @N3_IPV4_ADDRESS_REMOTE@ host-access
ip route add 0.0.0.0/0 table 0 via @N4_IPV4_ADDRESS_REMOTE@ host-core
ip route add 0.0.0.0/0 table 1 via @N6_IPV4_ADDRESS_REMOTE@ host-sgi
upf pfcp endpoint ip @N4_IPV4_ADDRESS_LOCAL@ vrf 0
upf node-id fqdn gw@GW_ID@.vppupf.node.5gcn.mnc@MNC03@.mcc@MCC@.@REALM@
upf nwi name @NWI_CORE@ vrf 0
upf nwi name @NWI_ACCESS@ vrf 2
upf nwi name @NWI_SGI@ vrf 1
upf specification release 16
upf gtpu endpoint ip @N3_IPV4_ADDRESS_LOCAL@ nwi @NWI_ACCESS@ teid 0x000004d2/2
unix {
nodaemon
log /tmp/vpp.log
full-coredump
gid vpp
interactive
cli-listen /run/vpp/cli.sock
exec /openair-upf/etc/init.conf
}
api-trace {
on
}
cpu {
main-core @VPP_MAIN_CORE@
corelist-workers @VPP_CORE_WORKER@
}
api-segment {
gid vpp
}
plugins {
path @VPP_PLUGIN_PATH@
plugin dpdk_plugin.so { disable }
plugin gtpu_plugin.so { disable }
plugin upf_plugin.so { enable }
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment