Commit ce487326 authored by sagar arora's avatar sagar arora

Merge branch 'releasev1.4.0' into 'master'

Release v1.4.0

See merge request oai/cn5g/oai-cn5g-nrf!29
parents 2621c6e2 e9af95b7
# RELEASE NOTES: #
## v1.4.0 -- July 2022 ##
* Remove unused packages
* Add NF profile handling for PCF
* HTTP/2 support for SBI interface
* Official images produced by CI are pushed to `oaisoftwarealliance` Docker-Hub Team account
* Reduce image size
## v1.3.0 -- January 2022 ##
* NF profile update
......
......@@ -175,9 +175,11 @@ pipeline {
success {
script {
sh 'echo "DEPLOYMENT: OK" > archives/deployment_status.log'
if (dsT_host_flag) {
sh 'python3 ./ci-scripts/routeCheck.py --mode=Add --userName=' + dsT_host_user + ' --hostName=' + dsT_host
}
}
}
unsuccessful {
script {
sh 'echo "DEPLOYMENT: KO" > archives/deployment_status.log'
......@@ -235,7 +237,9 @@ pipeline {
steps {
script {
echo '\u2705 \u001B[32mUn-Deploy NRF\u001B[0m'
if (dsT_host_flag) {
sh 'python3 ./ci-scripts/routeCheck.py --mode=Delete --userName=' + dsT_host_user + ' --hostName=' + dsT_host
}
dir('ci-scripts/dsTesterDockerCompose') {
sh 'docker-compose down > ../../archives/compose_normal_down.log 2>&1'
}
......@@ -252,7 +256,9 @@ pipeline {
sh 'docker logs cicd-oai-nrf > archives/logs/oai_nrf.log'
}
// Remove any leftover containers/networks
if (dsT_host_flag) {
sh 'python3 ./ci-scripts/routeCheck.py --mode=Delete --userName=' + dsT_host_user + ' --hostName=' + dsT_host
}
dir('ci-scripts/dsTesterDockerCompose') {
sh 'docker-compose down > ../../archives/compose_l_down.log 2>&1'
}
......
......@@ -50,6 +50,9 @@ def NRF_BASE_IMAGE_TAG = params.NrfBaseImageTag
// Merge Request Link
def gitlabMergeRequestLink
// Docker Hub account to push to
def DH_Account = "oaisoftwarealliance"
//-------------------------------------------------------------------------------
// Pipeline start
pipeline {
......@@ -107,7 +110,7 @@ pipeline {
if ("MERGE".equals(env.gitlabActionType)) {
try {
myShCmd('docker image inspect --format=\'Size = {{.Size}} bytes\' oai-nrf-base:' + NRF_BASE_IMAGE_TAG, rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmdNoDir('docker image inspect --format=\'Size = {{.Size}} bytes\' oai-nrf-base:' + NRF_BASE_IMAGE_TAG, rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
} catch (Exception e) {
currentBuild.result = 'FAILURE'
echo '\u26D4 \u001B[31mBase Image does not exist\u001B[0m'
......@@ -134,7 +137,6 @@ pipeline {
echo "MR TITLE is ${env.gitlabMergeRequestTitle}"
gitCommitAuthorEmailAddr = env.gitlabUserEmail
echo "GitLab Usermail is ${gitCommitAuthorEmailAddr}"
sh "git fetch --prune --unshallow"
shortenShaOne = sh returnStdout: true, script: 'git log -1 --pretty=format:"%h" ' + env.gitlabMergeRequestLastCommit
shortenShaOne = shortenShaOne.trim()
sh "./ci-scripts/doGitLabMerge.sh --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}"
......@@ -185,7 +187,7 @@ pipeline {
echo "Maybe a previous build went wrong"
}
// In case of push to `develop` branch we build from scratch
myShCmd('docker build --no-cache --target oai-nrf --tag oai-nrf:' + nrf_tag + ' --file docker/Dockerfile.nrf.ubuntu18 --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" . > archives/nrf_docker_image_build.log 2>&1', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd('docker build --no-cache --target oai-nrf --tag oai-nrf:' + nrf_tag + ' --file docker/Dockerfile.nrf.ubuntu18 . > archives/nrf_docker_image_build.log 2>&1', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
}
if ("MERGE".equals(env.gitlabActionType)) {
try {
......@@ -200,6 +202,9 @@ pipeline {
myShCmd('docker image tag oai-nrf-base:' + NRF_BASE_IMAGE_TAG + ' oai-nrf-base:latest', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd('docker build --no-cache --target oai-nrf --tag oai-nrf:' + nrf_tag + ' --file ci-scripts/docker/Dockerfile.ci.ubuntu.18.04 . > archives/nrf_docker_image_build.log 2>&1', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
}
// Putting a place holder to try out on the flattening of image.
// If not satisfactory, we can remove it.
myShCmd('python3 ./ci-scripts/flatten_image.py --tag oai-nrf:' + nrf_tag, rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd('docker image ls >> archives/nrf_docker_image_build.log', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
// We will keep also the TMP image in U18 case.
if ("MERGE".equals(env.gitlabActionType)) {
......@@ -243,10 +248,14 @@ pipeline {
}
myShCmd('sudo podman image prune --force', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
// Copy the RHEL Host certificates for building
myShCmd('mkdir -p tmp/ca tmp/entitlement', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
myShCmd('cp /etc/pki/entitlement/*pem tmp/entitlement', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
myShCmd('sudo cp /etc/rhsm/ca/redhat-uep.pem tmp/ca', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
myShCmd('sudo podman build --no-cache --target oai-nrf --tag oai-nrf:' + nrf_tag + ' --file docker/Dockerfile.nrf.rhel8 --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" . > archives/nrf_podman_image_build.log 2>&1', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
myShCmd('mkdir -p ./etc-pki-entitlement ./rhsm-conf ./rhsm-ca', 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/ca/*pem ./rhsm-ca', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
myShCmd('sudo podman build --no-cache --target oai-nrf --tag oai-nrf:' + nrf_tag + ' --file docker/Dockerfile.nrf.rhel8 . > archives/nrf_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-nrf:' + nrf_tag, rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
myShCmd('sudo podman image ls >> archives/nrf_podman_image_build.log', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
if ("MERGE".equals(env.gitlabActionType)) {
myShCmd('sudo podman image tag oai-nrf:' + nrf_tag + ' oai-nrf:' + rhel_nrf_tag, rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
......@@ -439,6 +448,36 @@ pipeline {
}
}
}
stage ('Testing the tutorials') {
steps {
script {
gitlabCommitStatus(name: "Test tutorials") {
localStatus = build job: 'OAI-CN5G-Tutorials-Check',
parameters: [
string(name: 'NRF_TAG', value: String.valueOf(nrf_tag)),
string(name: 'NRF_BRANCH', value: String.valueOf(nrf_branch))
], propagate: false
localResult = localStatus.getResult()
if (localStatus.resultIsBetterOrEqualTo('SUCCESS')) {
echo "Tutorials Test Job is OK"
} else {
echo "Tutorials Test Job is KO"
sh "ci-scripts/fail.sh"
}
}
}
}
post {
always {
script {
copyArtifacts(projectName: 'OAI-CN5G-Tutorials-Check',
filter: '*_results_oai_cn5g*.html',
selector: lastCompleted())
}
}
}
}
}
}
// For the moment it is Docker-Hub, but we might have a new one internally.
......@@ -451,9 +490,9 @@ pipeline {
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.DockerHubCredentials}", usernameVariable: 'DH_Username', passwordVariable: 'DH_Password']
]) {
myShCmd("echo ${DH_Password} | docker login --username ${DH_Username} --password-stdin", rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd("docker image tag oai-nrf:develop ${DH_Username}/oai-nrf:develop", rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd("docker push ${DH_Username}/oai-nrf:develop", rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd("docker rmi ${DH_Username}/oai-nrf:develop", rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd("docker image tag oai-nrf:develop ${DH_Account}/oai-nrf:develop", rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd("docker push ${DH_Account}/oai-nrf:develop", rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd("docker rmi ${DH_Account}/oai-nrf:develop", rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd("docker logout", rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
}
}
......@@ -587,6 +626,14 @@ def myShCmd(cmd, flag, user, host) {
}
}
def myShCmdNoDir(cmd, flag, user, host) {
if (flag) {
sh "ssh -t -t ${user}@${host} '${cmd}'"
} else {
sh "${cmd}"
}
}
def myShRetCmd(cmd, flag, user, host) {
if (flag) {
ret = sh returnStdout: true, script: "ssh -t -t ${user}@${host} 'cd /tmp/CI-CN-NRF && ${cmd}'"
......
......@@ -176,8 +176,14 @@ class HtmlReport():
self.file.write(' </tr>\n')
def testSummaryHeader(self):
self.file.write(' <h2>DS Tester Summary</h2>\n')
cwd = os.getcwd()
if not os.path.isfile(cwd + '/DS-TEST-RESULTS/dsTester_Summary.txt'):
self.file.write(' <br>\n')
self.file.write(' <div class="alert alert-warning">\n')
self.file.write(' <strong>NO TESTING DONE BEFORE MIGRATION TO NEW RAN EMULATOR <span class="glyphicon glyphicon-warning-sign"></span></strong>\n')
self.file.write(' </div>\n')
return True
self.file.write(' <h2>DS Tester Summary</h2>\n')
finalStatusOK = False
if os.path.isfile(cwd + '/DS-TEST-RESULTS/dcnrf2.yaml'):
cmd = f'egrep -c "final-result: pass" DS-TEST-RESULTS/dcnrf2.yaml || true'
......@@ -204,6 +210,9 @@ class HtmlReport():
def testSummaryDetails(self):
self.file.write(' <br>\n')
cwd = os.getcwd()
if not os.path.isfile(cwd + '/DS-TEST-RESULTS/dsTester_Summary.txt'):
return
self.file.write(' <button data-toggle="collapse" data-target="#ds-tester-details">More details on DsTester results</button>\n')
self.file.write(' <div id="ds-tester-details" class="collapse">\n')
self.file.write(' <table class="table-bordered" width = "60%" align = "center" border = 1>\n')
......@@ -212,7 +221,6 @@ class HtmlReport():
self.file.write(' <th>Test Status</th>\n')
self.file.write(' <th>Test Details</th>\n')
self.file.write(' </tr>\n')
cwd = os.getcwd()
if os.path.isfile(cwd + '/DS-TEST-RESULTS/dcnrf2.yaml'):
with open(cwd + '/DS-TEST-RESULTS/dcnrf2.yaml') as f:
data = yaml.load(f)
......
......@@ -139,6 +139,16 @@ then
exit 1
fi
# When running in a container, in /home folder
IS_CONTAINER=`egrep -c "docker|kubepods|podman|buildah|libpod" /proc/self/cgroup || true`
if [ $IS_CONTAINER -ne 0 ]
then
if [ $PWD = "/home/src" ]
then
git config --global --add safe.directory /home
fi
fi
# Merge request scenario
MERGE_COMMMIT=`git log -n1 --pretty=format:%H`
......
......@@ -22,6 +22,7 @@
#
# Dockerfile for the Open-Air-Interface NRF service
# Valid for Ubuntu-18.04 (bionic)
# The port exposed by container are 8080/tcp , 9090/tcp change it according to your setup
#
#---------------------------------------------------------------------
......@@ -37,6 +38,7 @@ RUN cp -Rf /openair-nrf-ext-ref /openair-nrf/build/ext
# Building NRF
WORKDIR /openair-nrf/build/scripts
RUN ./build_nrf --clean --Verbose --build-type Release --jobs && \
ldd /openair-nrf/build/nrf/build/nrf && \
mv /openair-nrf/build/nrf/build/nrf /openair-nrf/build/nrf/build/oai_nrf
#---------------------------------------------------------------------
......@@ -55,12 +57,13 @@ RUN apt-get update && \
iputils-ping \
bc \
tzdata \
tshark \
libasan4 \
libgoogle-glog0v5 \
libdouble-conversion1 \
libconfig++9v5 \
libldap-2.4-2 \
libkrb5-3 \
libgssapi-krb5-2 \
librtmp1 \
libpsl5 \
&& rm -rf /var/lib/apt/lists/*
......@@ -73,6 +76,7 @@ COPY --from=oai-nrf-builder \
./
COPY --from=oai-nrf-builder \
/usr/local/lib/libpistache.so \
/usr/local/lib/libnghttp2.so.14 \
/usr/local/lib/libnghttp2_asio.so.1 \
/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4 \
/usr/lib/x86_64-linux-gnu/libboost_system.so.1.65.1 \
......
......@@ -7,8 +7,7 @@ services:
- 80
- 9090
command: >
bash -c "nohup tshark -i eth0 -w /tmp/nrf.pcap 2>&1 > /dev/null &
/openair-nrf/bin/oai_nrf -c /openair-nrf/etc/nrf.conf -o | tee /tmp/nrf.log 2>&1
bash -c "/openair-nrf/bin/oai_nrf -c /openair-nrf/etc/nrf.conf -o | tee /tmp/nrf.log 2>&1
"
cap_add:
- NET_ADMIN
......
"""
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-nrf" '
cmd += ' --change "EXPOSE 80/tcp" '
cmd += ' --change "EXPOSE 9090/tcp" '
cmd += ' --change "CMD [\\"/openair-nrf/bin/oai_nrf\\", \\"-c\\", \\"/openair-nrf/etc/nrf.conf\\", \\"-o\\"]" '
cmd += ' --change "ENTRYPOINT [\\"/bin/bash\\", \\"/openair-nrf/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()
......@@ -618,7 +618,7 @@ class HtmlReport():
status = False
if nfType == 'NRF':
section_start_pattern = 'build_nrf --clean --Verbose --build-type Release --jobs'
section_end_pattern = 'FROM ubuntu:bionic as oai-nrf$'
section_end_pattern = 'FROM .* as oai-nrf$'
pass_pattern = 'nrf installed'
section_status = False
with open(cwd + '/archives/' + logFileName, 'r') as logfile:
......@@ -666,7 +666,7 @@ class HtmlReport():
if os.path.isfile(cwd + '/archives/' + logFileName):
if nfType == 'NRF':
section_start_pattern = 'build_nrf --clean --Verbose --build-type Release --jobs'
section_end_pattern = 'FROM ubuntu:bionic as oai-nrf$'
section_end_pattern = 'FROM .* as oai-nrf$'
section_status = False
with open(cwd + '/archives/' + logFileName, 'r') as logfile:
for line in logfile:
......@@ -727,23 +727,31 @@ class HtmlReport():
for variant in variants:
logFileName = 'nrf_' + variant + '_image_build.log'
if os.path.isfile(cwd + '/archives/' + logFileName):
section_start_pattern = 'FROM ubuntu:bionic as oai-nrf$'
section_end_pattern = 'COPY --from=oai-nrf-builder /openair-nrf/scripts/entrypoint.sh entrypoint.sh'
section_start_pattern = 'FROM .* as oai-nrf$'
section_end_pattern = 'COPY --from=oai-nrf-builder /openair-nrf/etc/nrf.conf '
section_status = False
status = False
noPbInLDD = True
with open(cwd + '/archives/' + logFileName, 'r') as logfile:
for line in logfile:
result = re.search(section_start_pattern, line)
if result is not None:
section_status = True
result = re.search('not found', line)
if section_status and result is not None:
noPbInLDD = False
result = re.search(section_end_pattern, line)
if result is not None:
section_status = False
status = True
logfile.close()
if status:
if status and noPbInLDD:
cell_msg = ' <td bgcolor="LimeGreen"><pre style="border:none; background-color:LimeGreen"><b>'
cell_msg += 'OK:\n'
elif noPbInLDD:
cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>'
cell_msg += 'KO:\n'
cell_msg += ' Some libraries were not copied from builder image\n'
else:
cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>'
cell_msg += 'KO:\n'
......@@ -841,7 +849,7 @@ class HtmlReport():
result = re.search(section_end_pattern, line)
if result is not None:
section_status = False
if section_status:
if section_status and not status:
if nfType == 'NRF':
if self.git_pull_request:
result = re.search('oai-nrf *ci-tmp', line)
......
......@@ -33,8 +33,12 @@ FROM registry.access.redhat.com/ubi8/ubi:latest AS oai-nrf-builder
ARG NEEDED_GIT_PROXY
COPY tmp/ca/redhat-uep.pem /etc/rhsm/ca
COPY tmp/entitlement/*.pem /etc/pki/entitlement
# Copy the entitlements
COPY ./etc-pki-entitlement /etc/pki/entitlement
# Copy the subscription manager configurations
COPY ./rhsm-conf /etc/rhsm
COPY ./rhsm-ca /etc/rhsm/ca
RUN rm -f /etc/rhsm-host && \
yum repolist --disablerepo=* && \
......@@ -78,7 +82,8 @@ RUN yum update -y && \
net-tools \
procps-ng\
libevent && \
rm -rf /var/lib/apt/lists/*
yum clean all -y && \
rm -rf /var/cache/yum /var/cache/dnf
# Copying executable and generated libraries
WORKDIR /openair-nrf/bin
......@@ -103,7 +108,8 @@ COPY --from=oai-nrf-builder \
/usr/lib64/libboost_regex.so.1.66.0 \
/usr/lib64/
RUN ldconfig
RUN ldconfig && \
ldd /openair-nrf/bin/oai_nrf
# Copying template configuration files
# The configuration folder will be flat
......
#/*
# * 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 Open-Air-Interface NRF service
......@@ -34,6 +54,7 @@ WORKDIR /openair-nrf
WORKDIR /openair-nrf/build/scripts
RUN ./build_nrf --install-deps --force
RUN ./build_nrf --clean --Verbose --build-type Release --jobs && \
ldd /openair-nrf/build/nrf/build/nrf && \
mv /openair-nrf/build/nrf/build/nrf /openair-nrf/build/nrf/build/oai_nrf
#---------------------------------------------------------------------
......@@ -52,12 +73,13 @@ RUN apt-get update && \
iputils-ping \
bc \
tzdata \
tshark \
libasan4 \
libgoogle-glog0v5 \
libdouble-conversion1 \
libconfig++9v5 \
libldap-2.4-2 \
libkrb5-3 \
libgssapi-krb5-2 \
librtmp1 \
libpsl5 \
&& rm -rf /var/lib/apt/lists/*
......@@ -70,6 +92,7 @@ COPY --from=oai-nrf-builder \
./
COPY --from=oai-nrf-builder \
/usr/local/lib/libpistache.so \
/usr/local/lib/libnghttp2.so.14 \
/usr/local/lib/libnghttp2_asio.so.1 \
/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4 \
/usr/lib/x86_64-linux-gnu/libboost_system.so.1.65.1 \
......
......@@ -12,6 +12,7 @@
*/
#include "NFProfile.h"
#include <iostream>
namespace oai {
namespace nrf {
......@@ -67,7 +68,7 @@ NFProfile::NFProfile() {
m_ChfInfoExtIsSet = false;
m_NrfInfoIsSet = false;
m_NwdafInfoIsSet = false;
// m_CustomInfoIsSet = false;
m_CustomInfoIsSet = false;
m_RecoveryTime = "";
m_RecoveryTimeIsSet = false;
m_NfServicePersistence = false;
......@@ -146,8 +147,7 @@ void to_json(nlohmann::json& j, const NFProfile& o) {
j["chfInfoExt"] = o.m_ChfInfoExt;
if (o.nrfInfoIsSet()) j["nrfInfo"] = o.m_NrfInfo;
if (o.nwdafInfoIsSet()) j["nwdafInfo"] = o.m_NwdafInfo;
// if(o.customInfoIsSet())
// j["customInfo"] = o.m_CustomInfo;
if (o.customInfoIsSet()) j["customInfo"] = o.m_CustomInfo;
if (o.recoveryTimeIsSet()) j["recoveryTime"] = o.m_RecoveryTime;
if (o.nfServicePersistenceIsSet())
j["nfServicePersistence"] = o.m_NfServicePersistence;
......@@ -323,11 +323,10 @@ void from_json(const nlohmann::json& j, NFProfile& o) {
j.at("nwdafInfo").get_to(o.m_NwdafInfo);
o.m_NwdafInfoIsSet = true;
}
/*if(j.find("customInfo") != j.end())
{
if (j.find("customInfo") != j.end()) {
j.at("customInfo").get_to(o.m_CustomInfo);
o.m_CustomInfoIsSet = true;
} */
}
if (j.find("recoveryTime") != j.end()) {
j.at("recoveryTime").get_to(o.m_RecoveryTime);
o.m_RecoveryTimeIsSet = true;
......@@ -867,26 +866,21 @@ bool NFProfile::nwdafInfoIsSet() const {
void NFProfile::unsetNwdafInfo() {
m_NwdafInfoIsSet = false;
}
/*Object NFProfile::getCustomInfo() const
{
nlohmann::json NFProfile::getCustomInfo() const {
return m_CustomInfo;
}
*/
/*
void NFProfile::setCustomInfo(Object const& value)
{
}
void NFProfile::setCustomInfo(nlohmann::json const& value) {
m_CustomInfo = value;
m_CustomInfoIsSet = true;
}*/
/* bool NFProfile::customInfoIsSet() const
{
}
bool NFProfile::customInfoIsSet() const {
return m_CustomInfoIsSet;
}*/
/*
void NFProfile::unsetCustomInfo()
{
}
void NFProfile::unsetCustomInfo() {
m_CustomInfoIsSet = false;
}*/
}
std::string NFProfile::getRecoveryTime() const {
return m_RecoveryTime;
......
......@@ -345,10 +345,10 @@ class NFProfile {
/// <summary>
///
/// </summary>
// Object getCustomInfo() const;
// void setCustomInfo(Object const& value);
// bool customInfoIsSet() const;
// void unsetCustomInfo();
nlohmann::json getCustomInfo() const;
void setCustomInfo(nlohmann::json const& value);
bool customInfoIsSet() const;
void unsetCustomInfo();
/// <summary>
///
/// </summary>
......@@ -480,8 +480,8 @@ class NFProfile {
bool m_NrfInfoIsSet;
NwdafInfo m_NwdafInfo;
bool m_NwdafInfoIsSet;
// Object m_CustomInfo;
// bool m_CustomInfoIsSet;
nlohmann::json m_CustomInfo;
bool m_CustomInfoIsSet;
std::string m_RecoveryTime;
bool m_RecoveryTimeIsSet;
bool m_NfServicePersistence;
......
......@@ -148,10 +148,4 @@ typedef struct guami_s {
std::string amf_id;
} guami_t;
typedef struct supi_range_s {
std::string start;
std::string end;
std::string pattern;
} supi_range_t;
#endif
......@@ -87,16 +87,67 @@ typedef struct upf_info_s {
std::vector<interface_upf_info_item_t> interface_upf_info_list;
} upf_info_t;
typedef struct supi_range_ausf_info_item_s {
typedef struct supi_range_s {
std::string start;
std::string end;
std::string pattern;
} supi_range_t;
typedef struct supi_range_info_item_s {
supi_range_t supi_range;
} supi_range_ausf_info_item_t;
} supi_range_info_item_t;
typedef struct identity_range_s {
std::string start;
std::string end;
std::string pattern;
} identity_range_t;
typedef struct identity_range_info_item_s {
identity_range_t identity_range;
} identity_range_info_item_t;
typedef struct internal_grpid_range_s {
std::string start;
std::string end;
std::string pattern;
} internal_grpid_range_t;
typedef struct internal_grpid_range_info_item_s {
internal_grpid_range_t int_grpid_range;
} internal_grpid_range_info_item_t;
typedef struct ausf_info_s {
std::string groupid;
std::vector<supi_range_ausf_info_item_t> supi_ranges;
std::vector<supi_range_info_item_t> supi_ranges;
std::vector<std::string> routing_indicator;
} ausf_info_t;
typedef struct udm_info_s {
std::string groupid;
std::vector<supi_range_info_item_t> supi_ranges;
std::vector<identity_range_info_item_t> gpsi_ranges;
std::vector<identity_range_info_item_t> ext_grp_id_ranges;
std::vector<std::string> routing_indicator;
std::vector<internal_grpid_range_info_item_t> int_grp_id_ranges;
} udm_info_t;
typedef struct udr_info_s {
std::string groupid;
std::vector<supi_range_info_item_t> supi_ranges;
std::vector<identity_range_info_item_t> gpsi_ranges;
std::vector<identity_range_info_item_t> ext_grp_id_ranges;
std::vector<std::string> data_set_id;
} udr_info_t;
typedef struct pcf_info_s {
std::string groupid;
std::vector<std::string> dnn_list;
std::vector<supi_range_info_item_t> supi_ranges;
std::vector<identity_range_info_item_t> gpsi_ranges;
// ToDo: rxDiamHost, rxDiamRealm, v2xSupportInd.
} pcf_info_t;
enum subscr_condition_type_e { // TODO: use enum class
UNKNOWN_CONDITION = 0,
NF_INSTANCE_ID_COND = 1,
......
......@@ -28,32 +28,33 @@
typedef enum nf_type_s {
NF_TYPE_NRF = 0,
NF_TYPE_AMF = 1,
NF_TYPE_SMF = 2,
NF_TYPE_AUSF = 3,
NF_TYPE_NEF = 4,
NF_TYPE_PCF = 5,
NF_TYPE_SMSF = 6,
NF_TYPE_NSSF = 7,
NF_TYPE_UDR = 8,
NF_TYPE_LMF = 9,
NF_TYPE_GMLC = 10,
NF_TYPE_5G_EIR = 11,
NF_TYPE_SEPP = 12,
NF_TYPE_UPF = 13,
NF_TYPE_N3IWF = 14,
NF_TYPE_AF = 15,
NF_TYPE_UDSF = 16,
NF_TYPE_BSF = 17,
NF_TYPE_CHF = 18,
NF_TYPE_NWDAF = 19,
NF_TYPE_UNKNOWN = 20
NF_TYPE_UDM = 1,
NF_TYPE_AMF = 2,
NF_TYPE_SMF = 3,
NF_TYPE_AUSF = 4,
NF_TYPE_NEF = 5,
NF_TYPE_PCF = 6,
NF_TYPE_SMSF = 7,
NF_TYPE_NSSF = 8,
NF_TYPE_UDR = 9,
NF_TYPE_LMF = 10,
NF_TYPE_GMLC = 11,
NF_TYPE_5G_EIR = 12,
NF_TYPE_SEPP = 13,
NF_TYPE_UPF = 14,
NF_TYPE_N3IWF = 15,
NF_TYPE_AF = 16,
NF_TYPE_UDSF = 17,
NF_TYPE_BSF = 18,
NF_TYPE_CHF = 19,
NF_TYPE_NWDAF = 20,
NF_TYPE_UNKNOWN = 21
} nf_type_t;
static const std::vector<std::string> nf_type_e2str = {
"NRF", "AMF", "SMF", "AUSF", "NEF", "PCF", "SMSF",
"NSSF", "UDR", "LMF", "GMLC", "5G_EIR", "SEPP", "UPF",
"N3IWF", "AF", "UDSF", "BSF", "CHF", "NWDAF", "UNKNOWN"};
"NRF", "UDM", "AMF", "SMF", "AUSF", "NEF", "PCF", "SMSF",
"NSSF", "UDR", "LMF", "GMLC", "5G_EIR", "SEPP", "UPF", "N3IWF",
"AF", "UDSF", "BSF", "CHF", "NWDAF", "UNKNOWN"};
typedef enum patch_op_type_s {
PATCH_OP_ADD = 0,
......
......@@ -65,6 +65,9 @@ bool api_conv::profile_api_to_nrf_profile(
"\tInstance name: %s", profile.get()->get_nf_instance_name().c_str());
profile.get()->set_nf_status(api_profile.getNfStatus());
profile.get()->set_custom_info(api_profile.getCustomInfo());
Logger::nrf_app().debug(
"getCustomInfo -> %s", api_profile.getCustomInfo().dump().c_str());
Logger::nrf_app().debug(
"\tStatus: %s", profile.get()->get_nf_status().c_str());
profile.get()->set_nf_heartBeat_timer(api_profile.getHeartBeatTimer());
......@@ -294,17 +297,23 @@ bool api_conv::profile_api_to_nrf_profile(
->add_upf_info(info);
} break;
case NF_TYPE_AUSF: {
Logger::nrf_app().debug("\tAUSF profile, AUSFF Info");
Logger::nrf_app().debug("\tAUSF profile, AUSF Info");
profile.get()->set_nf_type(NF_TYPE_AUSF);
ausf_info_t info = {};
AusfInfo ausf_info_api = api_profile.getAusfInfo();
info.groupid = ausf_info_api.getGroupId();
Logger::nrf_app().debug("\t\t GroupId - %s", info.groupid.c_str());
for (auto s : ausf_info_api.getSupiRanges()) {
supi_range_ausf_info_item_t supiRange = {};
supi_range_info_item_t supiRange = {};
supiRange.supi_range.start = s.getStart();
supiRange.supi_range.end = s.getEnd();
supiRange.supi_range.pattern = s.getPattern();
info.supi_ranges.push_back(supiRange);
Logger::nrf_app().debug(
"\t\t SupiRanges: Start - %s, End - %s, Pattern - %s",
supiRange.supi_range.start.c_str(),
supiRange.supi_range.end.c_str(),
supiRange.supi_range.pattern.c_str());
}
for (auto s : ausf_info_api.getRoutingIndicators()) {
info.routing_indicator.push_back(s);
......@@ -314,6 +323,176 @@ bool api_conv::profile_api_to_nrf_profile(
->add_ausf_info(info);
} break;
case NF_TYPE_UDM: {
Logger::nrf_app().debug("\tUDM profile, UDM Info");
profile.get()->set_nf_type(NF_TYPE_UDM);
udm_info_t info = {};
UdmInfo udm_info_api = api_profile.getUdmInfo();
info.groupid = udm_info_api.getGroupId();
Logger::nrf_app().debug("\t\t GroupId - %s", info.groupid.c_str());
if (udm_info_api.supiRangesIsSet()) {
for (auto s : udm_info_api.getSupiRanges()) {
supi_range_info_item_t supiRange = {};
supiRange.supi_range.start = s.getStart();
supiRange.supi_range.end = s.getEnd();
supiRange.supi_range.pattern = s.getPattern();
info.supi_ranges.push_back(supiRange);
Logger::nrf_app().debug(
"\t\t SupiRanges: Start - %s, End - %s, Pattern - %s",
supiRange.supi_range.start.c_str(),
supiRange.supi_range.end.c_str(),
supiRange.supi_range.pattern.c_str());
}
}
if (udm_info_api.gpsiRangesIsSet()) {
for (auto s : udm_info_api.getGpsiRanges()) {
identity_range_info_item_t gpsiRange = {};
gpsiRange.identity_range.start = s.getStart();
gpsiRange.identity_range.end = s.getEnd();
gpsiRange.identity_range.pattern = s.getPattern();
info.gpsi_ranges.push_back(gpsiRange);
Logger::nrf_app().debug(
"\t\t GpsiRanges: Start - %s, End - %s, Pattern - %s",
gpsiRange.identity_range.start.c_str(),
gpsiRange.identity_range.end.c_str(),
gpsiRange.identity_range.pattern.c_str());
}
}
if (udm_info_api.externalGroupIdentifiersRangesIsSet()) {
for (auto s : udm_info_api.getExternalGroupIdentifiersRanges()) {
identity_range_info_item_t ExtGrpId = {};
ExtGrpId.identity_range.start = s.getStart();
ExtGrpId.identity_range.end = s.getEnd();
ExtGrpId.identity_range.pattern = s.getPattern();
info.ext_grp_id_ranges.push_back(ExtGrpId);
Logger::nrf_app().debug(
"\t\t Ext_Id_Ranges: Start - %s, End - %s, Pattern - %s",
ExtGrpId.identity_range.start.c_str(),
ExtGrpId.identity_range.end.c_str(),
ExtGrpId.identity_range.pattern.c_str());
}
}
if (udm_info_api.routingIndicatorsIsSet()) {
for (auto s : udm_info_api.getRoutingIndicators()) {
info.routing_indicator.push_back(s);
Logger::nrf_app().debug("\t\t Routing Indicators: %s", s.c_str());
}
}
// ToDo:- InternalGroupIdentifiersRanges
// for (auto s : udm_info_api.getInternalGroupIdentifiersRanges()) {
// internal_grpid_range_info_item_t IntGrpId = {};
// IntGrpId.int_grpid_range.start = s.getStart();
// IntGrpId.int_grpid_range.end = s.getEnd();
// IntGrpId.int_grpid_range.pattern = s.getPattern();
// info.ext_grp_id_ranges.push_back(IntGrpId);
// }
(std::static_pointer_cast<udm_profile>(profile))
.get()
->add_udm_info(info);
} break;
case NF_TYPE_UDR: {
Logger::nrf_app().debug("\tUDR profile, UDR Info");
profile.get()->set_nf_type(NF_TYPE_UDR);
udr_info_t info = {};
UdrInfo udr_info_api = api_profile.getUdrInfo();
info.groupid = udr_info_api.getGroupId();
Logger::nrf_app().debug("\t\t GroupId - %s", info.groupid.c_str());
if (udr_info_api.supiRangesIsSet()) {
for (auto s : udr_info_api.getSupiRanges()) {
supi_range_info_item_t supiRange = {};
supiRange.supi_range.start = s.getStart();
supiRange.supi_range.end = s.getEnd();
supiRange.supi_range.pattern = s.getPattern();
info.supi_ranges.push_back(supiRange);
Logger::nrf_app().debug(
"\t\t SupiRanges: Start - %s, End - %s, Pattern - %s",
supiRange.supi_range.start.c_str(),
supiRange.supi_range.end.c_str(),
supiRange.supi_range.pattern.c_str());
}
}
if (udr_info_api.gpsiRangesIsSet()) {
for (auto s : udr_info_api.getGpsiRanges()) {
identity_range_info_item_t gpsiRange = {};
gpsiRange.identity_range.start = s.getStart();
gpsiRange.identity_range.end = s.getEnd();
gpsiRange.identity_range.pattern = s.getPattern();
info.gpsi_ranges.push_back(gpsiRange);
Logger::nrf_app().debug(
"\t\t GpsiRanges: Start - %s, End - %s, Pattern - %s",
gpsiRange.identity_range.start.c_str(),
gpsiRange.identity_range.end.c_str(),
gpsiRange.identity_range.pattern.c_str());
}
}
if (udr_info_api.externalGroupIdentifiersRangesIsSet()) {
for (auto s : udr_info_api.getExternalGroupIdentifiersRanges()) {
identity_range_info_item_t ExtGrpId = {};
ExtGrpId.identity_range.start = s.getStart();
ExtGrpId.identity_range.end = s.getEnd();
ExtGrpId.identity_range.pattern = s.getPattern();
info.ext_grp_id_ranges.push_back(ExtGrpId);
Logger::nrf_app().debug(
"\t\t Ext_Grp_Id_Ranges: Start - %s, End - %s, Pattern - %s",
ExtGrpId.identity_range.start.c_str(),
ExtGrpId.identity_range.end.c_str(),
ExtGrpId.identity_range.pattern.c_str());
}
}
// ToDo:- s.getInterfaceType() Not Implemented
// for (auto s : udr_info_api.getSupportedDataSets()) {
// info.data_set_id.push_back(s);
// Logger::nrf_app().debug("\t\t Supported Data Sets: %s", s.c_str());
// }
(std::static_pointer_cast<udr_profile>(profile))
.get()
->add_udr_info(info);
} break;
case NF_TYPE_PCF: {
Logger::nrf_app().debug("\tPCF profile, PCF Info");
profile.get()->set_nf_type(NF_TYPE_PCF);
pcf_info_t info = {};
PcfInfo pcf_info_api = api_profile.getPcfInfo();
info.groupid = pcf_info_api.getGroupId();
Logger::nrf_app().debug("\t\t GroupId - %s", info.groupid.c_str());
if (pcf_info_api.dnnListIsSet()) {
for (auto s : pcf_info_api.getDnnList()) {
Logger::nrf_app().debug("\t\t DNN - %s", s.c_str());
info.dnn_list.push_back(s);
}
}
if (pcf_info_api.supiRangesIsSet()) {
for (auto s : pcf_info_api.getSupiRanges()) {
supi_range_info_item_t supiRange = {};
supiRange.supi_range.start = s.getStart();
supiRange.supi_range.end = s.getEnd();
supiRange.supi_range.pattern = s.getPattern();
info.supi_ranges.push_back(supiRange);
Logger::nrf_app().debug(
"\t\t SupiRanges: Start - %s, End - %s, Pattern - %s",
supiRange.supi_range.start.c_str(),
supiRange.supi_range.end.c_str(),
supiRange.supi_range.pattern.c_str());
}
}
if (pcf_info_api.gpsiRangesIsSet()) {
for (auto s : pcf_info_api.getGpsiRanges()) {
identity_range_info_item_t gpsiRange = {};
gpsiRange.identity_range.start = s.getStart();
gpsiRange.identity_range.end = s.getEnd();
gpsiRange.identity_range.pattern = s.getPattern();
info.gpsi_ranges.push_back(gpsiRange);
Logger::nrf_app().debug(
"\t\t GpsiRanges: Start - %s, End - %s, Pattern - %s",
gpsiRange.identity_range.start.c_str(),
gpsiRange.identity_range.end.c_str(),
gpsiRange.identity_range.pattern.c_str());
}
}
(std::static_pointer_cast<pcf_profile>(profile))
.get()
->add_pcf_info(info);
} break;
default: {
}
}
......@@ -502,11 +681,12 @@ bool api_conv::subscription_api_to_nrf_subscription(
//------------------------------------------------------------------------------
nf_type_t api_conv::string_to_nf_type(const std::string& str) {
if (str.compare("NRF") == 0) return NF_TYPE_NRF;
if (str.compare("UDM") == 0) return NF_TYPE_UDM;
if (str.compare("AMF") == 0) return NF_TYPE_AMF;
if (str.compare("SMF") == 0) return NF_TYPE_SMF;
if (str.compare("AUSF") == 0) return NF_TYPE_AUSF;
if (str.compare("NEF") == 0) return NF_TYPE_NEF;
if (str.compare("PCP") == 0) return NF_TYPE_PCF;
if (str.compare("PCF") == 0) return NF_TYPE_PCF;
if (str.compare("SMSF") == 0) return NF_TYPE_SMSF;
if (str.compare("NSSF") == 0) return NF_TYPE_NSSF;
if (str.compare("UDR") == 0) return NF_TYPE_UDR;
......
......@@ -140,6 +140,18 @@ void nrf_app::handle_register_nf_instance(
sn = std::make_shared<ausf_profile>(m_event_sub);
} break;
case NF_TYPE_UDM: {
sn = std::make_shared<udm_profile>(m_event_sub);
} break;
case NF_TYPE_UDR: {
sn = std::make_shared<udr_profile>(m_event_sub);
} break;
case NF_TYPE_PCF: {
sn = std::make_shared<pcf_profile>(m_event_sub);
} break;
default: {
sn = std::make_shared<nrf_profile>(m_event_sub);
}
......
......@@ -230,6 +230,16 @@ void nrf_profile::get_nf_services(std::vector<nf_service_t>& n) const {
n = nf_services;
}
//------------------------------------------------------------------------------
void nrf_profile::set_custom_info(const nlohmann::json& c) {
custom_info = c;
}
//------------------------------------------------------------------------------
void nrf_profile::get_custom_info(nlohmann::json& c) const {
c = custom_info;
}
//------------------------------------------------------------------------------
void nrf_profile::display() {
Logger::nrf_app().debug("NF instance info");
......@@ -242,6 +252,8 @@ void nrf_profile::display() {
Logger::nrf_app().debug("\tPriority: %d", priority);
Logger::nrf_app().debug("\tCapacity: %d", capacity);
// SNSSAIs
if (!custom_info.empty())
Logger::nrf_app().debug("\tCustomInfo: %s", custom_info.dump().c_str());
if (!plmn_list.empty()) {
for (auto s : plmn_list) {
Logger::nrf_app().debug("\tPLMN List(MCC, MNC): %d, %s", s.mcc, s.mnc);
......@@ -593,6 +605,8 @@ void nrf_profile::to_json(nlohmann::json& data) const {
// }
data["priority"] = priority;
data["capacity"] = capacity;
// CustomInfo
if (!custom_info.empty()) data["customInfo"] = custom_info;
// NF services
data["nfServices"] = nlohmann::json::array();
for (auto service : nf_services) {
......@@ -1156,14 +1170,15 @@ void ausf_profile::get_ausf_info(ausf_info_t& infos) const {
void ausf_profile::display() {
nrf_profile::display();
Logger::nrf_app().debug("\tAUSF Info");
Logger::nrf_app().debug("\t\tGroupId: %s", ausf_info.groupid);
Logger::nrf_app().debug("\t\tGroupId: %s", ausf_info.groupid.c_str());
for (auto supi : ausf_info.supi_ranges) {
Logger::nrf_app().debug(
"\t\t SupiRanges: Start - %s, End - %s, Pattern - %s",
supi.supi_range.start, supi.supi_range.end, supi.supi_range.pattern);
supi.supi_range.start.c_str(), supi.supi_range.end.c_str(),
supi.supi_range.pattern.c_str());
}
for (auto route_ind : ausf_info.routing_indicator) {
Logger::nrf_app().debug("\t\t Routing Indicators: %s", route_ind);
Logger::nrf_app().debug("\t\t Routing Indicators: %s", route_ind.c_str());
}
}
......@@ -1264,7 +1279,479 @@ void ausf_profile::to_json(nlohmann::json& data) const {
data["ausfInfo"]["supiRanges"].push_back(tmp);
}
for (auto route_ind : ausf_info.routing_indicator) {
std::string tmp = route_ind;
data["ausfInfo"]["routingIndicators"].push_back(route_ind);
}
}
//------------------------------------------------------------------------------
void udm_profile::add_udm_info(const udm_info_t& info) {
udm_info = info;
}
//------------------------------------------------------------------------------
void udm_profile::get_udm_info(udm_info_t& infos) const {
infos = udm_info;
}
//------------------------------------------------------------------------------
void udm_profile::display() {
nrf_profile::display();
Logger::nrf_app().debug("\tUDM Info");
Logger::nrf_app().debug("\t\tGroupId: %s", udm_info.groupid.c_str());
for (auto supi : udm_info.supi_ranges) {
Logger::nrf_app().debug(
"\t\t SupiRanges: Start - %s, End - %s, Pattern - %s",
supi.supi_range.start.c_str(), supi.supi_range.end.c_str(),
supi.supi_range.pattern.c_str());
}
for (auto gpsiRange : udm_info.gpsi_ranges) {
Logger::nrf_app().debug(
"\t\t GpsiRanges: Start - %s, End - %s, Pattern - %s",
gpsiRange.identity_range.start.c_str(),
gpsiRange.identity_range.end.c_str(),
gpsiRange.identity_range.pattern.c_str());
}
for (auto ext_grp_id : udm_info.ext_grp_id_ranges) {
Logger::nrf_app().debug(
"\t\t externalGroupIdentifiersRanges: Start - %s, End - %s, Pattern - "
"%s",
ext_grp_id.identity_range.start.c_str(),
ext_grp_id.identity_range.end.c_str(),
ext_grp_id.identity_range.pattern.c_str());
}
for (auto int_grp_id : udm_info.int_grp_id_ranges) {
Logger::nrf_app().debug(
"\t\t internalGroupIdentifiersRanges: Start - %s, End - %s, Pattern - "
"%s",
int_grp_id.int_grpid_range.start.c_str(),
int_grp_id.int_grpid_range.end.c_str(),
int_grp_id.int_grpid_range.pattern.c_str());
}
for (auto route_ind : udm_info.routing_indicator) {
Logger::nrf_app().debug("\t\t Routing Indicators: %s", route_ind.c_str());
}
}
//------------------------------------------------------------------------------
bool udm_profile::add_profile_info(
const std::string& path, const std::string& value) {
bool result = nrf_profile::add_profile_info(path, value);
if (result) return true;
// add an element to a list of json object
if (path.compare("udmInfo") == 0) {
Logger::nrf_app().info("Does not support this operation for udmInfo");
return false;
}
if ((path.compare("nfInstanceId") != 0) and
(path.compare("nfInstanceName") != 0) and
(path.compare("nfType") != 0) and (path.compare("nfStatus") != 0) and
(path.compare("heartBeatTimer") != 0) and (path.compare("fqdn") != 0) and
(path.compare("plmnList") != 0) and
(path.compare("ipv4Addresses") != 0) and
(path.compare("priority") != 0) and (path.compare("capacity") != 0) and
(path.compare("priority") != 0) and (path.compare("nfServices") != 0) and
(path.compare("udmInfo") != 0)) {
Logger::nrf_app().debug("Add new member: %s", path.c_str());
// add new member
json_data[path] = value;
return true;
}
return false;
}
//------------------------------------------------------------------------------
bool udm_profile::replace_profile_info(
const std::string& path, const std::string& value) {
bool result = nrf_profile::replace_profile_info(path, value);
if (result) return true;
// for UDMAUSF info
if (path.compare("udmInfo") == 0) {
Logger::nrf_app().debug("Does not support this operation for udmInfo");
return false;
}
if ((path.compare("nfInstanceId") != 0) and
(path.compare("nfInstanceName") != 0) and
(path.compare("nfType") != 0) and (path.compare("nfStatus") != 0) and
(path.compare("heartBeatTimer") != 0) and (path.compare("fqdn") != 0) and
(path.compare("plmnList") != 0) and
(path.compare("ipv4Addresses") != 0) and
(path.compare("priority") != 0) and (path.compare("capacity") != 0) and
(path.compare("priority") != 0) and (path.compare("nfServices") != 0) and
(path.compare("udmInfo") != 0)) {
Logger::nrf_app().debug("Member (%s) not found!", path.c_str());
return false;
}
return false;
}
//------------------------------------------------------------------------------
bool udm_profile::remove_profile_info(const std::string& path) {
bool result = nrf_profile::remove_profile_info(path);
if (result) return true;
// for UDM info
if (path.compare("udmInfo") == 0) {
Logger::nrf_app().debug("Do not support this operation for udmInfo");
return false;
}
if ((path.compare("nfInstanceId") != 0) and
(path.compare("nfInstanceName") != 0) and
(path.compare("nfType") != 0) and (path.compare("nfStatus") != 0) and
(path.compare("heartBeatTimer") != 0) and (path.compare("fqdn") != 0) and
(path.compare("plmnList") != 0) and
(path.compare("ipv4Addresses") != 0) and
(path.compare("priority") != 0) and (path.compare("capacity") != 0) and
(path.compare("priority") != 0) and (path.compare("nfServices") != 0) and
(path.compare("udmInfo") != 0)) {
Logger::nrf_app().debug("Member (%s) not found!", path.c_str());
return false;
}
return false;
}
//------------------------------------------------------------------------------
void udm_profile::to_json(nlohmann::json& data) const {
nrf_profile::to_json(data);
// UDM Info
data["udmInfo"]["groupId"] = udm_info.groupid;
data["udmInfo"]["supiRanges"] = nlohmann::json::array();
data["udmInfo"]["gpsiRanges"] = nlohmann::json::array();
data["udmInfo"]["externalGroupIdentifiersRanges"] = nlohmann::json::array();
data["udmInfo"]["routingIndicators"] = nlohmann::json::array();
data["udmInfo"]["internalGroupIdentifiersRanges"] = nlohmann::json::array();
for (auto supi : udm_info.supi_ranges) {
nlohmann::json tmp = {};
tmp["start"] = supi.supi_range.start;
tmp["end"] = supi.supi_range.end;
tmp["pattern"] = supi.supi_range.pattern;
data["udmInfo"]["supiRanges"].push_back(tmp);
}
for (auto gpsi : udm_info.gpsi_ranges) {
nlohmann::json tmp = {};
tmp["start"] = gpsi.identity_range.start;
tmp["end"] = gpsi.identity_range.end;
tmp["pattern"] = gpsi.identity_range.pattern;
data["udmInfo"]["gpsiRanges"].push_back(tmp);
}
for (auto ext_grp_id : udm_info.ext_grp_id_ranges) {
nlohmann::json tmp = {};
tmp["start"] = ext_grp_id.identity_range.start;
tmp["end"] = ext_grp_id.identity_range.end;
tmp["pattern"] = ext_grp_id.identity_range.pattern;
data["udmInfo"]["externalGroupIdentifiersRanges"].push_back(tmp);
}
for (auto route_ind : udm_info.routing_indicator) {
data["udmInfo"]["routingIndicators"].push_back(route_ind);
}
for (auto int_grp_id : udm_info.int_grp_id_ranges) {
nlohmann::json tmp = {};
tmp["start"] = int_grp_id.int_grpid_range.start;
tmp["end"] = int_grp_id.int_grpid_range.end;
tmp["pattern"] = int_grp_id.int_grpid_range.pattern;
data["udmInfo"]["internalGroupIdentifiersRanges"].push_back(tmp);
}
}
//------------------------------------------------------------------------------
void udr_profile::add_udr_info(const udr_info_t& info) {
udr_info = info;
}
//------------------------------------------------------------------------------
void udr_profile::get_udr_info(udr_info_t& infos) const {
infos = udr_info;
}
//------------------------------------------------------------------------------
void udr_profile::display() {
nrf_profile::display();
Logger::nrf_app().debug("\tUDR Info");
Logger::nrf_app().debug("\t\tGroupId: %s", udr_info.groupid.c_str());
for (auto supi : udr_info.supi_ranges) {
Logger::nrf_app().debug(
"\t\t SupiRanges: Start - %s, End - %s, Pattern - %s",
supi.supi_range.start.c_str(), supi.supi_range.end.c_str(),
supi.supi_range.pattern.c_str());
}
for (auto gpsiRange : udr_info.gpsi_ranges) {
Logger::nrf_app().debug(
"\t\t GpsiRanges: Start - %s, End - %s, Pattern - %s",
gpsiRange.identity_range.start.c_str(),
gpsiRange.identity_range.end.c_str(),
gpsiRange.identity_range.pattern.c_str());
}
for (auto ext_grp_id : udr_info.ext_grp_id_ranges) {
Logger::nrf_app().debug(
"\t\t externalGroupIdentifiersRanges: Start - %s, End - %s, Pattern - "
"%s",
ext_grp_id.identity_range.start.c_str(),
ext_grp_id.identity_range.end.c_str(),
ext_grp_id.identity_range.pattern.c_str());
}
for (auto data_set_id : udr_info.data_set_id) {
Logger::nrf_app().debug("\t\t DataSetId: %s", data_set_id.c_str());
}
}
//------------------------------------------------------------------------------
bool udr_profile::add_profile_info(
const std::string& path, const std::string& value) {
bool result = nrf_profile::add_profile_info(path, value);
if (result) return true;
// add an element to a list of json object
if (path.compare("udrInfo") == 0) {
Logger::nrf_app().info("Does not support this operation for udrInfo");
return false;
}
if ((path.compare("nfInstanceId") != 0) and
(path.compare("nfInstanceName") != 0) and
(path.compare("nfType") != 0) and (path.compare("nfStatus") != 0) and
(path.compare("heartBeatTimer") != 0) and (path.compare("fqdn") != 0) and
(path.compare("plmnList") != 0) and
(path.compare("ipv4Addresses") != 0) and
(path.compare("priority") != 0) and (path.compare("capacity") != 0) and
(path.compare("priority") != 0) and (path.compare("nfServices") != 0) and
(path.compare("udrInfo") != 0)) {
Logger::nrf_app().debug("Add new member: %s", path.c_str());
// add new member
json_data[path] = value;
return true;
}
return false;
}
//------------------------------------------------------------------------------
bool udr_profile::replace_profile_info(
const std::string& path, const std::string& value) {
bool result = nrf_profile::replace_profile_info(path, value);
if (result) return true;
// for UDMAUSF info
if (path.compare("udrInfo") == 0) {
Logger::nrf_app().debug("Does not support this operation for udrInfo");
return false;
}
if ((path.compare("nfInstanceId") != 0) and
(path.compare("nfInstanceName") != 0) and
(path.compare("nfType") != 0) and (path.compare("nfStatus") != 0) and
(path.compare("heartBeatTimer") != 0) and (path.compare("fqdn") != 0) and
(path.compare("plmnList") != 0) and
(path.compare("ipv4Addresses") != 0) and
(path.compare("priority") != 0) and (path.compare("capacity") != 0) and
(path.compare("priority") != 0) and (path.compare("nfServices") != 0) and
(path.compare("udrInfo") != 0)) {
Logger::nrf_app().debug("Member (%s) not found!", path.c_str());
return false;
}
return false;
}
//------------------------------------------------------------------------------
bool udr_profile::remove_profile_info(const std::string& path) {
bool result = nrf_profile::remove_profile_info(path);
if (result) return true;
// for UDM info
if (path.compare("udrInfo") == 0) {
Logger::nrf_app().debug("Do not support this operation for udrInfo");
return false;
}
if ((path.compare("nfInstanceId") != 0) and
(path.compare("nfInstanceName") != 0) and
(path.compare("nfType") != 0) and (path.compare("nfStatus") != 0) and
(path.compare("heartBeatTimer") != 0) and (path.compare("fqdn") != 0) and
(path.compare("plmnList") != 0) and
(path.compare("ipv4Addresses") != 0) and
(path.compare("priority") != 0) and (path.compare("capacity") != 0) and
(path.compare("priority") != 0) and (path.compare("nfServices") != 0) and
(path.compare("udrInfo") != 0)) {
Logger::nrf_app().debug("Member (%s) not found!", path.c_str());
return false;
}
return false;
}
//------------------------------------------------------------------------------
void udr_profile::to_json(nlohmann::json& data) const {
nrf_profile::to_json(data);
// UDR Info
data["udrInfo"]["groupId"] = udr_info.groupid;
data["udrInfo"]["supiRanges"] = nlohmann::json::array();
data["udrInfo"]["gpsiRanges"] = nlohmann::json::array();
data["udrInfo"]["externalGroupIdentifiersRanges"] = nlohmann::json::array();
data["udrInfo"]["routingIndicators"] = nlohmann::json::array();
for (auto supi : udr_info.supi_ranges) {
nlohmann::json tmp = {};
tmp["start"] = supi.supi_range.start;
tmp["end"] = supi.supi_range.end;
tmp["pattern"] = supi.supi_range.pattern;
data["udrInfo"]["supiRanges"].push_back(tmp);
}
for (auto gpsi : udr_info.gpsi_ranges) {
nlohmann::json tmp = {};
tmp["start"] = gpsi.identity_range.start;
tmp["end"] = gpsi.identity_range.end;
tmp["pattern"] = gpsi.identity_range.pattern;
data["udrInfo"]["gpsiRanges"].push_back(tmp);
}
for (auto ext_grp_id : udr_info.ext_grp_id_ranges) {
nlohmann::json tmp = {};
tmp["start"] = ext_grp_id.identity_range.start;
tmp["end"] = ext_grp_id.identity_range.end;
tmp["pattern"] = ext_grp_id.identity_range.pattern;
data["udrInfo"]["externalGroupIdentifiersRanges"].push_back(tmp);
}
for (auto data_set_id : udr_info.data_set_id) {
data["udrInfo"]["routingIndicators"].push_back(data_set_id);
}
}
//------------------------------------------------------------------------------
void pcf_profile::add_pcf_info(const pcf_info_t& info) {
pcf_info = info;
}
//------------------------------------------------------------------------------
void pcf_profile::get_pcf_info(pcf_info_t& infos) const {
infos = pcf_info;
}
//------------------------------------------------------------------------------
void pcf_profile::display() {
nrf_profile::display();
Logger::nrf_app().debug("\tUDR Info");
Logger::nrf_app().debug("\t\tGroupId: %s", pcf_info.groupid.c_str());
for (auto dnn : pcf_info.dnn_list) {
Logger::nrf_app().debug("\t\t DNN: %s", dnn.c_str());
}
for (auto supi : pcf_info.supi_ranges) {
Logger::nrf_app().debug(
"\t\t SupiRanges: Start - %s, End - %s, Pattern - %s",
supi.supi_range.start.c_str(), supi.supi_range.end.c_str(),
supi.supi_range.pattern.c_str());
}
for (auto gpsiRange : pcf_info.gpsi_ranges) {
Logger::nrf_app().debug(
"\t\t GpsiRanges: Start - %s, End - %s, Pattern - %s",
gpsiRange.identity_range.start.c_str(),
gpsiRange.identity_range.end.c_str(),
gpsiRange.identity_range.pattern.c_str());
}
}
//------------------------------------------------------------------------------
bool pcf_profile::add_profile_info(
const std::string& path, const std::string& value) {
bool result = nrf_profile::add_profile_info(path, value);
if (result) return true;
// add an element to a list of json object
if (path.compare("pcfInfo") == 0) {
Logger::nrf_app().info("Does not support this operation for pcfInfo");
return false;
}
if ((path.compare("nfInstanceId") != 0) and
(path.compare("nfInstanceName") != 0) and
(path.compare("nfType") != 0) and (path.compare("nfStatus") != 0) and
(path.compare("heartBeatTimer") != 0) and (path.compare("fqdn") != 0) and
(path.compare("plmnList") != 0) and
(path.compare("ipv4Addresses") != 0) and
(path.compare("priority") != 0) and (path.compare("capacity") != 0) and
(path.compare("priority") != 0) and (path.compare("nfServices") != 0) and
(path.compare("pcfInfo") != 0)) {
Logger::nrf_app().debug("Add new member: %s", path.c_str());
// add new member
json_data[path] = value;
return true;
}
return false;
}
//------------------------------------------------------------------------------
bool pcf_profile::replace_profile_info(
const std::string& path, const std::string& value) {
bool result = nrf_profile::replace_profile_info(path, value);
if (result) return true;
// for UDMAUSF info
if (path.compare("pcfInfo") == 0) {
Logger::nrf_app().debug("Does not support this operation for pcfInfo");
return false;
}
if ((path.compare("nfInstanceId") != 0) and
(path.compare("nfInstanceName") != 0) and
(path.compare("nfType") != 0) and (path.compare("nfStatus") != 0) and
(path.compare("heartBeatTimer") != 0) and (path.compare("fqdn") != 0) and
(path.compare("plmnList") != 0) and
(path.compare("ipv4Addresses") != 0) and
(path.compare("priority") != 0) and (path.compare("capacity") != 0) and
(path.compare("priority") != 0) and (path.compare("nfServices") != 0) and
(path.compare("pcfInfo") != 0)) {
Logger::nrf_app().debug("Member (%s) not found!", path.c_str());
return false;
}
return false;
}
//------------------------------------------------------------------------------
bool pcf_profile::remove_profile_info(const std::string& path) {
bool result = nrf_profile::remove_profile_info(path);
if (result) return true;
// for UDM info
if (path.compare("pcfInfo") == 0) {
Logger::nrf_app().debug("Do not support this operation for pcfInfo");
return false;
}
if ((path.compare("nfInstanceId") != 0) and
(path.compare("nfInstanceName") != 0) and
(path.compare("nfType") != 0) and (path.compare("nfStatus") != 0) and
(path.compare("heartBeatTimer") != 0) and (path.compare("fqdn") != 0) and
(path.compare("plmnList") != 0) and
(path.compare("ipv4Addresses") != 0) and
(path.compare("priority") != 0) and (path.compare("capacity") != 0) and
(path.compare("priority") != 0) and (path.compare("nfServices") != 0) and
(path.compare("pcfInfo") != 0)) {
Logger::nrf_app().debug("Member (%s) not found!", path.c_str());
return false;
}
return false;
}
//------------------------------------------------------------------------------
void pcf_profile::to_json(nlohmann::json& data) const {
nrf_profile::to_json(data);
// UDR Info
data["pcfInfo"]["groupId"] = pcf_info.groupid;
data["pcfInfo"]["dnnList"] = nlohmann::json::array();
data["pcfInfo"]["supiRanges"] = nlohmann::json::array();
data["pcfInfo"]["gpsiRanges"] = nlohmann::json::array();
for (auto supi : pcf_info.supi_ranges) {
nlohmann::json tmp = {};
tmp["start"] = supi.supi_range.start;
tmp["end"] = supi.supi_range.end;
tmp["pattern"] = supi.supi_range.pattern;
data["pcfInfo"]["supiRanges"].push_back(tmp);
}
for (auto gpsi : pcf_info.gpsi_ranges) {
nlohmann::json tmp = {};
tmp["start"] = gpsi.identity_range.start;
tmp["end"] = gpsi.identity_range.end;
tmp["pattern"] = gpsi.identity_range.pattern;
data["pcfInfo"]["gpsiRanges"].push_back(tmp);
}
for (auto dnn : pcf_info.dnn_list) {
data["pcfInfo"]["dnnList"].push_back(dnn);
}
}
\ No newline at end of file
......@@ -68,6 +68,7 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
nf_instance_name = "";
nf_status = "";
json_data = {};
custom_info = {};
first_update = true;
is_updated = false;
}
......@@ -365,6 +366,20 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
*/
void get_json_data(nlohmann::json& data) const;
/*
* Set custom info
* @param [const nlohmann::json &] c: custom info to be set
* @return void
*/
void set_custom_info(const nlohmann::json& c);
/*
* Get custom info
* @param [nlohmann::json &] c: Store custom info
* @return void
*/
void get_custom_info(nlohmann::json& c) const;
/*
* Set NF instance services
* @param [std::vector<nf_service_t> &] n: nf_service
......@@ -507,6 +522,7 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
uint16_t capacity;
nlohmann::json json_data; // store extra json data
std::vector<nf_service_t> nf_services;
nlohmann::json custom_info; // store extra json data
/*
std::vector<PlmnId> m_PlmnList;
......@@ -847,6 +863,207 @@ class ausf_profile : public nrf_profile {
ausf_info_t ausf_info;
};
class udm_profile : public nrf_profile {
public:
udm_profile(nrf_event& ev) : nrf_profile(ev, NF_TYPE_UDM) { udm_info = {}; }
udm_profile(nrf_event& ev, const std::string& id) : nrf_profile(ev, id) {
nf_type = NF_TYPE_UDM;
udm_info = {};
}
udm_profile(udm_profile& b) = delete;
/*
* Add a UDM info
* @param [const udm_info_t &] info: UDM info
* @return void
*/
void add_udm_info(const udm_info_t& info);
/*
* Get list of UDM infos a UDM info
* @param [const udm_info_t &] info: UDM info
* @return void
*/
void get_udm_info(udm_info_t& infos) const;
/*
* Print related-information for a UDM profile
* @param void
* @return void:
*/
void display();
/*
* Update a new value for a member of UDM profile
* @param [const std::string &] path: member name
* @param [const std::string &] value: new value
* @return void
*/
bool replace_profile_info(const std::string& path, const std::string& value);
/*
* Add a new value for a member of UDM profile
* @param [const std::string &] path: member name
* @param [const std::string &] value: new value
* @return true if success, otherwise false
*/
bool add_profile_info(const std::string& path, const std::string& value);
/*
* Remove value of a member of UDM profile
* @param [const std::string &] path: member name
* @param [const std::string &] value: new value
* @return true if success, otherwise false
*/
bool remove_profile_info(const std::string& path);
/*
* Represent UDM profile as json object
* @param [nlohmann::json &] data: Json data
* @return void
*/
void to_json(nlohmann::json& data) const;
private:
udm_info_t udm_info;
};
class udr_profile : public nrf_profile {
public:
udr_profile(nrf_event& ev) : nrf_profile(ev, NF_TYPE_UDR) { udr_info = {}; }
udr_profile(nrf_event& ev, const std::string& id) : nrf_profile(ev, id) {
nf_type = NF_TYPE_UDR;
udr_info = {};
}
udr_profile(udr_profile& b) = delete;
/*
* Add a UDR info
* @param [const udr_info_t &] info: UDR info
* @return void
*/
void add_udr_info(const udr_info_t& info);
/*
* Get list of UDR infos a UDR info
* @param [const udr_info_t &] info: UDR info
* @return void
*/
void get_udr_info(udr_info_t& infos) const;
/*
* Print related-information for a UDR profile
* @param void
* @return void:
*/
void display();
/*
* Update a new value for a member of UDR profile
* @param [const std::string &] path: member name
* @param [const std::string &] value: new value
* @return void
*/
bool replace_profile_info(const std::string& path, const std::string& value);
/*
* Add a new value for a member of UDR profile
* @param [const std::string &] path: member name
* @param [const std::string &] value: new value
* @return true if success, otherwise false
*/
bool add_profile_info(const std::string& path, const std::string& value);
/*
* Remove value of a member of UDR profile
* @param [const std::string &] path: member name
* @param [const std::string &] value: new value
* @return true if success, otherwise false
*/
bool remove_profile_info(const std::string& path);
/*
* Represent UDR profile as json object
* @param [nlohmann::json &] data: Json data
* @return void
*/
void to_json(nlohmann::json& data) const;
private:
udr_info_t udr_info;
};
class pcf_profile : public nrf_profile {
public:
pcf_profile(nrf_event& ev) : nrf_profile(ev, NF_TYPE_PCF) { pcf_info = {}; }
pcf_profile(nrf_event& ev, const std::string& id) : nrf_profile(ev, id) {
nf_type = NF_TYPE_PCF;
pcf_info = {};
}
pcf_profile(pcf_profile& b) = delete;
/*
* Add a PCF info
* @param [const pcf_info_t &] info: PCF info
* @return void
*/
void add_pcf_info(const pcf_info_t& info);
/*
* Get list of PCF infos a PCF info
* @param [const pcf_info_t &] info: pcf info
* @return void
*/
void get_pcf_info(pcf_info_t& infos) const;
/*
* Print related-information for a PCF profile
* @param void
* @return void:
*/
void display();
/*
* Update a new value for a member of PCF profile
* @param [const std::string &] path: member name
* @param [const std::string &] value: new value
* @return void
*/
bool replace_profile_info(const std::string& path, const std::string& value);
/*
* Add a new value for a member of PCF profile
* @param [const std::string &] path: member name
* @param [const std::string &] value: new value
* @return true if success, otherwise false
*/
bool add_profile_info(const std::string& path, const std::string& value);
/*
* Remove value of a member of PCF profile
* @param [const std::string &] path: member name
* @param [const std::string &] value: new value
* @return true if success, otherwise false
*/
bool remove_profile_info(const std::string& path);
/*
* Represent PCF profile as json object
* @param [nlohmann::json &] data: Json data
* @return void
*/
void to_json(nlohmann::json& data) const;
private:
pcf_info_t pcf_info;
};
} // namespace app
} // namespace nrf
} // namespace oai
......
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