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