Commit 76a0124b authored by Raphael Defosseux's avatar Raphael Defosseux

Merge remote-tracking branch 'origin/develop'

parents b83ff606 f7f6cfa3
# RELEASE NOTES: # # RELEASE NOTES: #
## v1.5.0 -- January 2023 ##
* Feature improvements:
* PDU SESS EST + Qos Monitoring events exposure
* Giving some time for FQDN resolution
* PFCP: removing dependency to folly
* Add IEs to support UE Rel 16
* Added and integrated UPF graph instead of PFCP associations list
* Supported scenarios:
- I-UPF / A-UPF N9
- UL CL
* Implement Npcf_SMPolicyControl API client
* Changing the configuration file to jinja2-based approach
* At least one slice (slice #0) shall be completely defined
* Ubuntu22 and cgroup2 support
* Fixes:
* Fix openapi cause
* Fix small issue for Mime parser for normal message
* Fix Volume Threshold IE to PFCP Create URR IE
* Fix mcc mnc 00 udr
* Fix issues to work with Release-16 COTS UE
* Fix issue when there's no valid reply from UPF for PDU session release
* Fix Protocol identifier Selected Bearer Control Mode
* Fix issue for Static UE IP Addr
* Fix URR ID in IE Create URR (post UPF graph implementation)
* Fix issue for Full DNN (APN Operator Identifier)
* Docker image improvements
* Fixed docker exit by catching SIGTERM
* release mode does not use libasan anymore --> allocation of 20T virtual memory is no longer done
## v1.4.0 -- July 2022 ## ## v1.4.0 -- July 2022 ##
* Fix for handling S-NSSAI * Fix for handling S-NSSAI
* Add support for IMS * Add support for IMS
* HTTP/2 support for SBI interface * HTTP/2 support for SBI interface
* Add usage report feature * Add usage reporting feature
* Flexiable MTU * Flexible MTU
* Support for Ubuntu 20.04 bare-metal installation * Support for Ubuntu 20.04 bare-metal installation
* Official images produced by CI are pushed to `oaisoftwarealliance` Docker-Hub Team account * Official images produced by CI are pushed to `oaisoftwarealliance` Docker-Hub Team account
* Reduce image size * Reduce image size
......
...@@ -25,27 +25,29 @@ ...@@ -25,27 +25,29 @@
# #
####################################### #######################################
#SUPPORTED_DISTRO="Ubuntu 18.04, CentOS 7, RHEL 7" #SUPPORTED_DISTRO="Ubuntu 18.04, CentOS 7, RHEL 7"
SUPPORTED_DISTRO="Ubuntu 18.04, RHEL8" SUPPORTED_DISTRO="Ubuntu 18.04,20.04,22.04, RHEL8"
if [ ! -f /etc/os-release ]; then if [ ! -f /etc/os-release ]; then
echo_fatal "No /etc/os-release file found. You're likely on an unsupported distro." echo_fatal "No /etc/os-release file found. You're likely on an unsupported distro."
fi fi
OS_DISTRO=$(grep "^ID=" /etc/os-release | sed "s/ID=//" | sed "s/\"//g") 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") OS_RELEASE=$(grep "^VERSION_ID=" /etc/os-release | sed "s/VERSION_ID=//" | sed "s/\"//g")
case "$OS_DISTRO" in case "$OS_DISTRO" in
fedora) OS_BASEDISTRO="fedora"; INSTALLER="dnf"; CMAKE="cmake3" ;; fedora) OS_BASEDISTRO="fedora"; INSTALLER="dnf"; CMAKE="cmake" ;;
rhel) OS_BASEDISTRO="fedora"; INSTALLER="yum"; CMAKE="cmake3" ;; rhel) OS_BASEDISTRO="fedora"; INSTALLER="yum"; CMAKE="cmake" ;;
centos) OS_BASEDISTRO="fedora"; INSTALLER="yum"; CMAKE="cmake3" ;; centos) OS_BASEDISTRO="fedora"; INSTALLER="yum"; CMAKE="cmake3" ;;
debian) OS_BASEDISTRO="debian"; INSTALLER="apt-get"; CMAKE="cmake" ;; debian) OS_BASEDISTRO="debian"; INSTALLER="apt-get"; CMAKE="cmake" ;;
ubuntu) OS_BASEDISTRO="debian"; INSTALLER="apt-get"; CMAKE="cmake" ;; ubuntu) OS_BASEDISTRO="debian"; INSTALLER="apt-get"; CMAKE="cmake" ;;
esac esac
IS_CONTAINER=`egrep -c "docker|kubepods|podman|buildah|libpod" /proc/self/cgroup || true` IS_CONTAINER=`egrep -c "docker|kubepods|podman|buildah|libpod" /proc/self/cgroup || true`
IS_DOCKERBUILD=${IS_DOCKERFILE:-0}
if [ $IS_CONTAINER -eq 0 ] if [ $IS_CONTAINER -eq 0 ] && [ $IS_DOCKERBUILD -eq 0 ]
then then
SUDO='sudo -S -E' SUDO='sudo -S -E'
else else
SUDO='' SUDO=''
IS_CONTAINER=1
fi fi
############################### ###############################
...@@ -83,7 +85,7 @@ echo_info() { cecho "$*" $blue ;} ...@@ -83,7 +85,7 @@ echo_info() { cecho "$*" $blue ;}
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# From https://stackoverflow.com/questions/4023830/how-to-compare-two-strings-in-dot-separated-version-format-in-bash # 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) # 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) # arg2 is a dotted (or not) version number (ex 4.10.6.56-ubunutu)
# return 0 if $1 lower or equal $2, else 1 # return 0 if $1 lower or equal $2, else 1
version_le() { version_le() {
...@@ -129,6 +131,7 @@ check_supported_distribution() { ...@@ -129,6 +131,7 @@ check_supported_distribution() {
case "$distribution" in case "$distribution" in
"ubuntu18.04") return 0 ;; "ubuntu18.04") return 0 ;;
"ubuntu20.04") return 0 ;; "ubuntu20.04") return 0 ;;
"ubuntu22.04") return 0 ;;
"rhel8") return 0 ;; "rhel8") return 0 ;;
"rhel8.2") return 0 ;; "rhel8.2") return 0 ;;
"rhel8.3") return 0 ;; "rhel8.3") return 0 ;;
...@@ -164,7 +167,10 @@ clean_kernel() { ...@@ -164,7 +167,10 @@ clean_kernel() {
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
disable_ipv6() { disable_ipv6() {
$SUDO sysctl -w net.ipv6.conf.all.disable_ipv6=1 if [ $IS_CONTAINER -eq 0 ]
then
$SUDO sysctl -w net.ipv6.conf.all.disable_ipv6=1
fi
} }
...@@ -173,8 +179,8 @@ disable_ipv6() { ...@@ -173,8 +179,8 @@ disable_ipv6() {
# arg1 = version # arg1 = version
# arg2 = req_version # arg2 = req_version
# #
function version_gt() { function version_gt() {
test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1";
} }
...@@ -292,7 +298,10 @@ check_enable_epel_repos() { ...@@ -292,7 +298,10 @@ check_enable_epel_repos() {
echo "EPEL repos already present. Good." echo "EPEL repos already present. Good."
else else
echo "EPEL repos not present. Installing them." echo "EPEL repos not present. Installing them."
$SUDO $INSTALLER install $OPTION https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm wget --tries=4 --retry-connrefused --wait=8 \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
$SUDO $INSTALLER install $OPTION epel-release-latest-7.noarch.rpm
rm -f epel-release-latest-7.noarch.rpm
fi fi
fi fi
} }
...@@ -311,5 +320,3 @@ set_openair_env(){ ...@@ -311,5 +320,3 @@ set_openair_env(){
openair_path=${openair_path%/src/s6a/*} openair_path=${openair_path%/src/s6a/*}
export OPENAIRCN_DIR=$openair_path 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.fb_folly
# brief
# author Lionel GAUTHIER
#
#######################################
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)
install_fb_folly_from_source(){
echo "Starting to install folly"
if [ $1 -eq 0 ]; then
OPTION=""
read -p "Do you want to install FaceBook folly (github)? <y/N> " prompt
else
prompt='y'
OPTION="-y"
fi
if [ $2 -eq 0 ]; then
debug=0
else
debug=1
fi
if [[ $prompt =~ [yY](es)* ]]
then
if [[ "$OS_BASEDISTRO" == "fedora" ]]; then
$SUDO $INSTALLER install $OPTION \
gcc-c++ \
$CMAKE \
make \
boost-devel \
libevent-devel \
double-conversion-devel \
glog-devel \
gflags-devel \
snappy-devel \
lz4-devel \
zlib-devel \
binutils-devel \
jemalloc-devel \
openssl-devel
ret=$?;[[ $ret -ne 0 ]] && return $ret
elif [[ $OS_DISTRO == "ubuntu" ]]; then
$SUDO $INSTALLER install $OPTION \
$CMAKE \
g++ \
libevent-dev \
libdouble-conversion-dev \
libgoogle-glog-dev \
libgflags-dev \
libiberty-dev \
liblz4-dev \
liblzma-dev \
libsnappy-dev \
wget \
zlib1g-dev \
binutils-dev \
libjemalloc-dev
ret=$?;[[ $ret -ne 0 ]] && return $ret
fi
pushd /tmp
if [ $debug -eq 1 ]; then
# For advanced debugging options
$SUDO $INSTALLER install $OPTION \
libunwind8-dev \
libelf-dev \
libdwarf-dev
ret=$?;[[ $ret -ne 0 ]] && return $ret
wget 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 . -DBUILD_GMOCK=OFF && \
make && \
$SUDO make install
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
cd ..
fi
$SUDO rm -rf /tmp/folly
git clone https://github.com/facebook/folly.git
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
cd folly
if [[ "$OS_BASEDISTRO" == "fedora" ]]; then
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
else
git checkout -f v2019.11.11.00
fi
mkdir _build && cd _build
if [[ "$OS_BASEDISTRO" == "fedora" ]]; then
cmake3 ..
else
cmake ..
fi
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
make -j $(nproc)
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
$SUDO make install
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd
fi
echo_success "folly installation complete"
return 0
}
...@@ -30,45 +30,6 @@ ...@@ -30,45 +30,6 @@
SCRIPT=$(readlink -f ${BASH_SOURCE}) SCRIPT=$(readlink -f ${BASH_SOURCE})
THIS_SCRIPT_PATH=`dirname $SCRIPT` THIS_SCRIPT_PATH=`dirname $SCRIPT`
source $THIS_SCRIPT_PATH/build_helper source $THIS_SCRIPT_PATH/build_helper
source $THIS_SCRIPT_PATH/build_helper.libconfig
source $THIS_SCRIPT_PATH/build_helper.fb_folly
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
install_fmt() {
echo "Starting to install fmt"
if [ $1 -eq 0 ]; then
read -p "Do you want to install open-source formatting library for C++ ? <y/N> " prompt
OPTION=""
else
prompt='y'
OPTION="-y"
fi
echo "Install fmt from source"
if [[ $prompt =~ [yY](es)* ]]
then
cd /tmp
echo "Downloading fmt"
$SUDO rm -rf /tmp/fmt*
git clone https://github.com/fmtlib/fmt.git
ret=$?;[[ $ret -ne 0 ]] && return $ret
cd fmt
# Looks like since Nov 11 commits, we cannot build
git checkout -f 1936dddc3c53c1c0db55a665cf419dc7a257ba62
$CMAKE -DFMT_TEST=FALSE .
ret=$?;[[ $ret -ne 0 ]] && return $ret
make -j `nproc`
ret=$?;[[ $ret -ne 0 ]] && return $ret
$SUDO make install
cd /tmp
rm -rf /tmp/fmt*
fi
echo "fmt installation complete"
return 0
}
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script) #arg1 is force (0 or 1) (no interactive script)
...@@ -149,13 +110,14 @@ install_pistache_from_git() { ...@@ -149,13 +110,14 @@ install_pistache_from_git() {
-DPISTACHE_BUILD_EXAMPLES=false \ -DPISTACHE_BUILD_EXAMPLES=false \
-DPISTACHE_BUILD_TESTS=false \ -DPISTACHE_BUILD_TESTS=false \
-DPISTACHE_BUILD_DOCS=false \ -DPISTACHE_BUILD_DOCS=false \
.. ..
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
make make -j $(nproc)
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
$SUDO make install $SUDO make install
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd popd
rm -Rf $OPENAIRCN_DIR/build/ext/pistache/_build
fi fi
echo "pistache installation complete" echo "pistache installation complete"
return 0 return 0
...@@ -202,6 +164,7 @@ install_nlohmann_from_git() { ...@@ -202,6 +164,7 @@ install_nlohmann_from_git() {
$SUDO make install $SUDO make install
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd popd
rm -Rf $OPENAIRCN_DIR/build/ext/json/_build
fi fi
echo "Nlohmann Json installation complete" echo "Nlohmann Json installation complete"
return 0 return 0
...@@ -231,7 +194,7 @@ install_nghttp2_from_git() { ...@@ -231,7 +194,7 @@ install_nghttp2_from_git() {
if [[ $OS_DISTRO == "ubuntu" ]]; then if [[ $OS_DISTRO == "ubuntu" ]]; then
PACKAGE_LIST="\ PACKAGE_LIST="\
g++ \ g++ \
cmake \ $CMAKE \
binutils \ binutils \
autoconf \ autoconf \
automake \ automake \
...@@ -242,7 +205,7 @@ install_nghttp2_from_git() { ...@@ -242,7 +205,7 @@ install_nghttp2_from_git() {
libcunit1-dev \ libcunit1-dev \
libssl-dev \ libssl-dev \
libxml2-dev libev-dev libevent-dev libjansson-dev libc-ares-dev \ libxml2-dev libev-dev libevent-dev libjansson-dev libc-ares-dev \
libjemalloc-dev libsystemd-dev cython python3-dev python-setuptools" libjemalloc-dev libsystemd-dev python3-dev python-setuptools"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\ PACKAGE_LIST="\
gcc-c++ \ gcc-c++ \
...@@ -287,12 +250,13 @@ install_nghttp2_from_git() { ...@@ -287,12 +250,13 @@ install_nghttp2_from_git() {
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
./configure --enable-asio-lib --enable-lib-only ./configure --enable-asio-lib --enable-lib-only
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
make make -j $(nproc)
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
$SUDO make install $SUDO make install
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
$SUDO ldconfig $SUDO ldconfig
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
git clean -x -d -ff .
popd popd
fi fi
echo "nghttp2 installation complete" echo "nghttp2 installation complete"
...@@ -325,7 +289,9 @@ check_install_smf_deps() { ...@@ -325,7 +289,9 @@ check_install_smf_deps() {
#$SUDO systemctl mask apt-daily.timer #$SUDO systemctl mask apt-daily.timer
#$SUDO systemctl mask apt-daily-upgrade.service #$SUDO systemctl mask apt-daily-upgrade.service
#$SUDO systemctl mask apt-daily-upgrade.timer #$SUDO systemctl mask apt-daily-upgrade.timer
$SUDO sed -i 's/1/0/g' /etc/apt/apt.conf.d/10periodic if [ $IS_CONTAINER -eq 0 ]; then
$SUDO sed -i 's/1/0/g' /etc/apt/apt.conf.d/10periodic
fi
fi fi
update_package_db update_package_db
...@@ -338,24 +304,16 @@ check_install_smf_deps() { ...@@ -338,24 +304,16 @@ check_install_smf_deps() {
PACKAGE_LIST="\ PACKAGE_LIST="\
autoconf \ autoconf \
automake \ automake \
bison \
build-essential \ build-essential \
cmake \ $CMAKE \
daemon \
doxygen \
flex \
gdb \
wget \
git" git"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\ PACKAGE_LIST="\
autoconf \ autoconf \
automake \ automake \
bison \ gcc-c++ \
$CMAKE \ $CMAKE \
doxygen \ make \
flex \
gdb \
git" git"
else else
echo_fatal "$OS_DISTRO is not a supported distribution." echo_fatal "$OS_DISTRO is not a supported distribution."
...@@ -371,52 +329,46 @@ check_install_smf_deps() { ...@@ -371,52 +329,46 @@ check_install_smf_deps() {
# Currently Ubuntu18.04 has boost 1.65 as the latest # Currently Ubuntu18.04 has boost 1.65 as the latest
# We need at least 1.66 # We need at least 1.66
# PPA has 1.67 # PPA has 1.67
$SUDO $INSTALLER install $OPTION software-properties-common
$SUDO add-apt-repository ppa:mhier/libboost-latest --yes $SUDO add-apt-repository ppa:mhier/libboost-latest --yes
$SUDO $INSTALLER update $SUDO $INSTALLER update
specific_packages="libconfig++-dev libboost-all-dev" if [ $IS_CONTAINER -eq 0 ]; then
;; specific_packages="libconfig++-dev libasio-dev libboost-all-dev mysql-server libasan4"
else
specific_packages="libconfig++-dev libasio-dev libboost-all-dev libasan4"
fi
;;
"ubuntu20.04") "ubuntu20.04")
specific_packages="libconfig++-dev libasio-dev libboost-all-dev" specific_packages="libconfig++-dev libasio-dev libboost-all-dev libasan5"
;; ;;
*) "ubuntu22.04")
specific_packages="libconfig++-dev libasio-dev libboost-all-dev" specific_packages="libconfig++-dev libasio-dev libboost-all-dev libasan6"
;; ;;
esac esac
# removed libspdlog-dev # removed libspdlog-dev
PACKAGE_LIST="\ PACKAGE_LIST="\
$specific_packages \ $specific_packages \
guile-2.0-dev \
libcurl4-gnutls-dev \ libcurl4-gnutls-dev \
libevent-dev \ libevent-dev \
libgcrypt?-dev \
libgmp-dev \ libgmp-dev \
libhogweed? \ libhogweed? \
libidn2-0-dev \
libidn11-dev \
libpthread-stubs0-dev \
libssl-dev \ libssl-dev \
libtool \ libtool \
libxml2 \ libxml2 \
libxml2-dev \ libxml2-dev \
openssl \ openssl \
python \
nettle-dev \ nettle-dev \
libcurl4 \ libcurl4 \
net-tools \ net-tools \
pkg-config \ pkg-config \
wget \ ninja-build"
libasan?"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\ PACKAGE_LIST="\
guile-devel \ boost-devel \
libconfig-devel \ libconfig-devel \
libgcrypt-devel \ libgcrypt-devel \
gmp-devel \ gmp-devel \
libidn-devel \
lksctp-tools \
lksctp-tools-devel \
openssl-devel \ openssl-devel \
libnghttp2 \
libtool \ libtool \
libxml2 \ libxml2 \
libxml2-devel \ libxml2-devel \
...@@ -426,45 +378,41 @@ check_install_smf_deps() { ...@@ -426,45 +378,41 @@ check_install_smf_deps() {
libcurl-devel \ libcurl-devel \
python2 \ python2 \
pkgconfig \ pkgconfig \
ninja-build \
libasan" libasan"
else else
echo_fatal "$OS_DISTRO is not a supported distribution." echo_fatal "$OS_DISTRO is not a supported distribution."
fi fi
echo "Install distro libs" echo "Install distro libs"
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST $SUDO $INSTALLER install $OPTION $PACKAGE_LIST
# fix issue with libboost in U18 for a bare metal deployment # fix issue with libboost in U18 for a bare metal deployment
if [[ $OS_DISTRO == "ubuntu" ]]; then if [[ $OS_DISTRO == "ubuntu" ]]; then
case "$(get_distribution_release)" in case "$(get_distribution_release)" in
"ubuntu18.04") "ubuntu18.04")
$SUDO $INSTALLER remove $OPTION libboost1.65-dev || true $SUDO $INSTALLER remove $OPTION libboost1.65-dev || true
$SUDO $INSTALLER autoremove $OPTION || true
$SUDO $INSTALLER install $OPTION libboost1.67-dev $SUDO $INSTALLER install $OPTION libboost1.67-dev
;; ;;
esac esac
fi fi
ret=$?;[[ $ret -ne 0 ]] && return $ret ret=$?;[[ $ret -ne 0 ]] && return $ret
echo "distro libs installation complete" echo "distro libs installation complete"
# Use fmt lib included in spdlog
#install_fmt $1
#ret=$?;[[ $ret -ne 0 ]] && return $ret
install_spdlog_from_git $1 $2 install_spdlog_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret ret=$?;[[ $ret -ne 0 ]] && return $ret
install_fb_folly_from_source $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
install_pistache_from_git $1 $2 install_pistache_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret ret=$?;[[ $ret -ne 0 ]] && return $ret
install_nlohmann_from_git $1 $2 install_nlohmann_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret ret=$?;[[ $ret -ne 0 ]] && return $ret
install_nghttp2_from_git $1 $2 install_nghttp2_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret ret=$?;[[ $ret -ne 0 ]] && return $ret
$SUDO ldconfig
return 0 return 0
} }
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
...@@ -564,5 +512,3 @@ check_install_smf_min_deps() { ...@@ -564,5 +512,3 @@ check_install_smf_min_deps() {
return 0 return 0
} }
# prompt has been removed for easier Ctrl+C Ctrl+V
# please update the following information according to your configuration
INSTANCE=1
PREFIX='/usr/local/etc/oai'
mkdir -m 0777 -p $PREFIX
cp ../../etc/smf.conf $PREFIX
declare -A SMF_CONF
SMF_CONF[@INSTANCE@]=$INSTANCE
# SMF_CONF[@PREFIX@]=$PREFIX
SMF_CONF[@PID_DIRECTORY@]='/var/run'
SMF_CONF[@SMF_INTERFACE_NAME_FOR_N4@]='wlo1'
SMF_CONF[@SMF_INTERFACE_NAME_FOR_SBI@]='wlo1'
SMF_CONF[@SMF_INTERFACE_PORT_FOR_SBI@]='80'
SMF_CONF[@SMF_INTERFACE_HTTP2_PORT_FOR_SBI@]='9090'
SMF_CONF[@SMF_API_VERSION@]='v1'
SMF_CONF[@DNN_NI0@]='oai.ipv4'
SMF_CONF[@TYPE0@]='IPv4'
SMF_CONF[@DNN_RANGE0@]='12.1.1.2 - 12.1.1.128'
SMF_CONF[@DNN_NI1@]='default'
SMF_CONF[@TYPE1@]='IPv4'
SMF_CONF[@DNN_RANGE1@]='12.2.1.2 - 12.2.1.128'
SMF_CONF[@DNN_NI2@]='oai'
SMF_CONF[@TYPE2@]='IPv4'
SMF_CONF[@DNN_RANGE2@]='12.1.1.129 - 12.1.1.224'
SMF_CONF[@DNN_NI3@]='ims'
SMF_CONF[@TYPE3@]='IPv4'
SMF_CONF[@DNN_RANGE3@]='12.2.1.129 - 12.2.1.224'
SMF_CONF[@USE_NETWORK_INSTANCE@]='no'
SMF_CONF[@USE_LOCAL_SUBSCRIPTION_INFO@]='yes'
SMF_CONF[@DOMAIN_ACCESS@]='access.oai.org'
SMF_CONF[@DOMAIN_CORE@]='core.oai.org'
SMF_CONF[@USE_FQDN_DNS@]='no'
SMF_CONF[@ENABLE_USAGE_REPORTING@]='no'
SMF_CONF[@REGISTER_NRF@]='no'
SMF_CONF[@DISCOVER_UPF@]='no'
SMF_CONF[@HTTP_VERSION@]='1'
SMF_CONF[@UE_MTU@]='1358'
SMF_CONF[@NSSAI_SST0@]='222'
SMF_CONF[@NSSAI_SD0@]='123'
SMF_CONF[@NSSAI_SST1@]='1'
SMF_CONF[@NSSAI_SD1@]='0xFFFFFF'
SMF_CONF[@NSSAI_SST2@]='2'
SMF_CONF[@NSSAI_SD2@]='2'
SMF_CONF[@QOS_PROFILE_5QI0@]='6'
SMF_CONF[@QOS_PROFILE_5QI1@]='7'
SMF_CONF[@QOS_PROFILE_5QI2@]='8'
SMF_CONF[@SESSION_AMBR_UL0@]='20Mbps'
SMF_CONF[@SESSION_AMBR_UL1@]='220Mbps'
SMF_CONF[@SESSION_AMBR_UL2@]='20Mbps'
SMF_CONF[@SESSION_AMBR_DL0@]='20Mbps'
SMF_CONF[@SESSION_AMBR_DL1@]='220Mbps'
SMF_CONF[@SESSION_AMBR_DL2@]='20Mbps'
SMF_CONF[@UDM_IPV4_ADDRESS@]='172.16.1.103'
SMF_CONF[@UDM_PORT@]='80'
SMF_CONF[@UDM_API_VERSION@]='v2'
SMF_CONF[@UDM_FQDN@]='oai-udm'
SMF_CONF[@AMF_IPV4_ADDRESS@]='192.168.74.195'
SMF_CONF[@AMF_PORT@]='80'
SMF_CONF[@AMF_API_VERSION@]='v1'
SMF_CONF[@AMF_FQDN@]='oai-amf'
SMF_CONF[@UPF_IPV4_ADDRESS@]='192.168.12.245'
SMF_CONF[@UPF_FQDN_0@]='oai-upf0'
SMF_CONF[@NRF_IPV4_ADDRESS@]='127.0.0.1'
SMF_CONF[@NRF_PORT@]='8080'
SMF_CONF[@NRF_API_VERSION@]='v1'
SMF_CONF[@NRF_FQDN@]='oai-nrf'
SMF_CONF[@DEFAULT_DNS_IPV4_ADDRESS@]='8.8.8.8'
SMF_CONF[@DEFAULT_DNS_SEC_IPV4_ADDRESS@]='4.4.4.4'
for K in "${!SMF_CONF[@]}"; do
egrep -lRZ "$K" $PREFIX | xargs -0 -l sed -i -e "s|$K|${SMF_CONF[$K]}|g"
ret=$?;[[ ret -ne 0 ]] && echo "Tried to replace $K with ${SMF_CONF[$K]}"
done
...@@ -11,31 +11,28 @@ PREFIX='/usr/local/etc/oai' ...@@ -11,31 +11,28 @@ PREFIX='/usr/local/etc/oai'
sudo mkdir -m 0777 -p $PREFIX sudo mkdir -m 0777 -p $PREFIX
cp ../../etc/smf.conf $PREFIX cp ../../etc/smf.conf $PREFIX
declare -A SMF_CONF export CONFIG_FILE=$PREFIX/smf.conf
export MOUNT_CONFIG=NO
SMF_CONF[@INSTANCE@]=$INSTANCE
SMF_CONF[@PREFIX@]=$PREFIX export INSTANCE=1
SMF_CONF[@PID_DIRECTORY@]='/var/run' export SMF_INTERFACE_NAME_FOR_N4='eno1:sn4'
export SMF_INTERFACE_NAME_FOR_SBI='eno1:smf'
SMF_CONF[@SMF_INTERFACE_NAME_FOR_N4@]='eno1:sn4' export UDM_IPV4_ADDRESS='172.16.1.103'
SMF_CONF[@SMF_INTERFACE_NAME_FOR_SBI@]='eno1:smf' export UDM_PORT='80'
export AMF_IPV4_ADDRESS='172.16.1.102'
SMF_CONF[@SMF_INTERFACE_IPV4_ADDRESS_FOR_SBI@]='172.16.1.101' export AMF_PORT='80'
SMF_CONF[@SMF_INTERFACE_PORT_FOR_SBI@]='80' export UPF_IPV4_ADDRESS='172.16.2.102'
SMF_CONF[@SMF_INTERFACE_HTTP2_PORT_FOR_SBI@]='9090'
export DEFAULT_DNS_IPV4_ADDRESS='8.8.8.8'
SMF_CONF[@UDM_IPV4_ADDRESS@]='172.16.1.103' export DEFAULT_DNS_SEC_IPV4_ADDRESS='4.4.4.4'
SMF_CONF[@UDM_PORT@]='80'
# One mandatory slice
SMF_CONF[@AMF_IPV4_ADDRESS@]='172.16.1.102' export DNN_NI0=oai
SMF_CONF[@AMF_PORT@]='80' export TYPE0=IPv4
export DNN_RANGE0='12.1.1.151 - 12.1.1.253'
SMF_CONF[@UPF_IPV4_ADDRESS@]='172.16.2.102' export NSSAI_SST0=1
#export NSSAI_SD0=123
SMF_CONF[@DEFAULT_DNS_IPV4_ADDRESS@]='8.8.8.8' export SESSION_AMBR_UL0=800Mbps
SMF_CONF[@DEFAULT_DNS_SEC_IPV4_ADDRESS@]='4.4.4.4' export SESSION_AMBR_DL0=1000Mbps
for K in "${!SMF_CONF[@]}"; do ../../scripts/entrypoint.py
egrep -lRZ "$K" $PREFIX | xargs -0 -l sed -i -e "s|$K|${SMF_CONF[$K]}|g"
ret=$?;[[ ret -ne 0 ]] && echo "Tried to replace $K with ${SMF_CONF[$K]}"
done
...@@ -182,12 +182,13 @@ pipeline { ...@@ -182,12 +182,13 @@ pipeline {
// Currently this pipeline only runs for pushes to `develop` branch // Currently this pipeline only runs for pushes to `develop` branch
// First clean image registry // First clean image registry
try { try {
myShCmd('docker image tag oai-smf:develop oai-smf:develop-previous', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd('docker image rm oai-smf:develop', rem_u18_host_flag, rem_u18_host_user, rem_u18_host) myShCmd('docker image rm oai-smf:develop', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
} catch (Exception e) { } catch (Exception e) {
echo "Maybe a previous build went wrong" echo "Maybe a previous build went wrong"
} }
// In case of push to `develop` branch we build from scratch // In case of push to `develop` branch we build from scratch
myShCmd('docker build --no-cache --target oai-smf --tag oai-smf:' + smf_tag + ' --file docker/Dockerfile.smf.ubuntu18 . > archives/smf_docker_image_build.log 2>&1', rem_u18_host_flag, rem_u18_host_user, rem_u18_host) myShCmd('docker build --no-cache --target oai-smf --tag oai-smf:' + smf_tag + ' --file docker/Dockerfile.smf.ubuntu . > archives/smf_docker_image_build.log 2>&1', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
} }
if ("MERGE".equals(env.gitlabActionType)) { if ("MERGE".equals(env.gitlabActionType)) {
try { try {
...@@ -200,7 +201,7 @@ pipeline { ...@@ -200,7 +201,7 @@ pipeline {
} }
// "latest" is the tag used in the docker file. // "latest" is the tag used in the docker file.
myShCmd('docker image tag oai-smf-base:' +SMF_BASE_IMAGE_TAG + ' oai-smf-base:latest', rem_u18_host_flag, rem_u18_host_user, rem_u18_host) myShCmd('docker image tag oai-smf-base:' +SMF_BASE_IMAGE_TAG + ' oai-smf-base:latest', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd('docker build --no-cache --target oai-smf --tag oai-smf:' + smf_tag + ' --file ci-scripts/docker/Dockerfile.ci.ubuntu.18.04 . > archives/smf_docker_image_build.log 2>&1', rem_u18_host_flag, rem_u18_host_user, rem_u18_host) myShCmd('docker build --no-cache --target oai-smf --tag oai-smf:' + smf_tag + ' --file ci-scripts/docker/Dockerfile.ci.ubuntu . > archives/smf_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. // Putting a place holder to try out on the flattening of image.
// If not satisfactory, we can remove it. // If not satisfactory, we can remove it.
...@@ -221,8 +222,11 @@ pipeline { ...@@ -221,8 +222,11 @@ pipeline {
} }
success { success {
sh "echo 'OAI-SMF DOCKER IMAGE BUILD: OK' >> archives/smf_docker_image_build.log" sh "echo 'OAI-SMF DOCKER IMAGE BUILD: OK' >> archives/smf_docker_image_build.log"
myShCmd('docker image rm oai-smf:develop-previous || true', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
} }
unsuccessful { unsuccessful {
myShCmd('docker image tag oai-smf:develop-previous oai-smf:develop || true', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd('docker image rm oai-smf:develop-previous || true', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
sh "echo 'OAI-SMF DOCKER IMAGE BUILD: KO' >> archives/smf_docker_image_build.log" sh "echo 'OAI-SMF DOCKER IMAGE BUILD: KO' >> archives/smf_docker_image_build.log"
} }
} }
...@@ -237,6 +241,7 @@ pipeline { ...@@ -237,6 +241,7 @@ pipeline {
// Currently this pipeline only runs for pushes to `develop` branch // Currently this pipeline only runs for pushes to `develop` branch
// First clean image registry // First clean image registry
try { try {
myShCmd('sudo podman image tag oai-smf:develop oai-smf:develop-previous || true', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
myShCmd('sudo podman image rm oai-smf:develop || true', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host) myShCmd('sudo podman image rm oai-smf:develop || true', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
} catch (Exception e) { } catch (Exception e) {
echo "Maybe a previous build went wrong" echo "Maybe a previous build went wrong"
...@@ -251,10 +256,7 @@ pipeline { ...@@ -251,10 +256,7 @@ pipeline {
myShCmd('cp /etc/pki/entitlement/*pem ./etc-pki-entitlement', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host) 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/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 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-smf --tag oai-smf:' + smf_tag + ' --file docker/Dockerfile.smf.rhel8 . > archives/smf_podman_image_build.log 2>&1', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host) myShCmd('sudo podman build --no-cache --squash --target oai-smf --tag oai-smf:' + smf_tag + ' --file docker/Dockerfile.smf.rhel8 --format docker . > archives/smf_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-smf:' + smf_tag, rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
myShCmd('sudo podman image ls >> archives/smf_podman_image_build.log', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host) myShCmd('sudo podman image ls >> archives/smf_podman_image_build.log', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
if ("MERGE".equals(env.gitlabActionType)) { if ("MERGE".equals(env.gitlabActionType)) {
myShCmd('sudo podman image tag oai-smf:' + smf_tag + ' oai-smf:' + rhel_smf_tag, rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host) myShCmd('sudo podman image tag oai-smf:' + smf_tag + ' oai-smf:' + rhel_smf_tag, rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
...@@ -270,9 +272,12 @@ pipeline { ...@@ -270,9 +272,12 @@ pipeline {
} }
} }
success { success {
myShCmd('sudo podman image rm oai-smf:develop-previous || true', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
sh "echo 'OAI-SMF PODMAN RHEL8 IMAGE BUILD: OK' >> archives/smf_podman_image_build.log" sh "echo 'OAI-SMF PODMAN RHEL8 IMAGE BUILD: OK' >> archives/smf_podman_image_build.log"
} }
unsuccessful { unsuccessful {
myShCmd('sudo podman image tag oai-smf:develop-previous oai-smf:develop || true', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
myShCmd('sudo podman image rm oai-smf:develop-previous || true', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
sh "echo 'OAI-SMF PODMAN RHEL8 IMAGE BUILD: KO' >> archives/smf_podman_image_build.log" sh "echo 'OAI-SMF PODMAN RHEL8 IMAGE BUILD: KO' >> archives/smf_podman_image_build.log"
} }
} }
......
...@@ -205,4 +205,4 @@ echo "Nb Files that do NOT follow OAI rules: $NB_TO_FORMAT over $NB_TOTAL checke ...@@ -205,4 +205,4 @@ echo "Nb Files that do NOT follow OAI rules: $NB_TO_FORMAT over $NB_TOTAL checke
echo "NB_FILES_FAILING_CHECK=$NB_TO_FORMAT" > ./oai_rules_result.txt echo "NB_FILES_FAILING_CHECK=$NB_TO_FORMAT" > ./oai_rules_result.txt
echo "NB_FILES_CHECKED=$NB_TOTAL" >> ./oai_rules_result.txt echo "NB_FILES_CHECKED=$NB_TOTAL" >> ./oai_rules_result.txt
exit 0 if [ $NB_TO_FORMAT -ne 0 ]; then exit -1; else exit 0; fi
...@@ -21,22 +21,26 @@ ...@@ -21,22 +21,26 @@
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# #
# Dockerfile for the Open-Air-Interface SMF service # Dockerfile for the Open-Air-Interface SMF service
# Valid for Ubuntu-18.04 (bionic) # Valid for Ubuntu-18.04 (bionic),
# Ubuntu-20.04 (focal),
# Ubuntu-22.04 (jammy)
# #
#--------------------------------------------------------------------- #---------------------------------------------------------------------
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# BUILDER IMAGE # BUILDER IMAGE
#--------------------------------------------------------------------- #---------------------------------------------------------------------
ARG BASE_IMAGE=ubuntu:bionic
FROM oai-smf-base:latest as oai-smf-builder FROM oai-smf-base:latest as oai-smf-builder
RUN rm -Rf /openair-smf/
WORKDIR /openair-smf/ WORKDIR /openair-smf/
COPY . /openair-smf COPY . /openair-smf
RUN cp -Rf /openair-smf-ext-ref /openair-smf/build/ext
# Building SMF # Building SMF
WORKDIR /openair-smf/build/scripts WORKDIR /openair-smf/build/scripts
RUN ldconfig && \ RUN ldconfig && \
cp -Rf /openair-smf-ext-ref /openair-smf/build/ext && \
./build_smf --clean --Verbose --build-type Release --jobs && \ ./build_smf --clean --Verbose --build-type Release --jobs && \
ldd /openair-smf/build/smf/build/smf && \ ldd /openair-smf/build/smf/build/smf && \
mv /openair-smf/build/smf/build/smf /openair-smf/build/smf/build/oai_smf mv /openair-smf/build/smf/build/smf /openair-smf/build/smf/build/oai_smf
...@@ -44,47 +48,66 @@ RUN ldconfig && \ ...@@ -44,47 +48,66 @@ RUN ldconfig && \
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# TARGET IMAGE # TARGET IMAGE
#--------------------------------------------------------------------- #---------------------------------------------------------------------
FROM ubuntu:bionic as oai-smf FROM $BASE_IMAGE as oai-smf
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Paris ENV TZ=Europe/Paris
# We install some debug tools for the moment in addition of mandatory libraries # We install some debug tools for the moment in addition of mandatory libraries
RUN apt-get update && \ RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \ DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \ DEBIAN_FRONTEND=noninteractive apt-get install --yes \
python3 \
python3-jinja2 \
psmisc \ psmisc \
net-tools \ net-tools \
tzdata \
bc \ bc \
perl \ libssh-4 \
openssl \ openssl \
libasan4 \ libbrotli1 \
netbase \
# Ubuntu 18 --> libasan4
# Ubuntu 20 --> libasan5
# Ubuntu 22 --> libasan6
# libasan? \
libgssapi-krb5-2 \ libgssapi-krb5-2 \
libldap-2.4-2 \ # Ubuntu 18/20 --> libldap-2.4-2
libgoogle-glog0v5 \ # Ubuntu 22 --> libldap-2.5-0
libdouble-conversion1 \ libldap-2.?-? \
libconfig++9v5 \ libconfig++9v5 \
&& rm -rf /var/lib/apt/lists/* libsctp1 \
librtmp1 \
libpsl5 \
libcurl?-gnutls \
# Ubuntu 18 --> boost62/65 -> will remove both
# Ubuntu 20 --> boost67/71 -> will remove 67
# Ubuntu 22 --> boost74
libboost-thread1.??.0 \
libboost-chrono1.??.0 \
&& rm -rf /var/lib/apt/lists/* \
/lib/x86_64-linux-gnu/libboost_system.so.1.6*.0 \
/lib/x86_64-linux-gnu/libboost_chrono.so.1.6*.0 \
/lib/x86_64-linux-gnu/libboost_thread.so.1.6*.0
# Copying executable and generated libraries # Copying executable and generated libraries
WORKDIR /openair-smf/bin WORKDIR /openair-smf/bin
COPY --from=oai-smf-builder \ COPY --from=oai-smf-builder \
/openair-smf/build/smf/build/oai_smf \ /openair-smf/build/smf/build/oai_smf \
/openair-smf/scripts/entrypoint.sh \ /openair-smf/scripts/entrypoint.py \
/openair-smf/scripts/healthcheck.sh \
./ ./
WORKDIR /usr/local/lib/ WORKDIR /usr/local/lib/
COPY --from=oai-smf-builder \ COPY --from=oai-smf-builder \
/usr/local/lib/libpistache.so \ # Copying only the packages built from source
/usr/local/lib/libnghttp2.so.14 \ /usr/local/lib/libnghttp2.so.14 \
/usr/local/lib/libnghttp2_asio.so.1 \ /usr/local/lib/libnghttp2_asio.so.1 \
/usr/lib/libboost_system.so.1.67.0 \ /usr/local/lib/libpistache.so \
/usr/lib/libboost_thread.so.1.67.0 \
/usr/lib/libboost_chrono.so.1.67.0 \
/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 \
/openair-smf/build/smf/build/nas/libNAS.so \ /openair-smf/build/smf/build/nas/libNAS.so \
# Ubuntu 18 --> boost 67 will be copied
/usr/lib/libboost_system.so.1.* \
/usr/lib/libboost_thread.so.1.* \
/usr/lib/libboost_chrono.so.1.* \
./ ./
RUN ldconfig && \ RUN ldconfig && \
ldd /openair-smf/bin/oai_smf ldd /openair-smf/bin/oai_smf
...@@ -95,7 +118,13 @@ COPY --from=oai-smf-builder /openair-smf/etc/smf.conf . ...@@ -95,7 +118,13 @@ COPY --from=oai-smf-builder /openair-smf/etc/smf.conf .
WORKDIR /openair-smf WORKDIR /openair-smf
# expose ports
EXPOSE 80/tcp 9090/tcp 8805/udp EXPOSE 80/tcp 9090/tcp 8805/udp
# healthcheck
HEALTHCHECK --interval=10s \
--timeout=15s \
--retries=6 \
CMD /openair-smf/bin/healthcheck.sh
ENTRYPOINT ["/bin/bash","/openair-smf/bin/entrypoint.sh"] ENTRYPOINT ["python3","/openair-smf/bin/entrypoint.py"]
CMD ["/openair-smf/bin/oai_smf", "-c", "/openair-smf/etc/smf.conf", "-o"] CMD ["/openair-smf/bin/oai_smf", "-c", "/openair-smf/etc/smf.conf", "-o"]
...@@ -49,6 +49,9 @@ def perform_flattening(tag): ...@@ -49,6 +49,9 @@ def perform_flattening(tag):
if re.search('podman', podman_check.strip()): if re.search('podman', podman_check.strip()):
cli = 'sudo podman' cli = 'sudo podman'
image_prefix = 'localhost/' image_prefix = 'localhost/'
# since HEALTHCHECK is not supported by podman import
# we don't flatten
return 0
if cli == '': if cli == '':
cmd = 'which docker || true' cmd = 'which docker || true'
docker_check = subprocess.check_output(cmd, shell=True, universal_newlines=True) docker_check = subprocess.check_output(cmd, shell=True, universal_newlines=True)
...@@ -75,8 +78,9 @@ def perform_flattening(tag): ...@@ -75,8 +78,9 @@ def perform_flattening(tag):
cmd += ' --change "EXPOSE 80/tcp" ' cmd += ' --change "EXPOSE 80/tcp" '
cmd += ' --change "EXPOSE 8080/tcp" ' cmd += ' --change "EXPOSE 8080/tcp" '
cmd += ' --change "EXPOSE 8805/udp" ' cmd += ' --change "EXPOSE 8805/udp" '
cmd += ' --change "HEALTHCHECK --interval=10s --timeout=15s --retries=6 CMD /openair-smf/bin/healthcheck.sh" '
cmd += ' --change "CMD [\\"/openair-smf/bin/oai_smf\\", \\"-c\\", \\"/openair-smf/etc/smf.conf\\", \\"-o\\"]" ' cmd += ' --change "CMD [\\"/openair-smf/bin/oai_smf\\", \\"-c\\", \\"/openair-smf/etc/smf.conf\\", \\"-o\\"]" '
cmd += ' --change "ENTRYPOINT [\\"/bin/bash\\", \\"/openair-smf/bin/entrypoint.sh\\"]" ' cmd += ' --change "ENTRYPOINT [\\"python3\\", \\"/openair-smf/bin/entrypoint.py\\"]" '
cmd += ' - ' + image_prefix + tag cmd += ' - ' + image_prefix + tag
print (cmd) print (cmd)
subprocess.check_output(cmd, shell=True, universal_newlines=True) subprocess.check_output(cmd, shell=True, universal_newlines=True)
......
...@@ -198,7 +198,7 @@ class HtmlReport(): ...@@ -198,7 +198,7 @@ class HtmlReport():
self.file.write(' <strong>All files in repository follow OAI rules. <span class="glyphicon glyphicon-ok-circle"></span> -> (' + nb_total.strip() + ' were checked)</strong>\n') self.file.write(' <strong>All files in repository follow OAI rules. <span class="glyphicon glyphicon-ok-circle"></span> -> (' + nb_total.strip() + ' were checked)</strong>\n')
self.file.write(' </div>\n') self.file.write(' </div>\n')
else: else:
self.file.write(' <div class="alert alert-warning">\n') self.file.write(' <div class="alert alert-danger">\n')
if self.git_pull_request: if self.git_pull_request:
self.file.write(' <strong>' + nb_fail.strip() + ' modified files in Pull-Request DO NOT follow OAI rules. <span class="glyphicon glyphicon-warning-sign"></span> -> (' + nb_total.strip() + ' were checked)</strong>\n') self.file.write(' <strong>' + nb_fail.strip() + ' modified files in Pull-Request DO NOT follow OAI rules. <span class="glyphicon glyphicon-warning-sign"></span> -> (' + nb_total.strip() + ' were checked)</strong>\n')
else: else:
...@@ -373,8 +373,8 @@ class HtmlReport(): ...@@ -373,8 +373,8 @@ class HtmlReport():
self.file.write(' <tr bgcolor="#33CCFF" >\n') self.file.write(' <tr bgcolor="#33CCFF" >\n')
self.file.write(' <th>Stage Name</th>\n') self.file.write(' <th>Stage Name</th>\n')
self.file.write(' <th>Image Kind</th>\n') self.file.write(' <th>Image Kind</th>\n')
self.file.write(' <th>OAI AMF <font color="Gold">Ubuntu18</font> Image</th>\n') self.file.write(' <th>OAI SMF <font color="Gold">Ubuntu18</font> Image</th>\n')
self.file.write(' <th>OAI AMF <font color="Gold">RHEL8</font> Image</th>\n') self.file.write(' <th>OAI SMF <font color="Gold">RHEL8</font> Image</th>\n')
self.file.write(' </tr>\n') self.file.write(' </tr>\n')
def buildSummaryFooter(self): def buildSummaryFooter(self):
...@@ -481,8 +481,6 @@ class HtmlReport(): ...@@ -481,8 +481,6 @@ class HtmlReport():
section_end_pattern = 'build_smf --clean --Verbose --build-type Release --jobs' section_end_pattern = 'build_smf --clean --Verbose --build-type Release --jobs'
section_status = False section_status = False
package_install = False package_install = False
folly_build_start = False
folly_build_status = False
spdlog_build_start = False spdlog_build_start = False
spdlog_build_status = False spdlog_build_status = False
pistache_build_start = False pistache_build_start = False
...@@ -494,7 +492,7 @@ class HtmlReport(): ...@@ -494,7 +492,7 @@ class HtmlReport():
base_image = False base_image = False
with open(cwd + '/archives/' + logFileName, 'r') as logfile: with open(cwd + '/archives/' + logFileName, 'r') as logfile:
for line in logfile: for line in logfile:
result = re.search('FROM oai-smf-base', line) result = re.search('FROM oai-smf-base:latest', line)
if result is not None: if result is not None:
base_image = True base_image = True
result = re.search(section_start_pattern, line) result = re.search(section_start_pattern, line)
...@@ -510,12 +508,6 @@ class HtmlReport(): ...@@ -510,12 +508,6 @@ class HtmlReport():
result = re.search('distro libs installation complete', line) result = re.search('distro libs installation complete', line)
if result is not None: if result is not None:
package_install = True package_install = True
result = re.search('Starting to install folly', line)
if result is not None:
folly_build_start = True
result = re.search('folly installation complete', line)
if result is not None and folly_build_start:
folly_build_status = True
result = re.search('Starting to install spdlog', line) result = re.search('Starting to install spdlog', line)
if result is not None: if result is not None:
spdlog_build_start = True spdlog_build_start = True
...@@ -563,12 +555,6 @@ class HtmlReport(): ...@@ -563,12 +555,6 @@ class HtmlReport():
cell_msg += ' ** spdlog Installation: OK\n' cell_msg += ' ** spdlog Installation: OK\n'
else: else:
cell_msg += ' ** spdlog Installation: KO\n' cell_msg += ' ** spdlog Installation: KO\n'
if base_image:
cell_msg += ' ** folly Installation: N/A\n'
elif folly_build_status:
cell_msg += ' ** folly Installation: OK\n'
else:
cell_msg += ' ** folly Installation: KO\n'
if base_image: if base_image:
cell_msg += ' ** pistache Installation: N/A\n' cell_msg += ' ** pistache Installation: N/A\n'
elif pistache_build_status: elif pistache_build_status:
...@@ -582,11 +568,11 @@ class HtmlReport(): ...@@ -582,11 +568,11 @@ class HtmlReport():
else: else:
cell_msg += ' ** Nlohmann Json Installation: KO\n' cell_msg += ' ** Nlohmann Json Installation: KO\n'
if base_image: if base_image:
cell_msg += ' ** nghttp2 Installation: N/A\n' cell_msg += ' ** nghttp2-asio Installation: N/A\n'
elif nghttp2_build_status: elif nghttp2_build_status:
cell_msg += ' ** nghttp2 Installation: OK\n' cell_msg += ' ** nghttp2-asio Installation: OK\n'
else: else:
cell_msg += ' ** nghttp2 Installation: KO\n' cell_msg += ' ** nghttp2-asio Installation: KO\n'
cell_msg += '</b></pre></td>\n' cell_msg += '</b></pre></td>\n'
else: else:
cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>' cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>'
...@@ -620,7 +606,7 @@ class HtmlReport(): ...@@ -620,7 +606,7 @@ class HtmlReport():
status = False status = False
if nfType == 'SMF': if nfType == 'SMF':
section_start_pattern = 'build_smf --clean --Verbose --build-type Release --jobs' section_start_pattern = 'build_smf --clean --Verbose --build-type Release --jobs'
section_end_pattern = 'FROM ubuntu:bionic as oai-smf$' section_end_pattern = 'FROM .* as oai-smf$'
pass_pattern = 'smf installed' pass_pattern = 'smf installed'
section_status = False section_status = False
with open(cwd + '/archives/' + logFileName, 'r') as logfile: with open(cwd + '/archives/' + logFileName, 'r') as logfile:
...@@ -670,7 +656,7 @@ class HtmlReport(): ...@@ -670,7 +656,7 @@ class HtmlReport():
if os.path.isfile(cwd + '/archives/' + logFileName): if os.path.isfile(cwd + '/archives/' + logFileName):
if nfType == 'SMF': if nfType == 'SMF':
section_start_pattern = 'build_smf --clean --Verbose --build-type Release --jobs' section_start_pattern = 'build_smf --clean --Verbose --build-type Release --jobs'
section_end_pattern = 'FROM ubuntu:bionic as oai-smf$' section_end_pattern = 'FROM .* as oai-smf$'
section_status = False section_status = False
with open(cwd + '/archives/' + logFileName, 'r') as logfile: with open(cwd + '/archives/' + logFileName, 'r') as logfile:
for line in logfile: for line in logfile:
...@@ -733,7 +719,7 @@ class HtmlReport(): ...@@ -733,7 +719,7 @@ class HtmlReport():
for variant in variants: for variant in variants:
logFileName = 'smf_' + variant + '_image_build.log' logFileName = 'smf_' + variant + '_image_build.log'
if os.path.isfile(cwd + '/archives/' + logFileName): if os.path.isfile(cwd + '/archives/' + logFileName):
section_start_pattern = 'FROM ubuntu:bionic as oai-smf$' section_start_pattern = 'FROM .* as oai-smf$'
section_end_pattern = 'WORKDIR /openair-smf/etc' section_end_pattern = 'WORKDIR /openair-smf/etc'
section_status = False section_status = False
status = False status = False
......
#/*
# * 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-smf"
namespace: oaicicd-core
spec:
runPolicy: "Serial"
source:
type: "Binary"
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.smf.rhel8"
output:
to:
kind: "ImageStreamTag"
name: "oai-smf:develop"
#/*
# * 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
# */
#---------------------------------------------------------------------
#
apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
name: oai-smf
namespace: oaicicd-core
spec:
lookupPolicy:
local: true
status:
tag: develop
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# #
# Dockerfile for the Open-Air-Interface SMF service # Dockerfile for the Open-Air-Interface SMF service
# Valid for RHEL 8.2 # Valid for UBI 8.6 | RHEL 8.6
# #
#--------------------------------------------------------------------- #---------------------------------------------------------------------
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#--------------------------------------------------------------------- #---------------------------------------------------------------------
FROM registry.access.redhat.com/ubi8/ubi:latest AS oai-smf-builder FROM registry.access.redhat.com/ubi8/ubi:latest AS oai-smf-builder
ARG NEEDED_GIT_PROXY ENV IS_DOCKERFILE=1
# Copy the entitlements # Copy the entitlements
COPY ./etc-pki-entitlement /etc/pki/entitlement COPY ./etc-pki-entitlement /etc/pki/entitlement
...@@ -41,18 +41,24 @@ COPY ./rhsm-ca /etc/rhsm/ca ...@@ -41,18 +41,24 @@ COPY ./rhsm-ca /etc/rhsm/ca
RUN rm -f /etc/rhsm-host && \ RUN rm -f /etc/rhsm-host && \
yum repolist --disablerepo=* && \ yum repolist --disablerepo=* && \
subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms && \ subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms && \
yum update -y && \ yum update -y && \
yum install -y \ yum install -y \
psmisc \ psmisc \
git \ git \
diffutils \ diffutils \
file \ file \
boost-devel &&\ gcc-c++ \
rm -rf /var/lib/apt/lists/* ninja-build \
boost-devel \
openssl-devel \
openssl \
wget \
libasan && \
echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \
echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf
# Some GIT configuration command quite useful # 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 && \ RUN git config --global https.postBuffer 123289600 && \
git config --global http.sslverify false git config --global http.sslverify false
...@@ -60,49 +66,67 @@ RUN git config --global https.postBuffer 123289600 && \ ...@@ -60,49 +66,67 @@ RUN git config --global https.postBuffer 123289600 && \
WORKDIR /openair-smf WORKDIR /openair-smf
COPY . /openair-smf COPY . /openair-smf
# Installing and Building SMF # Installing all the needed libraries/packages to build and run SMF
WORKDIR /openair-smf/build/scripts WORKDIR /openair-smf/build/scripts
RUN ./build_smf --install-deps --force RUN ./build_smf --install-deps --force
RUN ./build_smf --clean --Verbose --build-type Release --jobs && \
# Building SMF
WORKDIR /openair-smf/build/scripts
RUN ldconfig && \
./build_smf --clean --Verbose --build-type Release --jobs && \
ldd /openair-smf/build/smf/build/smf && \ ldd /openair-smf/build/smf/build/smf && \
mv /openair-smf/build/smf/build/smf /openair-smf/build/smf/build/oai_smf && \ mv /openair-smf/build/smf/build/smf /openair-smf/build/smf/build/oai_smf && \
rm /etc/pki/entitlement/*pem # Remove entitlements and Subscription Manager configs
rm -rf /etc/pki/entitlement && \
rm -rf /etc/rhsm
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# TARGET IMAGE # TARGET IMAGE
#--------------------------------------------------------------------- #---------------------------------------------------------------------
FROM registry.access.redhat.com/ubi8/ubi:latest as oai-smf FROM registry.access.redhat.com/ubi8/ubi-minimal:latest as oai-smf
ENV TZ=Europe/Paris ENV TZ=Europe/Paris
# We install some debug tools for the moment in addition of mandatory libraries
RUN yum update -y && \ # Copy the entitlements
yum install -y --enablerepo="ubi-8-codeready-builder" \ COPY ./etc-pki-entitlement /etc/pki/entitlement
psmisc \ # Copy the subscription manager configurations
tzdata \ COPY ./rhsm-conf /etc/rhsm
procps-ng \ COPY ./rhsm-ca /etc/rhsm/ca
net-tools \
libevent && \
yum clean all -y && \ RUN rm -f /etc/rhsm-host && \
rm -rf /var/cache/yum /var/cache/dnf microdnf update -y && \
microdnf install -y \
python3 \
python3-pip \
tzdata \
# libasan \
procps-ng \
psmisc \
net-tools \
libicu \
boost \
libevent \
findutils \
libconfig && \
pip3 install jinja2 && \
microdnf clean all -y && \
rm -rf /var/cache/yum /var/cache/dnf && \
# Remove entitlements and Subscription Manager configs
rm -rf /etc/pki/entitlement && \
rm -rf /etc/rhsm
# Copying executable and generated libraries # Copying executable and generated libraries
WORKDIR /openair-smf/bin WORKDIR /openair-smf/bin
COPY --from=oai-smf-builder \ COPY --from=oai-smf-builder \
/openair-smf/build/smf/build/oai_smf \ /openair-smf/build/smf/build/oai_smf \
/openair-smf/scripts/entrypoint.sh \ /openair-smf/scripts/entrypoint.py \
/openair-smf/scripts/healthcheck.sh \
./ ./
COPY --from=oai-smf-builder \ COPY --from=oai-smf-builder \
/usr/local/lib64/libpistache.so.0 \ /usr/local/lib64/libpistache.so.0 \
/usr/local/lib/libnghttp2_asio.so \ /usr/local/lib/libnghttp2_asio.so \
/usr/lib64/libgflags.so.2.1 \
/usr/lib64/libglog.so.0 \
/usr/lib64/libdouble-conversion.so.1 \
/usr/lib64/libconfig++.so.9 \
/usr/lib64/libboost_system.so.1.66.0 \
/usr/lib64/libboost_thread.so.1.66.0 \
/usr/lib64/libboost_chrono.so.1.66.0 \
/usr/local/lib/libnghttp2_asio.so.1 \ /usr/local/lib/libnghttp2_asio.so.1 \
/usr/lib64/libasan.so.5 \
/openair-smf/build/smf/build/nas/libNAS.so \ /openair-smf/build/smf/build/nas/libNAS.so \
/usr/lib64/ /usr/lib64/
...@@ -118,6 +142,11 @@ WORKDIR /openair-smf ...@@ -118,6 +142,11 @@ WORKDIR /openair-smf
# expose ports # expose ports
EXPOSE 80/tcp 9090/tcp 8805/udp EXPOSE 80/tcp 9090/tcp 8805/udp
# healthcheck
HEALTHCHECK --interval=10s \
--timeout=15s \
--retries=6 \
CMD /openair-smf/bin/healthcheck.sh
ENTRYPOINT ["/openair-smf/bin/entrypoint.sh"] ENTRYPOINT ["python3", "/openair-smf/bin/entrypoint.py"]
CMD ["/openair-smf/bin/oai_smf", "-c", "/openair-smf/etc/smf.conf", "-o"] CMD ["/openair-smf/bin/oai_smf", "-c", "/openair-smf/etc/smf.conf", "-o"]
...@@ -21,30 +21,29 @@ ...@@ -21,30 +21,29 @@
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# #
# Dockerfile for the Open-Air-Interface SMF service # Dockerfile for the Open-Air-Interface SMF service
# Valid for Ubuntu-18.04 (bionic) # Valid for Ubuntu-18.04 (bionic),
# Ubuntu-20.04 (focal),
# Ubuntu-22.04 (jammy)
# #
#--------------------------------------------------------------------- #---------------------------------------------------------------------
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# BUILDER IMAGE # BASE IMAGE
#--------------------------------------------------------------------- #---------------------------------------------------------------------
FROM ubuntu:bionic as oai-smf-builder ARG BASE_IMAGE=ubuntu:bionic
FROM $BASE_IMAGE as oai-smf-base
ARG NEEDED_GIT_PROXY
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Paris
ENV IS_DOCKERFILE=1
RUN apt-get update && \ RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \ DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \ DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \ psmisc \
software-properties-common \ git \
gnupg \ && rm -rf /var/lib/apt/lists/*
git && \
rm -rf /var/lib/apt/lists/*
# Some GIT configuration command quite useful # 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 && \ RUN git config --global https.postBuffer 123289600 && \
git config --global http.sslverify false git config --global http.sslverify false
...@@ -52,57 +51,85 @@ RUN git config --global https.postBuffer 123289600 && \ ...@@ -52,57 +51,85 @@ RUN git config --global https.postBuffer 123289600 && \
WORKDIR /openair-smf WORKDIR /openair-smf
COPY . /openair-smf COPY . /openair-smf
# Installing and Building SMF # Installing all the needed libraries/packages to build and run SMF
WORKDIR /openair-smf/build/scripts WORKDIR /openair-smf/build/scripts
RUN ./build_smf --install-deps --force RUN ./build_smf --install-deps --force && \
RUN ./build_smf --clean --Verbose --build-type Release --jobs && \ cp -Rf /openair-smf/build/ext /openair-smf-ext-ref
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM oai-smf-base as oai-smf-builder
# Building SMF
WORKDIR /openair-smf/build/scripts
RUN ldconfig && \
./build_smf --clean --Verbose --build-type Release --jobs && \
ldd /openair-smf/build/smf/build/smf && \ ldd /openair-smf/build/smf/build/smf && \
mv /openair-smf/build/smf/build/smf /openair-smf/build/smf/build/oai_smf mv /openair-smf/build/smf/build/smf /openair-smf/build/smf/build/oai_smf
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# TARGET IMAGE # TARGET IMAGE
#--------------------------------------------------------------------- #---------------------------------------------------------------------
FROM ubuntu:bionic as oai-smf FROM $BASE_IMAGE as oai-smf
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Paris ENV TZ=Europe/Paris
# We install some debug tools for the moment in addition of mandatory libraries # We install some debug tools for the moment in addition of mandatory libraries
RUN apt-get update && \ RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \ DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \ DEBIAN_FRONTEND=noninteractive apt-get install --yes \
python3 \
python3-jinja2 \
psmisc \ psmisc \
net-tools \ net-tools \
tzdata \
bc \ bc \
perl \ libssh-4 \
openssl \ openssl \
libasan4 \ libbrotli1 \
netbase \
# Ubuntu 18 --> libasan4
# Ubuntu 20 --> libasan5
# Ubuntu 22 --> libasan6
# libasan? \
libgssapi-krb5-2 \ libgssapi-krb5-2 \
libldap-2.4-2 \ # Ubuntu 18/20 --> libldap-2.4-2
libgoogle-glog0v5 \ # Ubuntu 22 --> libldap-2.5-0
libdouble-conversion1 \ libldap-2.?-? \
libconfig++9v5 \ libconfig++9v5 \
&& rm -rf /var/lib/apt/lists/* libsctp1 \
librtmp1 \
libpsl5 \
libcurl?-gnutls \
# Ubuntu 18 --> boost62/65 -> will remove both
# Ubuntu 20 --> boost67/71 -> will remove 67
# Ubuntu 22 --> boost74
libboost-thread1.??.0 \
libboost-chrono1.??.0 \
&& rm -rf /var/lib/apt/lists/* \
/lib/x86_64-linux-gnu/libboost_system.so.1.6*.0 \
/lib/x86_64-linux-gnu/libboost_chrono.so.1.6*.0 \
/lib/x86_64-linux-gnu/libboost_thread.so.1.6*.0
# Copying executable and generated libraries # Copying executable and generated libraries
WORKDIR /openair-smf/bin WORKDIR /openair-smf/bin
COPY --from=oai-smf-builder \ COPY --from=oai-smf-builder \
/openair-smf/build/smf/build/oai_smf \ /openair-smf/build/smf/build/oai_smf \
/openair-smf/scripts/entrypoint.sh \ /openair-smf/scripts/entrypoint.py \
/openair-smf/scripts/healthcheck.sh \
./ ./
WORKDIR /usr/local/lib/ WORKDIR /usr/local/lib/
COPY --from=oai-smf-builder \ COPY --from=oai-smf-builder \
/usr/local/lib/libpistache.so \ # Copying only the packages built from source
/usr/local/lib/libnghttp2.so.14 \ /usr/local/lib/libnghttp2.so.14 \
/usr/local/lib/libnghttp2_asio.so.1 \ /usr/local/lib/libnghttp2_asio.so.1 \
/usr/lib/libboost_system.so.1.67.0 \ /usr/local/lib/libpistache.so \
/usr/lib/libboost_thread.so.1.67.0 \
/usr/lib/libboost_chrono.so.1.67.0 \
/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 \
/openair-smf/build/smf/build/nas/libNAS.so \ /openair-smf/build/smf/build/nas/libNAS.so \
# Ubuntu 18 --> boost 67 will be copied
/usr/lib/libboost_system.so.1.* \
/usr/lib/libboost_thread.so.1.* \
/usr/lib/libboost_chrono.so.1.* \
./ ./
RUN ldconfig && \ RUN ldconfig && \
ldd /openair-smf/bin/oai_smf ldd /openair-smf/bin/oai_smf
...@@ -113,7 +140,13 @@ COPY --from=oai-smf-builder /openair-smf/etc/smf.conf . ...@@ -113,7 +140,13 @@ COPY --from=oai-smf-builder /openair-smf/etc/smf.conf .
WORKDIR /openair-smf WORKDIR /openair-smf
# expose ports
EXPOSE 80/tcp 9090/tcp 8805/udp EXPOSE 80/tcp 9090/tcp 8805/udp
# healthcheck
HEALTHCHECK --interval=10s \
--timeout=15s \
--retries=6 \
CMD /openair-smf/bin/healthcheck.sh
ENTRYPOINT ["/bin/bash","/openair-smf/bin/entrypoint.sh"] ENTRYPOINT ["python3","/openair-smf/bin/entrypoint.py"]
CMD ["/openair-smf/bin/oai_smf", "-c", "/openair-smf/etc/smf.conf", "-o"] CMD ["/openair-smf/bin/oai_smf", "-c", "/openair-smf/etc/smf.conf", "-o"]
jinj2-generated configuration file #
We are switching to `python3-jinja2` tool in order to generate more complex configuration for our 5G core network functions.
Pre-requisites: install python3 and jinja2 packages:
```bash
sudo apt-get install -y python3 python3-jinja2
# or
sudo yum install -y python3 python3-pip
pip3 install jinja2
```
In a container deployment, you will still have to provide environment variables through a `docker-compose-file` or helm charts.
But you can also emulate how the entrypoint behaves locally on your workspace.
## Simple one-slice deployment ##
Create a `test-jinja.sh` file and edit it:
```bash
$ vi test-jinja.sh
cp ./etc/smf.conf ./etc/smf_copy.conf
export CONFIG_FILE=./etc/smf_copy.conf
export MOUNT_CONFIG=NO
export TZ=Europe/Paris
export SMF_INTERFACE_NAME_FOR_N4=eth0
export SMF_INTERFACE_NAME_FOR_SBI=eth0
export DEFAULT_DNS_IPV4_ADDRESS=172.21.3.100
export DEFAULT_DNS_SEC_IPV4_ADDRESS=8.8.8.8
export REGISTER_NRF=yes
export DISCOVER_UPF=yes
export USE_LOCAL_SUBSCRIPTION_INFO=yes
export USE_FQDN_DNS=yes
export AMF_IPV4_ADDRESS=192.168.70.132
export AMF_FQDN=oai-amf
export UDM_IPV4_ADDRESS=192.168.70.137
export UDM_API_VERSION=v2
export UDM_FQDN=oai-udm
export NRF_IPV4_ADDRESS=192.168.70.130
export NRF_FQDN=oai-nrf
export UPF_IPV4_ADDRESS=192.168.70.134
export UPF_FQDN_0=oai-spgwu
export DNN_NI0=oai
export TYPE0=IPv4
export DNN_RANGE0='12.1.1.151 - 12.1.1.253'
export NSSAI_SST0=1
#export NSSAI_SD0=123
export SESSION_AMBR_UL0=200Mbps
export SESSION_AMBR_DL0=400Mbps
./scripts/entrypoint.py
$ chmod 755 test-jinja.sh
$ ./test-jinja2.sh
Configuration file ./etc/smf_copy.conf is ready
```
## List of fields ##
### Features ###
Here is the current list of fields, with their mandatory status and any default values.
If there is no default value associated to a field, it means it is **MANDATORY** to provide one.
| Field Name | Mandatory / Optional | Default value if any |
|:-----------|----------------------|---------------------:|
| INSTANCE | Optional | 0 |
| PID_DIRECTORY | Optional | /var/run |
| UE_MTU | Optional | 1500 |
| REGISTER_NRF | Optional | no |
| DISCOVER_UPF | Optional | no |
| DISCOVER_PCF | Optional | no |
| USE_LOCAL_SUBSCRIPTION_INFO | Optional | no |
| USE_LOCAL_PCC_RULES | Optional | yes |
| USE_FQDN_DNS | Optional | no |
| HTTP_VERSION | Optional | 1 |
| USE_NETWORK_INSTANCE | Optional | 1 |
| ENABLE_USAGE_REPORTING | Optional | no |
### Networking ###
| Field Name | Mandatory / Optional | Default value if any |
|:-----------|----------------------|---------------------:|
| SMF_INTERFACE_NAME_FOR_N4 | Mandatory | |
| SMF_INTERFACE_NAME_FOR_SBI | Mandatory | |
| SMF_INTERFACE_PORT_FOR_SBI | Optional | 80 |
| SMF_INTERFACE_HTTP2_PORT_FOR_SBI | Optional | 8080 |
| SMF_API_VERSION | Optional | v1 |
| DEFAULT_DNS_IPV4_ADDRESS | Mandatory | |
| DEFAULT_DNS_SEC_IPV4_ADDRESS | Mandatory | |
| DEFAULT_CSCF_IPV4_ADDRESS | Optional | 127.0.0.1 |
| AMF_HOSTNAME | Optional | |
| AMF_IPV4_ADDRESS | Mandatory if AMF_HOSTNAME not defined | 0.0.0.0 |
| AMF_PORT | Optional | 80 |
| AMF_API_VERSION | Optional | v1 |
| AMF_FQDN | Optional | localhost |
| UDM_HOSTNAME | Optional | |
| UDM_IPV4_ADDRESS | Mandatory if UDM_HOSTNAME not defined | 0.0.0.0 |
| UDM_PORT | Optional | 80 |
| UDM_API_VERSION | Optional | v1 |
| UDM_FQDN | Optional | localhost |
| NRF_HOSTNAME | Optional | |
| NRF_IPV4_ADDRESS | Mandatory if NRF_HOSTNAME not defined | 0.0.0.0 |
| NRF_PORT | Optional | 80 |
| NRF_API_VERSION | Optional | v1 |
| NRF_FQDN | Optional | localhost |
| PCF_HOSTNAME | Optional | |
| PCF_IPV4_ADDRESS | Mandatory if PCF_HOSTNAME not defined | 0.0.0.0 |
| PCF_PORT | Optional | 80 |
| PCF_API_VERSION | Optional | v1 |
| PCF_FQDN | Optional | localhost |
Currently we are supporting only one UPF.
| Field Name | Mandatory / Optional | Default value if any |
|:-----------|----------------------|---------------------:|
| UPF0_HOSTNAME | Optional | |
| UPF_IPV4_ADDRESS | Mandatory if UPF0_HOSTNAME not defined | 0.0.0.0 |
| UPF_FQDN_0 | Optional | localhost |
| DOMAIN_ACCESS_0 | Optional | access.oai.org |
| DOMAIN_CORE_0 | Optional | core.oai.org |
### Slice Management ###
At least 1 slice (`SLICE0`) **SHALL** be configured. See example in first section above.
We currently support up to 4 slices. When configuring, please do in order (`SLICE0`, `SLICE1`, ...).
The mandatory keywords per slice are `DNN_NIx` and `NSSAI_SSTx`. Once they are both defined for a slice, all parameters **SHALL** be defined.
| Field Name | Mandatory / Optional | Default value if any |
|:-----------|----------------------|---------------------:|
| DNN_NIx | Mandatory | |
| TYPEx | Optional | IPv4 |
| DNN_RANGEx | Mandatory | |
| NSSAI_SSTx | Mandatory | |
| NSSAI_SDx | Optional | 0xFFFFFF |
| QOS_PROFILE_5QIx | Optional | 6 or 7 or 8 or 9 |
| SESSION_AMBR_ULx | Optional | 20Mbps |
| SESSION_AMBR_DLx | Optional | 22Mbps |
`DNN_RANGEx` shall be formatted like this : `'12.2.1.2 - 12.2.1.128'`.
See example in first section above.
This diff is collapsed.
#!/usr/bin/env python3
################################################################################
# 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
################################################################################
from jinja2 import Environment, FileSystemLoader
import socket
import os
import sys
CONFIG_FILE = str(os.getenv('CONFIG_FILE','/openair-smf/etc/smf.conf'))
MOUNT_CONFIG = str(os.getenv('MOUNT_CONFIG','no')).lower()
def resolve(hostname):
try:
return socket.gethostbyname(hostname)
except socket.error:
print(f"Not able to resolve {hostname}")
def render(filepath,funcs,values):
env = Environment(loader=FileSystemLoader(os.path.dirname(filepath)))
jinja_template = env.get_template(os.path.basename(filepath))
jinja_template.globals.update(funcs)
template_string = jinja_template.render(env=values)
return template_string
env_variables = dict()
#list of all the environment variables
for name, value in os.environ.items():
env_variables.update({name:value})
if MOUNT_CONFIG != "yes":
output = render(CONFIG_FILE,{"resolve":resolve},env_variables)
with open(CONFIG_FILE, "w") as fh:
fh.write(output)
print(f"Configuration file {CONFIG_FILE} is ready")
if len(sys.argv) == 1:
sys.exit(0)
os.execvp(sys.argv[1], sys.argv[1:]) #important for running the network function it works like exec $@
else:
print("Configuration file is mounted to the network function")
#!/bin/bash
set -euo pipefail
CONFIG_DIR="/openair-smf/etc"
# Default values
ENABLE_USAGE_REPORTING=${ENABLE_USAGE_REPORTING:-no}
USE_NETWORK_INSTANCE=${USE_NETWORK_INSTANCE:-no}
USE_LOCAL_SUBSCRIPTION_INFO=${USE_LOCAL_SUBSCRIPTION_INFO:-yes}
DOMAIN_ACCESS=${DOMAIN_ACCESS:-access.oai.org}
DOMAIN_CORE=${DOMAIN_CORE:-core.oai.org}
UE_MTU=${UE_MTU:-1358}
NSSAI_SST0=${NSSAI_SST0:-222}
NSSAI_SD0=${NSSAI_SD0:-123}
NSSAI_SST1=${NSSAI_SST1:-1}
NSSAI_SD1=${NSSAI_SD1:-1}
NSSAI_SST2=${NSSAI_SST2:-1}
NSSAI_SD2=${NSSAI_SD2:-1}
QOS_PROFILE_5QI0=${QOS_PROFILE_5QI0:-6}
QOS_PROFILE_5QI1=${QOS_PROFILE_5QI1:-7}
QOS_PROFILE_5QI2=${QOS_PROFILE_5QI2:-8}
SESSION_AMBR_UL0=${SESSION_AMBR_UL0:-20Mbps}
SESSION_AMBR_DL0=${SESSION_AMBR_DL0:-22Mbps}
SESSION_AMBR_UL1=${SESSION_AMBR_UL1:-20Mbps}
SESSION_AMBR_DL1=${SESSION_AMBR_DL1:-22Mbps}
SESSION_AMBR_UL2=${SESSION_AMBR_UL2:-20Mbps}
SESSION_AMBR_DL2=${SESSION_AMBR_DL2:-22Mbps}
if [[ ${USE_FQDN_DNS} == "yes" ]];then
AMF_IPV4_ADDRESS=${AMF_IPV4_ADDRESS:-0.0.0.0}
NRF_IPV4_ADDRESS=${NRF_IPV4_ADDRESS:-0.0.0.0}
UPF_IPV4_ADDRESS=${UPF_IPV4_ADDRESS:-0.0.0.0}
UDM_IPV4_ADDRESS=${UDM_IPV4_ADDRESS:-0.0.0.0}
fi
DEFAULT_CSCF_IPV4_ADDRESS=${DEFAULT_CSCF_IPV4_ADDRESS:-127.0.0.1}
HTTP_VERSION=${HTTP_VERSION:-1}
DNN_NI0=${DNN_NI0:-oai.ipv4}
TYPE0=${TYPE0:-IPv4}
DNN_RANGE0=${DNN_RANGE0:-'12.1.1.2 - 12.1.1.128'}
DNN_NI1=${DNN_NI1:-default}
TYPE1=${TYPE1:-IPv4}
DNN_RANGE1=${DNN_RANGE1:-'12.2.1.2 - 12.2.1.128'}
DNN_NI2=${DNN_NI2:-oai}
TYPE2=${TYPE2:-IPv4}
DNN_RANGE2=${DNN_RANGE2:-'12.1.1.129 - 12.1.1.224'}
DNN_NI3=${DNN_NI3:-ims}
TYPE3=${TYPE3:-IPv4v6}
DNN_RANGE3=${DNN_RANGE3:-'12.2.1.129 - 12.2.1.224'}
for c in ${CONFIG_DIR}/*.conf; do
# grep variable names (format: ${VAR}) from template to be rendered
if ! grep -oP '@[a-zA-Z0-9_]+@' ${c}; then
echo "Configuration is already set"
exec "$@"
fi
VARS=$(grep -oP '@[a-zA-Z0-9_]+@' ${c} | sort | uniq | xargs)
echo "Now setting these variables '${VARS}'"
# 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 [[ -z ${!NEW_VAR+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
echo "Done setting the configuration"
exec "$@"
#!/bin/bash
set -eo pipefail
STATUS=0
SMF_IP_SBI_INTERFACE=$(ifconfig $SMF_INTERFACE_NAME_FOR_SBI | grep inet | awk {'print $2'})
#Check if entrypoint properly configured the conf file and no parameter is unset(optional)
SMF_SBI_PORT_STATUS=$(netstat -tnpl | grep -o "$SMF_IP_SBI_INTERFACE:$SMF_INTERFACE_PORT_FOR_SBI")
NB_UNREPLACED_AT=`cat /openair-smf/etc/*.conf | grep -v contact@openairinterface.org | grep -c @ || true`
if [ $NB_UNREPLACED_AT -ne 0 ]; then
STATUS=-1
echo "Healthcheck error: UNHEALTHY configuration file is not configured properly"
fi
if [[ -z $SMF_SBI_PORT_STATUS ]]; then
STATUS=-1
echo "Healthcheck error: UNHEALTHY SBI TCP/HTTP port $SMF_INTERFACE_PORT_FOR_SBI is not listening."
fi
exit $STATUS
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "NFStatusNotifyApi.h" #include "NFStatusNotifyApi.h"
#include "Helpers.h" #include "Helpers.h"
#include "logger.hpp"
#include "smf_config.hpp" #include "smf_config.hpp"
extern smf::smf_config smf_cfg; extern smf::smf_config smf_cfg;
...@@ -56,6 +57,9 @@ void NFStatusNotifyApi::setupRoutes() { ...@@ -56,6 +57,9 @@ void NFStatusNotifyApi::setupRoutes() {
void NFStatusNotifyApi::notify_nf_status_handler( void NFStatusNotifyApi::notify_nf_status_handler(
const Pistache::Rest::Request& request, const Pistache::Rest::Request& request,
Pistache::Http::ResponseWriter response) { Pistache::Http::ResponseWriter response) {
Logger::smf_api_server().info("Received a NFStatusNotify message");
Logger::smf_api_server().debug("Message body: %s", request.body().c_str());
// Getting the body param // Getting the body param
NotificationData notificationData; NotificationData notificationData;
......
...@@ -65,15 +65,13 @@ void IndividualSMContextApiImpl::release_sm_context( ...@@ -65,15 +65,13 @@ void IndividualSMContextApiImpl::release_sm_context(
xgpp_conv::sm_context_release_from_openapi( xgpp_conv::sm_context_release_from_openapi(
smContextReleaseMessage, sm_context_req_msg); smContextReleaseMessage, sm_context_req_msg);
boost::shared_ptr< boost::shared_ptr<boost::promise<nlohmann::json> > p =
boost::promise<smf::pdu_session_release_sm_context_response> > boost::make_shared<boost::promise<nlohmann::json> >();
p = boost::make_shared< boost::shared_future<nlohmann::json> f;
boost::promise<smf::pdu_session_release_sm_context_response> >();
boost::shared_future<smf::pdu_session_release_sm_context_response> f;
f = p->get_future(); f = p->get_future();
// Generate ID for this promise (to be used in SMF-APP) // Generate ID for this promise (to be used in SMF-APP)
uint32_t promise_id = generate_promise_id(); uint32_t promise_id = m_smf_app->generate_promise_id();
Logger::smf_api_server().debug("Promise ID generated %d", promise_id); Logger::smf_api_server().debug("Promise ID generated %d", promise_id);
m_smf_app->add_promise(promise_id, p); m_smf_app->add_promise(promise_id, p);
...@@ -85,12 +83,24 @@ void IndividualSMContextApiImpl::release_sm_context( ...@@ -85,12 +83,24 @@ void IndividualSMContextApiImpl::release_sm_context(
itti_msg->http_version = 1; itti_msg->http_version = 1;
m_smf_app->handle_pdu_session_release_sm_context_request(itti_msg); m_smf_app->handle_pdu_session_release_sm_context_request(itti_msg);
// Wait for the result from APP and send reply to AMF boost::future_status status;
smf::pdu_session_release_sm_context_response sm_context_response = f.get(); // wait for timeout or ready
Logger::smf_api_server().debug("Got result for promise ID %d", promise_id); status = f.wait_for(boost::chrono::milliseconds(FUTURE_STATUS_TIMEOUT_MS));
int http_code = http_status_code_e::HTTP_STATUS_CODE_408_REQUEST_TIMEOUT;
// TODO: Process the response if (status == boost::future_status::ready) {
response.send(Pistache::Http::Code(sm_context_response.get_http_code())); assert(f.is_ready());
assert(f.has_value());
assert(!f.has_exception());
// Wait for the result from APP and send reply to NF consumer (e.g., AMF)
nlohmann::json sm_context_response = f.get();
Logger::smf_api_server().debug("Got result for promise ID %d", promise_id);
if (sm_context_response.find("http_code") != sm_context_response.end()) {
http_code = sm_context_response["http_code"].get<int>();
}
// TODO: Process the response
}
response.send(Pistache::Http::Code(http_code));
} }
void IndividualSMContextApiImpl::retrieve_sm_context( void IndividualSMContextApiImpl::retrieve_sm_context(
...@@ -118,15 +128,13 @@ void IndividualSMContextApiImpl::update_sm_context( ...@@ -118,15 +128,13 @@ void IndividualSMContextApiImpl::update_sm_context(
xgpp_conv::sm_context_update_from_openapi( xgpp_conv::sm_context_update_from_openapi(
smContextUpdateMessage, sm_context_req_msg); smContextUpdateMessage, sm_context_req_msg);
boost::shared_ptr< boost::shared_ptr<boost::promise<nlohmann::json> > p =
boost::promise<smf::pdu_session_update_sm_context_response> > boost::make_shared<boost::promise<nlohmann::json> >();
p = boost::make_shared< boost::shared_future<nlohmann::json> f;
boost::promise<smf::pdu_session_update_sm_context_response> >();
boost::shared_future<smf::pdu_session_update_sm_context_response> f;
f = p->get_future(); f = p->get_future();
// Generate ID for this promise (to be used in SMF-APP) // Generate ID for this promise (to be used in SMF-APP)
uint32_t promise_id = generate_promise_id(); uint32_t promise_id = m_smf_app->generate_promise_id();
Logger::smf_api_server().debug("Promise ID generated %d", promise_id); Logger::smf_api_server().debug("Promise ID generated %d", promise_id);
m_smf_app->add_promise(promise_id, p); m_smf_app->add_promise(promise_id, p);
...@@ -138,54 +146,90 @@ void IndividualSMContextApiImpl::update_sm_context( ...@@ -138,54 +146,90 @@ void IndividualSMContextApiImpl::update_sm_context(
itti_msg->http_version = 1; itti_msg->http_version = 1;
m_smf_app->handle_pdu_session_update_sm_context_request(itti_msg); m_smf_app->handle_pdu_session_update_sm_context_request(itti_msg);
// Wait for the result from APP and send reply to AMF boost::future_status status;
smf::pdu_session_update_sm_context_response sm_context_response = f.get(); // wait for timeout or ready
Logger::smf_api_server().debug("Got result for promise ID %d", promise_id); status = f.wait_for(boost::chrono::milliseconds(FUTURE_STATUS_TIMEOUT_MS));
if (status == boost::future_status::ready) {
nlohmann::json json_data = {}; assert(f.is_ready());
std::string body = {}; assert(f.has_value());
std::string json_format; assert(!f.has_exception());
// Wait for the result from APP and send reply to NF consumer (e.g., AMF)
sm_context_response.get_json_format(json_format); nlohmann::json sm_context_response = f.get();
sm_context_response.get_json_data(json_data); Logger::smf_api_server().debug("Got result for promise ID %d", promise_id);
Logger::smf_api_server().debug("Json data %s", json_data.dump().c_str());
nlohmann::json json_data = {};
if (sm_context_response.n1_sm_msg_is_set() and std::string body = {};
sm_context_response.n2_sm_info_is_set()) { std::string json_format;
mime_parser::create_multipart_related_content( bool n1_sm_msg_is_set = false;
body, json_data.dump(), CURL_MIME_BOUNDARY, bool n2_sm_info_is_set = false;
sm_context_response.get_n1_sm_message(),
sm_context_response.get_n2_sm_information(), json_format); int http_code = http_status_code_e::HTTP_STATUS_CODE_408_REQUEST_TIMEOUT;
response.headers().add<Pistache::Http::Header::ContentType>( if (sm_context_response.find("http_code") != sm_context_response.end()) {
Pistache::Http::Mime::MediaType( http_code = sm_context_response["http_code"].get<int>();
"multipart/related; boundary=" + std::string(CURL_MIME_BOUNDARY))); }
} else if (sm_context_response.n1_sm_msg_is_set()) {
mime_parser::create_multipart_related_content( if (sm_context_response.find("json_format") != sm_context_response.end()) {
body, json_data.dump(), CURL_MIME_BOUNDARY, json_format = sm_context_response["json_format"].get<std::string>();
sm_context_response.get_n1_sm_message(), }
multipart_related_content_part_e::NAS, json_format); if (sm_context_response.find("json_data") != sm_context_response.end()) {
response.headers().add<Pistache::Http::Header::ContentType>( json_data = sm_context_response["json_data"];
Pistache::Http::Mime::MediaType( }
"multipart/related; boundary=" + std::string(CURL_MIME_BOUNDARY)));
} else if (sm_context_response.n2_sm_info_is_set()) { if (sm_context_response.find("n1_sm_message") !=
mime_parser::create_multipart_related_content( sm_context_response.end()) {
body, json_data.dump(), CURL_MIME_BOUNDARY, // json_data = sm_context_response["n1_sm_message"].get<std::string>();
sm_context_response.get_n2_sm_information(), n1_sm_msg_is_set = true;
multipart_related_content_part_e::NGAP, json_format); }
response.headers().add<Pistache::Http::Header::ContentType>(
Pistache::Http::Mime::MediaType( if (sm_context_response.find("n2_sm_information") !=
"multipart/related; boundary=" + std::string(CURL_MIME_BOUNDARY))); sm_context_response.end()) {
} else if (json_data.size() > 0) { n2_sm_info_is_set = true;
response.headers().add<Pistache::Http::Header::ContentType>( }
Pistache::Http::Mime::MediaType(json_format));
body = json_data.dump().c_str(); // sm_context_response.get_json_format(json_format);
// sm_context_response.get_json_data(json_data);
Logger::smf_api_server().debug("Json data %s", json_data.dump().c_str());
if (n1_sm_msg_is_set and n2_sm_info_is_set) {
mime_parser::create_multipart_related_content(
body, json_data.dump(), CURL_MIME_BOUNDARY,
sm_context_response["n1_sm_message"].get<std::string>(),
sm_context_response["n2_sm_information"].get<std::string>(),
json_format);
response.headers().add<Pistache::Http::Header::ContentType>(
Pistache::Http::Mime::MediaType(
"multipart/related; boundary=" +
std::string(CURL_MIME_BOUNDARY)));
} else if (n1_sm_msg_is_set) {
mime_parser::create_multipart_related_content(
body, json_data.dump(), CURL_MIME_BOUNDARY,
sm_context_response["n1_sm_message"].get<std::string>(),
multipart_related_content_part_e::NAS, json_format);
response.headers().add<Pistache::Http::Header::ContentType>(
Pistache::Http::Mime::MediaType(
"multipart/related; boundary=" +
std::string(CURL_MIME_BOUNDARY)));
} else if (n2_sm_info_is_set) {
mime_parser::create_multipart_related_content(
body, json_data.dump(), CURL_MIME_BOUNDARY,
sm_context_response["n2_sm_information"].get<std::string>(),
multipart_related_content_part_e::NGAP, json_format);
response.headers().add<Pistache::Http::Header::ContentType>(
Pistache::Http::Mime::MediaType(
"multipart/related; boundary=" +
std::string(CURL_MIME_BOUNDARY)));
} else if (json_data.size() > 0) {
response.headers().add<Pistache::Http::Header::ContentType>(
Pistache::Http::Mime::MediaType(json_format));
body = json_data.dump().c_str();
} else {
response.send(Pistache::Http::Code(http_code));
return;
}
response.send(Pistache::Http::Code(http_code), body);
} else { } else {
response.send(Pistache::Http::Code(sm_context_response.get_http_code())); response.send(Pistache::Http::Code::Request_Timeout);
return;
} }
response.send(
Pistache::Http::Code(sm_context_response.get_http_code()), body);
} }
} // namespace api } // namespace api
} // namespace smf_server } // namespace smf_server
......
...@@ -94,9 +94,6 @@ class IndividualSMContextApiImpl ...@@ -94,9 +94,6 @@ class IndividualSMContextApiImpl
std::string m_address; std::string m_address;
protected: protected:
static uint64_t generate_promise_id() {
return util::uint_uid_generator<uint64_t>::get_instance().get_uid();
}
}; };
} // namespace api } // namespace api
......
...@@ -84,15 +84,13 @@ void SMContextsCollectionApiImpl::post_sm_contexts( ...@@ -84,15 +84,13 @@ void SMContextsCollectionApiImpl::post_sm_contexts(
m_address + base + smf_cfg.sbi_api_version + m_address + base + smf_cfg.sbi_api_version +
NSMF_PDU_SESSION_SM_CONTEXT_CREATE_URL); NSMF_PDU_SESSION_SM_CONTEXT_CREATE_URL);
boost::shared_ptr< boost::shared_ptr<boost::promise<nlohmann::json> > p =
boost::promise<smf::pdu_session_create_sm_context_response> > boost::make_shared<boost::promise<nlohmann::json> >();
p = boost::make_shared< boost::shared_future<nlohmann::json> f;
boost::promise<smf::pdu_session_create_sm_context_response> >();
boost::shared_future<smf::pdu_session_create_sm_context_response> f;
f = p->get_future(); f = p->get_future();
// Generate ID for this promise (to be used in SMF-APP) // Generate ID for this promise (to be used in SMF-APP)
uint32_t promise_id = generate_promise_id(); uint32_t promise_id = m_smf_app->generate_promise_id();
Logger::smf_api_server().debug("Promise ID generated %d", promise_id); Logger::smf_api_server().debug("Promise ID generated %d", promise_id);
m_smf_app->add_promise(promise_id, p); m_smf_app->add_promise(promise_id, p);
...@@ -112,40 +110,60 @@ void SMContextsCollectionApiImpl::post_sm_contexts( ...@@ -112,40 +110,60 @@ void SMContextsCollectionApiImpl::post_sm_contexts(
assert(f.has_value()); assert(f.has_value());
assert(!f.has_exception()); assert(!f.has_exception());
// Wait for the result from APP and send reply to AMF // Wait for the result from APP and send reply to AMF
smf::pdu_session_create_sm_context_response sm_context_response = f.get(); nlohmann::json sm_context_response = f.get();
Logger::smf_api_server().debug("Got result for promise ID %d", promise_id); Logger::smf_api_server().debug("Got result for promise ID %d", promise_id);
nlohmann::json json_data = {}; nlohmann::json json_data = {};
std::string json_format = {}; std::string json_format = {};
std::string body = {}; std::string body = {};
bool n1_sm_msg_is_set = false;
sm_context_response.get_json_data(json_data); int http_code = http_status_code_e::HTTP_STATUS_CODE_408_REQUEST_TIMEOUT;
sm_context_response.get_json_format(json_format); if (sm_context_response.find("http_code") != sm_context_response.end()) {
http_code = sm_context_response["http_code"].get<int>();
}
if (sm_context_response.n1_sm_msg_is_set()) { // add N1 container if if (sm_context_response.find("json_format") != sm_context_response.end()) {
// available json_format = sm_context_response["json_format"].get<std::string>();
}
if (sm_context_response.find("json_data") != sm_context_response.end()) {
json_data = sm_context_response["json_data"];
}
if (sm_context_response.find("n1_sm_message") !=
sm_context_response.end()) {
// json_data = sm_context_response["n1_sm_message"].get<std::string>();
n1_sm_msg_is_set = true;
}
if (http_code == http_status_code_e::HTTP_STATUS_CODE_201_CREATED) {
if (sm_context_response.find("smf_context_uri") !=
sm_context_response.end()) {
response.headers().add<Pistache::Http::Header::Location>(
sm_context_response["smf_context_uri"]
.get<std::string>()); // Location header
}
}
if (n1_sm_msg_is_set) { // add N1 container if available
mime_parser::create_multipart_related_content( mime_parser::create_multipart_related_content(
body, json_data.dump(), CURL_MIME_BOUNDARY, body, json_data.dump(), CURL_MIME_BOUNDARY,
sm_context_response.get_n1_sm_message(), sm_context_response["n1_sm_message"].get<std::string>(),
multipart_related_content_part_e::NAS, json_format); multipart_related_content_part_e::NAS, json_format);
response.headers().add<Pistache::Http::Header::ContentType>( response.headers().add<Pistache::Http::Header::ContentType>(
Pistache::Http::Mime::MediaType( Pistache::Http::Mime::MediaType(
"multipart/related; boundary=" + "multipart/related; boundary=" +
std::string(CURL_MIME_BOUNDARY))); std::string(CURL_MIME_BOUNDARY)));
} else if (!json_data.empty()) { // if not, include json data if available } else if (!json_data.empty()) { // if not, include json data if available
response.headers().add<Pistache::Http::Header::Location>(
sm_context_response.get_smf_context_uri()); // Location header
response.headers().add<Pistache::Http::Header::ContentType>( response.headers().add<Pistache::Http::Header::ContentType>(
Pistache::Http::Mime::MediaType(json_format)); Pistache::Http::Mime::MediaType(json_format));
body = json_data.dump().c_str(); body = json_data.dump().c_str();
} else { // otherwise, send reply without content } else { // otherwise, send reply without content
response.send(Pistache::Http::Code(sm_context_response.get_http_code())); response.send(Pistache::Http::Code(http_code));
return; return;
} }
response.send( response.send(Pistache::Http::Code(http_code), body);
Pistache::Http::Code(sm_context_response.get_http_code()), body);
} else { } else {
response.send(Pistache::Http::Code::Request_Timeout); response.send(Pistache::Http::Code::Request_Timeout);
} }
......
...@@ -79,9 +79,6 @@ class SMContextsCollectionApiImpl ...@@ -79,9 +79,6 @@ class SMContextsCollectionApiImpl
std::string m_address; std::string m_address;
protected: protected:
static uint64_t generate_promise_id() {
return util::uint_uid_generator<uint64_t>::get_instance().get_uid();
}
}; };
} // namespace api } // namespace api
......
...@@ -77,9 +77,6 @@ class SubscriptionsCollectionApiImpl ...@@ -77,9 +77,6 @@ class SubscriptionsCollectionApiImpl
std::string m_address; std::string m_address;
protected: protected:
static uint64_t generate_promise_id() {
return util::uint_uid_generator<uint64_t>::get_instance().get_uid();
}
}; };
} // namespace api } // namespace api
......
/** /**
* Nsmf_PDUSession * Npcf_SMPolicyControl API
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, * Session Management Policy Control Service © 2020, 3GPP Organizational
* CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved. * Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
* *
* The version of the OpenAPI document: 1.1.0.alpha-1 * The version of the OpenAPI document: 1.1.1.alpha-5
* *
* *
* NOTE: This class is auto generated by OpenAPI Generator * NOTE: This class is auto generated by OpenAPI Generator
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
*/ */
#include "AccessType.h" #include "AccessType.h"
#include "Helpers.h"
#include <stdexcept>
#include <sstream>
namespace oai { namespace oai {
namespace smf_server { namespace smf_server {
...@@ -19,17 +22,79 @@ namespace model { ...@@ -19,17 +22,79 @@ namespace model {
AccessType::AccessType() {} AccessType::AccessType() {}
AccessType::~AccessType() {} void AccessType::validate() const {
std::stringstream msg;
if (!validate(msg)) {
// throw
// org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool AccessType::validate(std::stringstream& msg) const {
return validate(msg, "");
}
bool AccessType::validate(
std::stringstream& msg, const std::string& pathPrefix) const {
bool success = true;
const std::string _pathPrefix =
pathPrefix.empty() ? "AccessType" : pathPrefix;
if (m_value == AccessType::eAccessType::INVALID_VALUE_OPENAPI_GENERATED) {
success = false;
msg << _pathPrefix << ": has no value;";
}
return success;
}
bool AccessType::operator==(const AccessType& rhs) const {
return getValue() == rhs.getValue()
void AccessType::validate() { ;
// TODO: implement validation }
bool AccessType::operator!=(const AccessType& rhs) const {
return !(*this == rhs);
} }
void to_json(nlohmann::json& j, const AccessType& o) { void to_json(nlohmann::json& j, const AccessType& o) {
j = nlohmann::json(); j = nlohmann::json();
switch (o.getValue()) {
case AccessType::eAccessType::INVALID_VALUE_OPENAPI_GENERATED:
j = "INVALID_VALUE_OPENAPI_GENERATED";
break;
case AccessType::eAccessType::API_3GPP_ACCESS:
j = "3GPP_ACCESS";
break;
case AccessType::eAccessType::API_NON_3GPP_ACCESS:
j = "NON_3GPP_ACCESS";
break;
}
} }
void from_json(const nlohmann::json& j, AccessType& o) {} void from_json(const nlohmann::json& j, AccessType& o) {
auto s = j.get<std::string>();
if (s == "3GPP_ACCESS") {
o.setValue(AccessType::eAccessType::API_3GPP_ACCESS);
} else if (s == "NON_3GPP_ACCESS") {
o.setValue(AccessType::eAccessType::API_NON_3GPP_ACCESS);
} else {
std::stringstream ss;
ss << "Unexpected value " << s << " in json"
<< " cannot be converted to enum of type"
<< " AccessType::eAccessType";
throw std::invalid_argument(ss.str());
}
}
AccessType::eAccessType AccessType::getValue() const {
return m_value;
}
void AccessType::setValue(AccessType::eAccessType value) {
m_value = value;
}
} // namespace model } // namespace model
} // namespace smf_server } // namespace smf_server
......
/** /**
* Nsmf_PDUSession * Npcf_SMPolicyControl API
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, * Session Management Policy Control Service © 2020, 3GPP Organizational
* CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved. * Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
* *
* The version of the OpenAPI document: 1.1.0.alpha-1 * The version of the OpenAPI document: 1.1.1.alpha-5
* *
* *
* NOTE: This class is auto generated by OpenAPI Generator * NOTE: This class is auto generated by OpenAPI Generator
...@@ -31,21 +31,54 @@ namespace model { ...@@ -31,21 +31,54 @@ namespace model {
class AccessType { class AccessType {
public: public:
AccessType(); AccessType();
virtual ~AccessType(); virtual ~AccessType() = default;
void validate(); enum class eAccessType {
// To have a valid default value.
// Avoiding name clashes with user defined
// enum values
// use API prefix to not have naming conflicts with NAS messages
INVALID_VALUE_OPENAPI_GENERATED = 0,
API_3GPP_ACCESS,
API_NON_3GPP_ACCESS
};
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on
/// failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes
/// an error message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and
/// calls it's validate. Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const AccessType& rhs) const;
bool operator!=(const AccessType& rhs) const;
///////////////////////////////////////////// /////////////////////////////////////////////
/// AccessType members /// AccessType members
AccessType::eAccessType getValue() const;
void setValue(AccessType::eAccessType value);
friend void to_json(nlohmann::json& j, const AccessType& o); friend void to_json(nlohmann::json& j, const AccessType& o);
friend void from_json(const nlohmann::json& j, AccessType& o); friend void from_json(const nlohmann::json& j, AccessType& o);
protected: protected:
AccessType::eAccessType m_value =
AccessType::eAccessType::INVALID_VALUE_OPENAPI_GENERATED;
}; };
} // namespace model } // namespace model
} // namespace smf_server } // namespace smf_server
} // namespace oai } // namespace oai
#endif /* AccessType_H_ */ #endif /* AccessType_H_ */
...@@ -25,11 +25,20 @@ void Cause::validate() { ...@@ -25,11 +25,20 @@ void Cause::validate() {
// TODO: implement validation // TODO: implement validation
} }
std::string Cause::getValue() const {
return cause;
}
void Cause::setValue(const std::string& value) {
cause = value;
}
void to_json(nlohmann::json& j, const Cause& o) { void to_json(nlohmann::json& j, const Cause& o) {
j = nlohmann::json(); j = nlohmann::json();
} }
void from_json(const nlohmann::json& j, Cause& o) {} void from_json(const nlohmann::json& j, Cause& o) {
j.get_to(o.cause);
}
} // namespace model } // namespace model
} // namespace smf_server } // namespace smf_server
......
...@@ -45,11 +45,14 @@ class Cause { ...@@ -45,11 +45,14 @@ class Cause {
///////////////////////////////////////////// /////////////////////////////////////////////
/// Cause members /// Cause members
std::string getValue() const;
void setValue(const std::string& value);
friend void to_json(nlohmann::json& j, const Cause& o); friend void to_json(nlohmann::json& j, const Cause& o);
friend void from_json(const nlohmann::json& j, Cause& o); friend void from_json(const nlohmann::json& j, Cause& o);
protected: protected:
std::string cause;
}; };
} // namespace model } // namespace model
......
/** /**
* Nsmf_PDUSession * Npcf_SMPolicyControl API
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, * Session Management Policy Control Service © 2020, 3GPP Organizational
* CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved. * Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
* *
* The version of the OpenAPI document: 1.1.0.alpha-1 * The version of the OpenAPI document: 1.1.1.alpha-5
* *
* *
* NOTE: This class is auto generated by OpenAPI Generator * NOTE: This class is auto generated by OpenAPI Generator
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
*/ */
#include "DnnSelectionMode.h" #include "DnnSelectionMode.h"
#include "Helpers.h"
#include <sstream>
namespace oai { namespace oai {
namespace smf_server { namespace smf_server {
...@@ -19,17 +22,66 @@ namespace model { ...@@ -19,17 +22,66 @@ namespace model {
DnnSelectionMode::DnnSelectionMode() {} DnnSelectionMode::DnnSelectionMode() {}
DnnSelectionMode::~DnnSelectionMode() {} void DnnSelectionMode::validate() const {
std::stringstream msg;
if (!validate(msg)) {
// throw
// org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool DnnSelectionMode::validate(std::stringstream& msg) const {
return validate(msg, "");
}
bool DnnSelectionMode::validate(
std::stringstream& msg, const std::string& pathPrefix) const {
bool success = true;
const std::string _pathPrefix =
pathPrefix.empty() ? "DnnSelectionMode" : pathPrefix;
if (!m_value.validate(msg)) {
success = false;
}
return success;
}
bool DnnSelectionMode::operator==(const DnnSelectionMode& rhs) const {
return
getValue() == rhs.getValue();
}
void DnnSelectionMode::validate() { bool DnnSelectionMode::operator!=(const DnnSelectionMode& rhs) const {
// TODO: implement validation return !(*this == rhs);
} }
void to_json(nlohmann::json& j, const DnnSelectionMode& o) { void to_json(nlohmann::json& j, const DnnSelectionMode& o) {
j = nlohmann::json(); j = nlohmann::json();
to_json(j, o.m_value);
} }
void from_json(const nlohmann::json& j, DnnSelectionMode& o) {} void from_json(const nlohmann::json& j, DnnSelectionMode& o) {
from_json(j, o.m_value);
}
DnnSelectionMode_anyOf DnnSelectionMode::getValue() const {
return m_value;
}
void DnnSelectionMode::setValue(DnnSelectionMode_anyOf value) {
m_value = value;
}
DnnSelectionMode_anyOf::eDnnSelectionMode_anyOf DnnSelectionMode::getEnumValue()
const {
return m_value.getValue();
}
void DnnSelectionMode::setEnumValue(
DnnSelectionMode_anyOf::eDnnSelectionMode_anyOf value) {
m_value.setValue(value);
}
} // namespace model } // namespace model
} // namespace smf_server } // namespace smf_server
......
/** /**
* Nsmf_PDUSession * Npcf_SMPolicyControl API
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, * Session Management Policy Control Service © 2020, 3GPP Organizational
* CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved. * Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
* *
* The version of the OpenAPI document: 1.1.0.alpha-1 * The version of the OpenAPI document: 1.1.1.alpha-5
* *
* *
* NOTE: This class is auto generated by OpenAPI Generator * NOTE: This class is auto generated by OpenAPI Generator
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#ifndef DnnSelectionMode_H_ #ifndef DnnSelectionMode_H_
#define DnnSelectionMode_H_ #define DnnSelectionMode_H_
#include "DnnSelectionMode_anyOf.h"
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
namespace oai { namespace oai {
...@@ -31,21 +32,46 @@ namespace model { ...@@ -31,21 +32,46 @@ namespace model {
class DnnSelectionMode { class DnnSelectionMode {
public: public:
DnnSelectionMode(); DnnSelectionMode();
virtual ~DnnSelectionMode(); virtual ~DnnSelectionMode() = default;
void validate(); /// <summary>
/// Validate the current data in the model. Throws a ValidationException on
/// failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes
/// an error message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and
/// calls it's validate. Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const DnnSelectionMode& rhs) const;
bool operator!=(const DnnSelectionMode& rhs) const;
///////////////////////////////////////////// /////////////////////////////////////////////
/// DnnSelectionMode members /// DnnSelectionMode members
DnnSelectionMode_anyOf getValue() const;
void setValue(DnnSelectionMode_anyOf value);
DnnSelectionMode_anyOf::eDnnSelectionMode_anyOf getEnumValue() const;
void setEnumValue(DnnSelectionMode_anyOf::eDnnSelectionMode_anyOf value);
friend void to_json(nlohmann::json& j, const DnnSelectionMode& o); friend void to_json(nlohmann::json& j, const DnnSelectionMode& o);
friend void from_json(const nlohmann::json& j, DnnSelectionMode& o); friend void from_json(const nlohmann::json& j, DnnSelectionMode& o);
friend void to_json(nlohmann::json& j, const DnnSelectionMode_anyOf& o);
friend void from_json(const nlohmann::json& j, DnnSelectionMode_anyOf& o);
protected: protected:
DnnSelectionMode_anyOf m_value;
}; };
} // namespace model } // namespace model
} // namespace smf_server } // namespace smf_server
} // namespace oai } // namespace oai
#endif /* DnnSelectionMode_H_ */ #endif /* DnnSelectionMode_H_ */
/**
* Npcf_SMPolicyControl API
* Session Management Policy Control Service © 2020, 3GPP Organizational
* Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.1.alpha-5
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
#include "DnnSelectionMode_anyOf.h"
#include "Helpers.h"
#include <stdexcept>
#include <sstream>
namespace oai {
namespace smf_server {
namespace model {
DnnSelectionMode_anyOf::DnnSelectionMode_anyOf() {}
void DnnSelectionMode_anyOf::validate() const {
std::stringstream msg;
if (!validate(msg)) {
// throw
// org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool DnnSelectionMode_anyOf::validate(std::stringstream& msg) const {
return validate(msg, "");
}
bool DnnSelectionMode_anyOf::validate(
std::stringstream& msg, const std::string& pathPrefix) const {
bool success = true;
const std::string _pathPrefix =
pathPrefix.empty() ? "DnnSelectionMode_anyOf" : pathPrefix;
if (m_value == DnnSelectionMode_anyOf::eDnnSelectionMode_anyOf::
INVALID_VALUE_OPENAPI_GENERATED) {
success = false;
msg << _pathPrefix << ": has no value;";
}
return success;
}
bool DnnSelectionMode_anyOf::operator==(
const DnnSelectionMode_anyOf& rhs) const {
return getValue() == rhs.getValue()
;
}
bool DnnSelectionMode_anyOf::operator!=(
const DnnSelectionMode_anyOf& rhs) const {
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const DnnSelectionMode_anyOf& o) {
j = nlohmann::json();
switch (o.getValue()) {
case DnnSelectionMode_anyOf::eDnnSelectionMode_anyOf::
INVALID_VALUE_OPENAPI_GENERATED:
j = "INVALID_VALUE_OPENAPI_GENERATED";
break;
case DnnSelectionMode_anyOf::eDnnSelectionMode_anyOf::VERIFIED:
j = "VERIFIED";
break;
case DnnSelectionMode_anyOf::eDnnSelectionMode_anyOf::UE_DNN_NOT_VERIFIED:
j = "UE_DNN_NOT_VERIFIED";
break;
case DnnSelectionMode_anyOf::eDnnSelectionMode_anyOf::NW_DNN_NOT_VERIFIED:
j = "NW_DNN_NOT_VERIFIED";
break;
}
}
void from_json(const nlohmann::json& j, DnnSelectionMode_anyOf& o) {
auto s = j.get<std::string>();
if (s == "VERIFIED") {
o.setValue(DnnSelectionMode_anyOf::eDnnSelectionMode_anyOf::VERIFIED);
} else if (s == "UE_DNN_NOT_VERIFIED") {
o.setValue(
DnnSelectionMode_anyOf::eDnnSelectionMode_anyOf::UE_DNN_NOT_VERIFIED);
} else if (s == "NW_DNN_NOT_VERIFIED") {
o.setValue(
DnnSelectionMode_anyOf::eDnnSelectionMode_anyOf::NW_DNN_NOT_VERIFIED);
} else {
std::stringstream ss;
ss << "Unexpected value " << s << " in json"
<< " cannot be converted to enum of type"
<< " DnnSelectionMode_anyOf::eDnnSelectionMode_anyOf";
throw std::invalid_argument(ss.str());
}
}
DnnSelectionMode_anyOf::eDnnSelectionMode_anyOf
DnnSelectionMode_anyOf::getValue() const {
return m_value;
}
void DnnSelectionMode_anyOf::setValue(
DnnSelectionMode_anyOf::eDnnSelectionMode_anyOf value) {
m_value = value;
}
} // namespace model
} // namespace smf_server
} // namespace oai
/**
* Npcf_SMPolicyControl API
* Session Management Policy Control Service © 2020, 3GPP Organizational
* Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.1.alpha-5
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
* DnnSelectionMode_anyOf.h
*
*
*/
#ifndef DnnSelectionMode_anyOf_H_
#define DnnSelectionMode_anyOf_H_
#include <nlohmann/json.hpp>
namespace oai {
namespace smf_server {
namespace model {
/// <summary>
///
/// </summary>
class DnnSelectionMode_anyOf {
public:
DnnSelectionMode_anyOf();
virtual ~DnnSelectionMode_anyOf() = default;
enum class eDnnSelectionMode_anyOf {
// To have a valid default value.
// Avoiding name clashes with user defined
// enum values
INVALID_VALUE_OPENAPI_GENERATED = 0,
VERIFIED,
UE_DNN_NOT_VERIFIED,
NW_DNN_NOT_VERIFIED
};
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on
/// failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes
/// an error message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and
/// calls it's validate. Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const DnnSelectionMode_anyOf& rhs) const;
bool operator!=(const DnnSelectionMode_anyOf& rhs) const;
/////////////////////////////////////////////
/// DnnSelectionMode_anyOf members
DnnSelectionMode_anyOf::eDnnSelectionMode_anyOf getValue() const;
void setValue(DnnSelectionMode_anyOf::eDnnSelectionMode_anyOf value);
friend void to_json(nlohmann::json& j, const DnnSelectionMode_anyOf& o);
friend void from_json(const nlohmann::json& j, DnnSelectionMode_anyOf& o);
protected:
DnnSelectionMode_anyOf::eDnnSelectionMode_anyOf m_value =
DnnSelectionMode_anyOf::eDnnSelectionMode_anyOf::
INVALID_VALUE_OPENAPI_GENERATED;
};
} // namespace model
} // namespace smf_server
} // namespace oai
#endif /* DnnSelectionMode_anyOf_H_ */
...@@ -35,6 +35,8 @@ void to_json(nlohmann::json& j, const DnnUpfInfoItem& o) { ...@@ -35,6 +35,8 @@ void to_json(nlohmann::json& j, const DnnUpfInfoItem& o) {
if (o.dnaiListIsSet() || !o.m_DnaiList.empty()) j["dnaiList"] = o.m_DnaiList; if (o.dnaiListIsSet() || !o.m_DnaiList.empty()) j["dnaiList"] = o.m_DnaiList;
if (o.pduSessionTypesIsSet() || !o.m_PduSessionTypes.empty()) if (o.pduSessionTypesIsSet() || !o.m_PduSessionTypes.empty())
j["pduSessionTypes"] = o.m_PduSessionTypes; j["pduSessionTypes"] = o.m_PduSessionTypes;
if (o.dnaiNwInstanceListIsSet() || !o.m_DnaiNwInstanceList.empty())
j["dnaiNwInstanceList"] = o.m_DnaiNwInstanceList;
} }
void from_json(const nlohmann::json& j, DnnUpfInfoItem& o) { void from_json(const nlohmann::json& j, DnnUpfInfoItem& o) {
...@@ -47,6 +49,10 @@ void from_json(const nlohmann::json& j, DnnUpfInfoItem& o) { ...@@ -47,6 +49,10 @@ void from_json(const nlohmann::json& j, DnnUpfInfoItem& o) {
j.at("pduSessionTypes").get_to(o.m_PduSessionTypes); j.at("pduSessionTypes").get_to(o.m_PduSessionTypes);
o.m_PduSessionTypesIsSet = true; o.m_PduSessionTypesIsSet = true;
} }
if (j.find("dnaiNwInstanceList") != j.end()) {
j.at("dnaiNwInstanceList").get_to(o.m_DnaiNwInstanceList);
o.m_DnaiNwInstanceListIsSet = true;
}
} }
std::string DnnUpfInfoItem::getDnn() const { std::string DnnUpfInfoItem::getDnn() const {
...@@ -83,6 +89,21 @@ void DnnUpfInfoItem::unsetPduSessionTypes() { ...@@ -83,6 +89,21 @@ void DnnUpfInfoItem::unsetPduSessionTypes() {
m_PduSessionTypesIsSet = false; m_PduSessionTypesIsSet = false;
} }
std::map<std::string, std::string>& DnnUpfInfoItem::getDnaiNwInstanceList() {
return m_DnaiNwInstanceList;
}
void DnnUpfInfoItem::setDnaiNwInstanceList(
std::map<std::string, std::string> const& value) {
m_DnaiNwInstanceList = value;
m_DnaiNwInstanceListIsSet = true;
}
bool DnnUpfInfoItem::dnaiNwInstanceListIsSet() const {
return m_DnaiNwInstanceListIsSet;
}
void DnnUpfInfoItem::unsetDnaiNwInstanceList() {
m_DnaiNwInstanceListIsSet = false;
}
} // namespace model } // namespace model
} // namespace smf_server } // namespace smf_server
} // namespace oai } // namespace oai
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <string> #include <string>
#include "PduSessionType.h" #include "PduSessionType.h"
#include <vector> #include <vector>
#include <map>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
namespace oai { namespace oai {
...@@ -61,6 +62,11 @@ class DnnUpfInfoItem { ...@@ -61,6 +62,11 @@ class DnnUpfInfoItem {
bool pduSessionTypesIsSet() const; bool pduSessionTypesIsSet() const;
void unsetPduSessionTypes(); void unsetPduSessionTypes();
std::map<std::string, std::string>& getDnaiNwInstanceList();
void setDnaiNwInstanceList(std::map<std::string, std::string> const& value);
bool dnaiNwInstanceListIsSet() const;
void unsetDnaiNwInstanceList();
friend void to_json(nlohmann::json& j, const DnnUpfInfoItem& o); friend void to_json(nlohmann::json& j, const DnnUpfInfoItem& o);
friend void from_json(const nlohmann::json& j, DnnUpfInfoItem& o); friend void from_json(const nlohmann::json& j, DnnUpfInfoItem& o);
...@@ -71,6 +77,9 @@ class DnnUpfInfoItem { ...@@ -71,6 +77,9 @@ class DnnUpfInfoItem {
bool m_DnaiListIsSet; bool m_DnaiListIsSet;
std::vector<PduSessionType> m_PduSessionTypes; std::vector<PduSessionType> m_PduSessionTypes;
bool m_PduSessionTypesIsSet; bool m_PduSessionTypesIsSet;
std::map<std::string, std::string> m_DnaiNwInstanceList;
bool m_DnaiNwInstanceListIsSet;
}; };
} // namespace model } // namespace model
......
...@@ -27,6 +27,20 @@ void Ecgi::validate() { ...@@ -27,6 +27,20 @@ void Ecgi::validate() {
// TODO: implement validation // TODO: implement validation
} }
bool Ecgi::operator==(const Ecgi& rhs) const {
return
(getPlmnId() == rhs.getPlmnId()) &&
(getEutraCellId() == rhs.getEutraCellId())
;
}
bool Ecgi::operator!=(const Ecgi& rhs) const {
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Ecgi& o) { void to_json(nlohmann::json& j, const Ecgi& o) {
j = nlohmann::json(); j = nlohmann::json();
j["plmnId"] = o.m_PlmnId; j["plmnId"] = o.m_PlmnId;
......
...@@ -37,6 +37,9 @@ class Ecgi { ...@@ -37,6 +37,9 @@ class Ecgi {
void validate(); void validate();
bool operator==(const Ecgi& rhs) const;
bool operator!=(const Ecgi& rhs) const;
///////////////////////////////////////////// /////////////////////////////////////////////
/// Ecgi members /// Ecgi members
......
/**
* Npcf_SMPolicyControl API
* Session Management Policy Control Service © 2020, 3GPP Organizational
* Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.1.alpha-5
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
#include "EthFlowDescription.h"
#include "Helpers.h"
#include <sstream>
namespace oai {
namespace smf_server {
namespace model {
EthFlowDescription::EthFlowDescription() {
m_DestMacAddr = "";
m_DestMacAddrIsSet = false;
m_EthType = "";
m_FDesc = "";
m_FDescIsSet = false;
m_FDirIsSet = false;
m_SourceMacAddr = "";
m_SourceMacAddrIsSet = false;
m_VlanTagsIsSet = false;
m_SrcMacAddrEnd = "";
m_SrcMacAddrEndIsSet = false;
m_DestMacAddrEnd = "";
m_DestMacAddrEndIsSet = false;
}
void EthFlowDescription::validate() const {
std::stringstream msg;
if (!validate(msg)) {
// throw
// org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool EthFlowDescription::validate(std::stringstream& msg) const {
return validate(msg, "");
}
bool EthFlowDescription::validate(
std::stringstream& msg, const std::string& pathPrefix) const {
bool success = true;
const std::string _pathPrefix =
pathPrefix.empty() ? "EthFlowDescription" : pathPrefix;
if (destMacAddrIsSet()) {
const std::string& value = m_DestMacAddr;
const std::string currentValuePath = _pathPrefix + ".destMacAddr";
}
if (sourceMacAddrIsSet()) {
const std::string& value = m_SourceMacAddr;
const std::string currentValuePath = _pathPrefix + ".sourceMacAddr";
}
if (vlanTagsIsSet()) {
const std::vector<std::string>& value = m_VlanTags;
const std::string currentValuePath = _pathPrefix + ".vlanTags";
if (value.size() < 1) {
success = false;
msg << currentValuePath << ": must have at least 1 elements;";
}
if (value.size() > 2) {
success = false;
msg << currentValuePath << ": must have at most 2 elements;";
}
{ // Recursive validation of array elements
const std::string oldValuePath = currentValuePath;
int i = 0;
for (const std::string& value : value) {
const std::string currentValuePath =
oldValuePath + "[" + std::to_string(i) + "]";
i++;
}
}
}
if (srcMacAddrEndIsSet()) {
const std::string& value = m_SrcMacAddrEnd;
const std::string currentValuePath = _pathPrefix + ".srcMacAddrEnd";
}
if (destMacAddrEndIsSet()) {
const std::string& value = m_DestMacAddrEnd;
const std::string currentValuePath = _pathPrefix + ".destMacAddrEnd";
}
return success;
}
bool EthFlowDescription::operator==(const EthFlowDescription& rhs) const {
return
((!destMacAddrIsSet() && !rhs.destMacAddrIsSet()) ||
(destMacAddrIsSet() && rhs.destMacAddrIsSet() &&
getDestMacAddr() == rhs.getDestMacAddr())) &&
(getEthType() == rhs.getEthType()) &&
((!fDescIsSet() && !rhs.fDescIsSet()) ||
(fDescIsSet() && rhs.fDescIsSet() && getFDesc() == rhs.getFDesc())) &&
((!fDirIsSet() && !rhs.fDirIsSet()) ||
(fDirIsSet() && rhs.fDirIsSet() && getFDir() == rhs.getFDir())) &&
((!sourceMacAddrIsSet() && !rhs.sourceMacAddrIsSet()) ||
(sourceMacAddrIsSet() && rhs.sourceMacAddrIsSet() &&
getSourceMacAddr() == rhs.getSourceMacAddr())) &&
((!vlanTagsIsSet() && !rhs.vlanTagsIsSet()) ||
(vlanTagsIsSet() && rhs.vlanTagsIsSet() &&
getVlanTags() == rhs.getVlanTags())) &&
((!srcMacAddrEndIsSet() && !rhs.srcMacAddrEndIsSet()) ||
(srcMacAddrEndIsSet() && rhs.srcMacAddrEndIsSet() &&
getSrcMacAddrEnd() == rhs.getSrcMacAddrEnd())) &&
((!destMacAddrEndIsSet() && !rhs.destMacAddrEndIsSet()) ||
(destMacAddrEndIsSet() && rhs.destMacAddrEndIsSet() &&
getDestMacAddrEnd() == rhs.getDestMacAddrEnd()))
;
}
bool EthFlowDescription::operator!=(const EthFlowDescription& rhs) const {
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const EthFlowDescription& o) {
j = nlohmann::json();
if (o.destMacAddrIsSet()) j["destMacAddr"] = o.m_DestMacAddr;
j["ethType"] = o.m_EthType;
if (o.fDescIsSet()) j["fDesc"] = o.m_FDesc;
if (o.fDirIsSet()) j["fDir"] = o.m_FDir;
if (o.sourceMacAddrIsSet()) j["sourceMacAddr"] = o.m_SourceMacAddr;
if (o.vlanTagsIsSet() || !o.m_VlanTags.empty()) j["vlanTags"] = o.m_VlanTags;
if (o.srcMacAddrEndIsSet()) j["srcMacAddrEnd"] = o.m_SrcMacAddrEnd;
if (o.destMacAddrEndIsSet()) j["destMacAddrEnd"] = o.m_DestMacAddrEnd;
}
void from_json(const nlohmann::json& j, EthFlowDescription& o) {
if (j.find("destMacAddr") != j.end()) {
j.at("destMacAddr").get_to(o.m_DestMacAddr);
o.m_DestMacAddrIsSet = true;
}
j.at("ethType").get_to(o.m_EthType);
if (j.find("fDesc") != j.end()) {
j.at("fDesc").get_to(o.m_FDesc);
o.m_FDescIsSet = true;
}
if (j.find("fDir") != j.end()) {
j.at("fDir").get_to(o.m_FDir);
o.m_FDirIsSet = true;
}
if (j.find("sourceMacAddr") != j.end()) {
j.at("sourceMacAddr").get_to(o.m_SourceMacAddr);
o.m_SourceMacAddrIsSet = true;
}
if (j.find("vlanTags") != j.end()) {
j.at("vlanTags").get_to(o.m_VlanTags);
o.m_VlanTagsIsSet = true;
}
if (j.find("srcMacAddrEnd") != j.end()) {
j.at("srcMacAddrEnd").get_to(o.m_SrcMacAddrEnd);
o.m_SrcMacAddrEndIsSet = true;
}
if (j.find("destMacAddrEnd") != j.end()) {
j.at("destMacAddrEnd").get_to(o.m_DestMacAddrEnd);
o.m_DestMacAddrEndIsSet = true;
}
}
std::string EthFlowDescription::getDestMacAddr() const {
return m_DestMacAddr;
}
void EthFlowDescription::setDestMacAddr(std::string const& value) {
m_DestMacAddr = value;
m_DestMacAddrIsSet = true;
}
bool EthFlowDescription::destMacAddrIsSet() const {
return m_DestMacAddrIsSet;
}
void EthFlowDescription::unsetDestMacAddr() {
m_DestMacAddrIsSet = false;
}
std::string EthFlowDescription::getEthType() const {
return m_EthType;
}
void EthFlowDescription::setEthType(std::string const& value) {
m_EthType = value;
}
std::string EthFlowDescription::getFDesc() const {
return m_FDesc;
}
void EthFlowDescription::setFDesc(std::string const& value) {
m_FDesc = value;
m_FDescIsSet = true;
}
bool EthFlowDescription::fDescIsSet() const {
return m_FDescIsSet;
}
void EthFlowDescription::unsetFDesc() {
m_FDescIsSet = false;
}
FlowDirection EthFlowDescription::getFDir() const {
return m_FDir;
}
void EthFlowDescription::setFDir(FlowDirection const& value) {
m_FDir = value;
m_FDirIsSet = true;
}
bool EthFlowDescription::fDirIsSet() const {
return m_FDirIsSet;
}
void EthFlowDescription::unsetFDir() {
m_FDirIsSet = false;
}
std::string EthFlowDescription::getSourceMacAddr() const {
return m_SourceMacAddr;
}
void EthFlowDescription::setSourceMacAddr(std::string const& value) {
m_SourceMacAddr = value;
m_SourceMacAddrIsSet = true;
}
bool EthFlowDescription::sourceMacAddrIsSet() const {
return m_SourceMacAddrIsSet;
}
void EthFlowDescription::unsetSourceMacAddr() {
m_SourceMacAddrIsSet = false;
}
std::vector<std::string> EthFlowDescription::getVlanTags() const {
return m_VlanTags;
}
void EthFlowDescription::setVlanTags(std::vector<std::string> const& value) {
m_VlanTags = value;
m_VlanTagsIsSet = true;
}
bool EthFlowDescription::vlanTagsIsSet() const {
return m_VlanTagsIsSet;
}
void EthFlowDescription::unsetVlanTags() {
m_VlanTagsIsSet = false;
}
std::string EthFlowDescription::getSrcMacAddrEnd() const {
return m_SrcMacAddrEnd;
}
void EthFlowDescription::setSrcMacAddrEnd(std::string const& value) {
m_SrcMacAddrEnd = value;
m_SrcMacAddrEndIsSet = true;
}
bool EthFlowDescription::srcMacAddrEndIsSet() const {
return m_SrcMacAddrEndIsSet;
}
void EthFlowDescription::unsetSrcMacAddrEnd() {
m_SrcMacAddrEndIsSet = false;
}
std::string EthFlowDescription::getDestMacAddrEnd() const {
return m_DestMacAddrEnd;
}
void EthFlowDescription::setDestMacAddrEnd(std::string const& value) {
m_DestMacAddrEnd = value;
m_DestMacAddrEndIsSet = true;
}
bool EthFlowDescription::destMacAddrEndIsSet() const {
return m_DestMacAddrEndIsSet;
}
void EthFlowDescription::unsetDestMacAddrEnd() {
m_DestMacAddrEndIsSet = false;
}
} // namespace model
} // namespace smf_server
} // namespace oai
/**
* Npcf_SMPolicyControl API
* Session Management Policy Control Service © 2020, 3GPP Organizational
* Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.1.alpha-5
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
* EthFlowDescription.h
*
* Identifies an Ethernet flow
*/
#ifndef EthFlowDescription_H_
#define EthFlowDescription_H_
#include "FlowDirection.h"
#include <string>
#include <vector>
#include <nlohmann/json.hpp>
namespace oai {
namespace smf_server {
namespace model {
/// <summary>
/// Identifies an Ethernet flow
/// </summary>
class EthFlowDescription {
public:
EthFlowDescription();
virtual ~EthFlowDescription() = default;
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on
/// failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes
/// an error message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and
/// calls it's validate. Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const EthFlowDescription& rhs) const;
bool operator!=(const EthFlowDescription& rhs) const;
/////////////////////////////////////////////
/// EthFlowDescription members
/// <summary>
///
/// </summary>
std::string getDestMacAddr() const;
void setDestMacAddr(std::string const& value);
bool destMacAddrIsSet() const;
void unsetDestMacAddr();
/// <summary>
///
/// </summary>
std::string getEthType() const;
void setEthType(std::string const& value);
/// <summary>
/// Defines a packet filter of an IP flow.
/// </summary>
std::string getFDesc() const;
void setFDesc(std::string const& value);
bool fDescIsSet() const;
void unsetFDesc();
/// <summary>
///
/// </summary>
FlowDirection getFDir() const;
void setFDir(FlowDirection const& value);
bool fDirIsSet() const;
void unsetFDir();
/// <summary>
///
/// </summary>
std::string getSourceMacAddr() const;
void setSourceMacAddr(std::string const& value);
bool sourceMacAddrIsSet() const;
void unsetSourceMacAddr();
/// <summary>
///
/// </summary>
std::vector<std::string> getVlanTags() const;
void setVlanTags(std::vector<std::string> const& value);
bool vlanTagsIsSet() const;
void unsetVlanTags();
/// <summary>
///
/// </summary>
std::string getSrcMacAddrEnd() const;
void setSrcMacAddrEnd(std::string const& value);
bool srcMacAddrEndIsSet() const;
void unsetSrcMacAddrEnd();
/// <summary>
///
/// </summary>
std::string getDestMacAddrEnd() const;
void setDestMacAddrEnd(std::string const& value);
bool destMacAddrEndIsSet() const;
void unsetDestMacAddrEnd();
friend void to_json(nlohmann::json& j, const EthFlowDescription& o);
friend void from_json(const nlohmann::json& j, EthFlowDescription& o);
protected:
std::string m_DestMacAddr;
bool m_DestMacAddrIsSet;
std::string m_EthType;
std::string m_FDesc;
bool m_FDescIsSet;
FlowDirection m_FDir;
bool m_FDirIsSet;
std::string m_SourceMacAddr;
bool m_SourceMacAddrIsSet;
std::vector<std::string> m_VlanTags;
bool m_VlanTagsIsSet;
std::string m_SrcMacAddrEnd;
bool m_SrcMacAddrEndIsSet;
std::string m_DestMacAddrEnd;
bool m_DestMacAddrEndIsSet;
};
} // namespace model
} // namespace smf_server
} // namespace oai
#endif /* EthFlowDescription_H_ */
...@@ -35,6 +35,43 @@ void EutraLocation::validate() { ...@@ -35,6 +35,43 @@ void EutraLocation::validate() {
// TODO: implement validation // TODO: implement validation
} }
bool EutraLocation::operator==(const EutraLocation& rhs) const {
return
(getTai() == rhs.getTai()) &&
(getEcgi() == rhs.getEcgi()) &&
((!ageOfLocationInformationIsSet() &&
!rhs.ageOfLocationInformationIsSet()) ||
(ageOfLocationInformationIsSet() &&
rhs.ageOfLocationInformationIsSet() &&
getAgeOfLocationInformation() == rhs.getAgeOfLocationInformation())) &&
((!ueLocationTimestampIsSet() && !rhs.ueLocationTimestampIsSet()) ||
(ueLocationTimestampIsSet() && rhs.ueLocationTimestampIsSet() &&
getUeLocationTimestamp() == rhs.getUeLocationTimestamp())) &&
((!geographicalInformationIsSet() &&
!rhs.geographicalInformationIsSet()) ||
(geographicalInformationIsSet() && rhs.geographicalInformationIsSet() &&
getGeographicalInformation() == rhs.getGeographicalInformation())) &&
((!geodeticInformationIsSet() && !rhs.geodeticInformationIsSet()) ||
(geodeticInformationIsSet() && rhs.geodeticInformationIsSet() &&
getGeodeticInformation() == rhs.getGeodeticInformation())) &&
((!globalNgenbIdIsSet() && !rhs.globalNgenbIdIsSet()) ||
(globalNgenbIdIsSet() && rhs.globalNgenbIdIsSet() &&
getGlobalNgenbId() == rhs.getGlobalNgenbId()))
;
}
bool EutraLocation::operator!=(const EutraLocation& rhs) const {
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const EutraLocation& o) { void to_json(nlohmann::json& j, const EutraLocation& o) {
j = nlohmann::json(); j = nlohmann::json();
j["tai"] = o.m_Tai; j["tai"] = o.m_Tai;
......
...@@ -39,6 +39,9 @@ class EutraLocation { ...@@ -39,6 +39,9 @@ class EutraLocation {
void validate(); void validate();
bool operator==(const EutraLocation& rhs) const;
bool operator!=(const EutraLocation& rhs) const;
///////////////////////////////////////////// /////////////////////////////////////////////
/// EutraLocation members /// EutraLocation members
......
...@@ -51,6 +51,8 @@ EventNotification::EventNotification() { ...@@ -51,6 +51,8 @@ EventNotification::EventNotification() {
m_DddStatusIsSet = false; m_DddStatusIsSet = false;
m_MaxWaitTime = ""; m_MaxWaitTime = "";
m_MaxWaitTimeIsSet = false; m_MaxWaitTimeIsSet = false;
m_usageReport = {};
m_usageReportIsSet = false;
} }
EventNotification::~EventNotification() {} EventNotification::~EventNotification() {}
...@@ -86,6 +88,7 @@ void to_json(nlohmann::json& j, const EventNotification& o) { ...@@ -86,6 +88,7 @@ void to_json(nlohmann::json& j, const EventNotification& o) {
if (o.pduSeIdIsSet()) j["pduSeId"] = o.m_PduSeId; if (o.pduSeIdIsSet()) j["pduSeId"] = o.m_PduSeId;
if (o.dddStatusIsSet()) j["dddStatus"] = o.m_DddStatus; if (o.dddStatusIsSet()) j["dddStatus"] = o.m_DddStatus;
if (o.maxWaitTimeIsSet()) j["maxWaitTime"] = o.m_MaxWaitTime; if (o.maxWaitTimeIsSet()) j["maxWaitTime"] = o.m_MaxWaitTime;
if (o.usageReportIsSet()) j["Usage Report"] = o.m_usageReport;
} }
void from_json(const nlohmann::json& j, EventNotification& o) { void from_json(const nlohmann::json& j, EventNotification& o) {
...@@ -175,6 +178,10 @@ void from_json(const nlohmann::json& j, EventNotification& o) { ...@@ -175,6 +178,10 @@ void from_json(const nlohmann::json& j, EventNotification& o) {
j.at("maxWaitTime").get_to(o.m_MaxWaitTime); j.at("maxWaitTime").get_to(o.m_MaxWaitTime);
o.m_MaxWaitTimeIsSet = true; o.m_MaxWaitTimeIsSet = true;
} }
if (j.find("Usage Report") != j.end()) {
j.at("Usage Report").get_to(o.m_usageReport);
o.m_usageReportIsSet = true;
}
} }
SmfEvent EventNotification::getEvent() const { SmfEvent EventNotification::getEvent() const {
...@@ -462,6 +469,19 @@ bool EventNotification::maxWaitTimeIsSet() const { ...@@ -462,6 +469,19 @@ bool EventNotification::maxWaitTimeIsSet() const {
void EventNotification::unsetMaxWaitTime() { void EventNotification::unsetMaxWaitTime() {
m_MaxWaitTimeIsSet = false; m_MaxWaitTimeIsSet = false;
} }
UsageReport EventNotification::getUsageReport() const {
return m_usageReport;
}
void EventNotification::setUsageReport(UsageReport const& value) {
m_usageReport = value;
m_usageReportIsSet = true;
}
bool EventNotification::usageReportIsSet() const {
return m_usageReportIsSet;
}
void EventNotification::unsetUsageReport() {
m_usageReportIsSet = false;
}
} // namespace model } // namespace model
} // namespace smf_server } // namespace smf_server
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "PlmnId.h" #include "PlmnId.h"
#include "RouteToLocation.h" #include "RouteToLocation.h"
#include "AccessType.h" #include "AccessType.h"
#include "UsageReport.h"
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
namespace oai { namespace oai {
...@@ -203,6 +204,13 @@ class EventNotification { ...@@ -203,6 +204,13 @@ class EventNotification {
void setMaxWaitTime(std::string const& value); void setMaxWaitTime(std::string const& value);
bool maxWaitTimeIsSet() const; bool maxWaitTimeIsSet() const;
void unsetMaxWaitTime(); void unsetMaxWaitTime();
/// <summary>
///
/// </summary>
UsageReport getUsageReport() const;
void setUsageReport(UsageReport const& value);
bool usageReportIsSet() const;
void unsetUsageReport();
friend void to_json(nlohmann::json& j, const EventNotification& o); friend void to_json(nlohmann::json& j, const EventNotification& o);
friend void from_json(const nlohmann::json& j, EventNotification& o); friend void from_json(const nlohmann::json& j, EventNotification& o);
...@@ -254,6 +262,8 @@ class EventNotification { ...@@ -254,6 +262,8 @@ class EventNotification {
bool m_DddStatusIsSet; bool m_DddStatusIsSet;
std::string m_MaxWaitTime; std::string m_MaxWaitTime;
bool m_MaxWaitTimeIsSet; bool m_MaxWaitTimeIsSet;
UsageReport m_usageReport;
bool m_usageReportIsSet;
}; };
} // namespace model } // namespace model
......
/**
* Npcf_SMPolicyControl API
* Session Management Policy Control Service © 2020, 3GPP Organizational
* Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.1.alpha-5
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
#include "FlowDirection.h"
#include "Helpers.h"
#include <sstream>
namespace oai {
namespace smf_server {
namespace model {
FlowDirection::FlowDirection() {}
void FlowDirection::validate() const {
std::stringstream msg;
if (!validate(msg)) {
// throw
// org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool FlowDirection::validate(std::stringstream& msg) const {
return validate(msg, "");
}
bool FlowDirection::validate(
std::stringstream& msg, const std::string& pathPrefix) const {
bool success = true;
const std::string _pathPrefix =
pathPrefix.empty() ? "FlowDirection" : pathPrefix;
if (!m_value.validate(msg)) {
success = false;
}
return success;
}
bool FlowDirection::operator==(const FlowDirection& rhs) const {
return
getValue() == rhs.getValue();
}
bool FlowDirection::operator!=(const FlowDirection& rhs) const {
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const FlowDirection& o) {
j = nlohmann::json();
to_json(j, o.m_value);
if (o.m_value.getValue() ==
FlowDirection_anyOf::eFlowDirection_anyOf::NULL_VALUE) {
throw std::invalid_argument(
"Could not convert to json: FlowDirection does not allow null values");
}
}
void from_json(const nlohmann::json& j, FlowDirection& o) {
from_json(j, o.m_value);
if (j.is_null()) {
throw std::invalid_argument(
"Could not convert from json: FlowDirection does not allow null "
"values");
}
}
FlowDirection_anyOf FlowDirection::getValue() const {
return m_value;
}
void FlowDirection::setValue(FlowDirection_anyOf value) {
m_value = value;
}
FlowDirection_anyOf::eFlowDirection_anyOf FlowDirection::getEnumValue() const {
return m_value.getValue();
}
void FlowDirection::setEnumValue(
FlowDirection_anyOf::eFlowDirection_anyOf value) {
m_value.setValue(value);
}
} // namespace model
} // namespace smf_server
} // namespace oai
/**
* Npcf_SMPolicyControl API
* Session Management Policy Control Service © 2020, 3GPP Organizational
* Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.1.alpha-5
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
* FlowDirection.h
*
* Possible values are - DOWNLINK: The corresponding filter applies for traffic
* to the UE. - UPLINK: The corresponding filter applies for traffic from the
* UE. - BIDIRECTIONAL: The corresponding filter applies for traffic both to and
* from the UE. - UNSPECIFIED: The corresponding filter applies for traffic to
* the UE (downlink), but has no specific direction declared. The service data
* flow detection shall apply the filter for uplink traffic as if the filter was
* bidirectional. The PCF shall not use the value UNSPECIFIED in filters created
* by the network in NW-initiated procedures. The PCF shall only include the
* value UNSPECIFIED in filters in UE-initiated procedures if the same value is
* received from the SMF.
*/
#ifndef FlowDirection_H_
#define FlowDirection_H_
#include "FlowDirection_anyOf.h"
#include <nlohmann/json.hpp>
namespace oai {
namespace smf_server {
namespace model {
/// <summary>
/// Possible values are - DOWNLINK: The corresponding filter applies for traffic
/// to the UE. - UPLINK: The corresponding filter applies for traffic from the
/// UE. - BIDIRECTIONAL: The corresponding filter applies for traffic both to
/// and from the UE. - UNSPECIFIED: The corresponding filter applies for traffic
/// to the UE (downlink), but has no specific direction declared. The service
/// data flow detection shall apply the filter for uplink traffic as if the
/// filter was bidirectional. The PCF shall not use the value UNSPECIFIED in
/// filters created by the network in NW-initiated procedures. The PCF shall
/// only include the value UNSPECIFIED in filters in UE-initiated procedures if
/// the same value is received from the SMF.
/// </summary>
class FlowDirection {
public:
FlowDirection();
virtual ~FlowDirection() = default;
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on
/// failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes
/// an error message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and
/// calls it's validate. Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const FlowDirection& rhs) const;
bool operator!=(const FlowDirection& rhs) const;
/////////////////////////////////////////////
/// FlowDirection members
FlowDirection_anyOf getValue() const;
void setValue(FlowDirection_anyOf value);
FlowDirection_anyOf::eFlowDirection_anyOf getEnumValue() const;
void setEnumValue(FlowDirection_anyOf::eFlowDirection_anyOf value);
friend void to_json(nlohmann::json& j, const FlowDirection& o);
friend void from_json(const nlohmann::json& j, FlowDirection& o);
friend void to_json(nlohmann::json& j, const FlowDirection_anyOf& o);
friend void from_json(const nlohmann::json& j, FlowDirection_anyOf& o);
protected:
FlowDirection_anyOf m_value;
};
} // namespace model
} // namespace smf_server
} // namespace oai
#endif /* FlowDirection_H_ */
/**
* Npcf_SMPolicyControl API
* Session Management Policy Control Service © 2020, 3GPP Organizational
* Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.1.alpha-5
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
#include "FlowDirectionRm.h"
#include "Helpers.h"
#include <sstream>
namespace oai {
namespace smf_server {
namespace model {
FlowDirectionRm::FlowDirectionRm() {}
void FlowDirectionRm::validate() const {
std::stringstream msg;
if (!validate(msg)) {
// throw
// org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool FlowDirectionRm::validate(std::stringstream& msg) const {
return validate(msg, "");
}
bool FlowDirectionRm::validate(
std::stringstream& msg, const std::string& pathPrefix) const {
bool success = true;
const std::string _pathPrefix =
pathPrefix.empty() ? "FlowDirectionRm" : pathPrefix;
return success;
}
bool FlowDirectionRm::operator==(const FlowDirectionRm& rhs) const {
return getValue() == rhs.getValue();
}
bool FlowDirectionRm::operator!=(const FlowDirectionRm& rhs) const {
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const FlowDirectionRm& o) {
j = nlohmann::json();
}
void from_json(const nlohmann::json& j, FlowDirectionRm& o) {}
FlowDirection_anyOf FlowDirectionRm::getValue() const {
return m_value;
}
void FlowDirectionRm::setValue(FlowDirection_anyOf value) {
m_value = value;
}
FlowDirection_anyOf::eFlowDirection_anyOf FlowDirectionRm::getEnumValue()
const {
return m_value.getValue();
}
void FlowDirectionRm::setEnumValue(
FlowDirection_anyOf::eFlowDirection_anyOf value) {
m_value.setValue(value);
}
} // namespace model
} // namespace smf_server
} // namespace oai
/**
* Npcf_SMPolicyControl API
* Session Management Policy Control Service © 2020, 3GPP Organizational
* Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.1.alpha-5
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
* FlowDirectionRm.h
*
*
*/
#ifndef FlowDirectionRm_H_
#define FlowDirectionRm_H_
#include "FlowDirection.h"
#include "NullValue.h"
#include <nlohmann/json.hpp>
namespace oai {
namespace smf_server {
namespace model {
/// <summary>
///
/// </summary>
class FlowDirectionRm {
public:
FlowDirectionRm();
virtual ~FlowDirectionRm() = default;
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on
/// failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes
/// an error message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and
/// calls it's validate. Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const FlowDirectionRm& rhs) const;
bool operator!=(const FlowDirectionRm& rhs) const;
/////////////////////////////////////////////
/// FlowDirectionRm members
FlowDirection_anyOf getValue() const;
void setValue(FlowDirection_anyOf value);
FlowDirection_anyOf::eFlowDirection_anyOf getEnumValue() const;
void setEnumValue(FlowDirection_anyOf::eFlowDirection_anyOf value);
friend void to_json(nlohmann::json& j, const FlowDirectionRm& o);
friend void from_json(const nlohmann::json& j, FlowDirectionRm& o);
protected:
FlowDirection_anyOf m_value;
};
} // namespace model
} // namespace smf_server
} // namespace oai
#endif /* FlowDirectionRm_H_ */
/**
* Npcf_SMPolicyControl API
* Session Management Policy Control Service © 2020, 3GPP Organizational
* Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.1.alpha-5
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
#include "FlowDirection_anyOf.h"
#include "Helpers.h"
#include <stdexcept>
#include <sstream>
namespace oai {
namespace smf_server {
namespace model {
FlowDirection_anyOf::FlowDirection_anyOf() {}
void FlowDirection_anyOf::validate() const {
std::stringstream msg;
if (!validate(msg)) {
// throw
// org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool FlowDirection_anyOf::validate(std::stringstream& msg) const {
return validate(msg, "");
}
bool FlowDirection_anyOf::validate(
std::stringstream& msg, const std::string& pathPrefix) const {
bool success = true;
const std::string _pathPrefix =
pathPrefix.empty() ? "FlowDirection_anyOf" : pathPrefix;
if (m_value == FlowDirection_anyOf::eFlowDirection_anyOf::
INVALID_VALUE_OPENAPI_GENERATED) {
success = false;
msg << _pathPrefix << ": has no value;";
}
return success;
}
bool FlowDirection_anyOf::operator==(const FlowDirection_anyOf& rhs) const {
return getValue() == rhs.getValue()
;
}
bool FlowDirection_anyOf::operator!=(const FlowDirection_anyOf& rhs) const {
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const FlowDirection_anyOf& o) {
j = nlohmann::json();
switch (o.getValue()) {
case FlowDirection_anyOf::eFlowDirection_anyOf::
INVALID_VALUE_OPENAPI_GENERATED:
j = "INVALID_VALUE_OPENAPI_GENERATED";
break;
case FlowDirection_anyOf::eFlowDirection_anyOf::DOWNLINK:
j = "DOWNLINK";
break;
case FlowDirection_anyOf::eFlowDirection_anyOf::UPLINK:
j = "UPLINK";
break;
case FlowDirection_anyOf::eFlowDirection_anyOf::BIDIRECTIONAL:
j = "BIDIRECTIONAL";
break;
case FlowDirection_anyOf::eFlowDirection_anyOf::UNSPECIFIED:
j = "UNSPECIFIED";
break;
case FlowDirection_anyOf::eFlowDirection_anyOf::NULL_VALUE:
j = nullptr;
break;
}
}
void from_json(const nlohmann::json& j, FlowDirection_anyOf& o) {
if (j.is_null()) {
o.setValue(FlowDirection_anyOf::eFlowDirection_anyOf::NULL_VALUE);
return;
}
auto s = j.get<std::string>();
if (s == "DOWNLINK") {
o.setValue(FlowDirection_anyOf::eFlowDirection_anyOf::DOWNLINK);
} else if (s == "UPLINK") {
o.setValue(FlowDirection_anyOf::eFlowDirection_anyOf::UPLINK);
} else if (s == "BIDIRECTIONAL") {
o.setValue(FlowDirection_anyOf::eFlowDirection_anyOf::BIDIRECTIONAL);
} else if (s == "UNSPECIFIED") {
o.setValue(FlowDirection_anyOf::eFlowDirection_anyOf::UNSPECIFIED);
} else if (s == "null") {
o.setValue(FlowDirection_anyOf::eFlowDirection_anyOf::NULL_VALUE);
} else {
std::stringstream ss;
ss << "Unexpected value " << s << " in json"
<< " cannot be converted to enum of type"
<< " FlowDirection_anyOf::eFlowDirection_anyOf";
throw std::invalid_argument(ss.str());
}
}
FlowDirection_anyOf::eFlowDirection_anyOf FlowDirection_anyOf::getValue()
const {
return m_value;
}
void FlowDirection_anyOf::setValue(
FlowDirection_anyOf::eFlowDirection_anyOf value) {
m_value = value;
}
} // namespace model
} // namespace smf_server
} // namespace oai
/**
* Npcf_SMPolicyControl API
* Session Management Policy Control Service © 2020, 3GPP Organizational
* Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.1.alpha-5
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
* FlowDirection_anyOf.h
*
*
*/
#ifndef FlowDirection_anyOf_H_
#define FlowDirection_anyOf_H_
#include <nlohmann/json.hpp>
namespace oai {
namespace smf_server {
namespace model {
/// <summary>
///
/// </summary>
class FlowDirection_anyOf {
public:
FlowDirection_anyOf();
virtual ~FlowDirection_anyOf() = default;
enum class eFlowDirection_anyOf {
// To have a valid default value.
// Avoiding name clashes with user defined
// enum values
INVALID_VALUE_OPENAPI_GENERATED = 0,
NULL_VALUE,
DOWNLINK,
UPLINK,
BIDIRECTIONAL,
UNSPECIFIED
};
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on
/// failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes
/// an error message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and
/// calls it's validate. Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const FlowDirection_anyOf& rhs) const;
bool operator!=(const FlowDirection_anyOf& rhs) const;
/////////////////////////////////////////////
/// FlowDirection_anyOf members
FlowDirection_anyOf::eFlowDirection_anyOf getValue() const;
void setValue(FlowDirection_anyOf::eFlowDirection_anyOf value);
friend void to_json(nlohmann::json& j, const FlowDirection_anyOf& o);
friend void from_json(const nlohmann::json& j, FlowDirection_anyOf& o);
protected:
FlowDirection_anyOf::eFlowDirection_anyOf m_value = FlowDirection_anyOf::
eFlowDirection_anyOf::INVALID_VALUE_OPENAPI_GENERATED;
};
} // namespace model
} // namespace smf_server
} // namespace oai
#endif /* FlowDirection_anyOf_H_ */
/**
* Npcf_SMPolicyControl API
* Session Management Policy Control Service © 2020, 3GPP Organizational
* Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.1.alpha-5
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
#include "FlowInformation.h"
#include "Helpers.h"
#include <sstream>
namespace oai {
namespace smf_server {
namespace model {
FlowInformation::FlowInformation() {
m_FlowDescription = "";
m_FlowDescriptionIsSet = false;
m_EthFlowDescriptionIsSet = false;
m_PackFiltId = "";
m_PackFiltIdIsSet = false;
m_PacketFilterUsage = false;
m_PacketFilterUsageIsSet = false;
m_TosTrafficClass = "";
m_TosTrafficClassIsSet = false;
m_Spi = "";
m_SpiIsSet = false;
m_FlowLabel = "";
m_FlowLabelIsSet = false;
m_FlowDirectionIsSet = false;
}
void FlowInformation::validate() const {
std::stringstream msg;
if (!validate(msg)) {
// throw
// org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool FlowInformation::validate(std::stringstream& msg) const {
return validate(msg, "");
}
bool FlowInformation::validate(
std::stringstream& msg, const std::string& pathPrefix) const {
bool success = true;
const std::string _pathPrefix =
pathPrefix.empty() ? "FlowInformation" : pathPrefix;
return success;
}
bool FlowInformation::operator==(const FlowInformation& rhs) const {
return
((!flowDescriptionIsSet() && !rhs.flowDescriptionIsSet()) ||
(flowDescriptionIsSet() && rhs.flowDescriptionIsSet() &&
getFlowDescription() == rhs.getFlowDescription())) &&
((!ethFlowDescriptionIsSet() && !rhs.ethFlowDescriptionIsSet()) ||
(ethFlowDescriptionIsSet() && rhs.ethFlowDescriptionIsSet() &&
getEthFlowDescription() == rhs.getEthFlowDescription())) &&
((!packFiltIdIsSet() && !rhs.packFiltIdIsSet()) ||
(packFiltIdIsSet() && rhs.packFiltIdIsSet() &&
getPackFiltId() == rhs.getPackFiltId())) &&
((!packetFilterUsageIsSet() && !rhs.packetFilterUsageIsSet()) ||
(packetFilterUsageIsSet() && rhs.packetFilterUsageIsSet() &&
isPacketFilterUsage() == rhs.isPacketFilterUsage())) &&
((!tosTrafficClassIsSet() && !rhs.tosTrafficClassIsSet()) ||
(tosTrafficClassIsSet() && rhs.tosTrafficClassIsSet() &&
getTosTrafficClass() == rhs.getTosTrafficClass())) &&
((!spiIsSet() && !rhs.spiIsSet()) ||
(spiIsSet() && rhs.spiIsSet() && getSpi() == rhs.getSpi())) &&
((!flowLabelIsSet() && !rhs.flowLabelIsSet()) ||
(flowLabelIsSet() && rhs.flowLabelIsSet() &&
getFlowLabel() == rhs.getFlowLabel())) &&
((!flowDirectionIsSet() && !rhs.flowDirectionIsSet()) ||
(flowDirectionIsSet() && rhs.flowDirectionIsSet() &&
getFlowDirection() == rhs.getFlowDirection()))
;
}
bool FlowInformation::operator!=(const FlowInformation& rhs) const {
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const FlowInformation& o) {
j = nlohmann::json();
if (o.flowDescriptionIsSet()) j["flowDescription"] = o.m_FlowDescription;
if (o.ethFlowDescriptionIsSet())
j["ethFlowDescription"] = o.m_EthFlowDescription;
if (o.packFiltIdIsSet()) j["packFiltId"] = o.m_PackFiltId;
if (o.packetFilterUsageIsSet())
j["packetFilterUsage"] = o.m_PacketFilterUsage;
if (o.tosTrafficClassIsSet()) j["tosTrafficClass"] = o.m_TosTrafficClass;
if (o.spiIsSet()) j["spi"] = o.m_Spi;
if (o.flowLabelIsSet()) j["flowLabel"] = o.m_FlowLabel;
if (o.flowDirectionIsSet()) j["flowDirection"] = o.m_FlowDirection;
}
void from_json(const nlohmann::json& j, FlowInformation& o) {
if (j.find("flowDescription") != j.end()) {
j.at("flowDescription").get_to(o.m_FlowDescription);
o.m_FlowDescriptionIsSet = true;
}
if (j.find("ethFlowDescription") != j.end()) {
j.at("ethFlowDescription").get_to(o.m_EthFlowDescription);
o.m_EthFlowDescriptionIsSet = true;
}
if (j.find("packFiltId") != j.end()) {
j.at("packFiltId").get_to(o.m_PackFiltId);
o.m_PackFiltIdIsSet = true;
}
if (j.find("packetFilterUsage") != j.end()) {
j.at("packetFilterUsage").get_to(o.m_PacketFilterUsage);
o.m_PacketFilterUsageIsSet = true;
}
if (j.find("tosTrafficClass") != j.end()) {
j.at("tosTrafficClass").get_to(o.m_TosTrafficClass);
o.m_TosTrafficClassIsSet = true;
}
if (j.find("spi") != j.end()) {
j.at("spi").get_to(o.m_Spi);
o.m_SpiIsSet = true;
}
if (j.find("flowLabel") != j.end()) {
j.at("flowLabel").get_to(o.m_FlowLabel);
o.m_FlowLabelIsSet = true;
}
if (j.find("flowDirection") != j.end()) {
j.at("flowDirection").get_to(o.m_FlowDirection);
o.m_FlowDirectionIsSet = true;
}
}
std::string FlowInformation::getFlowDescription() const {
return m_FlowDescription;
}
void FlowInformation::setFlowDescription(std::string const& value) {
m_FlowDescription = value;
m_FlowDescriptionIsSet = true;
}
bool FlowInformation::flowDescriptionIsSet() const {
return m_FlowDescriptionIsSet;
}
void FlowInformation::unsetFlowDescription() {
m_FlowDescriptionIsSet = false;
}
EthFlowDescription FlowInformation::getEthFlowDescription() const {
return m_EthFlowDescription;
}
void FlowInformation::setEthFlowDescription(EthFlowDescription const& value) {
m_EthFlowDescription = value;
m_EthFlowDescriptionIsSet = true;
}
bool FlowInformation::ethFlowDescriptionIsSet() const {
return m_EthFlowDescriptionIsSet;
}
void FlowInformation::unsetEthFlowDescription() {
m_EthFlowDescriptionIsSet = false;
}
std::string FlowInformation::getPackFiltId() const {
return m_PackFiltId;
}
void FlowInformation::setPackFiltId(std::string const& value) {
m_PackFiltId = value;
m_PackFiltIdIsSet = true;
}
bool FlowInformation::packFiltIdIsSet() const {
return m_PackFiltIdIsSet;
}
void FlowInformation::unsetPackFiltId() {
m_PackFiltIdIsSet = false;
}
bool FlowInformation::isPacketFilterUsage() const {
return m_PacketFilterUsage;
}
void FlowInformation::setPacketFilterUsage(bool const value) {
m_PacketFilterUsage = value;
m_PacketFilterUsageIsSet = true;
}
bool FlowInformation::packetFilterUsageIsSet() const {
return m_PacketFilterUsageIsSet;
}
void FlowInformation::unsetPacketFilterUsage() {
m_PacketFilterUsageIsSet = false;
}
std::string FlowInformation::getTosTrafficClass() const {
return m_TosTrafficClass;
}
void FlowInformation::setTosTrafficClass(std::string const& value) {
m_TosTrafficClass = value;
m_TosTrafficClassIsSet = true;
}
bool FlowInformation::tosTrafficClassIsSet() const {
return m_TosTrafficClassIsSet;
}
void FlowInformation::unsetTosTrafficClass() {
m_TosTrafficClassIsSet = false;
}
std::string FlowInformation::getSpi() const {
return m_Spi;
}
void FlowInformation::setSpi(std::string const& value) {
m_Spi = value;
m_SpiIsSet = true;
}
bool FlowInformation::spiIsSet() const {
return m_SpiIsSet;
}
void FlowInformation::unsetSpi() {
m_SpiIsSet = false;
}
std::string FlowInformation::getFlowLabel() const {
return m_FlowLabel;
}
void FlowInformation::setFlowLabel(std::string const& value) {
m_FlowLabel = value;
m_FlowLabelIsSet = true;
}
bool FlowInformation::flowLabelIsSet() const {
return m_FlowLabelIsSet;
}
void FlowInformation::unsetFlowLabel() {
m_FlowLabelIsSet = false;
}
FlowDirectionRm FlowInformation::getFlowDirection() const {
return m_FlowDirection;
}
void FlowInformation::setFlowDirection(FlowDirectionRm const& value) {
m_FlowDirection = value;
m_FlowDirectionIsSet = true;
}
bool FlowInformation::flowDirectionIsSet() const {
return m_FlowDirectionIsSet;
}
void FlowInformation::unsetFlowDirection() {
m_FlowDirectionIsSet = false;
}
} // namespace model
} // namespace smf_server
} // namespace oai
/**
* Npcf_SMPolicyControl API
* Session Management Policy Control Service © 2020, 3GPP Organizational
* Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.1.alpha-5
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
* FlowInformation.h
*
*
*/
#ifndef FlowInformation_H_
#define FlowInformation_H_
#include "FlowDirectionRm.h"
#include "EthFlowDescription.h"
#include <string>
#include <nlohmann/json.hpp>
namespace oai {
namespace smf_server {
namespace model {
/// <summary>
///
/// </summary>
class FlowInformation {
public:
FlowInformation();
virtual ~FlowInformation() = default;
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on
/// failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes
/// an error message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and
/// calls it's validate. Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const FlowInformation& rhs) const;
bool operator!=(const FlowInformation& rhs) const;
/////////////////////////////////////////////
/// FlowInformation members
/// <summary>
/// Defines a packet filter for an IP flow. Refer to subclause 5.4.2 of 3GPP
/// TS 29.212 for encoding.
/// </summary>
std::string getFlowDescription() const;
void setFlowDescription(std::string const& value);
bool flowDescriptionIsSet() const;
void unsetFlowDescription();
/// <summary>
///
/// </summary>
EthFlowDescription getEthFlowDescription() const;
void setEthFlowDescription(EthFlowDescription const& value);
bool ethFlowDescriptionIsSet() const;
void unsetEthFlowDescription();
/// <summary>
/// An identifier of packet filter.
/// </summary>
std::string getPackFiltId() const;
void setPackFiltId(std::string const& value);
bool packFiltIdIsSet() const;
void unsetPackFiltId();
/// <summary>
/// The packet shall be sent to the UE.
/// </summary>
bool isPacketFilterUsage() const;
void setPacketFilterUsage(bool const value);
bool packetFilterUsageIsSet() const;
void unsetPacketFilterUsage();
/// <summary>
/// Contains the Ipv4 Type-of-Service and mask field or the Ipv6 Traffic-Class
/// field and mask field.
/// </summary>
std::string getTosTrafficClass() const;
void setTosTrafficClass(std::string const& value);
bool tosTrafficClassIsSet() const;
void unsetTosTrafficClass();
/// <summary>
/// the security parameter index of the IPSec packet.
/// </summary>
std::string getSpi() const;
void setSpi(std::string const& value);
bool spiIsSet() const;
void unsetSpi();
/// <summary>
/// the Ipv6 flow label header field.
/// </summary>
std::string getFlowLabel() const;
void setFlowLabel(std::string const& value);
bool flowLabelIsSet() const;
void unsetFlowLabel();
/// <summary>
///
/// </summary>
FlowDirectionRm getFlowDirection() const;
void setFlowDirection(FlowDirectionRm const& value);
bool flowDirectionIsSet() const;
void unsetFlowDirection();
friend void to_json(nlohmann::json& j, const FlowInformation& o);
friend void from_json(const nlohmann::json& j, FlowInformation& o);
protected:
std::string m_FlowDescription;
bool m_FlowDescriptionIsSet;
EthFlowDescription m_EthFlowDescription;
bool m_EthFlowDescriptionIsSet;
std::string m_PackFiltId;
bool m_PackFiltIdIsSet;
bool m_PacketFilterUsage;
bool m_PacketFilterUsageIsSet;
std::string m_TosTrafficClass;
bool m_TosTrafficClassIsSet;
std::string m_Spi;
bool m_SpiIsSet;
std::string m_FlowLabel;
bool m_FlowLabelIsSet;
FlowDirectionRm m_FlowDirection;
bool m_FlowDirectionIsSet;
};
} // namespace model
} // namespace smf_server
} // namespace oai
#endif /* FlowInformation_H_ */
/**
* Npcf_SMPolicyControl API
* Session Management Policy Control Service © 2020, 3GPP Organizational
* Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.1.alpha-5
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
#include "FlowStatus.h"
#include "Helpers.h"
#include <sstream>
namespace oai {
namespace smf_server {
namespace model {
FlowStatus::FlowStatus() {}
void FlowStatus::validate() const {
std::stringstream msg;
if (!validate(msg)) {
// throw
// org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool FlowStatus::validate(std::stringstream& msg) const {
return validate(msg, "");
}
bool FlowStatus::validate(
std::stringstream& msg, const std::string& pathPrefix) const {
bool success = true;
const std::string _pathPrefix =
pathPrefix.empty() ? "FlowStatus" : pathPrefix;
if (!m_value.validate(msg)) {
success = false;
}
return success;
}
bool FlowStatus::operator==(const FlowStatus& rhs) const {
return
getValue() == rhs.getValue();
}
bool FlowStatus::operator!=(const FlowStatus& rhs) const {
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const FlowStatus& o) {
j = nlohmann::json();
to_json(j, o.m_value);
}
void from_json(const nlohmann::json& j, FlowStatus& o) {
from_json(j, o.m_value);
}
FlowStatus_anyOf FlowStatus::getValue() const {
return m_value;
}
void FlowStatus::setValue(FlowStatus_anyOf value) {
m_value = value;
}
FlowStatus_anyOf::eFlowStatus_anyOf FlowStatus::getEnumValue() const {
return m_value.getValue();
}
void FlowStatus::setEnumValue(FlowStatus_anyOf::eFlowStatus_anyOf value) {
m_value.setValue(value);
}
} // namespace model
} // namespace smf_server
} // namespace oai
/**
* Npcf_SMPolicyControl API
* Session Management Policy Control Service © 2020, 3GPP Organizational
* Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.1.alpha-5
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
* FlowStatus.h
*
*
*/
#ifndef FlowStatus_H_
#define FlowStatus_H_
#include "FlowStatus_anyOf.h"
#include <nlohmann/json.hpp>
namespace oai {
namespace smf_server {
namespace model {
/// <summary>
///
/// </summary>
class FlowStatus {
public:
FlowStatus();
virtual ~FlowStatus() = default;
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on
/// failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes
/// an error message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and
/// calls it's validate. Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const FlowStatus& rhs) const;
bool operator!=(const FlowStatus& rhs) const;
/////////////////////////////////////////////
/// FlowStatus members
FlowStatus_anyOf getValue() const;
void setValue(FlowStatus_anyOf value);
FlowStatus_anyOf::eFlowStatus_anyOf getEnumValue() const;
void setEnumValue(FlowStatus_anyOf::eFlowStatus_anyOf value);
friend void to_json(nlohmann::json& j, const FlowStatus& o);
friend void from_json(const nlohmann::json& j, FlowStatus& o);
friend void to_json(nlohmann::json& j, const FlowStatus_anyOf& o);
friend void from_json(const nlohmann::json& j, FlowStatus_anyOf& o);
protected:
FlowStatus_anyOf m_value;
};
} // namespace model
} // namespace smf_server
} // namespace oai
#endif /* FlowStatus_H_ */
/**
* Npcf_SMPolicyControl API
* Session Management Policy Control Service © 2020, 3GPP Organizational
* Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.1.alpha-5
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
#include "FlowStatus_anyOf.h"
#include "Helpers.h"
#include <stdexcept>
#include <sstream>
namespace oai {
namespace smf_server {
namespace model {
FlowStatus_anyOf::FlowStatus_anyOf() {}
void FlowStatus_anyOf::validate() const {
std::stringstream msg;
if (!validate(msg)) {
// throw
// org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool FlowStatus_anyOf::validate(std::stringstream& msg) const {
return validate(msg, "");
}
bool FlowStatus_anyOf::validate(
std::stringstream& msg, const std::string& pathPrefix) const {
bool success = true;
const std::string _pathPrefix =
pathPrefix.empty() ? "FlowStatus_anyOf" : pathPrefix;
if (m_value ==
FlowStatus_anyOf::eFlowStatus_anyOf::INVALID_VALUE_OPENAPI_GENERATED) {
success = false;
msg << _pathPrefix << ": has no value;";
}
return success;
}
bool FlowStatus_anyOf::operator==(const FlowStatus_anyOf& rhs) const {
return getValue() == rhs.getValue()
;
}
bool FlowStatus_anyOf::operator!=(const FlowStatus_anyOf& rhs) const {
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const FlowStatus_anyOf& o) {
j = nlohmann::json();
switch (o.getValue()) {
case FlowStatus_anyOf::eFlowStatus_anyOf::INVALID_VALUE_OPENAPI_GENERATED:
j = "INVALID_VALUE_OPENAPI_GENERATED";
break;
case FlowStatus_anyOf::eFlowStatus_anyOf::ENABLED_UPLINK:
j = "ENABLED-UPLINK";
break;
case FlowStatus_anyOf::eFlowStatus_anyOf::ENABLED_DOWNLINK:
j = "ENABLED-DOWNLINK";
break;
case FlowStatus_anyOf::eFlowStatus_anyOf::ENABLED:
j = "ENABLED";
break;
case FlowStatus_anyOf::eFlowStatus_anyOf::DISABLED:
j = "DISABLED";
break;
case FlowStatus_anyOf::eFlowStatus_anyOf::REMOVED:
j = "REMOVED";
break;
}
}
void from_json(const nlohmann::json& j, FlowStatus_anyOf& o) {
auto s = j.get<std::string>();
if (s == "ENABLED-UPLINK") {
o.setValue(FlowStatus_anyOf::eFlowStatus_anyOf::ENABLED_UPLINK);
} else if (s == "ENABLED-DOWNLINK") {
o.setValue(FlowStatus_anyOf::eFlowStatus_anyOf::ENABLED_DOWNLINK);
} else if (s == "ENABLED") {
o.setValue(FlowStatus_anyOf::eFlowStatus_anyOf::ENABLED);
} else if (s == "DISABLED") {
o.setValue(FlowStatus_anyOf::eFlowStatus_anyOf::DISABLED);
} else if (s == "REMOVED") {
o.setValue(FlowStatus_anyOf::eFlowStatus_anyOf::REMOVED);
} else {
std::stringstream ss;
ss << "Unexpected value " << s << " in json"
<< " cannot be converted to enum of type"
<< " FlowStatus_anyOf::eFlowStatus_anyOf";
throw std::invalid_argument(ss.str());
}
}
FlowStatus_anyOf::eFlowStatus_anyOf FlowStatus_anyOf::getValue() const {
return m_value;
}
void FlowStatus_anyOf::setValue(FlowStatus_anyOf::eFlowStatus_anyOf value) {
m_value = value;
}
} // namespace model
} // namespace smf_server
} // namespace oai
/**
* Npcf_SMPolicyControl API
* Session Management Policy Control Service © 2020, 3GPP Organizational
* Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.1.alpha-5
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
* FlowStatus_anyOf.h
*
*
*/
#ifndef FlowStatus_anyOf_H_
#define FlowStatus_anyOf_H_
#include <nlohmann/json.hpp>
namespace oai {
namespace smf_server {
namespace model {
/// <summary>
///
/// </summary>
class FlowStatus_anyOf {
public:
FlowStatus_anyOf();
virtual ~FlowStatus_anyOf() = default;
enum class eFlowStatus_anyOf {
// To have a valid default value.
// Avoiding name clashes with user defined
// enum values
INVALID_VALUE_OPENAPI_GENERATED = 0,
ENABLED_UPLINK,
ENABLED_DOWNLINK,
ENABLED,
DISABLED,
REMOVED
};
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on
/// failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes
/// an error message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and
/// calls it's validate. Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const FlowStatus_anyOf& rhs) const;
bool operator!=(const FlowStatus_anyOf& rhs) const;
/////////////////////////////////////////////
/// FlowStatus_anyOf members
FlowStatus_anyOf::eFlowStatus_anyOf getValue() const;
void setValue(FlowStatus_anyOf::eFlowStatus_anyOf value);
friend void to_json(nlohmann::json& j, const FlowStatus_anyOf& o);
friend void from_json(const nlohmann::json& j, FlowStatus_anyOf& o);
protected:
FlowStatus_anyOf::eFlowStatus_anyOf m_value =
FlowStatus_anyOf::eFlowStatus_anyOf::INVALID_VALUE_OPENAPI_GENERATED;
};
} // namespace model
} // namespace smf_server
} // namespace oai
#endif /* FlowStatus_anyOf_H_ */
...@@ -28,6 +28,20 @@ void GNbId::validate() { ...@@ -28,6 +28,20 @@ void GNbId::validate() {
// TODO: implement validation // TODO: implement validation
} }
bool GNbId::operator==(const GNbId& rhs) const {
return
(getBitLength() == rhs.getBitLength()) &&
(getGNBValue() == rhs.getGNBValue())
;
}
bool GNbId::operator!=(const GNbId& rhs) const {
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const GNbId& o) { void to_json(nlohmann::json& j, const GNbId& o) {
j = nlohmann::json(); j = nlohmann::json();
j["bitLength"] = o.m_BitLength; j["bitLength"] = o.m_BitLength;
......
...@@ -36,6 +36,9 @@ class GNbId { ...@@ -36,6 +36,9 @@ class GNbId {
void validate(); void validate();
bool operator==(const GNbId& rhs) const;
bool operator!=(const GNbId& rhs) const;
///////////////////////////////////////////// /////////////////////////////////////////////
/// GNbId members /// GNbId members
......
...@@ -39,6 +39,43 @@ void GlobalRanNodeId::validate() { ...@@ -39,6 +39,43 @@ void GlobalRanNodeId::validate() {
// TODO: implement validation // TODO: implement validation
} }
bool GlobalRanNodeId::operator==(const GlobalRanNodeId& rhs) const {
return
(getPlmnId() == rhs.getPlmnId()) &&
((!n3IwfIdIsSet() && !rhs.n3IwfIdIsSet()) ||
(n3IwfIdIsSet() && rhs.n3IwfIdIsSet() &&
getN3IwfId() == rhs.getN3IwfId())) &&
((!gNbIdIsSet() && !rhs.gNbIdIsSet()) ||
(gNbIdIsSet() && rhs.gNbIdIsSet() && getGNbId() == rhs.getGNbId())) &&
((!ngeNbIdIsSet() && !rhs.ngeNbIdIsSet()) ||
(ngeNbIdIsSet() && rhs.ngeNbIdIsSet() &&
getNgeNbId() == rhs.getNgeNbId())) &&
((!wagfIdIsSet() && !rhs.wagfIdIsSet()) ||
(wagfIdIsSet() && rhs.wagfIdIsSet() &&
getWagfId() == rhs.getWagfId())) &&
((!tngfIdIsSet() && !rhs.tngfIdIsSet()) ||
(tngfIdIsSet() && rhs.tngfIdIsSet() &&
getTngfId() == rhs.getTngfId())) &&
((!nidIsSet() && !rhs.nidIsSet()) ||
(nidIsSet() && rhs.nidIsSet() && getNid() == rhs.getNid())) &&
((!eNbIdIsSet() && !rhs.eNbIdIsSet()) ||
(eNbIdIsSet() && rhs.eNbIdIsSet() && getENbId() == rhs.getENbId()))
;
}
bool GlobalRanNodeId::operator!=(const GlobalRanNodeId& rhs) const {
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const GlobalRanNodeId& o) { void to_json(nlohmann::json& j, const GlobalRanNodeId& o) {
j = nlohmann::json(); j = nlohmann::json();
j["plmnId"] = o.m_PlmnId; j["plmnId"] = o.m_PlmnId;
......
...@@ -38,6 +38,9 @@ class GlobalRanNodeId { ...@@ -38,6 +38,9 @@ class GlobalRanNodeId {
void validate(); void validate();
bool operator==(const GlobalRanNodeId& rhs) const;
bool operator!=(const GlobalRanNodeId& rhs) const;
///////////////////////////////////////////// /////////////////////////////////////////////
/// GlobalRanNodeId members /// GlobalRanNodeId members
......
...@@ -25,11 +25,29 @@ void Ipv6Addr::validate() { ...@@ -25,11 +25,29 @@ void Ipv6Addr::validate() {
// TODO: implement validation // TODO: implement validation
} }
bool Ipv6Addr::operator==(const Ipv6Addr& rhs) const {
return getIpv6Addr() == rhs.getIpv6Addr();
}
bool Ipv6Addr::operator!=(const Ipv6Addr& rhs) const {
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Ipv6Addr& o) { void to_json(nlohmann::json& j, const Ipv6Addr& o) {
j = nlohmann::json(); j = nlohmann::json();
j = o.getIpv6Addr();
} }
void from_json(const nlohmann::json& j, Ipv6Addr& o) {} void from_json(const nlohmann::json& j, Ipv6Addr& o) {
o.setIpv6Addr(j);
}
std::string Ipv6Addr::getIpv6Addr() const {
return m_Ipv6Addr;
}
void Ipv6Addr::setIpv6Addr(std::string const& value) {
m_Ipv6Addr = value;
}
} // namespace model } // namespace model
} // namespace smf_server } // namespace smf_server
......
...@@ -38,10 +38,20 @@ class Ipv6Addr { ...@@ -38,10 +38,20 @@ class Ipv6Addr {
///////////////////////////////////////////// /////////////////////////////////////////////
/// Ipv6Addr members /// Ipv6Addr members
bool operator==(const Ipv6Addr& rhs) const;
bool operator!=(const Ipv6Addr& rhs) const;
/////////////////////////////////////////////
/// Ipv6Addr members
friend void to_json(nlohmann::json& j, const Ipv6Addr& o); friend void to_json(nlohmann::json& j, const Ipv6Addr& o);
friend void from_json(const nlohmann::json& j, Ipv6Addr& o); friend void from_json(const nlohmann::json& j, Ipv6Addr& o);
std::string getIpv6Addr() const;
void setIpv6Addr(std::string const& value);
protected: protected:
std::string m_Ipv6Addr;
}; };
} // namespace model } // namespace model
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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