Commit 8442c5a8 authored by kharade's avatar kharade

Merge branch 'develop' of https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-upf-vpp...

Merge branch 'develop' of https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-upf-vpp into build_time_optimise
parents 15481124 377a0362
This diff is collapsed.
...@@ -165,7 +165,7 @@ pipeline { ...@@ -165,7 +165,7 @@ pipeline {
// First clean image registry // First clean image registry
myShCmd('docker image rm oai-upf-vpp:' + upf_tag + ' || true', rem_u18_host_flag, rem_u18_host_user, rem_u18_host) myShCmd('docker image rm oai-upf-vpp:' + upf_tag + ' || true', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd('mkdir -p archives', rem_u18_host_flag, rem_u18_host_user, rem_u18_host) myShCmd('mkdir -p archives', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd('docker build --no-cache --target oai-upf-vpp --tag oai-upf-vpp:' + upf_tag + ' --file docker/Dockerfile.upf-vpp.ubuntu18 --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" . > archives/upf_docker_image_build.log 2>&1', rem_u18_host_flag, rem_u18_host_user, rem_u18_host) myShCmd('docker build --no-cache --target oai-upf-vpp --tag oai-upf-vpp:' + upf_tag + ' --file docker/Dockerfile.upf-vpp.ubuntu --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" . > archives/upf_docker_image_build.log 2>&1', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd('docker image ls >> archives/upf_docker_image_build.log', rem_u18_host_flag, rem_u18_host_user, rem_u18_host) myShCmd('docker image ls >> archives/upf_docker_image_build.log', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
// We will keep also the TMP image in U18 case. // We will keep also the TMP image in U18 case.
if ("MERGE".equals(env.gitlabActionType)) { if ("MERGE".equals(env.gitlabActionType)) {
......
...@@ -513,7 +513,7 @@ class HtmlReport(): ...@@ -513,7 +513,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 +558,7 @@ class HtmlReport(): ...@@ -558,7 +558,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,9 +629,9 @@ class HtmlReport(): ...@@ -629,9 +629,9 @@ 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:
if variant == 'docker': if variant == 'docker':
result = re.search('ago *([0-9A-Z\.]+)', line) result = re.search('ago *([0-9A-Z\.]+)', line)
......
...@@ -103,27 +103,32 @@ RUN yum repolist --disablerepo=* && \ ...@@ -103,27 +103,32 @@ RUN yum repolist --disablerepo=* && \
yum remove -y wget && \ yum remove -y wget && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
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/vpp_plugins .
COPY --from=vpp-upf-builder /vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libvppinfra.so.21.01.1 . COPY --from=vpp-upf-builder \
COPY --from=vpp-upf-builder /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/vpp_plugins/upf_plugin.so \
COPY --from=vpp-upf-builder /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/vpp_plugins/dpdk_plugin.so \
COPY --from=vpp-upf-builder /vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libvlib.so.21.01.1 . /usr/lib64/vpp_plugins/
COPY --from=vpp-upf-builder /vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libsvm.so.21.01.1 .
COPY --from=vpp-upf-builder /vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libnat.so.21.01.1 . 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 RUN ldconfig
......
...@@ -87,38 +87,40 @@ RUN apt-get update && \ ...@@ -87,38 +87,40 @@ RUN apt-get update && \
net-tools \ net-tools \
tshark \ 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/vpp_plugins . /openair-upf/etc/
COPY --from=vpp-upf-builder /vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libvppinfra.so.21.01.1 .
COPY --from=vpp-upf-builder /vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libvnet.so.21.01.1 . COPY --from=vpp-upf-builder \
COPY --from=vpp-upf-builder /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/vpp_plugins/upf_plugin.so \
COPY --from=vpp-upf-builder /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/vpp_plugins/dpdk_plugin.so \
COPY --from=vpp-upf-builder /vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/libsvm.so.21.01.1 . /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 .
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 RUN ldconfig
......
...@@ -39,6 +39,10 @@ ...@@ -39,6 +39,10 @@
set -euo pipefail set -euo pipefail
CONFIG_DIR="/openair-upf/etc" CONFIG_DIR="/openair-upf/etc"
BIN_DIR="/openair-upf/bin"
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}') ACCESS_IPV4=$(ifconfig $INTERFACE_ACCESS | grep "inet " | awk '{print $2}')
CORE_IPV4=$(ifconfig $INTERFACE_CP | grep "inet " | awk '{print $2}') CORE_IPV4=$(ifconfig $INTERFACE_CP | grep "inet " | awk '{print $2}')
...@@ -50,7 +54,7 @@ N6_IPV4_ADDRESS_LOCAL=$(ifconfig $INTERFACE_CORE | grep "inet " | awk '{print $2 ...@@ -50,7 +54,7 @@ N6_IPV4_ADDRESS_LOCAL=$(ifconfig $INTERFACE_CORE | grep "inet " | awk '{print $2
############################### ###############################
# 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)
......
...@@ -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
{ {
"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,
...@@ -31,7 +32,7 @@ ...@@ -31,7 +32,7 @@
}, { }, {
"endpointFqdn": "@NWI_N6@", "endpointFqdn": "@NWI_N6@",
"interfaceType": "N6", "interfaceType": "N6",
"ipv4EndpointAddresses": ["@CORE_IPV4@"], "ipv4EndpointAddresses": ["@SGI_IPV4@"],
"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