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-nssf
  • river/oai-cn5g-nssf
  • oai/cn5g/oai-cn5g-nssf
3 results
Show changes
Commits on Source (21)
Showing
with 155 additions and 110 deletions
# RELEASE NOTES: #
## v2.1.0 -- August 2024 ##
* Features
* Fixes
- Fix HTTP/2 server shutdown
* Tech Debt
- Stopping support for RHEL8/Rocky8 in favor of RHEL9/Rocky9
- Move NSSF SBI models to common src git submodule
## v2.0.0 -- December 2023 ##
* Features
......
Subproject commit 1658381e06a477c79d34508f10610e54ff1e62ef
Subproject commit 0968c25ea2414dac69181dc57a23ee17848c3111
################################################################################
# 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 used to specify the common models and utils this library is using
## DO NOT JUST COPY THIS FILE FROM OTHER NFs. The reasoning behind this is to only compile used files to optimize
## build speed
include(${SRC_TOP_DIR}/${MOUNTED_COMMON}/model/common_model/common_model.cmake)
# Add common model dependencies from UDR API model
list(APPEND USED_COMMON_MODEL_SRC_FILES
${COMMON_MODEL_DIR}/AccessTokenErr.cpp
${COMMON_MODEL_DIR}/AccessTokenReq.cpp
${COMMON_MODEL_DIR}/ExtSnssai.cpp
${COMMON_MODEL_DIR}/Helpers.cpp
${COMMON_MODEL_DIR}/InvalidParam.cpp
${COMMON_MODEL_DIR}/NFType.cpp
${COMMON_MODEL_DIR}/NFType_anyOf.cpp
${COMMON_MODEL_DIR}/ProblemDetails.cpp
${COMMON_MODEL_DIR}/PatchItem.cpp
${COMMON_MODEL_DIR}/PatchOperation.cpp
${COMMON_MODEL_DIR}/PatchOperation_anyOf.cpp
${COMMON_MODEL_DIR}/PlmnIdNid.cpp
${COMMON_MODEL_DIR}/SdRange.cpp
)
# we also use NRF models
include(${SRC_TOP_DIR}/${MOUNTED_COMMON}/model/nrf/nrf_model.cmake)
# finally, we have to include common_model.cmake (has to be last
include(${SRC_TOP_DIR}/${MOUNTED_COMMON}/model/common_model/common_model.cmake)
......@@ -133,7 +133,6 @@ check_install_nssf_deps() {
check \
nettle-devel \
libcurl-devel \
python2 \
pkgconfig \
ninja-build \
boost-devel \
......
......@@ -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 NSSF Image",
"Build RHEL8 NSSF Image",
"Build RHEL NSSF 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-nssf --tag oai-nssf:${nssf_tag} --file docker/Dockerfile.nssf.ubuntu . > archives/nssf_docker_image_build.log 2>&1"
sh "docker buildx build ${dockerBuildOptions} --target oai-nssf --tag oai-nssf:${nssf_tag} --file docker/Dockerfile.nssf.ubuntu . > archives/nssf_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-nssf:${nssf_tag}"
sh "docker image prune --force"
sh "docker image ls | egrep --color=never 'nssf|REPOSITORY' >> archives/nssf_docker_image_build.log"
sh "docker image ls | egrep --color=never 'nssf|REPOSITORY' >> archives/nssf_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-nssf:${nssf_tag} ${PrivateRegistryURL}/oai-nssf:${nssf_tag}"
......@@ -171,48 +176,54 @@ pipeline {
}
post {
success {
sh "echo 'OAI-NSSF DOCKER IMAGE BUILD: OK' >> archives/nssf_docker_image_build.log"
sh "echo 'OAI-NSSF UBUNTU IMAGE BUILD: OK' >> archives/nssf_ubuntu_image_build.log"
}
unsuccessful {
sh "echo 'OAI-NSSF DOCKER IMAGE BUILD: KO' >> archives/nssf_docker_image_build.log"
sh "echo 'OAI-NSSF UBUNTU IMAGE BUILD: KO' >> archives/nssf_ubuntu_image_build.log"
}
}
}
stage ('Build RHEL8 NSSF Image') {
stage ('Build RHEL NSSF Image') {
agent { label rhelNode }
steps {
lock (rhelResource) {
script {
gitlabCommitStatus(name: "Build RHEL8 NSSF Image") {
gitlabCommitStatus(name: "Build RHEL NSSF Image") {
// It's a different agent from main one.
prepareWorkspaceMergeCase()
sh "sudo podman image rm oai-nssf:${nssf_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-nssf:${nssf_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-nssf --tag oai-nssf:${nssf_tag} --file docker/Dockerfile.nssf.rhel8 --format docker . > archives/nssf_podman_image_build.log 2>&1"
sh "sudo podman image prune --force"
sh "sudo podman image ls | egrep --color=never 'nssf|REPOSITORY' >> archives/nssf_podman_image_build.log"
sh "oc delete -f openshift/build-config.yaml || true"
sh "sed -i -e 's@oai-nssf:latest@oai-nssf:${nssf_tag}@g' openshift/build-config.yaml"
sh "oc create -f openshift/build-config.yaml"
sh 'oc start-build nssf-build-cfg --from-dir=./ --exclude=""'
// need python to wait for pod nssf-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 nssf-build-cfg-1-build --log-file archives/nssf_rhel_image_build.log"
sh "oc describe istag oai-nssf:${nssf_tag} | grep 'Image Size:' >> archives/nssf_rhel_image_build.log"
}
}
}
}
post {
success {
sh "echo 'OAI-NSSF PODMAN RHEL8 IMAGE BUILD: OK' >> archives/nssf_podman_image_build.log"
sh "echo 'OAI-NSSF RHEL IMAGE BUILD: OK' >> archives/nssf_rhel_image_build.log"
}
unsuccessful {
sh "echo 'OAI-NSSF PODMAN RHEL8 IMAGE BUILD: KO' >> archives/nssf_podman_image_build.log"
sh "echo 'OAI-NSSF RHEL IMAGE BUILD: KO' >> archives/nssf_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/nssf_podman_image_build.log', name: 'podmanBuildLog'
sh "oc delete build nssf-build-cfg-1 || true"
sh "oc logout || true"
stash allowEmpty: true, includes: 'archives/nssf_rhel_image_build.log', name: 'rhelBuildLog'
}
}
}
......@@ -295,7 +306,7 @@ pipeline {
post {
always {
script {
unstash 'podmanBuildLog'
unstash 'rhelBuildLog'
unstash 'cppcheckLogs'
unstash 'formatCheckLogs'
}
......
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, 'nssf', '20', '8'))
wfile.write(build_summary(args, 'nssf', '22', '9'))
wfile.write(coding_formatting_log_check(args))
wfile.write(analyze_sca_log_check())
wfile.write(generate_footer())
......
......@@ -21,14 +21,14 @@
#---------------------------------------------------------------------
#
# Dockerfile for the Open-Air-Interface NSSF service
# Valid for UBI 8.6 | RHEL 8.6
# Valid for UBI 9.x | RHEL 9.x
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM registry.access.redhat.com/ubi8/ubi:latest AS oai-nssf-builder
FROM registry.access.redhat.com/ubi9/ubi:latest AS oai-nssf-builder
ENV IS_DOCKERFILE=1
......@@ -40,11 +40,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-nssf
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest as oai-nssf
ENV TZ=Europe/Paris
# Copy the entitlements
......
......@@ -21,19 +21,18 @@
#---------------------------------------------------------------------
#
# Dockerfile for the Open-Air-Interface NSSF service
# Valid for Rocky Linux 8.7+
# Valid for Rocky Linux 9.+
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM docker.io/rockylinux:8 AS oai-nssf-builder
FROM docker.io/rockylinux:9 AS oai-nssf-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
......@@ -69,7 +68,7 @@ FROM mikefarah/yq:latest as yq-source
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM docker.io/rockylinux:8-minimal as oai-nssf
FROM docker.io/rockylinux:9-minimal as oai-nssf
ENV TZ=Europe/Paris
# We install some debug tools for the moment in addition of mandatory libraries
......
################################################################################
# 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,35 +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/msg)
include_directories(${SRC_TOP_DIR}/common/utils)
include_directories(${SRC_TOP_DIR}/itti)
include_directories(${SRC_TOP_DIR}/nssf_app)
include_directories(${SRC_TOP_DIR}/api-server/model)
include_directories(${SRC_TOP_DIR}/${MOUNTED_COMMON}/logger)
set(CN_UTILS_SRC STATIC
${CMAKE_CURRENT_SOURCE_DIR}/conversions.cpp
${CMAKE_CURRENT_SOURCE_DIR}/get_gateway_netlink.cpp
${CMAKE_CURRENT_SOURCE_DIR}/if.cpp
${CMAKE_CURRENT_SOURCE_DIR}/pid_file.cpp
${CMAKE_CURRENT_SOURCE_DIR}/string.cpp
)
add_library(CN_UTILS ${CN_UTILS_SRC})
# contact@openairinterface.org
# ---------------------------------------------------------------------
#
kind: BuildConfig
apiVersion: build.openshift.io/v1
metadata:
name: "nssf-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.nssf.rhel9"
output:
to:
kind: "ImageStreamTag"
name: "oai-nssf:latest"
# CODEOWNERS
- Rohan KHARADE, OSA
- Tien Thinh NGUYEN, Eurecom
- Raphael DEFOSSEUX, OSA
- Stefan Spettel, phine.tech
\ No newline at end of file
......@@ -23,20 +23,21 @@ set(NSSF_API_SERVER_DIR "${SRC_TOP_DIR}/api-server")
include_directories(${NSSF_API_SERVER_DIR}/api)
include_directories(${NSSF_API_SERVER_DIR}/impl)
include_directories(${NSSF_API_SERVER_DIR}/model)
include_directories(${NSSF_API_SERVER_DIR}/)
include_directories(${SRC_TOP_DIR}/nssf_app)
include_directories(${SRC_TOP_DIR}/common)
include_directories(${SRC_TOP_DIR}/common/utils)
include_directories(${SRC_TOP_DIR}/${MOUNTED_COMMON}/config)
include_directories(${SRC_TOP_DIR}/${MOUNTED_COMMON}/common)
include_directories(${SRC_TOP_DIR}/${MOUNTED_COMMON}/logger)
include(${SRC_TOP_DIR}/${MOUNTED_COMMON}/config/config.cmake)
include(${SRC_TOP_DIR}/${MOUNTED_COMMON}/model/common_model/common_model.cmake)
include(${SRC_TOP_DIR}/${MOUNTED_COMMON}/model/nrf/nrf_model.cmake)
include_directories(${SRC_TOP_DIR}/${MOUNTED_COMMON}/model/nssf)
include_directories(${SRC_TOP_DIR}/${MOUNTED_COMMON}/utils)
include_directories(${SRC_TOP_DIR}/${MOUNTED_COMMON}/utils/bstr)
include(${SRC_TOP_DIR}/${MOUNTED_COMMON}/model/nssf/nssf_model.cmake)
file(GLOB NSSF_API_SERVER_src_files
${NSSF_API_SERVER_DIR}/nssf-api-server.cpp
${NSSF_API_SERVER_DIR}/nssf-http2-server.cpp
${NSSF_API_SERVER_DIR}/model/*.cpp
${NSSF_API_SERVER_DIR}/api/*.cpp
${NSSF_API_SERVER_DIR}/impl/*.cpp
)
......
......@@ -12,8 +12,10 @@
*/
#include "NFInstanceIDDocumentApi.h"
#include "Helpers.h"
#include "nssf_config.hpp"
#include "sbi_helper.hpp"
extern std::unique_ptr<oai::config::nssf::nssf_config> nssf_cfg;
......@@ -23,8 +25,10 @@ namespace api {
using namespace oai::model::common::helpers;
using namespace oai::nssf_server::model;
using namespace oai::common::sbi;
const std::string NFInstanceIDDocumentApi::base = "/nnssf-nssaiavailability/";
const std::string NFInstanceIDDocumentApi::base =
sbi_helper::NssfNssaiAvailabilityBase;
NFInstanceIDDocumentApi::NFInstanceIDDocumentApi(
const std::shared_ptr<Pistache::Rest::Router>& rtr)
......
......@@ -12,8 +12,10 @@
*/
#include "NSSAIAvailabilityStoreApi.h"
#include "Helpers.h"
#include "nssf_config.hpp"
#include "sbi_helper.hpp"
extern std::unique_ptr<oai::config::nssf::nssf_config> nssf_cfg;
......@@ -23,8 +25,10 @@ namespace api {
using namespace oai::model::common::helpers;
using namespace oai::nssf_server::model;
using namespace oai::common::sbi;
const std::string NSSAIAvailabilityStoreApi::base = "/nnssf-nssaiavailability/";
const std::string NSSAIAvailabilityStoreApi::base =
sbi_helper::NssfNssaiAvailabilityBase;
NSSAIAvailabilityStoreApi::NSSAIAvailabilityStoreApi(
const std::shared_ptr<Pistache::Rest::Router>& rtr)
......
......@@ -12,8 +12,10 @@
*/
#include "NetworkSliceInformationDocumentApi.h"
#include "Helpers.h"
#include "nssf_config.hpp"
#include "sbi_helper.hpp"
extern std::unique_ptr<oai::config::nssf::nssf_config> nssf_cfg;
......@@ -24,9 +26,10 @@ namespace api {
using namespace oai::model::common::helpers;
using namespace oai::nssf_server::model;
using namespace oai::model::common;
using namespace oai::common::sbi;
const std::string NetworkSliceInformationDocumentApi::base =
"/nnssf-nsselection/";
sbi_helper::NssfNsSelectionBase;
NetworkSliceInformationDocumentApi::NetworkSliceInformationDocumentApi(
const std::shared_ptr<Pistache::Rest::Router>& rtr)
......@@ -42,7 +45,7 @@ void NetworkSliceInformationDocumentApi::setupRoutes() {
Routes::Get(
*router,
base + nssf_cfg->local().get_sbi().get_api_version() +
"/network-slice-information",
sbi_helper::NssfNsSelectionPathNetworSliceInformation,
Routes::bind(
&NetworkSliceInformationDocumentApi::n_s_selection_get_handler,
this));
......@@ -96,8 +99,8 @@ void NetworkSliceInformationDocumentApi::n_s_selection_get_handler(
nfId = Pistache::Some(valueQuery_instance);
}
}
auto sliceInfoRequestForRegistrationQuery =
request.query().get("slice-info-request-for-registration");
auto sliceInfoRequestForRegistrationQuery = request.query().get(
sbi_helper::NssfNsSelectionParametersSliceInfoRequestForRegistration);
Pistache::Optional<SliceInfoForRegistration>
sliceInfoRequestForRegistration;
if (!sliceInfoRequestForRegistrationQuery.isEmpty()) {
......@@ -200,7 +203,7 @@ bool fromStringValueHelper(
const std::string& inStr,
oai::nssf_server::model::SliceInfoForPDUSession& value) {
Logger::nssf_sbi().info(
" Query_PARAM::SLICE_INFO_PDU_SESSION - %s", inStr.c_str());
" Query_PARAM slice-info-request-for-pdu-session - %s", inStr.c_str());
nlohmann::json::parse(inStr.c_str()).get_to(value);
return true;
}
......@@ -208,7 +211,8 @@ bool fromStringValueHelper(
bool fromStringValueHelper(
const std::string& inStr,
oai::nssf_server::model::SliceInfoForUEConfigurationUpdate& value) {
Logger::nssf_sbi().info(" Query_PARAM::SLICE_INFO_UE_CU - %s", inStr.c_str());
Logger::nssf_sbi().info(
" Query_PARAM slice-info-request-for-registration - %s", inStr.c_str());
nlohmann::json::parse(inStr.c_str()).get_to(value);
return true;
}
......
......@@ -12,8 +12,10 @@
*/
#include "SubscriptionIDDocumentApi.h"
#include "Helpers.h"
#include "nssf_config.hpp"
#include "sbi_helper.hpp"
extern std::unique_ptr<oai::config::nssf::nssf_config> nssf_cfg;
......@@ -23,8 +25,10 @@ namespace api {
using namespace oai::model::common::helpers;
using namespace oai::model::common;
using namespace oai::common::sbi;
const std::string SubscriptionIDDocumentApi::base = "/nnssf-nssaiavailability/";
const std::string SubscriptionIDDocumentApi::base =
sbi_helper::NssfNssaiAvailabilityBase;
SubscriptionIDDocumentApi::SubscriptionIDDocumentApi(
const std::shared_ptr<Pistache::Rest::Router>& rtr)
......@@ -40,13 +44,13 @@ void SubscriptionIDDocumentApi::setupRoutes() {
Routes::Patch(
*router,
base + nssf_cfg->local().get_sbi().get_api_version() +
"/nssai-availability/subscriptions/:subscriptionId",
sbi_helper::NssfNssaiAvailabilityPathSubscriptionId,
Routes::bind(
&SubscriptionIDDocumentApi::
n_ssai_availability_sub_modify_patch_handler,
this));
Routes::Delete(
*router, base + "/nssai-availability/subscriptions/:subscriptionId",
*router, base + sbi_helper::NssfNssaiAvailabilityPathSubscriptionId,
Routes::bind(
&SubscriptionIDDocumentApi::n_ssai_availability_unsubscribe_handler,
this));
......
......@@ -12,8 +12,10 @@
*/
#include "SubscriptionsCollectionApi.h"
#include "Helpers.h"
#include "nssf_config.hpp"
#include "sbi_helper.hpp"
extern std::unique_ptr<oai::config::nssf::nssf_config> nssf_cfg;
......@@ -23,9 +25,11 @@ namespace api {
using namespace oai::model::common::helpers;
using namespace oai::nssf_server::model;
using namespace oai::common::sbi;
const std::string SubscriptionsCollectionApi::base =
"/nnssf-nssaiavailability/";
sbi_helper::NssfNssaiAvailabilityBase;
;
SubscriptionsCollectionApi::SubscriptionsCollectionApi(
const std::shared_ptr<Pistache::Rest::Router>& rtr)
......@@ -41,7 +45,7 @@ void SubscriptionsCollectionApi::setupRoutes() {
Routes::Post(
*router,
base + nssf_cfg->local().get_sbi().get_api_version() +
"/nssai-availability/subscriptions",
sbi_helper::NssfNssaiAvailabilityPathSubscriptions,
Routes::bind(
&SubscriptionsCollectionApi::n_ssai_availability_post_handler, this));
......
......@@ -62,7 +62,7 @@ void NFInstanceIDDocumentApiImpl::n_ssai_availability_put(
nfId, nssaiAvailabilityInfo, auth_nssai_avail_info, http_code, 1,
problem_details);
if (http_code != HTTP_STATUS_CODE_200_OK) {
if (http_code != oai::common::sbi::http_status_code::OK) {
to_json(json_data, problem_details);
content_type = "application/problem+json";
// content type
......
......@@ -63,7 +63,7 @@ void NetworkSliceInformationDocumentApiImpl::n_s_selection_get(
if (!nfType.isEmpty())
nf_type = nfType.get();
else {
http_code = HTTP_STATUS_CODE_400_BAD_REQUEST;
http_code = oai::common::sbi::http_status_code::BAD_REQUEST;
response.send(Pistache::Http::Code(http_code));
Logger::nssf_sbi().error(
"Invalid NF_Type (Valid NF_Type is AMF, NSSF, NWDAP, SMF)");
......@@ -118,7 +118,7 @@ void NetworkSliceInformationDocumentApiImpl::n_s_selection_get(
http_code, 1, problem_details, auth_slice_info);
}
if (http_code != HTTP_STATUS_CODE_200_OK) {
if (http_code != oai::common::sbi::http_status_code::OK) {
to_json(json_data, problem_details);
content_type = "application/problem+json";
// content type
......
......@@ -39,7 +39,7 @@ void NssfSliceConfigApiImpl::nssf_slice_config_get_apis(
nlohmann::json json_data = {};
std::string content_type = "application/json";
nssf_cfg.get_api_list(json_data);
http_code = HTTP_STATUS_CODE_200_OK;
http_code = oai::common::sbi::http_status_code::OK;
response.headers().add<Pistache::Http::Header::ContentType>(
Pistache::Http::Mime::MediaType(content_type));
response.send(Pistache::Http::Code(http_code), json_data.dump(4).c_str());
......@@ -54,13 +54,13 @@ void NssfSliceConfigApiImpl::nssf_slice_config_get(
std::string content_type = "application/json";
// if (nssf_cfg.get_slice_config(json_data)) {
// http_code = HTTP_STATUS_CODE_200_OK;
// http_code = oai::common::sbi::http_status_code::OK;
// response.headers().add<Pistache::Http::Header::ContentType>(
// Pistache::Http::Mime::MediaType(content_type));
// response.send(Pistache::Http::Code(http_code),
// json_data.dump(4).c_str());
// } else {
http_code = HTTP_STATUS_CODE_503_SERVICE_UNAVAILABLE;
http_code = oai::common::sbi::http_status_code::SERVICE_UNAVAILABLE;
response.headers().add<Pistache::Http::Header::ContentType>(
Pistache::Http::Mime::MediaType(content_type));
response.send(Pistache::Http::Code(http_code));
......