Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • limx1980/oai-cn5g-ausf
  • maxime.six/oai-cn-5-g-ausf-quantum-safe
  • oai/cn5g/oai-cn5g-ausf
3 results
Show changes
Commits on Source (53)
Showing
with 248 additions and 265 deletions
# RELEASE NOTES : #
## v2.1.0 -- August 2024 ##
* Features
- Add connection handling mechanism
- Use HTTP Request Timeout parameter from Conf file
* Fixes
- Fix HTTP/2 server shutdown
- Fix of the shutdown for the task manager
- Fix issue for SD
* Tech Debt
- Remove NRF dependency from AUSF
- Stopping support for RHEL8/Rocky8 in favor of RHEL9/Rocky9
- Code refactor cleanup
- Removing unneccessary packages from target images
- Cleanup AUSF client
- Move AUSF SBI models to common src git submodule
- HTTP client cpr library refactoring effort
## v2.0.0 -- December 2023 ##
* Features
......
# CODEOWNERS
src/ausf_app:
- Keliang DU, BUPT
- Keliang DU, Jian Yang, Fengjiao He, Hongxin Wang BUPT
- Tien Thinh NGUYEN, Eurecom
src/itti
- Lionel GAUTHIER, Eurecom
- Tien Thinh NGUYEN, Eurecom
src/common
- Sebastien ROUX, Eurecom
- Lionel Gauthier, Eurecom
......
Subproject commit 1658381e06a477c79d34508f10610e54ff1e62ef
Subproject commit 0968c25ea2414dac69181dc57a23ee17848c3111
......@@ -36,6 +36,7 @@ source $THIS_SCRIPT_PATH/../common-build/installation/build_helper.pistache
source $THIS_SCRIPT_PATH/../common-build/installation/build_helper.nlohmann
source $THIS_SCRIPT_PATH/../common-build/installation/build_helper.nghttp2
source $THIS_SCRIPT_PATH/../common-build/installation/build_helper.yamlcpp
source $THIS_SCRIPT_PATH/../common-build/installation/build_helper.cpr
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
......@@ -100,10 +101,10 @@ check_install_ausf_deps() {
if [[ $OS_DISTRO == "ubuntu" ]]; then
case "$(get_distribution_release)" in
"ubuntu20.04")
specific_packages="libconfig++-dev libasio-dev libboost-all-dev libasan5"
specific_packages="libasio-dev libboost-all-dev libasan5"
;;
"ubuntu22.04")
specific_packages="libconfig++-dev libasio-dev libboost-all-dev libasan6"
specific_packages="libasio-dev libboost-all-dev libasan6"
;;
esac
# removed libspdlog-dev
......@@ -127,7 +128,6 @@ check_install_ausf_deps() {
ninja-build"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\
libconfig-devel \
gmp-devel \
libidn-devel \
openssl-devel \
......@@ -138,7 +138,6 @@ check_install_ausf_deps() {
check \
nettle-devel \
libcurl-devel \
python2 \
pkgconfig \
ninja-build \
boost-devel \
......@@ -166,6 +165,9 @@ check_install_ausf_deps() {
install_nghttp2_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
install_cpr_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
# latest usage of yaml-cpp suggests that we should be using 0.7+ version
# To be sure, let's install from source all the time for the moment
if [[ $OS_DISTRO == "ubuntu" ]]; then
......
......@@ -30,6 +30,7 @@ ubuntuBuildResource = params.UbuntuBuildResource
// Location of the RHEL CN executor
rhelNode = params.RhelBuildNode
rhelResource = params.RhelBuildResource
rhelOcCredentials = params.RhelOcCredentials
// Location of the CPPCHECK executor
cppcheckNode = params.CppCheckNode
......@@ -67,7 +68,7 @@ pipeline {
// Minimal checks
gitlabBuilds(builds: [
"Build Ubuntu AUSF Image",
"Build RHEL8 AUSF Image",
"Build RHEL AUSF Image",
"Static Code Analysis",
"Code Formatting Checker"
])
......@@ -82,6 +83,10 @@ pipeline {
JOB_TIMESTAMP = sh returnStdout: true, script: 'date --utc --rfc-3339=seconds | sed -e "s#+00:00##"'
JOB_TIMESTAMP = JOB_TIMESTAMP.trim()
if (params.RhelOcCredentials == null) {
echo '\u26D4 \u001B[31mNo Credentials to connect to Openshift!\u001B[0m'
error "Stopping pipeline!"
}
if (params.DockerHubCredentials == null) {
echo '\u26D4 \u001B[31mNo Credentials to push to DockerHub!\u001B[0m'
error "Stopping pipeline!"
......@@ -152,12 +157,12 @@ pipeline {
if ("MERGE".equals(env.gitlabActionType)) {
dockerBuildOptions = ''
}
sh "docker buildx build ${dockerBuildOptions} --target oai-ausf --tag oai-ausf:${ausf_tag} --file docker/Dockerfile.ausf.ubuntu . > archives/ausf_docker_image_build.log 2>&1"
sh "docker buildx build ${dockerBuildOptions} --target oai-ausf --tag oai-ausf:${ausf_tag} --file docker/Dockerfile.ausf.ubuntu . > archives/ausf_ubuntu_image_build.log 2>&1"
// Putting a place holder to try out on the flattening of image.
// If not satisfactory, we can remove it.
sh "python3 ./ci-scripts/flatten_image.py --tag oai-ausf:${ausf_tag}"
sh "docker image prune --force"
sh "docker image ls | egrep --color=never 'ausf|REPOSITORY' >> archives/ausf_docker_image_build.log"
sh "docker image ls | egrep --color=never 'ausf|REPOSITORY' >> archives/ausf_ubuntu_image_build.log"
// Pushing to local private registry for testing purpose
sh "docker login -u oaicicd -p oaicicd ${PrivateRegistryURL}"
sh "docker image tag oai-ausf:${ausf_tag} ${PrivateRegistryURL}/oai-ausf:${ausf_tag}"
......@@ -171,48 +176,54 @@ pipeline {
}
post {
success {
sh "echo 'OAI-AUSF DOCKER IMAGE BUILD: OK' >> archives/ausf_docker_image_build.log"
sh "echo 'OAI-AUSF UBUNTU IMAGE BUILD: OK' >> archives/ausf_ubuntu_image_build.log"
}
unsuccessful {
sh "echo 'OAI-AUSF DOCKER IMAGE BUILD: KO' >> archives/ausf_docker_image_build.log"
sh "echo 'OAI-AUSF UBUNTU IMAGE BUILD: KO' >> archives/ausf_ubuntu_image_build.log"
}
}
}
stage ('Build RHEL8 AUSF Image') {
stage ('Build RHEL AUSF Image') {
agent { label rhelNode }
steps {
lock (rhelResource) {
script {
gitlabCommitStatus(name: "Build RHEL8 AUSF Image") {
gitlabCommitStatus(name: "Build RHEL AUSF Image") {
// It's a different agent from main one.
prepareWorkspaceMergeCase()
sh "sudo podman image rm oai-ausf:${ausf_tag} || true"
sh "sudo podman image prune --force"
withCredentials([
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${rhelOcCredentials}", usernameVariable: 'OC_Username', passwordVariable: 'OC_Password']
]) {
sh "oc login -u ${OC_Username} -p ${OC_Password}"
}
sh "oc delete istag oai-ausf:${ausf_tag} || true"
// Copy the RHEL Host certificates for building
sh "mkdir -p ./etc-pki-entitlement ./rhsm-conf ./rhsm-ca"
sh "cp /etc/pki/entitlement/*pem ./etc-pki-entitlement"
sh "sudo cp /etc/rhsm/rhsm.conf ./rhsm-conf"
sh "sudo cp /etc/rhsm/ca/*pem ./rhsm-ca"
sh "./ci-scripts/common/python/recreate_entitlement.py"
// Building
sh "sudo podman build --no-cache --squash --target oai-ausf --tag oai-ausf:${ausf_tag} --file docker/Dockerfile.ausf.rhel8 --format docker . > archives/ausf_podman_image_build.log 2>&1"
sh "sudo podman image prune --force"
sh "sudo podman image ls | egrep --color=never 'ausf|REPOSITORY' >> archives/ausf_podman_image_build.log"
sh "oc delete -f openshift/build-config.yaml || true"
sh "sed -i -e 's@oai-ausf:latest@oai-ausf:${ausf_tag}@g' openshift/build-config.yaml"
sh "oc create -f openshift/build-config.yaml"
sh 'oc start-build ausf-build-cfg --from-dir=./ --exclude=""'
// need python to wait for pod ausf-build-cfg-1-build to be Completed or Error
// it fails if it detects error or timeout at 20 minutes
sh "./ci-scripts/common/python/check_build_pod_status.py --pod-name ausf-build-cfg-1-build --log-file archives/ausf_rhel_image_build.log"
sh "oc describe istag oai-ausf:${ausf_tag} | grep 'Image Size:' >> archives/ausf_rhel_image_build.log"
}
}
}
}
post {
success {
sh "echo 'OAI-AUSF PODMAN RHEL8 IMAGE BUILD: OK' >> archives/ausf_podman_image_build.log"
sh "echo 'OAI-AUSF RHEL IMAGE BUILD: OK' >> archives/ausf_rhel_image_build.log"
}
unsuccessful {
sh "echo 'OAI-AUSF PODMAN RHEL8 IMAGE BUILD: KO' >> archives/ausf_podman_image_build.log"
sh "echo 'OAI-AUSF RHEL IMAGE BUILD: KO' >> archives/ausf_rhel_image_build.log"
}
cleanup {
script {
sh "sudo podman image prune --force"
sh "rm -Rf ./etc-pki-entitlement ./rhsm-conf ./rhsm-ca"
stash allowEmpty: true, includes: 'archives/ausf_podman_image_build.log', name: 'podmanBuildLog'
sh "oc delete build ausf-build-cfg-1 || true"
sh "oc logout || true"
stash allowEmpty: true, includes: 'archives/ausf_rhel_image_build.log', name: 'rhelBuildLog'
}
}
}
......@@ -295,7 +306,7 @@ pipeline {
post {
always {
script {
unstash 'podmanBuildLog'
unstash 'rhelBuildLog'
unstash 'cppcheckLogs'
unstash 'formatCheckLogs'
}
......@@ -333,12 +344,11 @@ pipeline {
}
}
}
// Home-made RAN emulator
stage ('NGAP-Tester') {
stage ('Testing with COTS-UE') {
steps {
script {
gitlabCommitStatus(name: "NGAP-Tester") {
localStatus = build job: 'OAI-CN5G-NGAP-Tester',
gitlabCommitStatus(name: "Test with COTS-UE") {
localStatus = build job: 'OAI-CN5G-COTS-UE-Test',
parameters: [
string(name: 'AUSF_TAG', value: String.valueOf(ausf_tag)),
string(name: 'AUSF_BRANCH', value: String.valueOf(ausf_branch))
......@@ -346,9 +356,9 @@ pipeline {
localResult = localStatus.getResult()
if (localStatus.resultIsBetterOrEqualTo('SUCCESS')) {
echo "NGAP-Tester is OK"
echo "Test Job with COTS-UE is OK"
} else {
error "NGAP-Tester is is KO"
error "Test Job with COTS-UE is is KO"
}
}
}
......@@ -356,13 +366,43 @@ pipeline {
post {
always {
script {
copyArtifacts(projectName: 'OAI-CN5G-NGAP-Tester',
copyArtifacts(projectName: 'OAI-CN5G-COTS-UE-Test',
filter: '*_results_oai_cn5g*.html',
selector: lastCompleted())
}
}
}
}
// Home-made RAN emulator
stage ('Robot-Test') {
steps {
script {
gitlabCommitStatus(name: "Robot-Test") {
localStatus = build job: 'OAI-CN5G-RobotTest',
parameters: [
string(name: 'AUSF_TAG', value: String.valueOf(ausf_tag)),
string(name: 'AUSF_BRANCH', value: String.valueOf(ausf_branch))
], propagate: false
localResult = localStatus.getResult()
if (localStatus.resultIsBetterOrEqualTo('SUCCESS')) {
echo "Robot-Test is OK"
} else {
error "Robot-Test is is KO"
}
}
}
}
post {
always {
script {
copyArtifacts(projectName: 'OAI-CN5G-RobotTest',
filter: '*.html',
selector: lastCompleted())
}
}
}
}
}
}
// We are only publishing the Ubuntu image to Docker-Hub
......
Subproject commit a5a3d12c62ae2497458fd6e1495fc4c8854f79b0
Subproject commit 3b119a93f7009d09036466f97f4f50e2738baae2
......@@ -58,7 +58,7 @@ class HtmlReport():
with open(os.path.join(cwd, REPORT_NAME), 'w') as wfile:
wfile.write(generate_header(args))
wfile.write(generate_git_info(args))
wfile.write(build_summary(args, 'ausf', '20', '8'))
wfile.write(build_summary(args, 'ausf', '22', '9'))
wfile.write(coding_formatting_log_check(args))
wfile.write(analyze_sca_log_check())
wfile.write(generate_footer())
......@@ -67,15 +67,23 @@ class HtmlReport():
gitInfo = generate_git_info(args)
cwd = os.getcwd()
for reportFile in os.listdir(cwd):
if reportFile.endswith('.html') and re.search('results_oai_cn5g_', reportFile) is not None:
if reportFile.endswith('.html') and (re.search('results_oai_cn5g_', reportFile) is not None or re.search('test_results_robot_', reportFile) is not None):
newFile = ''
robotBuildUrl = ''
gitInfoAppended = False
with open(os.path.join(cwd, reportFile), 'r') as rfile:
for line in rfile:
if re.search('<h2>', line) is not None and not gitInfoAppended:
gitInfoAppended = True
newFile += gitInfo
newFile += line
if re.search('OAI-CN5G-RobotTest -- Build-ID', line) is not None:
result = re.search('href="(?P<build_url>[a-zA-Z0-9\-\:\/\.]+)"', line)
if result is not None:
robotBuildUrl = result.group('build_url')
if re.search('archives/log.html', line) is not None:
newFile += re.sub('archives', f'{robotBuildUrl}/artifact/archives', line)
else:
newFile += line
with open(os.path.join(cwd, reportFile), 'w') as wfile:
wfile.write(newFile)
......
......@@ -21,7 +21,7 @@
#---------------------------------------------------------------------
#
# Dockerfile for the Open-Air-Interface AUSF service
# Valid for UBI 8.6 | RHEL 8.6
# Valid for UBI 9.x | RHEL 9.x
#
#---------------------------------------------------------------------
......@@ -29,7 +29,7 @@
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM registry.access.redhat.com/ubi8/ubi:latest AS oai-ausf-builder
FROM registry.access.redhat.com/ubi9/ubi:latest AS oai-ausf-builder
ENV IS_DOCKERFILE=1
......@@ -41,11 +41,11 @@ COPY ./rhsm-conf /etc/rhsm
COPY ./rhsm-ca /etc/rhsm/ca
RUN rm -f /etc/rhsm-host && \
yum repolist --disablerepo=* && \
subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms && \
yum update -y && \
subscription-manager repos --enable codeready-builder-for-rhel-9-x86_64-rpms && \
dnf update -y && \
# here just to display the current version
cat /etc/os-release && \
yum install -y \
dnf install -y \
psmisc \
git \
diffutils \
......@@ -78,7 +78,7 @@ FROM mikefarah/yq:latest as yq-source
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest as oai-ausf
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest as oai-ausf
ENV TZ=Europe/Paris
# We install some debug tools for the moment in addition of mandatory libraries
......@@ -104,8 +104,7 @@ RUN rm -f /etc/rhsm-host && \
libicu \
boost \
libevent \
findutils \
libconfig && \
findutils && \
microdnf clean all -y && \
rm -rf /var/cache/yum /var/cache/dnf && \
# Remove entitlements and Subscription Manager configs
......@@ -128,6 +127,7 @@ COPY --from=oai-ausf-builder \
/usr/local/lib64/libspdlog.so \
/usr/local/lib64/libfmt.so \
/usr/local/lib64/libyaml-cpp.so.0.* \
/usr/local/lib64/libcpr.so.1 \
/usr/lib64/
RUN ldconfig && \
......@@ -135,7 +135,6 @@ RUN ldconfig && \
WORKDIR /openair-ausf/etc
COPY --from=oai-ausf-builder \
/openair-ausf/etc/ausf.conf \
/openair-ausf/etc/config.yaml ./
WORKDIR /openair-ausf
......
......@@ -21,7 +21,7 @@
#---------------------------------------------------------------------
#
# Dockerfile for the Open-Air-Interface AUSF service
# Valid for Rocky Linux 8.7+
# Valid for Rocky Linux 9.+
#
#---------------------------------------------------------------------
......@@ -29,12 +29,11 @@
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM docker.io/rockylinux:8 AS oai-ausf-builder
FROM docker.io/rockylinux:9 AS oai-ausf-builder
ENV IS_DOCKERFILE=1
RUN dnf install 'dnf-command(config-manager)' -y && \
dnf config-manager --set-enabled powertools && \
dnf install epel-release -y && crb enable && \
dnf update -y && \
# here just to display the current version
......@@ -62,16 +61,14 @@ WORKDIR /openair-ausf/build/scripts
RUN ./build_ausf --install-deps --force
RUN ./build_ausf --clean --Verbose --build-type Release --jobs && \
ldd /openair-ausf/build/ausf/build/ausf && \
mv /openair-ausf/build/ausf/build/ausf /openair-ausf/build/ausf/build/oai_ausf && \
sed -i -e "s@nf-root-folder@ausf@" -e "s@nf-config-file@ausf.conf@" \
../common-build/docker-scripts/entrypoint.py
mv /openair-ausf/build/ausf/build/ausf /openair-ausf/build/ausf/build/oai_ausf
FROM mikefarah/yq:latest as yq-source
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM docker.io/rockylinux:8-minimal as oai-ausf
FROM docker.io/rockylinux:9-minimal as oai-ausf
ENV TZ=Europe/Paris
# We install some debug tools for the moment in addition of mandatory libraries
......@@ -89,8 +86,7 @@ RUN microdnf update -y && \
libicu \
boost \
libevent \
findutils \
libconfig && \
findutils && \
microdnf clean all -y && \
rm -rf /var/cache/yum /var/cache/dnf
......@@ -109,17 +105,15 @@ COPY --from=oai-ausf-builder \
/usr/local/lib/libnghttp2_asio.so.1 \
/usr/local/lib64/libspdlog.so \
/usr/local/lib64/libfmt.so \
/usr/local/lib64/libyaml-cpp.so.0.* \
/usr/local/lib64/libyaml-cpp.so.0.* \
/usr/local/lib64/libcpr.so.1 \
/usr/lib64/
RUN ldconfig && \
ldd /openair-ausf/bin/oai_ausf
WORKDIR /openair-ausf/etc
COPY --from=oai-ausf-builder /openair-ausf/etc/ausf.conf .
COPY --from=oai-ausf-builder \
/openair-ausf/etc/ausf.conf \
/openair-ausf/etc/config.yaml ./
WORKDIR /openair-ausf
......
......@@ -93,7 +93,6 @@ RUN apt-get update && \
# Ubuntu 20 --> libasan5
# Ubuntu 22 --> libasan6
# libasan? \
libconfig++9v5 \
# Ubuntu 20 --> libnettle7
# Ubuntu 22 --> libnettle8
libnettle? \
......@@ -108,9 +107,6 @@ RUN apt-get update && \
libcurl?-gnutls \
librtmp1 \
libpsl5 \
# Ubuntu 20 --> boost71
# Ubuntu 22 --> boost74
libboost-thread1.7?.0 \
&& rm -rf /var/lib/apt/lists/*
# Copying executable and generated libraries
......@@ -128,6 +124,7 @@ COPY --from=oai-ausf-builder \
/usr/local/lib/libpistache.so \
/usr/local/lib/libfmt.so \
/usr/local/lib/libyaml-cpp.so.0.? \
/usr/local/lib/libcpr.so.1 \
/usr/local/lib/
RUN ldconfig && \
......@@ -135,7 +132,6 @@ RUN ldconfig && \
WORKDIR /openair-ausf/etc
COPY --from=oai-ausf-builder \
/openair-ausf/etc/ausf.conf \
/openair-ausf/etc/config.yaml ./
WORKDIR /openair-ausf
......
################################################################################
# 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
################################################################################
#### This file is a jinja2 template all the values between double curly brace will be replaced with environment variables
## AUSF configuration file
AUSF =
{
INSTANCE_ID = {{ env["INSTANCE_ID"] if "INSTANCE_ID" in env.keys() else '0' }};
PID_DIRECTORY = "{{ env ["PID_DIR"] if "PID_DIR" in env.keys() else '/var/run' }}";
AUSF_NAME = "{{ env["AUSF_NAME"] }}";
LOG_LEVEL = "{{ env["LOG_LEVEL"] if "LOG_LEVEL" in env.keys() else 'debug' }}";
INTERFACES:{
# AUSF binded interface for SBI interface (e.g., communication with AMF, UDM)
SBI:{
INTERFACE_NAME = "{{ env["SBI_IF_NAME"] }}";
IPV4_ADDRESS = "read";
# YOUR NETWORK CONFIG HERE (default: 80)
PORT = {{ env["SBI_PORT"] if "SBI_PORT" in env.keys() else '80' }};
# YOUR API VERSION FOR UDM CONFIG HERE (default: v1)
API_VERSION = "{{ env["SBI_API_VERSION"] if "SBI_API_VERSION" in env.keys() else 'v1' }}";
# YOUR NETWORK CONFIG HERE (default: 8080)
HTTP2_PORT = {{ env["SBI_HTTP2_PORT"] if "SBI_HTTP2_PORT" in env.keys() else '8080' }};
};
};
# SUPPORT FEATURES
SUPPORT_FEATURES:{
# STRING, {"yes", "no"},
# Set to yes if AUSF will relying on a DNS to resolve UDM's FQDN
USE_FQDN_DNS = "{{ env["USE_FQDN_DNS"] if "USE_FQDN_DNS" in env.keys() else 'no' }}";
# Set to yes to enable HTTP2 for AMF server
USE_HTTP2 = "{{ env["USE_HTTP2"] if "USE_HTTP2" in env.keys() else 'no' }}";
# Set to 'yes' if AUSF resgisters to an NRF
REGISTER_NRF = "{{ env["REGISTER_NRF"] if "REGISTER_NRF" in env.keys() else 'no' }}";
}
# UDM Information
UDM:{
{%- if env["UDM_HOSTNAME"] is defined %}
IPV4_ADDRESS = "{{ resolve(env["UDM_HOSTNAME"]) }}";
{%- else %}
IPV4_ADDRESS = "{{ env["UDM_IP_ADDRESS"] if "UDM_IP_ADDRESS" in env.keys() else '0.0.0.0' }}";
{%- endif %}
# YOUR NETWORK CONFIG HERE (default: 80)
PORT = {{ env["UDM_PORT"] if "UDM_PORT" in env.keys() else '80' }};
# YOUR API VERSION FOR UDM CONFIG HERE
API_VERSION = "{{ env["UDM_VERSION_NB"] if "UDM_VERSION_NB" in env.keys() else 'v1' }}";
# YOUR UDM FQDN CONFIG HERE
FQDN = "{{ env["UDM_FQDN"] if "UDM_FQDN" in env.keys() else 'localhost' }}"
};
NRF :
{
{%- if env["NRF_HOSTNAME"] is defined %}
IPV4_ADDRESS = "{{ resolve(env["NRF_HOSTNAME"]) }}";
{%- else %}
IPV4_ADDRESS = "{{ env["NRF_IPV4_ADDRESS"] if "NRF_IPV4_ADDRESS" in env.keys() else '0.0.0.0' }}";
{%- endif %}
# YOUR NRF CONFIG HERE (default: 80)
PORT = {{ env["NRF_PORT"] if "NRF_PORT" in env.keys() else '80' }};
# YOUR NRF API VERSION HERE
API_VERSION = "{{ env["NRF_API_VERSION"] if "NRF_API_VERSION" in env.keys() else 'v1' }}";
FQDN = "{{ env["NRF_FQDN"] if "NRF_FQDN" in env.keys() else 'localhost' }}";
};
};
################################################################################
# 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.
......@@ -7,40 +6,41 @@
# except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.openairinterface.org/?page_id=698
# 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
################################################################################
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${SRC_TOP_DIR}/common)
include_directories(${SRC_TOP_DIR}/common/unicode)
include_directories(${SRC_TOP_DIR}/nas/common)
include_directories(${SRC_TOP_DIR}/utils)
include_directories(${SRC_TOP_DIR}/utils/bstr)
include_directories(${SRC_TOP_DIR}/${MOUNTED_COMMON}/logger)
set(CN_UTILS_SRC STATIC
${CMAKE_CURRENT_SOURCE_DIR}/bstrlib.c
${CMAKE_CURRENT_SOURCE_DIR}/backtrace.c
${CMAKE_CURRENT_SOURCE_DIR}/conversions.c
${CMAKE_CURRENT_SOURCE_DIR}/dynamic_memory_check.c
${CMAKE_CURRENT_SOURCE_DIR}/hex_string_convert.cpp
${CMAKE_CURRENT_SOURCE_DIR}/http_multi_parser.cpp
${CMAKE_CURRENT_SOURCE_DIR}/if.cpp
${CMAKE_CURRENT_SOURCE_DIR}/string.cpp
${CMAKE_CURRENT_SOURCE_DIR}/pid_file.cpp
${CMAKE_CURRENT_SOURCE_DIR}/thread_sched.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mime_parser.cpp
${CMAKE_CURRENT_SOURCE_DIR}/fqdn.cpp
)
add_library(CN_UTILS ${CN_UTILS_SRC})
# contact@openairinterface.org
# ---------------------------------------------------------------------
#
kind: BuildConfig
apiVersion: build.openshift.io/v1
metadata:
name: "ausf-build-cfg"
spec:
runPolicy: "Serial"
source:
type: "Binary"
secrets:
- secret:
name: etc-pki-entitlement
destinationDir: etc-pki-entitlement
configMaps:
- configMap:
name: rhsm-conf
destinationDir: rhsm-conf
- configMap:
name: rhsm-ca
destinationDir: rhsm-ca
strategy:
dockerStrategy:
dockerfilePath: "docker/Dockerfile.ausf.rhel9"
output:
to:
kind: "ImageStreamTag"
name: "oai-ausf:latest"
......@@ -23,13 +23,13 @@ set(5GAKA_DIR "${SRC_TOP_DIR}/5gaka")
include_directories(${SRC_TOP_DIR}/ausf_app)
include_directories(${SRC_TOP_DIR}/common)
include_directories(${SRC_TOP_DIR}/common/utils)
include_directories(${SRC_TOP_DIR}/common/libngap)
include_directories(${SRC_TOP_DIR}/5gaka)
include_directories(${SRC_TOP_DIR}/${MOUNTED_COMMON}/logger)
include_directories(${SRC_TOP_DIR}/${MOUNTED_COMMON}/ngap/libngap)
include_directories(${SRC_TOP_DIR}/${MOUNTED_COMMON}/utils)
file(GLOB 5GAKA_src_files
${SRC_TOP_DIR}/common/libngap/*.c
file(GLOB 5GAKA_src_files
${SRC_TOP_DIR}/${MOUNTED_COMMON}/ngap/libngap/*.c
${5GAKA_DIR}/*.cpp
)
......
......@@ -19,31 +19,20 @@
* contact@openairinterface.org
*/
/*! \file authentication_algorithms_with_5gaka.cpp
\brief
\brief
\author
\company
\date 2020
\email: email: contact@openairinterface.org
*/
#include "authentication_algorithms_with_5gaka.hpp"
#include <arpa/inet.h>
#include <errno.h>
#include <gmp.h>
#include <nettle/hmac.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include "OCTET_STRING.h"
#include "logger.hpp"
#include "output_wrapper.hpp"
#include "sha256.hpp"
#include "comUt.hpp"
random_state_t random_state;
......@@ -238,22 +227,23 @@ void Authentication_5gaka::f5star(
void Authentication_5gaka::ComputeOPc(
const uint8_t kP[16], const uint8_t opP[16], uint8_t opcP[16]) {
uint8_t i;
bool should_log = Logger::should_log(spdlog::level::debug);
RijndaelKeySchedule(kP);
if (should_log) print_buffer("ausf_app", "ComputeOPc kP : ", kP, 16);
oai::utils::output_wrapper::print_buffer(
"ausf_app", "ComputeOPc kP : ", kP, 16);
RijndaelEncrypt(opP, opcP);
if (should_log) {
print_buffer("ausf_app", "ComputeOPc opP : ", opP, 16);
print_buffer("ausf_app", "ComputeOPc opcP : ", opcP, 16);
}
oai::utils::output_wrapper::print_buffer(
"ausf_app", "ComputeOPc opP : ", opP, 16);
oai::utils::output_wrapper::print_buffer(
"ausf_app", "ComputeOPc opcP : ", opcP, 16);
for (i = 0; i < 16; i++) opcP[i] ^= opP[i];
if (should_log) print_buffer("ausf_app", "ComputeOPc opcP : ", opcP, 16);
oai::utils::output_wrapper::print_buffer(
"ausf_app", "ComputeOPc opcP : ", opcP, 16);
return;
}
......@@ -289,15 +279,16 @@ void Authentication_5gaka::derive_kseaf(
OCTET_STRING_fromBuf(
&netName, serving_network.c_str(), serving_network.length());
uint8_t S[100];
bool should_log = Logger::should_log(spdlog::level::debug);
S[0] = 0x6C; // FC
S[0] = 0x6C; // FC
memcpy(&S[1], netName.buf, netName.size);
S[1 + netName.size] = (uint8_t) ((netName.size & 0xff00) >> 8);
S[2 + netName.size] = (uint8_t) (netName.size & 0x00ff);
if (should_log) print_buffer("ausf_app", "derive_kseaf Kausf", kausf, 32);
oai::utils::output_wrapper::print_buffer(
"ausf_app", "derive_kseaf Kausf", kausf, 32);
kdf(kausf, 32, S, 3 + netName.size, kseaf, 32);
if (should_log) print_buffer("ausf_app", "derive_kseaf Kseaf", kseaf, 32);
oai::utils::output_wrapper::print_buffer(
"ausf_app", "derive_kseaf Kseaf", kseaf, 32);
}
//------------------------------------------------------------------------------
......@@ -312,7 +303,6 @@ void Authentication_5gaka::derive_kausf(
uint8_t S[100];
uint8_t key[32];
bool should_log = Logger::should_log(spdlog::level::debug);
memcpy(&key[0], ck, 16);
memcpy(&key[16], ik, 16); // KEY
S[0] = 0x6A;
......@@ -325,9 +315,11 @@ void Authentication_5gaka::derive_kausf(
S[9 + netName.size] = 0x00;
S[10 + netName.size] = 0x06;
if (should_log) print_buffer("ausf_app", "derive_kausf key", key, 32);
oai::utils::output_wrapper::print_buffer(
"ausf_app", "derive_kausf key", key, 32);
kdf(key, 32, S, 11 + netName.size, kausf, 32);
if (should_log) print_buffer("ausf_app", "derive_kausf kausf", kausf, 32);
oai::utils::output_wrapper::print_buffer(
"ausf_app", "derive_kausf kausf", kausf, 32);
}
//------------------------------------------------------------------------------
......@@ -340,8 +332,7 @@ void Authentication_5gaka::derive_kamf(
OCTET_STRING_fromBuf(&supi, ueSupi.c_str(), ueSupi.length());
int supiLen = supi.size;
uint8_t S[100];
bool should_log = Logger::should_log(spdlog::level::debug);
S[0] = 0x6D; // FC = 0x6D
S[0] = 0x6D; // FC = 0x6D
memcpy(&S[1], supi.buf, supiLen);
// memcpy (&S[1+supiLen], &supiLen, 2);
S[1 + supiLen] = (uint8_t) ((supiLen & 0xff00) >> 8);
......@@ -351,9 +342,11 @@ void Authentication_5gaka::derive_kamf(
S[5 + supiLen] = 0x00;
S[6 + supiLen] = 0x02;
if (should_log) print_buffer("ausf_app", "derive_kamf kseaf", kseaf, 32);
oai::utils::output_wrapper::print_buffer(
"ausf_app", "derive_kamf kseaf", kseaf, 32);
kdf(kseaf, 32, S, 7 + supiLen, kamf, 32);
if (should_log) print_buffer("ausf_app", "derive_kamf kamf", kamf, 32);
oai::utils::output_wrapper::print_buffer(
"ausf_app", "derive_kamf kamf", kamf, 32);
}
//------------------------------------------------------------------------------
......@@ -364,7 +357,6 @@ void Authentication_5gaka::derive_knas(
uint8_t S[20];
uint8_t out[32] = {0};
bool should_log = Logger::should_log(spdlog::level::debug);
S[0] = 0x69; // FC
S[1] = (uint8_t) (nas_alg_type & 0xFF);
S[2] = 0x00;
......@@ -373,11 +365,13 @@ void Authentication_5gaka::derive_knas(
S[5] = 0x00;
S[6] = 0x01;
if (should_log) print_buffer("ausf_app", "derive_knas kamf", kamf, 32);
oai::utils::output_wrapper::print_buffer(
"ausf_app", "derive_knas kamf", kamf, 32);
kdf(kamf, 32, S, 7, out, 32);
// memcpy (knas, &out[31 - 16 + 1], 16);
for (int i = 0; i < 16; i++) knas[i] = out[16 + i];
if (should_log) print_buffer("ausf_app", "derive_knas knas", knas, 16);
oai::utils::output_wrapper::print_buffer(
"ausf_app", "derive_knas knas", knas, 16);
// Logger::ausf_app().debug("derive knas finished!");
}
......@@ -386,7 +380,6 @@ void Authentication_5gaka::derive_kgnb(
uint32_t uplinkCount, uint8_t accessType, uint8_t kamf[32], uint8_t* kgnb) {
Logger::ausf_app().debug("derive_kgnb ...");
uint8_t S[20];
bool should_log = Logger::should_log(spdlog::level::debug);
S[0] = 0x6E;
*(uint32_t*) (S + 1) = htonl(uplinkCount);
S[5] = 0x00;
......@@ -395,9 +388,11 @@ void Authentication_5gaka::derive_kgnb(
S[8] = 0x00;
S[9] = 0x01;
if (should_log) print_buffer("ausf_app", "derive_kgnb kamf", kamf, 32);
oai::utils::output_wrapper::print_buffer(
"ausf_app", "derive_kgnb kamf", kamf, 32);
kdf(kamf, 32, S, 10, kgnb, 32);
if (should_log) print_buffer("ausf_app", "derive_kgnb kgnb", kgnb, 32);
oai::utils::output_wrapper::print_buffer(
"ausf_app", "derive_kgnb kgnb", kgnb, 32);
}
//------------------------------------------------------------------------------
......@@ -445,8 +440,7 @@ void Authentication_5gaka::derive_kasme(
int Authentication_5gaka::generate_vector(
const uint8_t opc[16], uint64_t imsi, uint8_t key[16], uint8_t plmn[3],
uint8_t sqn[6], auc_vector_t* vector) {
bool should_log = Logger::should_log(spdlog::level::debug);
uint8_t amf[] = {0x80, 0x00};
uint8_t amf[] = {0x80, 0x00};
uint8_t mac_a[8];
uint8_t ck[16];
uint8_t ik[16];
......@@ -460,30 +454,33 @@ int Authentication_5gaka::generate_vector(
* Compute MAC
*/
f1(opc, key, vector->rand, sqn, amf, mac_a);
if (should_log) {
print_buffer("ausf_app", "generate_vector MAC_A", mac_a, 8);
print_buffer("ausf_app", "generate_vector SQN : ", sqn, 6);
print_buffer("ausf_app", "generate_vector RAND : ", vector->rand, 16);
}
oai::utils::output_wrapper::print_buffer(
"ausf_app", "generate_vector MAC_A", mac_a, 8);
oai::utils::output_wrapper::print_buffer(
"ausf_app", "generate_vector SQN : ", sqn, 6);
oai::utils::output_wrapper::print_buffer(
"ausf_app", "generate_vector RAND : ", vector->rand, 16);
/*
* Compute XRES, CK, IK, AK
*/
f2345(opc, key, vector->rand, vector->xres, ck, ik, ak);
if (should_log) {
print_buffer("ausf_app", "generate_vector AK : ", ak, 6);
print_buffer("ausf_app", "generate_vector CK : ", ck, 16);
print_buffer("ausf_app", "generate_vector IK : ", ik, 16);
print_buffer("ausf_app", "generate_vector XRES : ", vector->xres, 8);
}
oai::utils::output_wrapper::print_buffer(
"ausf_app", "generate_vector AK : ", ak, 6);
oai::utils::output_wrapper::print_buffer(
"ausf_app", "generate_vector CK : ", ck, 16);
oai::utils::output_wrapper::print_buffer(
"ausf_app", "generate_vector IK : ", ik, 16);
oai::utils::output_wrapper::print_buffer(
"ausf_app", "generate_vector XRES : ", vector->xres, 8);
/*
* AUTN = SQN ^ AK || AMF || MAC
*/
generate_autn(sqn, ak, amf, mac_a, vector->autn);
if (should_log)
print_buffer("ausf_app", "generate_vector AUTN : ", vector->autn, 16);
oai::utils::output_wrapper::print_buffer(
"ausf_app", "generate_vector AUTN : ", vector->autn, 16);
derive_kasme(ck, ik, plmn, sqn, ak, vector->kasme);
if (should_log)
print_buffer("ausf_app", "generate_vector KASME : ", vector->kasme, 32);
oai::utils::output_wrapper::print_buffer(
"ausf_app", "generate_vector KASME : ", vector->kasme, 32);
return 0;
}
......@@ -502,7 +499,6 @@ uint8_t* Authentication_5gaka::sqn_ms_derive(
uint8_t* sqn_ms = NULL;
uint8_t amf[2] = {0, 0};
int i = 0;
bool should_log = Logger::should_log(spdlog::level::debug);
conc_sqn_ms = auts;
mac_s = &auts[6];
......@@ -521,19 +517,22 @@ uint8_t* Authentication_5gaka::sqn_ms_derive(
sqn_ms[i] = ak[i] ^ conc_sqn_ms[i];
}
if (should_log) {
print_buffer("ausf_app", "sqn_ms_derive() KEY : ", key, 16);
print_buffer("ausf_app", "sqn_ms_derive() RAND : ", rand_p, 16);
print_buffer("ausf_app", "sqn_ms_derive() AUTS : ", auts, 14);
print_buffer("ausf_app", "sqn_ms_derive() AK : ", ak, 6);
print_buffer("ausf_app", "sqn_ms_derive() SQN_MS : ", sqn_ms, 6);
print_buffer("ausf_app", "sqn_ms_derive() MAC_S : ", mac_s, 8);
}
oai::utils::output_wrapper::print_buffer(
"ausf_app", "sqn_ms_derive() KEY : ", key, 16);
oai::utils::output_wrapper::print_buffer(
"ausf_app", "sqn_ms_derive() RAND : ", rand_p, 16);
oai::utils::output_wrapper::print_buffer(
"ausf_app", "sqn_ms_derive() AUTS : ", auts, 14);
oai::utils::output_wrapper::print_buffer(
"ausf_app", "sqn_ms_derive() AK : ", ak, 6);
oai::utils::output_wrapper::print_buffer(
"ausf_app", "sqn_ms_derive() SQN_MS : ", sqn_ms, 6);
oai::utils::output_wrapper::print_buffer(
"ausf_app", "sqn_ms_derive() MAC_S : ", mac_s, 8);
f1star(opc, key, rand_p, sqn_ms, amf, mac_s_computed);
if (should_log) {
print_buffer("ausf_app", "MAC_S +: ", mac_s_computed, 8);
}
oai::utils::output_wrapper::print_buffer(
"ausf_app", "MAC_S +: ", mac_s_computed, 8);
if (memcmp(mac_s_computed, mac_s, 8) != 0) {
Logger::ausf_app().warn("Failed to verify computed SQN_MS");
......@@ -588,8 +587,7 @@ void Authentication_5gaka::annex_a_4_33501(
uint8_t out[32];
Authentication_5gaka::kdf(key, 32, S, 31 + netName.size, out, 32);
for (int i = 0; i < 16; i++) output[i] = out[16 + i];
if (Logger::should_log(spdlog::level::debug))
print_buffer("udm_ueau", "XRES*(new)", out, 32);
oai::utils::output_wrapper::print_buffer("udm_ueau", "XRES*(new)", out, 32);
}
//------------------------------------------------------------------------------
......
......@@ -19,19 +19,9 @@
* contact@openairinterface.org
*/
/*! \file authentication_algorithms_with_5gaka.hpp
\brief
\brief
\author
\company
\date 2020
\email: email: contact@openairinterface.org
*/
#ifndef _5GAKA_H_
#define _5GAKA_H_
// extern "C"{
#include <gmp.h>
#include <pthread.h>
#include <stdint.h>
......@@ -39,7 +29,6 @@
#include <unistd.h>
#include <string>
//}
#define SQN_LENGTH_BITS (48)
#define SQN_LENGTH_OCTEST (SQN_LENGTH_BITS / 8)
......
......@@ -19,15 +19,6 @@
* contact@openairinterface.org
*/
/*! \file rijndael.cpp
\brief
\brief
\author
\company
\date 2020
\email: email: contact@openairinterface.org
*/
#include "authentication_algorithms_with_5gaka.hpp"
typedef uint8_t u8;
......
......@@ -19,14 +19,6 @@
* contact@openairinterface.org
*/
/*! \file sha256.cpp
\brief
\author
\company
\date 2020
\email: email: contact@openairinterface.org
*/
#include "sha256.hpp"
#include <cstring>
......
......@@ -19,14 +19,6 @@
* contact@openairinterface.org
*/
/*! \file sha256.hpp
\brief
\author
\company
\date 2020
\email: email: contact@openairinterface.org
*/
#ifndef Sha256_H
#define Sha256_H
#include <string>
......
......@@ -27,17 +27,19 @@ include_directories(${AUSF_API_SERVER_DIR}/model)
include_directories(${AUSF_API_SERVER_DIR}/)
include_directories(${SRC_TOP_DIR}/ausf_app)
include_directories(${SRC_TOP_DIR}/common)
include_directories(${SRC_TOP_DIR}/common/utils)
include_directories(${SRC_TOP_DIR}/common/libngap)
include_directories(${SRC_TOP_DIR}/5gaka)
include_directories(${SRC_TOP_DIR}/${MOUNTED_COMMON}/common)
include_directories(${SRC_TOP_DIR}/${MOUNTED_COMMON}/http)
include_directories(${SRC_TOP_DIR}/${MOUNTED_COMMON}/logger)
include_directories(${SRC_TOP_DIR}/${MOUNTED_COMMON}/utils)
include_directories(${SRC_TOP_DIR}/${MOUNTED_COMMON}/utils/bstr)
include_directories(${SRC_TOP_DIR}/${MOUNTED_COMMON}/model/common_model)
include(${BUILD_TOP_DIR}/ausf/used_models.cmake)
include(${SRC_TOP_DIR}/${MOUNTED_COMMON}/model/ausf/ausf.cmake)
file(GLOB AUSF_API_SERVER_src_files
${AUSF_API_SERVER_DIR}/ausf-api-server.cpp
${AUSF_API_SERVER_DIR}/ausf_http2-server.cpp
${AUSF_API_SERVER_DIR}/model/*.cpp
${AUSF_API_SERVER_DIR}/api/*.cpp
${AUSF_API_SERVER_DIR}/impl/*.cpp
)
......
......@@ -43,7 +43,7 @@ namespace ausf_server {
namespace api {
using namespace oai::model::common::helpers;
using namespace oai::ausf_server::model;
using namespace oai::model::ausf;
DefaultApi::DefaultApi(std::shared_ptr<Pistache::Rest::Router> rtr) {
router = rtr;
......