Commit d0999567 authored by sagar arora's avatar sagar arora

Release v1.4.0

* Standalone support validated for traffic steering and redirection
* Added instructions for bare-metal installation
* Support for Ubuntu 20.04 bare-metal/docker installation
* Official images produced by CI are pushed to `oaisoftwarealliance` Docker-Hub Team account
parents 51ac716a 82dd0458
# RELEASE NOTES: # # RELEASE NOTES: #
## v1.4.0 -- July 2022 ##
* Standalone support validated for traffic steering and redirection
* Added instructions for bare-metal installation
* Support for Ubuntu 20.04 bare-metal/docker installation
* Official images produced by CI are pushed to `oaisoftwarealliance` Docker-Hub Team account
## v1.3.0 -- January 2022 ## ## v1.3.0 -- January 2022 ##
* Upgrade to UPG plugin stable/1.2 * Upgrade to UPG plugin stable/1.2
......
...@@ -15,6 +15,7 @@ At the moment, it contains the following network elements: ...@@ -15,6 +15,7 @@ At the moment, it contains the following network elements:
* Unified Data Management (**UDM**) * Unified Data Management (**UDM**)
* Unified Data Repository (**UDR**) * Unified Data Repository (**UDR**)
* User Plane Function (**UPF**) * User Plane Function (**UPF**)
* Network Slicing Selection Function (**NSSF**)
Each has its own repository: this repository (`oai-cn5g-upf-vpp`) is meant for UPF. Each has its own repository: this repository (`oai-cn5g-upf-vpp`) is meant for UPF.
......
...@@ -166,7 +166,7 @@ compilations() { ...@@ -166,7 +166,7 @@ compilations() {
echo_info "Compilation log for $1 is here: $dlog/$2.txt" echo_info "Compilation log for $1 is here: $dlog/$2.txt"
cd $OPENAIRCN_DIR/$1/ cd $OPENAIRCN_DIR/$1/
{ {
make build make build-release | tee $dlog/$2.txt
if grep -q "@@ Installing vpp @@" "$dlog/$2.txt" ; then if grep -q "@@ Installing vpp @@" "$dlog/$2.txt" ; then
echo_success "##### VPP Compiled Successfully #####" echo_success "##### VPP Compiled Successfully #####"
else else
......
...@@ -51,15 +51,11 @@ check_install_vpp_upf_deps() { ...@@ -51,15 +51,11 @@ check_install_vpp_upf_deps() {
check_supported_distribution check_supported_distribution
[[ $? -ne 0 ]] && return $? [[ $? -ne 0 ]] && return $?
# prevent lock on /var/lib/dpkg/lock if [[ $OS_RELEASE == "20.04" ]]; then
if [[ $OS_DISTRO == "ubuntu" ]]; then TZ=Europe/Paris
#$SUDO systemctl mask apt-daily.service ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
#$SUDO systemctl mask apt-daily.timer
#$SUDO systemctl mask apt-daily-upgrade.service
#$SUDO systemctl mask apt-daily-upgrade.timer
$SUDO sed -i 's/1/0/g' /etc/apt/apt.conf.d/10periodic
fi fi
# Compilers, generators, ... # Compilers, generators, ...
if [[ $OS_DISTRO == "ubuntu" ]]; then if [[ $OS_DISTRO == "ubuntu" ]]; then
PACKAGE_LIST="\ PACKAGE_LIST="\
...@@ -83,7 +79,7 @@ check_install_vpp_upf_deps() { ...@@ -83,7 +79,7 @@ check_install_vpp_upf_deps() {
echo_fatal "$OS_DISTRO is not a supported distribution." echo_fatal "$OS_DISTRO is not a supported distribution."
fi fi
echo "Install build tools" echo "Install build tools"
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST $SUDO $INSTALLER update && $SUDO $INSTALLER install $OPTION $PACKAGE_LIST
ret=$?;[[ $ret -ne 0 ]] && return $ret ret=$?;[[ $ret -ne 0 ]] && return $ret
check_install_vpp_upf_source_deps check_install_vpp_upf_source_deps
...@@ -92,29 +88,33 @@ check_install_vpp_upf_deps() { ...@@ -92,29 +88,33 @@ check_install_vpp_upf_deps() {
} }
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
check_install_vpp_upf_deps() { check_install_vpp_upf_source_deps() {
echo_info "Cloning fdio VPP $OPENAIRCN_DIR/"
if [ -d "$OPENAIRCN_DIR/vpp" ]; then if [ -d "$OPENAIRCN_DIR/vpp" ]; then
echo_error "clone failed : - vpp source is already present at $OPENAIRCN_DIR/... use option -w to wipe out vpp source" echo_error "Warning :- vpp source is already present at $OPENAIRCN_DIR/... use option -w to wipe out vpp source"
fi fi
install_dep install_dep
} }
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
install_dep(){ install_dep(){
if [ -d "$OPENAIRCN_DIR/vpp" ]; then
remove_vpp_source
fi
GIT_URL=https://github.com/fdio/vpp.git GIT_URL=https://github.com/fdio/vpp.git
GIT_BRANCH=stable/2101 GIT_BRANCH=stable/2101
pushd $OPENAIRCN_DIR/ pushd $OPENAIRCN_DIR/
echo_info "Cloning fdio VPP $OPENAIRCN_DIR/"
git clone -b $GIT_BRANCH $GIT_URL git clone -b $GIT_BRANCH $GIT_URL
# echo "APT::Get::Assume-Yes "true";" >> /etc/apt/apt.conf.d/90forceyes $SUDO rm -rf /etc/apt/apt.conf.d/90forceyes
# echo "APT::Get::force-yes "true";" >> /etc/apt/apt.conf.d/90forceyes $SUDO sh -c 'echo "APT::Get::Assume-Yes "true";" >> /etc/apt/apt.conf.d/90forceyes'
cd vpp && make install-dep $SUDO sh -c 'echo "APT::Get::force-yes "true";" >> /etc/apt/apt.conf.d/90forceyes'
make install-dep -C vpp
return 0 return 0
} }
remove_vpp_source(){ remove_vpp_source(){
rm -rf $OPENAIRCN_DIR/vpp/ rm -rf $OPENAIRCN_DIR/vpp/
echo_fatal "Removed vpp source $OPENAIRCN_DIR/vpp" echo_error "Removed vpp source $OPENAIRCN_DIR/vpp"
} }
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
...@@ -146,5 +146,26 @@ vpp_upf_init(){ ...@@ -146,5 +146,26 @@ vpp_upf_init(){
cp $OPENAIRCN_DIR/scripts/upf_conf/* $OPENAIRCN_DIR/vpp cp $OPENAIRCN_DIR/scripts/upf_conf/* $OPENAIRCN_DIR/vpp
cp $OPENAIRCN_DIR/scripts/run.sh $OPENAIRCN_DIR/vpp cp $OPENAIRCN_DIR/scripts/run.sh $OPENAIRCN_DIR/vpp
echo_info "Installing VPP" echo_info "Installing VPP"
sudo cp -rf $OPENAIRCN_DIR/vpp/build-root/install-vpp_debug-native/vpp/lib/ /usr/lib/x86_64-linux-gnu/vpp_plugins/ # Copying binaries
$SUDO cp -rf $OPENAIRCN_DIR/vpp/build-root/install-vpp-native/vpp/bin/vpp /bin/
$SUDO cp -rf $OPENAIRCN_DIR/vpp/build-root/install-vpp-native/vpp/bin/vppctl /bin/
echo_info "Copied binaries to /bin"
# Copying necessary libraries
# $SUDO cp -rf $OPENAIRCN_DIR/vpp/build-root/install-vpp-native/vpp/lib/vpp_plugins /usr/lib/x86_64-linux-gnu/vpp_plugins/
$SUDO cp -rf $OPENAIRCN_DIR/vpp/build-root/install-vpp-native/vpp/lib/vpp_plugins/upf_plugin.so /usr/lib/x86_64-linux-gnu/vpp_plugins/
$SUDO cp -rf $OPENAIRCN_DIR/vpp/build-root/install-vpp-native/vpp/lib/vpp_plugins/dpdk_plugin.so /usr/lib/x86_64-linux-gnu/vpp_plugins/
$SUDO cp -rf $OPENAIRCN_DIR/vpp/build-root/install-vpp-native/vpp/lib/libvppinfra.so.21.01.1 /usr/lib/x86_64-linux-gnu/
$SUDO cp -rf $OPENAIRCN_DIR/vpp/build-root/install-vpp-native/vpp/lib/libvnet.so.21.01.1 /usr/lib/x86_64-linux-gnu/
$SUDO cp -rf $OPENAIRCN_DIR/vpp/build-root/install-vpp-native/vpp/lib/libvlibmemory.so.21.01.1 /usr/lib/x86_64-linux-gnu/
$SUDO cp -rf $OPENAIRCN_DIR/vpp/build-root/install-vpp-native/vpp/lib/libvlib.so.21.01.1 /usr/lib/x86_64-linux-gnu/
$SUDO cp -rf $OPENAIRCN_DIR/vpp/build-root/install-vpp-native/vpp/lib/libsvm.so.21.01.1 /usr/lib/x86_64-linux-gnu/
$SUDO cp -rf $OPENAIRCN_DIR/vpp/build-root/install-vpp-native/vpp/lib/libnat.so.21.01.1 /usr/lib/x86_64-linux-gnu/
$SUDO ldconfig
echo_info "Copied libraries to /usr/lib/x86_64-linux-gnu/"
if [ $(getent group vpp) ]; then
echo "group vpp not added since it already exists"
else
$SUDO groupadd vpp
echo "group vpp added"
fi
} }
...@@ -142,7 +142,6 @@ function main() ...@@ -142,7 +142,6 @@ function main()
mkdir -m 777 -p $dext mkdir -m 777 -p $dext
if [ $var_check_install_deps -gt 0 ];then if [ $var_check_install_deps -gt 0 ];then
disable_ipv6
check_install_vpp_upf_deps $force $debug check_install_vpp_upf_deps $force $debug
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo_error "Error: VPP UPF deps installation failed" echo_error "Error: VPP UPF deps installation failed"
......
This diff is collapsed.
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
#---------------------------------------------------------------------
#
# Dockerfile for the VPP-UPG service
# Valid for RHEL 8.2
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM vpp-upf-base:latest AS vpp-upf-builder
WORKDIR /vpp-upf
COPY . .
# Applying vpp patches
RUN git clone -b stable/2101 https://github.com/fdio/vpp.git && \
git clone -b stable/1.2 https://github.com/travelping/upg-vpp.git && \
cd upg-vpp && \
cd .. && \
mv upg-vpp/upf/ vpp/src/plugins/ && \
mv upg-vpp/vpp-patches/* scripts/patches/ && \
mv upg-vpp/vpp.spec / && \
./scripts/apply_vpp_patches.sh
RUN make build-release -C vpp/ && \
ldd /vpp-upf/vpp/build-root/install-vpp-native/vpp/bin/vpp && \
ldd /vpp-upf/vpp/build-root/install-vpp-native/vpp/bin/vppctl
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM registry.access.redhat.com/ubi7/ubi:latest as oai-upf-vpp
ENV TZ=Europe/Paris
# We install some debug tools for the moment in addition of mandatory libraries
RUN yum repolist --disablerepo=* && \
yum update -y && \
yum install -y \
net-tools \
iputils \
tshark \
tzdata\
iproute \
numactl-devel \
wget \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm && \
wget http://repo.openfusion.net/centos7-x86_64/hyperscan-devel-5.3.0-1.of.el7.x86_64.rpm \
http://repo.openfusion.net/centos7-x86_64/hyperscan-5.3.0-1.of.el7.x86_64.rpm && \
rpm -i *.rpm && \
rm *.rpm && \
yum remove -y wget && \
yum clean all -y && \
rm -rf /var/cache/yum /var/cache/dnf
WORKDIR /openair-upf/bin
COPY --from=vpp-upf-builder \
/vpp-upf/scripts/entrypoint.sh \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/bin/vpp \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/bin/vppctl \
/vpp-upf/src/nrf_client.sh ./
COPY --from=vpp-upf-builder \
/vpp-upf/scripts/upf_conf/init.conf \
/vpp-upf/scripts/upf_conf/startup_debug.conf \
/vpp-upf/scripts/upf_conf/upf_profile.json \
/openair-upf/etc/
COPY --from=vpp-upf-builder \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/vpp_plugins/upf_plugin.so \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/vpp_plugins/dpdk_plugin.so \
/usr/lib64/vpp_plugins/
COPY --from=vpp-upf-builder \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libvppinfra.so.21.01.1 \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libvnet.so.21.01.1 \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libvlibmemory.so.21.01.1 \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libvlib.so.21.01.1 \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libsvm.so.21.01.1 \
# /vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libnat.so.21.01.1 \
/usr/lib64/
RUN ldconfig && \
ldd /openair-upf/bin/vpp && \
ldd /openair-upf/bin/vppctl
RUN groupadd vpp
WORKDIR /openair-upf
COPY --from=vpp-upf-builder /vpp-upf/scripts/run.sh .
#expose
EXPOSE 8085/udp 2152/udp
ENTRYPOINT ["/openair-upf/bin/entrypoint.sh"]
CMD ["/openair-upf/run.sh"]
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
#---------------------------------------------------------------------
#
# Dockerfile for the VPP-UPF service
# Valid for Ubuntu-18.04 (bionic) and Ubuntu-20.04 (focal)
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
ARG BASE_IMAGE=ubuntu:18.04
FROM vpp-upf-base:latest AS vpp-upf-builder
WORKDIR /vpp-upf
COPY . .
# Applying vpp patches
RUN git clone -b stable/2101 https://github.com/fdio/vpp.git && \
git clone -b stable/1.2 https://github.com/travelping/upg-vpp.git && \
cd upg-vpp && \
cd .. && \
mv upg-vpp/upf/ vpp/src/plugins/ && \
mv upg-vpp/vpp-patches/* scripts/patches/ && \
mv upg-vpp/vpp.spec / && \
./scripts/apply_vpp_patches.sh
# To Do - remove unnecessary pulgin build to optimise build time e.g. ipsec, dpdk etc.
# Build vpp with Travelping upf plugin
RUN make build-release -C vpp && \
ldd /vpp-upf/vpp/build-root/install-vpp-native/vpp/bin/vpp && \
ldd /vpp-upf/vpp/build-root/install-vpp-native/vpp/bin/vppctl
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM $BASE_IMAGE as oai-upf-vpp
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Paris
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \
net-tools \
tzdata\
libhyperscan-dev \
iproute2 \
iputils-ping \
curl \
libnuma1 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /openair-upf/bin
COPY --from=vpp-upf-builder \
/vpp-upf/scripts/entrypoint.sh \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/bin/vpp \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/bin/vppctl \
/vpp-upf/src/nrf_client.sh \
./
COPY --from=vpp-upf-builder \
/vpp-upf/scripts/upf_conf/init.conf \
/vpp-upf/scripts/upf_conf/startup_debug.conf \
/vpp-upf/scripts/upf_conf/upf_profile.json \
/openair-upf/etc/
COPY --from=vpp-upf-builder \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/vpp_plugins/upf_plugin.so \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/vpp_plugins/dpdk_plugin.so \
/usr/lib/x86_64-linux-gnu/vpp_plugins/
COPY --from=vpp-upf-builder \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libvppinfra.so.21.01.1 \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libvnet.so.21.01.1 \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libvlibmemory.so.21.01.1 \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libvlib.so.21.01.1 \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libsvm.so.21.01.1 \
# /vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libnat.so.21.01.1 \
/usr/lib/x86_64-linux-gnu/
RUN ldconfig && \
ldd /openair-upf/bin/vpp && \
ldd /openair-upf/bin/vppctl
RUN groupadd vpp
WORKDIR /openair-upf
COPY --from=vpp-upf-builder /vpp-upf/scripts/run.sh .
#expose
EXPOSE 8085/udp 2152/udp
ENTRYPOINT ["/openair-upf/bin/entrypoint.sh"]
CMD ["/openair-upf/run.sh"]
"""
Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The OpenAirInterface Software Alliance licenses this file to You under
the OAI Public License, Version 1.1 (the "License"); you may not use this file
except in compliance with the License.
You may obtain a copy of the License at
http://www.openairinterface.org/?page_id=698
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------------
For more information about the OpenAirInterface (OAI) Software Alliance:
contact@openairinterface.org
"""
import argparse
import re
import subprocess
import sys
def main() -> None:
args = _parse_args()
status = perform_flattening(args.tag)
sys.exit(status)
def _parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(description='Flattening Image')
parser.add_argument(
'--tag', '-t',
action='store',
required=True,
help='Image Tag in image-name:image tag format',
)
return parser.parse_args()
def perform_flattening(tag):
# First detect which docker/podman command to use
cli = ''
image_prefix = ''
cmd = 'which podman || true'
podman_check = subprocess.check_output(cmd, shell=True, universal_newlines=True)
if re.search('podman', podman_check.strip()):
cli = 'sudo podman'
image_prefix = 'localhost/'
if cli == '':
cmd = 'which docker || true'
docker_check = subprocess.check_output(cmd, shell=True, universal_newlines=True)
if re.search('docker', docker_check.strip()):
cli = 'docker'
image_prefix = ''
if cli == '':
print ('No docker / podman installed: quitting')
return -1
print (f'Flattening {tag}')
# Creating a container
cmd = cli + ' run --name test-flatten --entrypoint /bin/true -d ' + tag
print (cmd)
subprocess.check_output(cmd, shell=True, universal_newlines=True)
# Export / Import trick
cmd = cli + ' export test-flatten | ' + cli + ' import '
# Bizarro syntax issue with podman
if cli == 'docker':
cmd += ' --change "ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" '
else:
cmd += ' --change "ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" '
cmd += ' --change "WORKDIR /openair-upf" '
cmd += ' --change "EXPOSE 8085/udp" '
cmd += ' --change "EXPOSE 2152/udp" '
cmd += ' --change "CMD [\\"/openair-upf/run.sh\\"]" '
cmd += ' --change "ENTRYPOINT [\\"/openair-upf/bin/entrypoint.sh\\"]" '
cmd += ' - ' + image_prefix + tag
print (cmd)
subprocess.check_output(cmd, shell=True, universal_newlines=True)
# Remove container
cmd = cli + ' rm -f test-flatten'
print (cmd)
subprocess.check_output(cmd, shell=True, universal_newlines=True)
# At this point the original image is a dangling image.
# CI pipeline will clean up (`image prune --force`)
return 0
if __name__ == '__main__':
main()
...@@ -49,7 +49,7 @@ class HtmlReport(): ...@@ -49,7 +49,7 @@ class HtmlReport():
self.buildSummaryHeader() self.buildSummaryHeader()
self.initialGitSetup() self.initialGitSetup()
self.cloningAnPatching() self.cloningAndPatching()
self.installLibsPackagesRow() self.installLibsPackagesRow()
self.buildCompileRows() self.buildCompileRows()
self.copyToTargetImage() self.copyToTargetImage()
...@@ -253,7 +253,7 @@ class HtmlReport(): ...@@ -253,7 +253,7 @@ class HtmlReport():
self.file.write(cell_msg) self.file.write(cell_msg)
def cloningAnPatching(self): def cloningAndPatching(self):
self.file.write(' <tr>\n') self.file.write(' <tr>\n')
self.file.write(' <td bgcolor="lightcyan" >Cloning and Patching VPP</td>\n') self.file.write(' <td bgcolor="lightcyan" >Cloning and Patching VPP</td>\n')
self.analyze_docker_clone_patch('UPF-VPP') self.analyze_docker_clone_patch('UPF-VPP')
...@@ -273,8 +273,11 @@ class HtmlReport(): ...@@ -273,8 +273,11 @@ class HtmlReport():
logFileName = 'upf_' + variant + '_image_build.log' logFileName = 'upf_' + variant + '_image_build.log'
if os.path.isfile(cwd + '/archives/' + logFileName): if os.path.isfile(cwd + '/archives/' + logFileName):
status = False status = False
section_start_pattern = 'git clone -b stable/2101 https://github.com/fdio/vpp.git' section_start_pattern = 'RUN git clone -b stable/2101 https://github.com/fdio/vpp.git'
section_end_pattern = 'RUN make install-dep build-release -C vpp' if self.git_pull_request:
section_end_pattern = 'RUN make build-release -C vpp'
else:
section_end_pattern = 'RUN make install-dep -C vpp'
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:
...@@ -322,7 +325,10 @@ class HtmlReport(): ...@@ -322,7 +325,10 @@ class HtmlReport():
logFileName = 'upf_' + variant + '_image_build.log' logFileName = 'upf_' + variant + '_image_build.log'
if os.path.isfile(cwd + '/archives/' + logFileName): if os.path.isfile(cwd + '/archives/' + logFileName):
status = False status = False
section_start_pattern = 'RUN make install-dep build-release -C vpp' if self.git_pull_request:
section_start_pattern = 'RUN make build-release -C vpp'
else:
section_start_pattern = 'RUN make install-dep -C vpp'
if variant == 'docker': if variant == 'docker':
section_end_pattern = 'FROM ubuntu:bionic as oai-upf-vpp' section_end_pattern = 'FROM ubuntu:bionic as oai-upf-vpp'
else: else:
...@@ -355,11 +361,13 @@ class HtmlReport(): ...@@ -355,11 +361,13 @@ class HtmlReport():
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>'
cell_msg += 'KO:\n' cell_msg += 'KO:\n'
if not self.git_pull_request:
cell_msg += ' -- make install-dep -C vpp\n'
if package_install:
cell_msg += ' ** Packages Installation: OK\n'
else:
cell_msg += ' ** Packages Installation: KO\n'
cell_msg += ' -- make install-dep build-release -C vpp\n' cell_msg += ' -- make install-dep build-release -C vpp\n'
if package_install:
cell_msg += ' ** Packages Installation: OK\n'
else:
cell_msg += ' ** Packages Installation: KO\n'
if dpdk_build_status: if dpdk_build_status:
cell_msg += ' ** dpdk Installation: OK\n' cell_msg += ' ** dpdk Installation: OK\n'
else: else:
...@@ -513,7 +521,7 @@ class HtmlReport(): ...@@ -513,7 +521,7 @@ class HtmlReport():
logFileName = 'upf_' + variant + '_image_build.log' logFileName = 'upf_' + variant + '_image_build.log'
if os.path.isfile(cwd + '/archives/' + logFileName): if os.path.isfile(cwd + '/archives/' + logFileName):
section_start_pattern = '[aA][sS] oai-upf-vpp$' section_start_pattern = '[aA][sS] oai-upf-vpp$'
section_end_pattern = 'WORKDIR /openair-upf/etc' section_end_pattern = 'RUN ldconfig'
section_status = False section_status = False
status = False status = False
with open(cwd + '/archives/' + logFileName, 'r') as logfile: with open(cwd + '/archives/' + logFileName, 'r') as logfile:
...@@ -558,7 +566,7 @@ class HtmlReport(): ...@@ -558,7 +566,7 @@ class HtmlReport():
for variant in variants: for variant in variants:
logFileName = 'upf_' + variant + '_image_build.log' logFileName = 'upf_' + variant + '_image_build.log'
if os.path.isfile(cwd + '/archives/' + logFileName): if os.path.isfile(cwd + '/archives/' + logFileName):
section_start_pattern = 'WORKDIR /openair-upf/etc' section_start_pattern = 'RUN groupadd vpp'
if variant == 'docker': if variant == 'docker':
section_end_pattern = 'Successfully tagged oai-upf-vpp:' section_end_pattern = 'Successfully tagged oai-upf-vpp:'
else: else:
...@@ -629,10 +637,10 @@ class HtmlReport(): ...@@ -629,10 +637,10 @@ class HtmlReport():
if section_status: if section_status:
if nfType == 'UPF-VPP': if nfType == 'UPF-VPP':
if self.git_pull_request: if self.git_pull_request:
result = re.search('oai-upf-vpp *ci-tmp', line) result = re.search('oai-upf-vpp *ci-tmp ', line)
else: else:
result = re.search('oai-upf-vpp *develop', line) result = re.search('oai-upf-vpp *develop ', line)
if result is not None: if result is not None and not status:
if variant == 'docker': if variant == 'docker':
result = re.search('ago *([0-9A-Z\.]+)', line) result = re.search('ago *([0-9A-Z\.]+)', line)
else: else:
......
...@@ -32,8 +32,12 @@ FROM registry.access.redhat.com/ubi7/ubi:latest AS vpp-upf-builder ...@@ -32,8 +32,12 @@ FROM registry.access.redhat.com/ubi7/ubi:latest AS vpp-upf-builder
ARG NEEDED_GIT_PROXY ARG NEEDED_GIT_PROXY
COPY tmp/ca/redhat-uep.pem /etc/rhsm/ca # Copy the entitlements
COPY tmp/entitlement/*.pem /etc/pki/entitlement COPY ./etc-pki-entitlement /etc/pki/entitlement
# Copy the subscription manager configurations
COPY ./rhsm-conf /etc/rhsm
COPY ./rhsm-ca /etc/rhsm/ca
RUN rm -f /etc/rhsm-host && \ RUN rm -f /etc/rhsm-host && \
subscription-manager repos --enable rhel-server-rhscl-7-rpms && \ subscription-manager repos --enable rhel-server-rhscl-7-rpms && \
...@@ -72,7 +76,10 @@ RUN git clone -b stable/2101 https://github.com/fdio/vpp.git && \ ...@@ -72,7 +76,10 @@ RUN git clone -b stable/2101 https://github.com/fdio/vpp.git && \
mv upg-vpp/vpp.spec / && \ mv upg-vpp/vpp.spec / && \
./scripts/apply_vpp_patches.sh ./scripts/apply_vpp_patches.sh
RUN make install-dep build-release -C vpp/ RUN make install-dep -C vpp/
RUN make build-release -C vpp/ && \
ldd /vpp-upf/vpp/build-root/install-vpp-native/vpp/bin/vpp && \
ldd /vpp-upf/vpp/build-root/install-vpp-native/vpp/bin/vppctl
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# TARGET IMAGE # TARGET IMAGE
...@@ -97,25 +104,39 @@ RUN yum repolist --disablerepo=* && \ ...@@ -97,25 +104,39 @@ RUN yum repolist --disablerepo=* && \
rpm -i *.rpm && \ rpm -i *.rpm && \
rm *.rpm && \ rm *.rpm && \
yum remove -y wget && \ yum remove -y wget && \
rm -rf /var/lib/apt/lists/* yum clean all -y && \
rm -rf /var/cache/yum /var/cache/dnf
RUN yum install -y python-pip && pip install termcolor
WORKDIR /openair-upf/bin WORKDIR /openair-upf/bin
COPY --from=vpp-upf-builder /vpp-upf/scripts/entrypoint.sh . COPY --from=vpp-upf-builder \
COPY --from=vpp-upf-builder /vpp-upf/vpp/build-root/install-vpp-native/vpp/bin/vpp . /vpp-upf/scripts/entrypoint.sh \
COPY --from=vpp-upf-builder /vpp-upf/vpp/build-root/install-vpp-native/vpp/bin/vppctl . /vpp-upf/vpp/build-root/install-vpp-native/vpp/bin/vpp \
COPY --from=vpp-upf-builder /vpp-upf/src/nrf_client.py . /vpp-upf/vpp/build-root/install-vpp-native/vpp/bin/vppctl \
/vpp-upf/src/nrf_client.sh ./
WORKDIR /openair-upf/etc
COPY --from=vpp-upf-builder /vpp-upf/scripts/upf_conf/init.conf . COPY --from=vpp-upf-builder \
COPY --from=vpp-upf-builder /vpp-upf/scripts/upf_conf/startup_debug.conf . /vpp-upf/scripts/upf_conf/init.conf \
COPY --from=vpp-upf-builder /vpp-upf/scripts/upf_conf/upf_profile.json . /vpp-upf/scripts/upf_conf/startup_debug.conf \
/vpp-upf/scripts/upf_conf/upf_profile.json \
WORKDIR /usr/lib64 /openair-upf/etc/
COPY --from=vpp-upf-builder /vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/ .
COPY --from=vpp-upf-builder \
RUN ldconfig /vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/vpp_plugins/upf_plugin.so \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/vpp_plugins/dpdk_plugin.so \
/usr/lib64/vpp_plugins/
COPY --from=vpp-upf-builder \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libvppinfra.so.21.01.1 \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libvnet.so.21.01.1 \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libvlibmemory.so.21.01.1 \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libvlib.so.21.01.1 \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libsvm.so.21.01.1 \
# /vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libnat.so.21.01.1 \
/usr/lib64/
RUN ldconfig && \
ldd /openair-upf/bin/vpp && \
ldd /openair-upf/bin/vppctl
RUN groupadd vpp RUN groupadd vpp
......
...@@ -21,14 +21,15 @@ ...@@ -21,14 +21,15 @@
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# #
# Dockerfile for the VPP-UPF service # Dockerfile for the VPP-UPF service
# Valid for Ubuntu-18.04 (bionic) # Valid for Ubuntu-18.04 (bionic) and Ubuntu-20.04 (focal)
# #
#--------------------------------------------------------------------- #---------------------------------------------------------------------
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# BUILDER IMAGE # BUILDER IMAGE
#--------------------------------------------------------------------- #---------------------------------------------------------------------
FROM ubuntu:18.04 AS vpp-upf-builder ARG BASE_IMAGE=ubuntu:18.04
FROM $BASE_IMAGE AS vpp-upf-builder
ARG NEEDED_GIT_PROXY ARG NEEDED_GIT_PROXY
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
...@@ -70,13 +71,16 @@ RUN git clone -b stable/2101 https://github.com/fdio/vpp.git && \ ...@@ -70,13 +71,16 @@ RUN git clone -b stable/2101 https://github.com/fdio/vpp.git && \
# To Do - remove unnecessary pulgin build to optimise build time e.g. ipsec, dpdk etc. # To Do - remove unnecessary pulgin build to optimise build time e.g. ipsec, dpdk etc.
# Build vpp with travelping upf plugin # Build vpp with Travelping upf plugin
RUN make install-dep build-release -C vpp RUN make install-dep -C vpp
RUN make build-release -C vpp && \
ldd /vpp-upf/vpp/build-root/install-vpp-native/vpp/bin/vpp && \
ldd /vpp-upf/vpp/build-root/install-vpp-native/vpp/bin/vppctl
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# TARGET IMAGE # TARGET IMAGE
#--------------------------------------------------------------------- #---------------------------------------------------------------------
FROM ubuntu:bionic as oai-upf-vpp FROM $BASE_IMAGE as oai-upf-vpp
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Paris ENV TZ=Europe/Paris
...@@ -84,36 +88,45 @@ RUN apt-get update && \ ...@@ -84,36 +88,45 @@ 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 \
net-tools \ net-tools \
tshark \
tzdata\ tzdata\
openssl \
libhyperscan-dev \ libhyperscan-dev \
iproute2 \ iproute2 \
iputils-ping \ iputils-ping \
vim \ curl \
python \
python-pip \
libcurl4-openssl-dev \
libssl-dev \
libnuma1 \ libnuma1 \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN pip install pycurl termcolor
WORKDIR /openair-upf/bin WORKDIR /openair-upf/bin
COPY --from=vpp-upf-builder /vpp-upf/scripts/entrypoint.sh . COPY --from=vpp-upf-builder \
COPY --from=vpp-upf-builder /vpp-upf/vpp/build-root/install-vpp-native/vpp/bin/vpp . /vpp-upf/scripts/entrypoint.sh \
COPY --from=vpp-upf-builder /vpp-upf/vpp/build-root/install-vpp-native/vpp/bin/vppctl . /vpp-upf/vpp/build-root/install-vpp-native/vpp/bin/vpp \
COPY --from=vpp-upf-builder /vpp-upf/src/nrf_client.py . /vpp-upf/vpp/build-root/install-vpp-native/vpp/bin/vppctl \
/vpp-upf/src/nrf_client.sh \
WORKDIR /openair-upf/etc ./
COPY --from=vpp-upf-builder /vpp-upf/scripts/upf_conf/init.conf .
COPY --from=vpp-upf-builder /vpp-upf/scripts/upf_conf/startup_debug.conf . COPY --from=vpp-upf-builder \
COPY --from=vpp-upf-builder /vpp-upf/scripts/upf_conf/upf_profile.json . /vpp-upf/scripts/upf_conf/init.conf \
/vpp-upf/scripts/upf_conf/startup_debug.conf \
WORKDIR /usr/lib/x86_64-linux-gnu/ /vpp-upf/scripts/upf_conf/upf_profile.json \
COPY --from=vpp-upf-builder /vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/ . /openair-upf/etc/
RUN ldconfig COPY --from=vpp-upf-builder \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/vpp_plugins/upf_plugin.so \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/vpp_plugins/dpdk_plugin.so \
/usr/lib/x86_64-linux-gnu/vpp_plugins/
COPY --from=vpp-upf-builder \
# /vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libnat.so.21.01.1 \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libvppinfra.so.21.01.1 \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libvnet.so.21.01.1 \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libvlibmemory.so.21.01.1 \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libvlib.so.21.01.1 \
/vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libsvm.so.21.01.1 \
/usr/lib/x86_64-linux-gnu/
RUN ldconfig && \
ldd /openair-upf/bin/vpp && \
ldd /openair-upf/bin/vppctl
RUN groupadd vpp RUN groupadd vpp
......
...@@ -20,11 +20,20 @@ Here in our network configuration, we need to pass the "GIT PROXY" configuration ...@@ -20,11 +20,20 @@ Here in our network configuration, we need to pass the "GIT PROXY" configuration
```bash ```bash
$ docker build --target oai-upf-vpp --tag oai-upf-vpp:latest \ $ docker build --target oai-upf-vpp --tag oai-upf-vpp:latest \
--file docker/Dockerfile.upf-vpp.ubuntu18 \ --file docker/Dockerfile.upf-vpp.ubuntu \
--build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" . --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" .
``` ```
## 3.2 On a RHEL 7 Host ## ## 3.2 On a Ubuntu 20.04 Host ##
```bash
$ docker build --target oai-upf-vpp --tag oai-upf-vpp:latest \
--file docker/Dockerfile.upf-vpp.ubuntu \
--build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" \
--build-arg BASE_IMAGE=ubuntu:20.04 .
```
## 3.3 On a RHEL 7 Host ##
```bash ```bash
$ docker build --target oai-upf-vpp --tag oai-upf-vpp:latest \ $ docker build --target oai-upf-vpp --tag oai-upf-vpp:latest \
......
...@@ -39,7 +39,7 @@ After successful dependencies install, ...@@ -39,7 +39,7 @@ After successful dependencies install,
@@@@ Installing vpp @@@@ @@@@ Installing vpp @@@@
[0/1] Install the project... [0/1] Install the project...
-- Install configuration: "debug" -- Install configuration: "debug"
make[1]: Leaving directory '/home/rohan/oai-cn5g-upf-vpp/vpp/build-root' make[1]: Leaving directory 'oai-cn5g-upf-vpp/vpp/build-root'
##### VPP compiled ##### ##### VPP compiled #####
VPP UPG initializing VPP UPG initializing
Installing VPP Installing VPP
...@@ -48,3 +48,43 @@ Installing VPP ...@@ -48,3 +48,43 @@ Installing VPP
```bash ```bash
/oai-cn5g-upf-vpp/build/scripts$ ./build_vpp_upf -w /oai-cn5g-upf-vpp/build/scripts$ ./build_vpp_upf -w
``` ```
### Networking Setup
We need veth pairs type of interfaces for vpp switch. So we create three veth pairs (n3, n4 and n6) as below -
```bash
sudo ip link add name n4in type veth peer name n4out
sudo ip link add name n3in type veth peer name n3out
sudo ip link add name n6in type veth peer name n6out
```
Now we connect one end of veth pair to vpp switch - <br/>
Sample init.conf (upf config)
```bash
create host-interface name n3in
set interface ip table host-n3in 2
set interface ip address host-n3in 192.168.72.203/24
set interface state host-n3in up
create host-interface name n4in
set interface ip address host-n4in 192.168.70.203/24
set interface state host-n4in up
create host-interface name n6in
set interface ip table host-n6in 1
set interface ip address host-n6in 192.168.73.203/24
set interface state host-n6in up
```
And then we connect other end of veth pair to the core network docker bridges (demo-oai (n4), cn5g-access(n3), cn5g-core (n6)).
```bash
sudo brctl addif demo-oai n4out
sudo brctl addif cn5g-access n3out
sudo brctl addif cn5g-core n6out
sudo ip link set dev n4out up
sudo ip link set dev n6out up
sudo ip link set dev n3out up
```
The bridge used here are created by docker. For more details checkout [docker-compose file](https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-fed/-/blob/master/docker-compose/docker-compose-basic-vpp-nrf.yaml) used to set up core network.
You can create your own bridge or linux namespace for networking purpose, if you dont want to use docker bridges.
...@@ -39,18 +39,35 @@ ...@@ -39,18 +39,35 @@
set -euo pipefail set -euo pipefail
CONFIG_DIR="/openair-upf/etc" CONFIG_DIR="/openair-upf/etc"
BIN_DIR="/openair-upf/bin"
REGISTER_NRF=${REGISTER_NRF:-no}
NRF_IPV4_ADDRESS=${NRF_IPV4_ADDRESS:-0.0.0.0}
NRF_PORT=${NRF_PORT:-80}
NRF_API_VERSION=${NRF_API_VERSION:-v1}
NRF_FQDN=${NRF_FQDN:-oai-nrf}
USE_FQDN_DNS=${USE_FQDN_DNS:-no}
if [[ ${USE_FQDN_DNS} == "yes" ]];then
NRF_IPV4_ADDRESS=(`getent hosts $NRF_FQDN | awk '{print $1}'`)
echo -e "\nResolving NRF by FQDN : $NRF_FQDN - $NRF_IPV4_ADDRESS"
fi
UUID=$(cat /proc/sys/kernel/random/uuid)
SGI_IPV4=$(ifconfig $INTERFACE_CORE | grep "inet " | awk '{print $2}') SGI_IPV4=$(ifconfig $INTERFACE_CORE | grep "inet " | awk '{print $2}')
ACCESS_IPV4=$(ifconfig $INTERFACE_ACCESS | grep "inet " | awk '{print $2}')
CORE_IPV4=$(ifconfig $INTERFACE_CP | grep "inet " | awk '{print $2}')
N3_IPV4_ADDRESS_LOCAL=$(ifconfig $INTERFACE_ACCESS | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".202" N3_IPV4_ADDRESS_LOCAL=${N3_IPV4_ADDRESS_LOCAL:-$(ifconfig $INTERFACE_ACCESS | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".202"}
N4_IPV4_ADDRESS_LOCAL=$(ifconfig $INTERFACE_CP | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".202" N4_IPV4_ADDRESS_LOCAL=${N4_IPV4_ADDRESS_LOCAL:-$(ifconfig $INTERFACE_CP | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".202"}
N6_IPV4_ADDRESS_LOCAL=$(ifconfig $INTERFACE_CORE | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".202" N6_IPV4_ADDRESS_LOCAL=${N6_IPV4_ADDRESS_LOCAL:-$(ifconfig $INTERFACE_CORE | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".202"}
N3_IPV4_ADDRESS_REMOTE=${N3_IPV4_ADDRESS_REMOTE:-$(ifconfig $INTERFACE_ACCESS | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".1"}
N4_IPV4_ADDRESS_REMOTE=${N4_IPV4_ADDRESS_REMOTE:-$(ifconfig $INTERFACE_CP | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".1"}
N6_IPV4_ADDRESS_REMOTE=${N6_IPV4_ADDRESS_REMOTE:-$(ifconfig $INTERFACE_CORE | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".1"}
############################### ###############################
# UPF Config # UPF Config
############################### ###############################
array=(${CONFIG_DIR}/*.conf ${CONFIG_DIR}/*.json) array=(${CONFIG_DIR}/*.conf ${CONFIG_DIR}/*.json ${BIN_DIR}/nrf_client.sh)
for c in "${array[@]}"; do for c in "${array[@]}"; do
# grep variable names (format: ${VAR}) from template to be rendered # grep variable names (format: ${VAR}) from template to be rendered
VARS=$(grep -oP '@[a-zA-Z0-9_]+@' ${c} | sort | uniq | xargs) VARS=$(grep -oP '@[a-zA-Z0-9_]+@' ${c} | sort | uniq | xargs)
...@@ -95,6 +112,13 @@ ip link set n6 up ...@@ -95,6 +112,13 @@ ip link set n6 up
ip route add $NETWORK_UE_IP via $SGI_IPV4 dev n6 ip route add $NETWORK_UE_IP via $SGI_IPV4 dev n6
# If standard SST is provided then ignore SD values
if [[ "$SST" -lt 128 ]]; then
sed '/sd/d' ${CONFIG_DIR}/upf_profile.json > ${CONFIG_DIR}/tmp_profile.json
mv ${CONFIG_DIR}/tmp_profile.json ${CONFIG_DIR}/upf_profile.json
fi
echo "Done setting the configuration" echo "Done setting the configuration"
exec "$@" exec "$@"
--- a/src/plugins/CMakeLists.txt 2022-02-24 15:09:32.984235101 +0100
+++ b/src/plugins/CMakeLists.txt 2022-02-24 15:08:41.663698835 +0100
@@ -19,11 +19,18 @@
##############################################################################
# find and add all plugin subdirs
##############################################################################
+set(ALLOWED_PLUGINS "dpdk" "upf")
+
FILE(GLOB files RELATIVE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/*/CMakeLists.txt
)
foreach (f ${files})
get_filename_component(dir ${f} DIRECTORY)
- add_subdirectory(${dir})
+ IF(${dir} IN_LIST ALLOWED_PLUGINS)
+ message("Adding sudirectory -> " ${dir})
+ add_subdirectory(${dir})
+ ENDIF()
+ #add_subdirectory(${dir})
endforeach()
+
...@@ -80,9 +80,7 @@ do ...@@ -80,9 +80,7 @@ do
done done
if [[ ${REGISTER_NRF} == "yes" ]];then if [[ ${REGISTER_NRF} == "yes" ]];then
NRF_APP="$base/bin/nrf_client.py" $base/bin/nrf_client.sh
NRF_ARGS=" --nrf_ip="$NRF_IP_ADDR" --nrf_port="$NRF_PORT" --http_version="$HTTP_VERSION
python $NRF_APP $NRF_ARGS
fi fi
sleep infinity sleep infinity
#!/bin/bash
#"""
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this
# * file except in compliance with the License. You may obtain a copy of the
# * License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
#
#/*! \file nrf_client.py
# \author Rohan KHARADE
# \date 2021
# \email: rohan.kharade@openairinterface.org
#*/
#"""
if [ $(id -u) -ne 0 ]; then
exec sudo -E "$0" "$@"
fi
base=$(dirname $0)
APP="$base/bin/vpp"
ARGS="-c $base/etc/startup_debug.conf"
USAGE="Usage: run.sh [-r] [ debug ]
debug: executes vpp under gdb"
while getopts ":r" opt; do
case $opt in
r)
APP="$base/bin/vpp"
ARGS="-c $base/etc/startup.conf"
;;
\?)
echo "Invalid option: -$OPTARG\n" >&2
echo "$USAGE" >&2
exit 1
;;
esac
done
shift $((OPTIND-1))
if test -z "$1"; then
$APP $ARGS &
elif test "$1" = "debug"; then
shift
gdb -ex 'set print pretty on' -ex 'run' --args $APP $ARGS $@
else
echo "$USAGE" >&2
exit 1
fi
while :
do
echo "waiting for vpp-upf service"
RES=$(bin/vppctl sh upf specification release | awk {'print $3'})
echo $RES
if [[ $RES =~ 16 ]]; then
echo "vpp-upf service is running now"
break
fi
sleep 3
done
if [[ ${REGISTER_NRF} == "yes" ]];then
$base/bin/nrf_client.sh
fi
sleep infinity
ip table add 1
ip table add 2
create host-interface name @INTERFACE_CORE@
set interface mtu 1500 host-@INTERFACE_CORE@
set interface ip table host-@INTERFACE_CORE@ 1
set interface ip address host-@INTERFACE_CORE@ @INTERFACE_CORE@/24
set interface state host-@INTERFACE_CORE@ up
create host-interface name @INTERFACE_CP@
set interface mtu 1500 host-@INTERFACE_CP@
set interface ip table host-@INTERFACE_CP@ 0
set interface ip address host-@INTERFACE_CP@ @INTERFACE_CP@/24
set interface state host-@INTERFACE_CP@ up
create host-interface name @INTERFACE_ACCESS@
set interface mtu 1500 host-@INTERFACE_ACCESS@
set interface ip table host-@INTERFACE_ACCESS@ 2
set interface ip address host-@INTERFACE_ACCESS@ @INTERFACE_ACCESS@/24
set interface state host-@INTERFACE_ACCESS@ up
ip route add 0.0.0.0/0 table 2 via @N3_IPV4_ADDRESS_REMOTE@ host-n3
ip route add 0.0.0.0/0 table 0 via @N4_IPV4_ADDRESS_REMOTE@ host-n4
ip route add 0.0.0.0/0 table 1 via @N6_IPV4_ADDRESS_REMOTE@ host-n6
upf pfcp endpoint ip @N4_IPV4_ADDRESS_LOCAL@ vrf 0
upf node-id fqdn gw@GW_ID@.vppupf.node.5gcn.mnc@MNC03@.mcc@MCC@.@REALM@
upf nwi name @NWI_N3@ vrf 2
upf nwi name @NWI_N6@ vrf 1
upf specification release 16
upf gtpu endpoint ip @N3_IPV4_ADDRESS_LOCAL@ nwi @NWI_N3@ teid 0x000004d2/2
#!/bin/bash
#"""
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this
# * file except in compliance with the License. You may obtain a copy of the
# * License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
#
#/*! \file nrf_client.py
# \author Rohan KHARADE
# \date 2021
# \email: rohan.kharade@openairinterface.org
#*/
#"""
trigger_nf_registration() {
UUID=9614ea76-2e95-4f01-ad57-e7abbf251820
CONFIG_DIR=/openair-upf/etc
NRF_URL=$NRF_IP_ADDR:$NRF_PORT/nnrf-nfm/v1/nf-instances/$UUID
##### Variables #####
DUMP_STATUS_CODE=$(echo '--write-out %{http_code} --silent --output /dev/null')
PATCH_DATA=$(echo '[{"op":"replace","path":"/nfStatus","value":"REGISTERED"}]')
CONTENT_TYPE=$(echo 'Content-Type: application/json')
HTTP2=--http2-prior-knowledge
UPF_PROFILE=$CONFIG_DIR/upf_profile.json
NF_HEARTBEAT_TIMER=10
NF_HEARTBEAT_START=5
##### NF Registration #####
echo "Sending NF Registration Request (HTTP Version $HTTP_VERSION)"
if [[ ${HTTP_VERSION} == 2 ]];then
response=$(curl $HTTP2 $DUMP_STATUS_CODE -X PUT $NRF_URL -d @$UPF_PROFILE -H "$CONTENT_TYPE")
else
response=$(curl $DUMP_STATUS_CODE -X PUT $NRF_URL -d @$UPF_PROFILE -H "$CONTENT_TYPE")
fi
##### NF Heartbeat #####
if [[ ${response} == 201 || ${response} == 200 ]];then
echo -e "Received NF registration response (HTTP_STATUS_CODE_200/201)\n"
sleep $NF_HEARTBEAT_START
while true
do
echo "Sending NF heartbeat request"
if [[ ${HTTP_VERSION} == 2 ]]; then
response=$(curl $HTTP2 $DUMP_STATUS_CODE -X PATCH $NRF_URL -d $PATCH_DATA -H "$CONTENT_TYPE")
else
response=$(curl $DUMP_STATUS_CODE -X PATCH $NRF_URL -d $PATCH_DATA -H "$CONTENT_TYPE")
fi
if [[ ${response} == 204 ]];then
echo -e "Received NF heartbeat response (HTTP_STATUS_CODE_204)\n"
fi
sleep $NF_HEARTBEAT_TIMER
done
else
echo -e "\nNF Registration Procedure Failed ........!!!!"
fi
}
if [ $(id -u) -ne 0 ]; then
exec sudo -E "$0" "$@"
fi
base=$(dirname $0)
APP="$base/bin/vpp"
ARGS="-c $base/etc/startup_debug.conf"
$APP $ARGS &
while :
do
echo "waiting for vpp-upf service"
RES=$(bin/vppctl sh upf specification release | awk {'print $3'})
echo $RES
if [[ $RES =~ 16 ]]; then
echo "vpp-upf service is running now"
break
fi
sleep 3
done
if [[ ${REGISTER_NRF} == "yes" ]];then
trigger_nf_registration
fi
sleep infinity
unix {
nodaemon
log /tmp/vpp.log
full-coredump
gid vpp
interactive
cli-listen /run/vpp/cli.sock
exec @INIT_CONF_PATH@
}
api-trace {
on
}
cpu {
main-core 0
corelist-workers 1
}
api-segment {
gid vpp
}
plugins {
path @VPP_PLUGIN_PATH@
plugin dpdk_plugin.so { disable }
plugin gtpu_plugin.so { disable }
plugin upf_plugin.so { enable }
}
#!/usr/bin/env bash
NWI_N3=access.oai.org
NWI_N6=core.oai.org
GW_ID=1
MNC03=95
MCC=208
REALM=3gppnetwork.org
NETWORK_UE_IP=12.2.1.0/24
INIT_CONF_PATH=
VPP_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/vpp_plugins/ # Ubntu18.04
INTERFACE_ACCESS=cn5g-access # N3
INTERFACE_CORE=cn5g-core # N6
INTERFACE_CP=demo-oai # N4
NSSAI_SD_0=123
SST=222
DNN=default
REGISTER_NRF=yes
NRF_IP_ADDR=192.168.70.130
NRF_PORT=8080
UUID=0beafa60-8211-4774-b54f-2a8a35a721fe #$(cat /proc/sys/kernel/random/uuid)
HTTP_VERSION=2
################ Gateway for N3(Gnb), N4(SMF), N6(DN/NAT Gateway) ################
#N3_IPV4_ADDRESS_REMOTE=${N3_IPV4_ADDRESS_REMOTE:-$(ifconfig $INTERFACE_ACCESS | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".1"}
N3_IPV4_ADDRESS_REMOTE=192.168.70.1
#N4_IPV4_ADDRESS_REMOTE=${N4_IPV4_ADDRESS_REMOTE:-$(ifconfig $INTERFACE_CP | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".1"}
N4_IPV4_ADDRESS_REMOTE=192.168.72.1
#N6_IPV4_ADDRESS_REMOTE=${N6_IPV4_ADDRESS_REMOTE:-$(ifconfig $INTERFACE_CORE | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".1"}
N6_IPV4_ADDRESS_REMOTE=192.168.73.135
################ Veth Pair IP in the VPP switch ################
#N3_IPV4_ADDRESS_LOCAL=${N3_IPV4_ADDRESS_LOCAL:-$(ifconfig $INTERFACE_ACCESS | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".202"}
N3_IPV4_ADDRESS_LOCAL=192.168.72.202
#N4_IPV4_ADDRESS_LOCAL=${N4_IPV4_ADDRESS_LOCAL:-$(ifconfig $INTERFACE_CP | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".202"}
N4_IPV4_ADDRESS_LOCAL=192.168.70.202
#N6_IPV4_ADDRESS_LOCAL=${N6_IPV4_ADDRESS_LOCAL:-$(ifconfig $INTERFACE_CORE | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".202"}
N6_IPV4_ADDRESS_LOCAL=192.168.73.202
{
"nfInstanceId": "@UUID@",
"capacity": 100,
"fqdn": "gw@GW_ID@.vppupf.node.5gcn.mnc@MNC03@.mcc@MCC@.@REALM@",
"heartBeatTimer": 10,
"ipv4Addresses": ["@N4_IPV4_ADDRESS_LOCAL@"],
"json_data": null,
"nfInstanceName": "OAI-UPF-VPP",
"nfServices": [],
"nfStatus": "REGISTERED",
"nfType": "UPF",
"priority": 1,
"sNssais": [{
"sd": "@NSSAI_SD_0@",
"sst": @SST@
}],
"upfInfo": {
"sNssaiUpfInfoList": [{
"dnnUpfInfoList": [{
"dnn": "@DNN@"
}],
"sNssai": {
"sd": "@NSSAI_SD_0@",
"sst": @SST@
}
}],
"interfaceUpfInfoList": [{
"endpointFqdn": "@NWI_N3@",
"interfaceType": "N3",
"ipv4EndpointAddresses": ["@N3_IPV4_ADDRESS_LOCAL@"],
"networkInstance": "@NWI_N3@"
}, {
"endpointFqdn": "@NWI_N6@",
"interfaceType": "N6",
"ipv4EndpointAddresses": ["@N6_IPV4_ADDRESS_LOCAL@"],
"networkInstance": "@NWI_N6@"
}]
}
}
{ {
"nfInstanceId": "@UUID@",
"capacity": 100, "capacity": 100,
"fqdn": "gw@GW_ID@.vppupf.node.5gcn.mnc@MNC03@.mcc@MCC@.@REALM@", "fqdn": "gw@GW_ID@.vppupf.node.5gcn.mnc@MNC03@.mcc@MCC@.@REALM@",
"heartBeatTimer": 10, "heartBeatTimer": 10,
...@@ -26,12 +27,12 @@ ...@@ -26,12 +27,12 @@
"interfaceUpfInfoList": [{ "interfaceUpfInfoList": [{
"endpointFqdn": "@NWI_N3@", "endpointFqdn": "@NWI_N3@",
"interfaceType": "N3", "interfaceType": "N3",
"ipv4EndpointAddresses": ["@ACCESS_IPV4@"], "ipv4EndpointAddresses": ["@N3_IPV4_ADDRESS_LOCAL@"],
"networkInstance": "@NWI_N3@" "networkInstance": "@NWI_N3@"
}, { }, {
"endpointFqdn": "@NWI_N6@", "endpointFqdn": "@NWI_N6@",
"interfaceType": "N6", "interfaceType": "N6",
"ipv4EndpointAddresses": ["@CORE_IPV4@"], "ipv4EndpointAddresses": ["@N6_IPV4_ADDRESS_LOCAL@"],
"networkInstance": "@NWI_N6@" "networkInstance": "@NWI_N6@"
}] }]
......
#!/usr/bin/env python
"""
/*
* 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 nrf_client.py
\author Rohan KHARADE
\date 2018
\email: rohan.kharade@openairinterface.org
*/
"""
import time, sys, json, logging, uuid, pycurl, argparse, atexit
from termcolor import colored
logging.basicConfig(format='%(asctime)s] %(filename)s: %(levelname)s '
'- %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p')
class upf_profile(object):
def __init__(self, nrf_ip = None, nrf_port = None, http_version = None):
self.logger = logging.getLogger("upf")
atexit.register(self.goodbye) # register a message to print out when exit
message = " NRF UPF client started "
self.logger.info(message)
#@@@@@@@@ Initialize arguments #@@@@@@@@
self.nrf_ip = nrf_ip
self.nrf_port = nrf_port
self.http_version = http_version
self.status_code = 0
self.uuid = uuid.uuid4()
self.url = 'http://'+str(self.nrf_ip)+':'+str(self.nrf_port)+'/nnrf-nfm/v1/nf-instances/'+str(self.uuid)
self.curl = pycurl.Curl()
self.headers = ["Content-Type:application/json"]
self.dir_config = '/openair-upf/'
self.file_name = self.dir_config+'etc/upf_profile.json'
self.conf_file = open(self.file_name,)
self.upf_profile = json.load(self.conf_file)
#@@@@@@@@ Initialize upf profile #@@@@@@@@
self.upf_profile['nfInstanceId'] = str(self.uuid)
self.capacity = self.upf_profile['capacity']
self.fqdn = self.upf_profile['fqdn']
self.heartBeatTimer = self.upf_profile['heartBeatTimer']
self.ipv4Addresses = self.upf_profile['ipv4Addresses']
self.nfInstanceId = self.upf_profile['nfInstanceId']
self.nfInstanceName = self.upf_profile['nfInstanceName']
self.nfStatus = self.upf_profile['nfStatus']
self.nfType = self.upf_profile['nfType']
self.priority = self.upf_profile['priority']
self.sNssais = self.upf_profile['sNssais']
self.upfInfo = self.upf_profile['upfInfo']
message = " UPF profile is parsed "
self.logger.info(message)
def display_upf_profile(self):
message = " Display UPF profile "
self.logger.info(message)
print(colored('[*] UPF Profile \n \t fqdn = '+self.fqdn+ \
'\n \t capacity = '+str(self.capacity)+ \
'\n \t heartBeatTimer = '+str(self.heartBeatTimer)+ \
'\n \t ipv4Addresses = '+u", ".join(self.ipv4Addresses)+ \
'\n \t nfInstanceId = '+self.nfInstanceId+ \
'\n \t nfInstanceName = '+self.nfInstanceName+ \
'\n \t nfStatus = '+self.nfStatus+ \
'\n \t nfType = '+self.nfType+ \
'\n \t priority = '+str(self.priority)+ \
'\n \t sNssais = '+json.dumps(self.sNssais)+ \
'\n \t upfInfo = '+json.dumps(self.upfInfo,indent=6) \
,'green'))
def trigger_nf_registration(self):
message = " Sending NF registration request (HTTP Version - "+str(self.http_version)+")"
self.logger.info(message)
self.curl.setopt(self.curl.URL, self.url)
self.curl.setopt(self.curl.HTTPHEADER, self.headers)
self.curl.setopt(self.curl.CUSTOMREQUEST, 'PUT')
self.curl.setopt(self.curl.POSTFIELDS, json.dumps(self.upf_profile))
if(str(self.http_version) == '2'):
self.curl.setopt(self.curl.HTTP_VERSION, pycurl.CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE)
response=self.curl.perform()
self.status_code=self.curl.getinfo(self.curl.RESPONSE_CODE)
if self.status_code == 201 or self.status_code == 200:
message = " Succussfully registered at NRF !!"
self.logger.info(message)
self.trigger_nf_heartbeat()
else:
print(colored('\n\n NF registration failed \n\n', 'red'))
def trigger_nf_heartbeat(self):
patch_data = [{"op": "replace","path": "/nfStatus","value": "REGISTERED"}]
while True:
message = " Sending NF heartbeat requset (HTTP Version - "+str(self.http_version)+") !!"
self.logger.info(message)
time.sleep(5)
self.curl.setopt(self.curl.CUSTOMREQUEST, 'PATCH')
self.curl.setopt(self.curl.POSTFIELDS, json.dumps(patch_data))
response=self.curl.perform()
self.status_code=self.curl.getinfo(self.curl.RESPONSE_CODE)
if self.status_code == 204:
message = " Succussfully received NF heartbeat response !!"
self.logger.info(message)
else:
print(colored('\n\n NF heartbeat procedure failed \n\n', 'red'))
def goodbye(self):
print(colored('\n\n\n [*] You are now leaving OAI-NRF framework .....\n\n\n', 'yellow'))
sys.exit(0)
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description='Process commandline arguments and override configurations')
parser.add_argument('--nrf_ip', metavar='[number]', action='store', type=str,
required=False, default='192.168.71.130',
help='set the nrf ip address. default = 192.168.71.130')
parser.add_argument('--nrf_port', metavar='[number]', action='store', type=str,
required=False, default='8080',
help='set the nrf port. default = 8080')
parser.add_argument('--http_version', metavar='[number]', action='store', type=str,
required=False, default='2',
help='set the nrf ip address. default = 2')
args = parser.parse_args()
nrf_client = upf_profile(args.nrf_ip, args.nrf_port, args.http_version)
nrf_client.display_upf_profile()
nrf_client.trigger_nf_registration()
"""
* Usage of nrf client -->
$ python nrf_client.py -h
usage: nrf_client.py [-h] [--nrf_ip [number]] [--nrf_port [number]]
[--http_version [number]]
Process commandline arguments and override configurations
optional arguments:
-h, --help show this help message and exit
--nrf_ip [number] set the nrf ip address. default = 192.168.71.130
--nrf_port [number] set the nrf port. default = 8080
--http_version [number] set the nrf ip address. default = 2
"""
#!/bin/bash
#"""
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this
# * file except in compliance with the License. You may obtain a copy of the
# * License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
#
#/*! \file nrf_client.py
# \author Rohan KHARADE
# \date 2022
# \email: rohan.kharade@openairinterface.org
#*/
#"""
UUID=@UUID@
CONFIG_DIR=@CONFIG_DIR@
NRF_URL=$NRF_IP_ADDR:$NRF_PORT/nnrf-nfm/v1/nf-instances/$UUID
##### Variables #####
DUMP_STATUS_CODE=$(echo '--write-out %{http_code} --silent --output /dev/null')
PATCH_DATA=$(echo '[{"op":"replace","path":"/nfStatus","value":"REGISTERED"}]')
CONTENT_TYPE=$(echo 'Content-Type: application/json')
HTTP2=--http2-prior-knowledge
UPF_PROFILE=$CONFIG_DIR/upf_profile.json
NF_HEARTBEAT_TIMER=10
NF_HEARTBEAT_START=5
##### NF Registration #####
echo "Sending NF Registration Request (HTTP Version $HTTP_VERSION)"
if [[ ${HTTP_VERSION} == 2 ]];then
response=$(curl $HTTP2 $DUMP_STATUS_CODE -X PUT $NRF_URL -d @$UPF_PROFILE -H "$CONTENT_TYPE")
else
response=$(curl $DUMP_STATUS_CODE -X PUT $NRF_URL -d @$UPF_PROFILE -H "$CONTENT_TYPE")
fi
##### NF Heartbeat #####
if [[ ${response} == 201 || ${response} == 200 ]];then
echo -e "Received NF registration response (HTTP_STATUS_CODE_200/201)\n"
sleep $NF_HEARTBEAT_START
while true
do
echo "Sending NF heartbeat request"
if [[ ${HTTP_VERSION} == 2 ]]; then
response=$(curl $HTTP2 $DUMP_STATUS_CODE -X PATCH $NRF_URL -d $PATCH_DATA -H "$CONTENT_TYPE")
else
response=$(curl $DUMP_STATUS_CODE -X PATCH $NRF_URL -d $PATCH_DATA -H "$CONTENT_TYPE")
fi
if [[ ${response} == 204 ]];then
echo -e "Received NF heartbeat response (HTTP_STATUS_CODE_204)\n"
fi
sleep $NF_HEARTBEAT_TIMER
done
else
echo -e "\nNF Registration Procedure Failed ........!!!!"
fi
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