Commit 09c7657e authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

First version for allowing SMF to receive notification from NRF

parent fa438400
......@@ -27,112 +27,91 @@
# either expressed or implied, of the FreeBSD Project.
#
---
# see https://clang.llvm.org/docs/ClangFormatStyleOptions.html for explanation
# of style options
BasedOnStyle: Google
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
IndentWidth: 2
ColumnLimit: 80
IncludeBlocks: Preserve
SortIncludes: false
# alignment
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
DerivePointerAlignment: false
PointerAlignment: Left
# function style
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortFunctionsOnASingleLine: Inline
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
IndentWrappedFunctionNames: false
# template style
AlwaysBreakTemplateDeclarations: Yes
# preprocessor style
IndentPPDirectives: None
# block style
AllowShortBlocksOnASingleLine: false
KeepEmptyLinesAtTheStartOfBlocks: false
# break style
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakBeforeTernaryOperators: false
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: true
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeCategories:
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: true
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
# spacing style
UseTab: Never
SpaceAfterCStyleCast: true
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
TabWidth: 8
UseTab: Never
...
# class style
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
# case statements
IndentCaseLabels: true
# cpp
Cpp11BracedListStyle: true
FixNamespaceComments: true
NamespaceIndentation: None
SortUsingDeclarations: true
# todo
# AlwaysBreakBeforeMultilineStrings: bool
# PenaltyBreakAssignment (unsigned)
# PenaltyBreakBeforeFirstCallParameter (unsigned)
# PenaltyBreakComment (unsigned)
# PenaltyBreakFirstLessLess (unsigned)
# PenaltyBreakString (unsigned)
# PenaltyBreakTemplateDeclaration (unsigned)
# PenaltyExcessCharacter (unsigned)
# PenaltyReturnTypeOnItsOwnLine (unsigned)
/**
* Nsmf_EventExposure
* Session Management Event Exposure Service. © 2019, 3GPP Organizational
* Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
#include "NFStatusNotifyApi.h"
#include "Helpers.h"
#include "smf_config.hpp"
extern smf::smf_config smf_cfg;
namespace oai {
namespace smf_server {
namespace api {
using namespace oai::smf_server::helpers;
using namespace oai::smf_server::model;
NFStatusNotifyApi::NFStatusNotifyApi(
std::shared_ptr<Pistache::Rest::Router> rtr) {
router = rtr;
}
void NFStatusNotifyApi::init() {
setupRoutes();
}
void NFStatusNotifyApi::setupRoutes() {
using namespace Pistache::Rest;
Routes::Post(
*router, base + smf_cfg.sbi_api_version + "/subscriptions",
Routes::bind(&NFStatusNotifyApi::notify_nf_status_handler, this));
// Default handler, called when a route is not found
router->addCustomHandler(
Routes::bind(&NFStatusNotifyApi::notify_nf_status_default_handler, this));
}
void NFStatusNotifyApi::notify_nf_status_handler(
const Pistache::Rest::Request& request,
Pistache::Http::ResponseWriter response) {
// Getting the body param
NotificationData notificationData;
try {
nlohmann::json::parse(request.body()).get_to(notificationData);
this->receive_nf_status_notification(notificationData, response);
} catch (nlohmann::detail::exception& e) {
// send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
} catch (Pistache::Http::HttpError& e) {
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
return;
} catch (std::exception& e) {
// send a 500 error
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
return;
}
}
void NFStatusNotifyApi::notify_nf_status_default_handler(
const Pistache::Rest::Request&, Pistache::Http::ResponseWriter response) {
response.send(
Pistache::Http::Code::Not_Found, "The requested method does not exist");
}
} // namespace api
} // namespace smf_server
} // namespace oai
/**
* Nsmf_EventExposure
* Session Management Event Exposure Service. © 2019, 3GPP Organizational
* Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
* NFStatusNotifyApi.h
*
*
*/
#ifndef NFStatusNotifyApi_H_
#define NFStatusNotifyApi_H_
#include <pistache/http.h>
#include <pistache/router.h>
#include <pistache/http_headers.h>
#include <pistache/optional.h>
#include "NotificationData.h"
#include "ProblemDetails.h"
namespace oai {
namespace smf_server {
namespace api {
using namespace oai::smf_server::model;
class NFStatusNotifyApi {
public:
NFStatusNotifyApi(std::shared_ptr<Pistache::Rest::Router>);
virtual ~NFStatusNotifyApi() {}
void init();
const std::string base = "/nsmf_nfstatus_notify/";
private:
void setupRoutes();
void notify_nf_status_handler(
const Pistache::Rest::Request& request,
Pistache::Http::ResponseWriter response);
void notify_nf_status_default_handler(
const Pistache::Rest::Request& request,
Pistache::Http::ResponseWriter response);
std::shared_ptr<Pistache::Rest::Router> router;
/// <summary>
///
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="NotificationData"></param>
virtual void receive_nf_status_notification(
const NotificationData& notificationData,
Pistache::Http::ResponseWriter& response) = 0;
};
} // namespace api
} // namespace smf_server
} // namespace oai
#endif /* NFStatusNotifyApi_H_ */
/**
* Nsmf_EventExposure
* Session Management Event Exposure Service. © 2019, 3GPP Organizational
* Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
#include "NFStatusNotifyApiImpl.h"
#include "logger.hpp"
#include "smf_msg.hpp"
#include "itti_msg_sbi.hpp"
#include "smf_config.hpp"
extern smf::smf_config smf_cfg;
namespace oai {
namespace smf_server {
namespace api {
using namespace oai::smf_server::model;
NFStatusNotifyApiImpl::NFStatusNotifyApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, smf::smf_app* smf_app_inst,
std::string address)
: NFStatusNotifyApi(rtr), m_smf_app(smf_app_inst), m_address(address) {}
void NFStatusNotifyApiImpl::receive_nf_status_notification(
const NotificationData& notificationData,
Pistache::Http::ResponseWriter& response) {
Logger::smf_api_server().info(
"NFStatusNotifyApiImpl, received a NF status notification...");
smf::data_notification_msg notification_msg = {};
notification_msg.set_notification_event_type(notificationData.getEvent());
notification_msg.set_nf_instance_uri(notificationData.getNfInstanceUri());
std::shared_ptr<smf::nf_profile> p = {};
// Only support UPF for now
if (notificationData.getNfProfile().getNfType() == "UPF")
p = std::make_shared<smf::upf_profile>();
nlohmann::json pj = {};
to_json(pj, notificationData);
p.get()->from_json(pj);
notification_msg.set_profile(p);
// Step 2. Handle the message in smf_app
std::shared_ptr<itti_sbi_notification_data> itti_msg =
std::make_shared<itti_sbi_notification_data>(TASK_SMF_N11, TASK_SMF_APP);
itti_msg->notification_msg = notification_msg;
itti_msg->http_version = 1;
ProblemDetails problem_details = {};
uint8_t http_code = 0;
if (m_smf_app->handle_nf_status_notification(
itti_msg, problem_details, http_code)) {
response.send(Pistache::Http::Code(204));
} else {
nlohmann::json json_data = {};
to_json(json_data, problem_details);
// content type
response.headers().add<Pistache::Http::Header::ContentType>(
Pistache::Http::Mime::MediaType("application/problem+json"));
response.send(Pistache::Http::Code(http_code), json_data.dump().c_str());
}
}
} // namespace api
} // namespace smf_server
} // namespace oai
/**
* Nsmf_EventExposure
* Session Management Event Exposure Service. © 2019, 3GPP Organizational
* Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
* NFStatusNotifyApiImpl.h
*
*
*/
#ifndef NF_STATUS_NOTIFY_API_IMPL_H_
#define NF_STATUS_NOTIFY_API_IMPL_H_
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <NFStatusNotifyApi.h>
#include <pistache/optional.h>
#include "NotificationData.h"
#include "ProblemDetails.h"
#include "smf_app.hpp"
namespace oai {
namespace smf_server {
namespace api {
using namespace oai::smf_server::model;
class NFStatusNotifyApiImpl : public oai::smf_server::api::NFStatusNotifyApi {
public:
NFStatusNotifyApiImpl(
std::shared_ptr<Pistache::Rest::Router>, smf::smf_app* smf_app_inst,
std::string address);
~NFStatusNotifyApiImpl() {}
void receive_nf_status_notification(
const NotificationData& notificationData,
Pistache::Http::ResponseWriter& response);
private:
smf::smf_app* m_smf_app;
std::string m_address;
};
} // namespace api
} // namespace smf_server
} // namespace oai
#endif
......@@ -53,10 +53,10 @@ void from_json(const nlohmann::json &j, NotificationData &o) {
}
}
NotificationEventType NotificationData::getEvent() const {
std::string NotificationData::getEvent() const {
return m_Event;
}
void NotificationData::setEvent(NotificationEventType const &value) {
void NotificationData::setEvent(std::string const &value) {
m_Event = value;
}
std::string NotificationData::getNfInstanceUri() const {
......
......@@ -45,8 +45,8 @@ class NotificationData {
/// <summary>
///
/// </summary>
NotificationEventType getEvent() const;
void setEvent(NotificationEventType const &value);
std::string getEvent() const;
void setEvent(std::string const &value);
/// <summary>
///
/// </summary>
......@@ -70,7 +70,7 @@ class NotificationData {
friend void to_json(nlohmann::json &j, const NotificationData &o);
friend void from_json(const nlohmann::json &j, NotificationData &o);
protected:
NotificationEventType m_Event;
std::string m_Event;
std::string m_NfInstanceUri;
......
This diff is collapsed.
......@@ -3,9 +3,9 @@
* 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
* 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
*
......@@ -30,64 +30,64 @@
#define ITTI_MSG_SBI_HPP_INCLUDED_
#include "itti_msg.hpp"
#include "smf_msg.hpp"
#include "pistache/http.h"
#include "smf_msg.hpp"
class itti_sbi_msg : public itti_msg {
public:
itti_sbi_msg(const itti_msg_type_t msg_type, const task_id_t orig,
const task_id_t dest)
:
itti_msg(msg_type, orig, dest) {
}
itti_sbi_msg(const itti_sbi_msg &i)
:
itti_msg(i) {
}
itti_sbi_msg(const itti_sbi_msg &i, const task_id_t orig,
itti_sbi_msg(
const itti_msg_type_t msg_type, const task_id_t orig,
const task_id_t dest)
:
itti_sbi_msg(i) {
: itti_msg(msg_type, orig, dest) {}
itti_sbi_msg(const itti_sbi_msg& i) : itti_msg(i) {}
itti_sbi_msg(
const itti_sbi_msg& i, const task_id_t orig, const task_id_t dest)
: itti_sbi_msg(i) {
origin = orig;
destination = dest;
}
};
//-----------------------------------------------------------------------------
class itti_sbi_event_exposure_request : public itti_sbi_msg {
public:
itti_sbi_event_exposure_request(const task_id_t orig, const task_id_t dest)
:
itti_sbi_msg(SBI_EVENT_EXPOSURE_REQUEST, orig, dest),
: itti_sbi_msg(SBI_EVENT_EXPOSURE_REQUEST, orig, dest),
event_exposure(),
http_version(1) {
}
itti_sbi_event_exposure_request(
const itti_sbi_event_exposure_request &i)
:
itti_sbi_msg(i),
event_exposure(i.event_exposure),
http_version(1) {
}
http_version(1) {}
itti_sbi_event_exposure_request(const itti_sbi_event_exposure_request& i)
: itti_sbi_msg(i), event_exposure(i.event_exposure), http_version(1) {}
itti_sbi_event_exposure_request(
const itti_sbi_event_exposure_request &i, const task_id_t orig,
const itti_sbi_event_exposure_request& i, const task_id_t orig,
const task_id_t dest)
:
itti_sbi_msg(i, orig, dest),
: itti_sbi_msg(i, orig, dest),
event_exposure(i.event_exposure),
http_version(i.http_version) {
}
const char* get_msg_name() {
return "SBI_EVENT_EXPOSURE_REQUEST";
}
;
http_version(i.http_version) {}
const char* get_msg_name() { return "SBI_EVENT_EXPOSURE_REQUEST"; };
smf::event_exposure_msg event_exposure;
uint8_t http_version;
};
//-----------------------------------------------------------------------------
class itti_sbi_notification_data : public itti_sbi_msg {
public:
itti_sbi_notification_data(const task_id_t orig, const task_id_t dest)
: itti_sbi_msg(SBI_NOTIFICATION_DATA, orig, dest),
notification_msg(),
http_version(1) {}
itti_sbi_notification_data(const itti_sbi_notification_data& i)
: itti_sbi_msg(i),
notification_msg(i.notification_msg),
http_version(1) {}
itti_sbi_notification_data(
const itti_sbi_notification_data& i, const task_id_t orig,
const task_id_t dest)
: itti_sbi_msg(i, orig, dest),
notification_msg(i.notification_msg),
http_version(i.http_version) {}
const char* get_msg_name() { return "SBI_NOTIFICATION_DATA"; };
smf::data_notification_msg notification_msg;
uint8_t http_version;
};
#endif /* ITTI_MSG_SBI_HPP_INCLUDED_ */
......@@ -3,9 +3,9 @@
* 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
* 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
*
......@@ -22,9 +22,10 @@
#ifndef FILE_SMF_SEEN
#define FILE_SMF_SEEN
#include"3gpp_29.274.h"
#include"3gpp_29.571.h"
#include"3gpp_24.501.h"
#include "3gpp_29.274.h"
#include "3gpp_29.571.h"
#include "3gpp_24.501.h"
#include <nlohmann/json.hpp>
typedef uint64_t supi64_t;
#define SUPI_64_FMT "%" SCNu64
......@@ -36,8 +37,8 @@ typedef struct {
char data[SUPI_DIGITS_MAX + 1];
} supi_t;
static void smf_string_to_supi(supi_t *const supi, char const *const supi_str) {
//strncpy(supi->data, supi_str, SUPI_DIGITS_MAX + 1);
static void smf_string_to_supi(supi_t* const supi, char const* const supi_str) {
// strncpy(supi->data, supi_str, SUPI_DIGITS_MAX + 1);
memcpy((void*) supi->data, (void*) supi_str, SUPI_DIGITS_MAX + 1);
supi->length = strlen(supi->data);
return;
......@@ -58,25 +59,13 @@ static uint64_t smf_supi_to_u64(supi_t supi) {
typedef struct s_nssai // section 28.4, TS23.003
{
uint8_t sST;
//uint32_t sD:24;
// uint32_t sD:24;
std::string sD;
//s_nssai(const uint8_t& sst, const uint32_t sd) : sST(sst), sD(sd) {}
s_nssai(const uint8_t &sst, const std::string sd)
:
sST(sst),
sD(sd) {
}
s_nssai()
:
sST(),
sD() {
}
s_nssai(const s_nssai &p)
:
sST(p.sST),
sD(p.sD) {
}
bool operator==(const struct s_nssai &s) const {
// s_nssai(const uint8_t& sst, const uint32_t sd) : sST(sst), sD(sd) {}
s_nssai(const uint8_t& sst, const std::string sd) : sST(sst), sD(sd) {}
s_nssai() : sST(), sD() {}
s_nssai(const s_nssai& p) : sST(p.sST), sD(p.sD) {}
bool operator==(const struct s_nssai& s) const {
if ((s.sST == this->sST) && (s.sD.compare(this->sD) == 0)) {
return true;
} else {
......@@ -88,7 +77,7 @@ typedef struct s_nssai // section 28.4, TS23.003
typedef uint8_t pdu_session_id;
//SMF + AMF + 3GPP TS 29.571 (Common data)
// SMF + AMF + 3GPP TS 29.571 (Common data)
enum class http_response_codes_e {
HTTP_RESPONSE_CODE_OK = 200,
HTTP_RESPONSE_CODE_CREATED = 201,
......@@ -116,7 +105,7 @@ enum class http_response_codes_e {
};
//From 23.502
// From 23.502
enum class session_management_procedures_type_e {
PROCEDURE_TYPE_UNKNOWN = 0,
PDU_SESSION_ESTABLISHMENT_UE_REQUESTED = 1,
......@@ -138,7 +127,7 @@ enum class session_management_procedures_type_e {
};
static const std::vector<std::string> session_management_procedures_type_e2str =
{ "PDU_SESSION_ESTABLISHMENT_UE_REQUESTED",
{"PDU_SESSION_ESTABLISHMENT_UE_REQUESTED",
"SERVICE_REQUEST_UE_TRIGGERED_STEP1",
"SERVICE_REQUEST_UE_TRIGGERED_STEP2",
"SERVICE_REQUEST_NETWORK_TRIGGERED",
......@@ -151,64 +140,63 @@ static const std::vector<std::string> session_management_procedures_type_e2str =
"PDU_SESSION_RELEASE_UE_REQUESTED_STEP2",
"PDU_SESSION_RELEASE_UE_REQUESTED_STEP3",
"PDU_SESSION_RELEASE_SMF_INITIATED",
"PDU_SESSION_RELEASE_AMF_INITIATED", "PDU_SESSION_RELEASE_AN_INITIATED",
"PDU_SESSION_RELEASE_AMF_INITIATED",
"PDU_SESSION_RELEASE_AN_INITIATED",
"PDU_SESSION_TEST"
};
};
enum class sm_context_status_e {
SM_CONTEXT_STATUS_ACTIVE = 0,
SM_CONTEXT_STATUS_RELEASED = 1
};
static const std::vector<std::string> sm_context_status_e2str =
{ "ACTIVE",
"RELEASED"
};
static const std::vector<std::string> sm_context_status_e2str = {"ACTIVE",
"RELEASED"};
typedef struct qos_profile_gbr_s {
gfbr_t gfbr; //Guaranteed Flow Bit Rate
gfbr_t gfbr; // Guaranteed Flow Bit Rate
mfbr_t mfbr; // Maximum Flow Bit Rate
// Notification Control
// Maximum Packet Loss Rate (UL/DL)
} qos_profile_gbr_t;
enum class qos_profile_type_e {
NON_GBR = 0,
GBR = 1
};
enum class qos_profile_type_e { NON_GBR = 0, GBR = 1 };
//See Section 5.7.2@3GPP TS 23.501
// See Section 5.7.2@3GPP TS 23.501
typedef struct qos_profile_s {
uint8_t _5qi;
arp_5gc_t arp;
uint8_t priority_level;
qos_profile_type_e profile_type;
union {
reflective_qos_attribute_e rqa; //Reflective QoS Attribute (RQA)
qos_profile_gbr_t qos_profile_gbr; //Attributes for GBR
reflective_qos_attribute_e rqa; // Reflective QoS Attribute (RQA)
qos_profile_gbr_t qos_profile_gbr; // Attributes for GBR
} parameter;
} qos_profile_t;
//URL, N1, N2 (may get from configuration file)
// URL, N1, N2 (may get from configuration file)
#define NAMF_COMMUNICATION_BASE "/namf-comm/"
#define NAMF_COMMUNICATION_N1N2_MESSAGE_TRANSFER_URL "/ue-contexts/{}/n1-n2-messages" //context id
#define NAMF_COMMUNICATION_N1N2_MESSAGE_TRANSFER_URL \
"/ue-contexts/{}/n1-n2-messages" // context id
#define NUDM_SDM_BASE "/nudm-sdm/"
#define NUDM_SDM_GET_SM_DATA_URL "/{}/sm-data" //ue Id
#define NUDM_SDM_GET_SM_DATA_URL "/{}/sm-data" // ue Id
#define N1_SM_CONTENT_ID "n1SmMsg"
#define N1N2_MESSAGE_CLASS "SM"
#define N2_SM_CONTENT_ID "n2msg"
#define NSMF_PDU_SESSION_BASE "/nsmf-pdusession/"
#define NSMF_CALLBACK_N1N2_MESSAGE_TRANSFER_FAILURE "/callback/N1N2MsgTxfrFailureNotification/{}" //UE Id
#define NSMF_CALLBACK_N1N2_MESSAGE_TRANSFER_FAILURE \
"/callback/N1N2MsgTxfrFailureNotification/{}" // UE Id
#define NSMF_PDU_SESSION_SM_CONTEXT_CREATE_URL "/sm-contexts"
#define NSMF_PDU_SESSION_SM_CONTEXT_UPDATE_URL "/sm-contexts/"
//NRF
// NRF
#define NNRF_NFM_BASE "/nnrf-nfm/"
#define NNRF_NF_REGISTER_URL "/nf-instances/"
#define NNRF_NF_STATUS_SUBSCRIBE_URL "/subscriptions/"
#define NRF_CURL_TIMEOUT_MS 100L
//for CURL
// for CURL
#define AMF_CURL_TIMEOUT_MS 100L
#define AMF_NUMBER_RETRIES 3
#define UDM_CURL_TIMEOUT_MS 100L
......@@ -242,7 +230,7 @@ typedef struct nf_service_version_s {
std::string api_version_in_uri; // apiVersionInUri
std::string api_full_version; // apiFullVersion
nf_service_version_s &operator=(const nf_service_version_s &s) {
nf_service_version_s& operator=(const nf_service_version_s& s) {
api_version_in_uri = s.api_version_in_uri;
api_full_version = s.api_full_version;
}
......@@ -283,4 +271,34 @@ typedef struct nf_service_s {
}
} nf_service_t;
typedef struct dnn_upf_info_item_s {
std::string dnn;
// std::vector<std::string> dnai_list
// std::vector<std::string> pdu_session_types
} dnn_upf_info_item_t;
typedef struct snssai_upf_info_item_s {
snssai_t snssai;
std::vector<dnn_upf_info_item_t> dnn_upf_info_list;
} snssai_upf_info_item_t;
typedef struct upf_info_s {
std::vector<snssai_upf_info_item_t> snssai_upf_info_list;
} upf_info_t;
typedef struct patch_item_s {
std::string op;
std::string path;
// std::string from;
std::string value;
nlohmann::json to_json() const {
nlohmann::json json_data = {};
json_data["op"] = op;
json_data["path"] = path;
json_data["value"] = value;
return json_data;
}
} patch_item_t;
#endif
......@@ -3,9 +3,9 @@
* 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
* 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
*
......@@ -121,8 +121,10 @@ typedef enum {
N11_UPDATE_NF_INSTANCE_REQUEST,
N11_UPDATE_NF_INSTANCE_RESPONSE,
N11_DEREGISTER_NF_INSTANCE,
N11_SUBSCRIBE_UPF_STATUS_NOTIFY,
NX_TRIGGER_SESSION_MODIFICATION,
SBI_EVENT_EXPOSURE_REQUEST,
SBI_NOTIFICATION_DATA,
UDP_INIT,
UDP_DATA_REQ,
UDP_DATA_IND,
......@@ -135,13 +137,14 @@ typedef enum {
typedef unsigned long message_number_t;
class itti_msg {
public:
public:
itti_msg();
itti_msg(const itti_msg_type_t msg_type, const task_id_t origin, const task_id_t destination);
itti_msg(
const itti_msg_type_t msg_type, const task_id_t origin,
const task_id_t destination);
itti_msg(const itti_msg& i);
itti_msg& operator=(itti_msg other)
{
itti_msg& operator=(itti_msg other) {
std::swap(msg_num, other.msg_num);
std::swap(origin, other.origin);
std::swap(destination, other.destination);
......@@ -159,30 +162,41 @@ public:
};
class itti_msg_timeout : public itti_msg {
public:
itti_msg_timeout(const task_id_t origin, const task_id_t destination, uint32_t timer_id, uint64_t arg1_user, uint64_t arg2_user):
itti_msg(TIME_OUT, origin, destination), timer_id(timer_id), arg1_user(arg1_user), arg2_user(arg2_user) {}
itti_msg_timeout(const itti_msg_timeout& i) : itti_msg(i), timer_id(i.timer_id), arg1_user(i.arg1_user), arg2_user(i.arg2_user) {}
static const char* get_msg_name() {return "TIME_OUT";};
public:
itti_msg_timeout(
const task_id_t origin, const task_id_t destination, uint32_t timer_id,
uint64_t arg1_user, uint64_t arg2_user)
: itti_msg(TIME_OUT, origin, destination),
timer_id(timer_id),
arg1_user(arg1_user),
arg2_user(arg2_user) {}
itti_msg_timeout(const itti_msg_timeout& i)
: itti_msg(i),
timer_id(i.timer_id),
arg1_user(i.arg1_user),
arg2_user(i.arg2_user) {}
static const char* get_msg_name() { return "TIME_OUT"; };
uint32_t timer_id;
uint64_t arg1_user;
uint64_t arg2_user;
};
class itti_msg_ping : public itti_msg {
public:
itti_msg_ping(const task_id_t origin, const task_id_t destination, uint32_t seq): itti_msg(HEALTH_PING, origin, destination), seq(seq) {}
public:
itti_msg_ping(
const task_id_t origin, const task_id_t destination, uint32_t seq)
: itti_msg(HEALTH_PING, origin, destination), seq(seq) {}
itti_msg_ping(const itti_msg_ping& i) : itti_msg(i), seq(i.seq) {}
static const char* get_msg_name() {return "HEALTH_PING";};
static const char* get_msg_name() { return "HEALTH_PING"; };
uint32_t seq;
};
class itti_msg_terminate : public itti_msg {
public:
itti_msg_terminate(const task_id_t origin, const task_id_t destination):
itti_msg(TERMINATE, origin, destination) {}
public:
itti_msg_terminate(const task_id_t origin, const task_id_t destination)
: itti_msg(TERMINATE, origin, destination) {}
itti_msg_terminate(const itti_msg_terminate& i) : itti_msg(i) {}
static const char* get_msg_name() {return "TERMINATE";};
static const char* get_msg_name() { return "TERMINATE"; };
};
#endif /* SRC_ITTI_ITTI_MSG_HPP_INCLUDED_ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -48,8 +48,8 @@ class smf_n11 {
public:
smf_n11();
smf_n11(smf_n11 const &) = delete;
void operator=(smf_n11 const &) = delete;
smf_n11(smf_n11 const&) = delete;
void operator=(smf_n11 const&) = delete;
/*
* Send N1N2 Message Transfer Request to AMF
......@@ -123,13 +123,24 @@ class smf_n11 {
*/
void deregister_nf_instance(
std::shared_ptr<itti_n11_deregister_nf_instance> msg);
/*
* Send a NFStatusSubscribe to NRF (to be notified when a new UPF becomes
* available)
* @param [std::shared_ptr<itti_n11_subscribe_upf_status_notify>] msg: Content
* of message to be sent
* @return void
*/
void subscribe_upf_status_notify(
std::shared_ptr<itti_n11_subscribe_upf_status_notify> msg);
/*
* Create Curl handle for multi curl
* @param [event_notification&] ev_notif: content of the event notification
* @param [std::string *] data: data
* @return pointer to the created curl
*/
CURL *curl_create_handle(event_notification &ev_notif, std::string *data);
CURL* curl_create_handle(event_notification& ev_notif, std::string* data);
};
} // namespace smf
#endif /* FILE_SMF_N11_HPP_SEEN */
This diff is collapsed.
This diff is collapsed.
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