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,
......
This diff is collapsed.
......@@ -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);
}
......
This diff is collapsed.
......@@ -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