Commit 89d36fb3 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Add API Version option for AMF N11 (SBI)

parent 3a515df5
...@@ -72,6 +72,8 @@ AMF = ...@@ -72,6 +72,8 @@ AMF =
INTERFACE_NAME = "@AMF_INTERFACE_NAME_FOR_N11@"; # YOUR NETWORK CONFIG HERE INTERFACE_NAME = "@AMF_INTERFACE_NAME_FOR_N11@"; # YOUR NETWORK CONFIG HERE
IPV4_ADDRESS = "read"; IPV4_ADDRESS = "read";
PORT = 80; # YOUR NETWORK CONFIG HERE PORT = 80; # YOUR NETWORK CONFIG HERE
API_VERSION = "v1"; # YOUR AMF API VERSION CONFIG HERE
SMF_INSTANCES_POOL = ( SMF_INSTANCES_POOL = (
{SMF_INSTANCE_ID = @SMF_INSTANCE_ID_0@; IPV4_ADDRESS = "@SMF_IPV4_ADDR_0@"; PORT = "80"; VERSION = "@SMF_HTTP_VERSION_0@"; SELECTED = "true"}, # YOUR SMF CONFIG HERE {SMF_INSTANCE_ID = @SMF_INSTANCE_ID_0@; IPV4_ADDRESS = "@SMF_IPV4_ADDR_0@"; PORT = "80"; VERSION = "@SMF_HTTP_VERSION_0@"; SELECTED = "true"}, # YOUR SMF CONFIG HERE
......
...@@ -190,6 +190,13 @@ int amf_config::load(const std::string& config_file) { ...@@ -190,6 +190,13 @@ int amf_config::load(const std::string& config_file) {
load_interface(n2_amf_cfg, n2); load_interface(n2_amf_cfg, n2);
const Setting& n11_cfg = new_if_cfg[AMF_CONFIG_STRING_INTERFACE_N11]; const Setting& n11_cfg = new_if_cfg[AMF_CONFIG_STRING_INTERFACE_N11];
load_interface(n11_cfg, n11); load_interface(n11_cfg, n11);
// SBI API VERSION
if (!(n11_cfg.lookupValue(
AMF_CONFIG_STRING_API_VERSION, sbi_api_version))) {
Logger::amf_app().error(AMF_CONFIG_STRING_API_VERSION "failed");
throw(AMF_CONFIG_STRING_API_VERSION "failed");
}
const Setting& smf_addr_pool = const Setting& smf_addr_pool =
n11_cfg[AMF_CONFIG_STRING_SMF_INSTANCES_POOL]; n11_cfg[AMF_CONFIG_STRING_SMF_INSTANCES_POOL];
int count = smf_addr_pool.getLength(); int count = smf_addr_pool.getLength();
...@@ -448,6 +455,7 @@ void amf_config::display() { ...@@ -448,6 +455,7 @@ void amf_config::display() {
Logger::config().info( Logger::config().info(
" ip ....................: %s", inet_ntoa(n11.addr4)); " ip ....................: %s", inet_ntoa(n11.addr4));
Logger::config().info(" port ..................: %d", n11.port); Logger::config().info(" port ..................: %d", n11.port);
Logger::config().info(" API version............: %s", sbi_api_version.c_str());
if (enable_nf_registration or enable_smf_selection) { if (enable_nf_registration or enable_smf_selection) {
Logger::config().info("- NRF:"); Logger::config().info("- NRF:");
......
...@@ -182,6 +182,7 @@ class amf_config { ...@@ -182,6 +182,7 @@ class amf_config {
interface_cfg_t n11; interface_cfg_t n11;
interface_cfg_t nausf; interface_cfg_t nausf;
itti_cfg_t itti; itti_cfg_t itti;
std::string sbi_api_version;
unsigned int statistics_interval; unsigned int statistics_interval;
std::string AMF_Name; std::string AMF_Name;
guami_t guami; guami_t guami;
......
...@@ -698,12 +698,13 @@ void amf_n2::handle_itti_message( ...@@ -698,12 +698,13 @@ void amf_n2::handle_itti_message(
Logger::amf_n2().debug("SUPI (%s)", supi.c_str()); Logger::amf_n2().debug("SUPI (%s)", supi.c_str());
std::shared_ptr<pdu_session_context> psc; std::shared_ptr<pdu_session_context> psc;
// TODO: REMOVE supi_to_pdu_ctx
if (!amf_app_inst->find_pdu_session_context( if (!amf_app_inst->find_pdu_session_context(
supi, itti_msg.pdu_session_id, psc)) { supi, itti_msg.pdu_session_id, psc)) {
Logger::amf_n2().warn( Logger::amf_n2().warn(
"Cannot get pdu_session_context with SUPI (%s)", supi.c_str()); "Cannot get pdu_session_context with SUPI (%s)", supi.c_str());
} }
// TODO: REMOVE supi_to_pdu_ctx
/* /*
if (amf_n11_inst->is_supi_to_pdu_ctx(supi)) { if (amf_n11_inst->is_supi_to_pdu_ctx(supi)) {
psc = amf_n11_inst->supi_to_pdu_ctx(supi); psc = amf_n11_inst->supi_to_pdu_ctx(supi);
......
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
#include "IndividualSubscriptionDocumentApi.h" #include "IndividualSubscriptionDocumentApi.h"
#include "Helpers.h" #include "Helpers.h"
#include "amf_config.hpp"
extern config::amf_config amf_cfg;
namespace oai { namespace oai {
namespace amf { namespace amf {
...@@ -34,13 +37,13 @@ void IndividualSubscriptionDocumentApi::setupRoutes() { ...@@ -34,13 +37,13 @@ void IndividualSubscriptionDocumentApi::setupRoutes() {
using namespace Pistache::Rest; using namespace Pistache::Rest;
Routes::Put( Routes::Put(
*router, base + "/subscriptions/:subscriptionId", *router, base + amf_cfg.sbi_api_version + "/subscriptions/:subscriptionId",
Routes::bind( Routes::bind(
&IndividualSubscriptionDocumentApi:: &IndividualSubscriptionDocumentApi::
a_mf_status_change_subscribe_modfy_handler, a_mf_status_change_subscribe_modfy_handler,
this)); this));
Routes::Delete( Routes::Delete(
*router, base + "/subscriptions/:subscriptionId", *router, base + amf_cfg.sbi_api_version + "/subscriptions/:subscriptionId",
Routes::bind( Routes::bind(
&IndividualSubscriptionDocumentApi:: &IndividualSubscriptionDocumentApi::
a_mf_status_change_un_subscribe_handler, a_mf_status_change_un_subscribe_handler,
......
...@@ -41,7 +41,7 @@ public: ...@@ -41,7 +41,7 @@ public:
virtual ~IndividualSubscriptionDocumentApi() {} virtual ~IndividualSubscriptionDocumentApi() {}
void init(); void init();
const std::string base = "/namf-comm/v1"; const std::string base = "/namf-comm/";
private: private:
void setupRoutes(); void setupRoutes();
......
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
#include "IndividualUeContextDocumentApi.h" #include "IndividualUeContextDocumentApi.h"
#include "Helpers.h" #include "Helpers.h"
#include "amf_config.hpp"
extern config::amf_config amf_cfg;
namespace oai { namespace oai {
namespace amf { namespace amf {
...@@ -34,24 +37,24 @@ void IndividualUeContextDocumentApi::setupRoutes() { ...@@ -34,24 +37,24 @@ void IndividualUeContextDocumentApi::setupRoutes() {
using namespace Pistache::Rest; using namespace Pistache::Rest;
Routes::Put( Routes::Put(
*router, base + "/ue-contexts/:ueContextId", *router, base + amf_cfg.sbi_api_version + "/ue-contexts/:ueContextId",
Routes::bind( Routes::bind(
&IndividualUeContextDocumentApi::create_ue_context_handler, this)); &IndividualUeContextDocumentApi::create_ue_context_handler, this));
Routes::Post( Routes::Post(
*router, base + "/ue-contexts/:ueContextId/assign-ebi", *router, base + amf_cfg.sbi_api_version + "/ue-contexts/:ueContextId/assign-ebi",
Routes::bind( Routes::bind(
&IndividualUeContextDocumentApi::e_bi_assignment_handler, this)); &IndividualUeContextDocumentApi::e_bi_assignment_handler, this));
Routes::Post( Routes::Post(
*router, base + "/ue-contexts/:ueContextId/transfer-update", *router, base + amf_cfg.sbi_api_version + "/ue-contexts/:ueContextId/transfer-update",
Routes::bind( Routes::bind(
&IndividualUeContextDocumentApi::registration_status_update_handler, &IndividualUeContextDocumentApi::registration_status_update_handler,
this)); this));
Routes::Post( Routes::Post(
*router, base + "/ue-contexts/:ueContextId/release", *router, base + amf_cfg.sbi_api_version + "/ue-contexts/:ueContextId/release",
Routes::bind( Routes::bind(
&IndividualUeContextDocumentApi::release_ue_context_handler, this)); &IndividualUeContextDocumentApi::release_ue_context_handler, this));
Routes::Post( Routes::Post(
*router, base + "/ue-contexts/:ueContextId/transfer", *router, base + amf_cfg.sbi_api_version + "/ue-contexts/:ueContextId/transfer",
Routes::bind( Routes::bind(
&IndividualUeContextDocumentApi::u_e_context_transfer_handler, this)); &IndividualUeContextDocumentApi::u_e_context_transfer_handler, this));
......
...@@ -51,7 +51,7 @@ public: ...@@ -51,7 +51,7 @@ public:
virtual ~IndividualUeContextDocumentApi() {} virtual ~IndividualUeContextDocumentApi() {}
void init(); void init();
const std::string base = "/namf-comm/v1"; const std::string base = "/namf-comm/";
private: private:
void setupRoutes(); void setupRoutes();
......
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
#include "N1N2IndividualSubscriptionDocumentApi.h" #include "N1N2IndividualSubscriptionDocumentApi.h"
#include "Helpers.h" #include "Helpers.h"
#include "amf_config.hpp"
extern config::amf_config amf_cfg;
namespace oai { namespace oai {
namespace amf { namespace amf {
...@@ -34,7 +37,7 @@ void N1N2IndividualSubscriptionDocumentApi::setupRoutes() { ...@@ -34,7 +37,7 @@ void N1N2IndividualSubscriptionDocumentApi::setupRoutes() {
Routes::Delete( Routes::Delete(
*router, *router,
base + base + amf_cfg.sbi_api_version +
"/ue-contexts/:ueContextId/n1-n2-messages/subscriptions/" "/ue-contexts/:ueContextId/n1-n2-messages/subscriptions/"
":subscriptionId", ":subscriptionId",
Routes::bind( Routes::bind(
......
...@@ -39,7 +39,7 @@ public: ...@@ -39,7 +39,7 @@ public:
virtual ~N1N2IndividualSubscriptionDocumentApi() {} virtual ~N1N2IndividualSubscriptionDocumentApi() {}
void init(); void init();
const std::string base = "/namf-comm/v1"; const std::string base = "/namf-comm/";
private: private:
void setupRoutes(); void setupRoutes();
......
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
#include "Helpers.h" #include "Helpers.h"
#include "mime_parser.hpp" #include "mime_parser.hpp"
#include "logger.hpp" #include "logger.hpp"
#include "amf_config.hpp"
extern config::amf_config amf_cfg;
namespace oai { namespace oai {
namespace amf { namespace amf {
...@@ -36,7 +39,7 @@ void N1N2MessageCollectionDocumentApi::setupRoutes() { ...@@ -36,7 +39,7 @@ void N1N2MessageCollectionDocumentApi::setupRoutes() {
using namespace Pistache::Rest; using namespace Pistache::Rest;
Routes::Post( Routes::Post(
*router, base + "/ue-contexts/:ueContextId/n1-n2-messages", *router, base + amf_cfg.sbi_api_version + "/ue-contexts/:ueContextId/n1-n2-messages",
Routes::bind( Routes::bind(
&N1N2MessageCollectionDocumentApi::n1_n2_message_transfer_handler, &N1N2MessageCollectionDocumentApi::n1_n2_message_transfer_handler,
this)); this));
......
...@@ -44,7 +44,7 @@ public: ...@@ -44,7 +44,7 @@ public:
virtual ~N1N2MessageCollectionDocumentApi() {} virtual ~N1N2MessageCollectionDocumentApi() {}
void init(); void init();
const std::string base = "/namf-comm/v2"; const std::string base = "/namf-comm/";
private: private:
void setupRoutes(); void setupRoutes();
......
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
#include "N1N2SubscriptionsCollectionForIndividualUEContextsDocumentApi.h" #include "N1N2SubscriptionsCollectionForIndividualUEContextsDocumentApi.h"
#include "Helpers.h" #include "Helpers.h"
#include "amf_config.hpp"
extern config::amf_config amf_cfg;
namespace oai { namespace oai {
namespace amf { namespace amf {
...@@ -36,7 +39,7 @@ void N1N2SubscriptionsCollectionForIndividualUEContextsDocumentApi:: ...@@ -36,7 +39,7 @@ void N1N2SubscriptionsCollectionForIndividualUEContextsDocumentApi::
using namespace Pistache::Rest; using namespace Pistache::Rest;
Routes::Post( Routes::Post(
*router, base + "/ue-contexts/:ueContextId/n1-n2-messages/subscriptions", *router, base + amf_cfg.sbi_api_version + "/ue-contexts/:ueContextId/n1-n2-messages/subscriptions",
Routes::bind( Routes::bind(
&N1N2SubscriptionsCollectionForIndividualUEContextsDocumentApi:: &N1N2SubscriptionsCollectionForIndividualUEContextsDocumentApi::
n1_n2_message_subscribe_handler, n1_n2_message_subscribe_handler,
......
...@@ -42,7 +42,7 @@ public: ...@@ -42,7 +42,7 @@ public:
virtual ~N1N2SubscriptionsCollectionForIndividualUEContextsDocumentApi() {} virtual ~N1N2SubscriptionsCollectionForIndividualUEContextsDocumentApi() {}
void init(); void init();
const std::string base = "/namf-comm/v1"; const std::string base = "/namf-comm/";
private: private:
void setupRoutes(); void setupRoutes();
......
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
#include "NonUEN2MessageNotificationIndividualSubscriptionDocumentApi.h" #include "NonUEN2MessageNotificationIndividualSubscriptionDocumentApi.h"
#include "Helpers.h" #include "Helpers.h"
#include "amf_config.hpp"
extern config::amf_config amf_cfg;
namespace oai { namespace oai {
namespace amf { namespace amf {
...@@ -36,7 +39,7 @@ void NonUEN2MessageNotificationIndividualSubscriptionDocumentApi:: ...@@ -36,7 +39,7 @@ void NonUEN2MessageNotificationIndividualSubscriptionDocumentApi::
Routes::Delete( Routes::Delete(
*router, *router,
base + "/non-ue-n2-messages/subscriptions/:n2NotifySubscriptionId", base + amf_cfg.sbi_api_version + "/non-ue-n2-messages/subscriptions/:n2NotifySubscriptionId",
Routes::bind( Routes::bind(
&NonUEN2MessageNotificationIndividualSubscriptionDocumentApi:: &NonUEN2MessageNotificationIndividualSubscriptionDocumentApi::
non_ue_n2_info_un_subscribe_handler, non_ue_n2_info_un_subscribe_handler,
......
...@@ -40,7 +40,7 @@ public: ...@@ -40,7 +40,7 @@ public:
virtual ~NonUEN2MessageNotificationIndividualSubscriptionDocumentApi() {} virtual ~NonUEN2MessageNotificationIndividualSubscriptionDocumentApi() {}
void init(); void init();
const std::string base = "/namf-comm/v1"; const std::string base = "/namf-comm/";
private: private:
void setupRoutes(); void setupRoutes();
......
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
#include "NonUEN2MessagesCollectionDocumentApi.h" #include "NonUEN2MessagesCollectionDocumentApi.h"
#include "Helpers.h" #include "Helpers.h"
#include "amf_config.hpp"
extern config::amf_config amf_cfg;
namespace oai { namespace oai {
namespace amf { namespace amf {
...@@ -34,7 +37,7 @@ void NonUEN2MessagesCollectionDocumentApi::setupRoutes() { ...@@ -34,7 +37,7 @@ void NonUEN2MessagesCollectionDocumentApi::setupRoutes() {
using namespace Pistache::Rest; using namespace Pistache::Rest;
Routes::Post( Routes::Post(
*router, base + "/non-ue-n2-messages/transfer", *router, base + amf_cfg.sbi_api_version + "/non-ue-n2-messages/transfer",
Routes::bind( Routes::bind(
&NonUEN2MessagesCollectionDocumentApi:: &NonUEN2MessagesCollectionDocumentApi::
non_ue_n2_message_transfer_handler, non_ue_n2_message_transfer_handler,
......
...@@ -42,7 +42,7 @@ public: ...@@ -42,7 +42,7 @@ public:
virtual ~NonUEN2MessagesCollectionDocumentApi() {} virtual ~NonUEN2MessagesCollectionDocumentApi() {}
void init(); void init();
const std::string base = "/namf-comm/v1"; const std::string base = "/namf-comm/";
private: private:
void setupRoutes(); void setupRoutes();
......
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
#include "NonUEN2MessagesSubscriptionsCollectionDocumentApi.h" #include "NonUEN2MessagesSubscriptionsCollectionDocumentApi.h"
#include "Helpers.h" #include "Helpers.h"
#include "amf_config.hpp"
extern config::amf_config amf_cfg;
namespace oai { namespace oai {
namespace amf { namespace amf {
...@@ -35,7 +38,7 @@ void NonUEN2MessagesSubscriptionsCollectionDocumentApi::setupRoutes() { ...@@ -35,7 +38,7 @@ void NonUEN2MessagesSubscriptionsCollectionDocumentApi::setupRoutes() {
using namespace Pistache::Rest; using namespace Pistache::Rest;
Routes::Post( Routes::Post(
*router, base + "/non-ue-n2-messages/subscriptions", *router, base + amf_cfg.sbi_api_version + "/non-ue-n2-messages/subscriptions",
Routes::bind( Routes::bind(
&NonUEN2MessagesSubscriptionsCollectionDocumentApi:: &NonUEN2MessagesSubscriptionsCollectionDocumentApi::
non_ue_n2_info_subscribe_handler, non_ue_n2_info_subscribe_handler,
......
...@@ -41,7 +41,7 @@ public: ...@@ -41,7 +41,7 @@ public:
virtual ~NonUEN2MessagesSubscriptionsCollectionDocumentApi() {} virtual ~NonUEN2MessagesSubscriptionsCollectionDocumentApi() {}
void init(); void init();
const std::string base = "/namf-comm/v1"; const std::string base = "/namf-comm/";
private: private:
void setupRoutes(); void setupRoutes();
......
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
#include "SubscriptionsCollectionDocumentApi.h" #include "SubscriptionsCollectionDocumentApi.h"
#include "Helpers.h" #include "Helpers.h"
#include "amf_config.hpp"
extern config::amf_config amf_cfg;
namespace oai { namespace oai {
namespace amf { namespace amf {
...@@ -34,7 +37,7 @@ void SubscriptionsCollectionDocumentApi::setupRoutes() { ...@@ -34,7 +37,7 @@ void SubscriptionsCollectionDocumentApi::setupRoutes() {
using namespace Pistache::Rest; using namespace Pistache::Rest;
Routes::Post( Routes::Post(
*router, base + "/subscriptions", *router, base + amf_cfg.sbi_api_version + "/subscriptions",
Routes::bind( Routes::bind(
&SubscriptionsCollectionDocumentApi:: &SubscriptionsCollectionDocumentApi::
a_mf_status_change_subscribe_handler, a_mf_status_change_subscribe_handler,
......
...@@ -40,7 +40,7 @@ public: ...@@ -40,7 +40,7 @@ public:
virtual ~SubscriptionsCollectionDocumentApi() {} virtual ~SubscriptionsCollectionDocumentApi() {}
void init(); void init();
const std::string base = "/namf-comm/v1"; const std::string base = "/namf-comm/";
private: private:
void setupRoutes(); void setupRoutes();
......
...@@ -80,12 +80,13 @@ void N1N2MessageCollectionDocumentApiImpl::n1_n2_message_transfer( ...@@ -80,12 +80,13 @@ void N1N2MessageCollectionDocumentApiImpl::n1_n2_message_transfer(
"Key for PDU Session context: SUPI (%s)", supi.c_str()); "Key for PDU Session context: SUPI (%s)", supi.c_str());
std::shared_ptr<pdu_session_context> psc; std::shared_ptr<pdu_session_context> psc;
// TODO: REMOVE supi_to_pdu_ctx
if (!amf_app_inst->find_pdu_session_context( if (!amf_app_inst->find_pdu_session_context(
supi, (uint8_t) n1N2MessageTransferReqData.getPduSessionId(), psc)) { supi, (uint8_t) n1N2MessageTransferReqData.getPduSessionId(), psc)) {
Logger::amf_server().error( Logger::amf_server().error(
"Cannot get pdu_session_context with SUPI (%s)", supi.c_str()); "Cannot get pdu_session_context with SUPI (%s)", supi.c_str());
} }
// TODO: REMOVE supi_to_pdu_ctx
/* /*
if(amf_n11_inst->is_supi_to_pdu_ctx(supi)){ if(amf_n11_inst->is_supi_to_pdu_ctx(supi)){
psc = amf_n11_inst->supi_to_pdu_ctx(supi); psc = amf_n11_inst->supi_to_pdu_ctx(supi);
......
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