Commit d7720955 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Merge branch 'sbi_interface' into 'develop'

Sbi interface

See merge request oai/cn5g/oai-cn5g-amf!138
parents 7ac990fa 907517be
......@@ -68,7 +68,7 @@ AMF =
};
# AMF binded interface for SBI (N11 (SMF)/N12 (AUSF), etc.)
N11:
SBI:
{
INTERFACE_NAME = "@AMF_INTERFACE_NAME_FOR_N11@";
IPV4_ADDRESS = "read";
......
......@@ -50,7 +50,7 @@ file(GLOB AMF_src_files
${CMAKE_CURRENT_SOURCE_DIR}/amf_module_from_config.cpp
${CMAKE_CURRENT_SOURCE_DIR}/amf_n1.cpp
${CMAKE_CURRENT_SOURCE_DIR}/amf_n2.cpp
${CMAKE_CURRENT_SOURCE_DIR}/amf_n11.cpp
${CMAKE_CURRENT_SOURCE_DIR}/amf_sbi.cpp
${CMAKE_CURRENT_SOURCE_DIR}/amf_event.cpp
${CMAKE_CURRENT_SOURCE_DIR}/amf_profile.cpp
${CMAKE_CURRENT_SOURCE_DIR}/amf_statistics.cpp
......
......@@ -37,7 +37,7 @@
#include "DLNASTransport.hpp"
#include "amf_config.hpp"
#include "amf_n1.hpp"
#include "amf_n11.hpp"
#include "amf_sbi.hpp"
#include "amf_n2.hpp"
#include "amf_statistics.hpp"
#include "itti.hpp"
......@@ -56,7 +56,7 @@ extern amf_app* amf_app_inst;
extern itti_mw* itti_inst;
amf_n2* amf_n2_inst = nullptr;
amf_n1* amf_n1_inst = nullptr;
amf_n11* amf_n11_inst = nullptr;
amf_sbi* amf_sbi_inst = nullptr;
extern amf_config amf_cfg;
extern statistics stacs;
......@@ -82,7 +82,7 @@ amf_app::amf_app(const amf_config& amf_cfg)
amf_n1_inst = new amf_n1();
amf_n2_inst =
new amf_n2(std::string(inet_ntoa(amf_cfg.n2.addr4)), amf_cfg.n2.port);
amf_n11_inst = new amf_n11();
amf_sbi_inst = new amf_sbi();
} catch (std::exception& e) {
Logger::amf_app().error("Cannot create AMF APP: %s", e.what());
throw;
......@@ -1018,7 +1018,7 @@ void amf_app::generate_amf_profile() {
nf_instance_profile.set_nf_priority(1);
nf_instance_profile.set_nf_capacity(100);
nf_instance_profile.delete_nf_ipv4_addresses();
nf_instance_profile.add_nf_ipv4_addresses(amf_cfg.n11.addr4);
nf_instance_profile.add_nf_ipv4_addresses(amf_cfg.sbi.addr4);
// NF services
nf_service_t nf_service = {};
......@@ -1032,9 +1032,9 @@ void amf_app::generate_amf_profile() {
nf_service.nf_service_status = "REGISTERED";
// IP Endpoint
ip_endpoint_t endpoint = {};
endpoint.ipv4_address = amf_cfg.n11.addr4;
endpoint.ipv4_address = amf_cfg.sbi.addr4;
endpoint.transport = "TCP";
endpoint.port = amf_cfg.n11.port;
endpoint.port = amf_cfg.sbi.port;
nf_service.ip_endpoints.push_back(endpoint);
nf_instance_profile.delete_nf_services();
......@@ -1067,27 +1067,28 @@ std::string amf_app::get_nf_instance() const {
//---------------------------------------------------------------------------------------------
void amf_app::register_to_nrf() {
// send request to N11 to send NF registration to NRF
// send request to SBI to send NF registration to NRF
trigger_nf_registration_request();
}
//------------------------------------------------------------------------------
void amf_app::trigger_nf_registration_request() {
Logger::amf_app().debug(
"Send ITTI msg to N11 task to trigger the registration request to NRF");
"Send ITTI msg to SBI task to trigger the registration request to NRF");
std::shared_ptr<itti_n11_register_nf_instance_request> itti_msg =
std::make_shared<itti_n11_register_nf_instance_request>(
TASK_AMF_APP, TASK_AMF_N11);
std::shared_ptr<itti_sbi_register_nf_instance_request> itti_msg =
std::make_shared<itti_sbi_register_nf_instance_request>(
TASK_AMF_APP, TASK_AMF_SBI);
itti_msg->profile = nf_instance_profile;
amf_n11_inst->register_nf_instance(itti_msg);
// TODO: use ITTI to send message between N1 and SBI
amf_sbi_inst->register_nf_instance(itti_msg);
/*
int ret = itti_inst->send_msg(itti_msg);
if (RETURNok != ret) {
Logger::amf_app().error(
"Could not send ITTI message %s to task TASK_AMF_N11",
"Could not send ITTI message %s to task TASK_AMF_SBI",
itti_msg->get_msg_name());
}
*/
......@@ -1096,16 +1097,16 @@ void amf_app::trigger_nf_registration_request() {
//------------------------------------------------------------------------------
void amf_app::trigger_nf_deregistration() const {
Logger::amf_app().debug(
"Send ITTI msg to N11 task to trigger the deregistration request to NRF");
"Send ITTI msg to SBI task to trigger the deregistration request to NRF");
std::shared_ptr<itti_n11_deregister_nf_instance> itti_msg =
std::make_shared<itti_n11_deregister_nf_instance>(
TASK_AMF_APP, TASK_AMF_N11);
std::shared_ptr<itti_sbi_deregister_nf_instance> itti_msg =
std::make_shared<itti_sbi_deregister_nf_instance>(
TASK_AMF_APP, TASK_AMF_SBI);
itti_msg->amf_instance_id = amf_instance_id;
int ret = itti_inst->send_msg(itti_msg);
if (RETURNok != ret) {
Logger::amf_app().error(
"Could not send ITTI message %s to task TASK_AMF_N11",
"Could not send ITTI message %s to task TASK_AMF_SBI",
itti_msg->get_msg_name());
}
}
......@@ -1129,8 +1130,8 @@ void amf_app::add_promise(
void amf_app::add_promise(
const uint32_t pid,
const boost::shared_ptr<boost::promise<nlohmann::json>>& p) {
std::unique_lock lock(m_curl_handle_responses_n11);
curl_handle_responses_n11.emplace(pid, p);
std::unique_lock lock(m_curl_handle_responses_sbi);
curl_handle_responses_sbi.emplace(pid, p);
}
//---------------------------------------------------------------------------------------------
......@@ -1170,10 +1171,10 @@ void amf_app::trigger_process_response(
"Trigger process response: Set promise with ID %u "
"to ready",
pid);
std::unique_lock lock(m_curl_handle_responses_n11);
if (curl_handle_responses_n11.count(pid) > 0) {
curl_handle_responses_n11[pid]->set_value(json_data);
std::unique_lock lock(m_curl_handle_responses_sbi);
if (curl_handle_responses_sbi.count(pid) > 0) {
curl_handle_responses_sbi[pid]->set_value(json_data);
// Remove this promise from list
curl_handle_responses_n11.erase(pid);
curl_handle_responses_sbi.erase(pid);
}
}
......@@ -37,7 +37,7 @@
#include "amf_module_from_config.hpp"
#include "amf_profile.hpp"
#include "itti.hpp"
#include "itti_msg_n11.hpp"
#include "itti_msg_sbi.hpp"
#include "itti_msg_amf_app.hpp"
#include "ue_context.hpp"
#include "amf_subscription.hpp"
......@@ -92,9 +92,9 @@ class amf_app {
std::map<uint32_t, boost::shared_ptr<boost::promise<std::string>>>
curl_handle_responses_n2_sm;
mutable std::shared_mutex m_curl_handle_responses_n11;
mutable std::shared_mutex m_curl_handle_responses_sbi;
std::map<uint32_t, boost::shared_ptr<boost::promise<nlohmann::json>>>
curl_handle_responses_n11;
curl_handle_responses_sbi;
util::uint_generator<uint32_t> n1n2sub_id_generator;
std::map<
......@@ -458,14 +458,14 @@ class amf_app {
void generate_amf_profile();
/*
* Send request to N11 task to trigger NF instance registration to NRF
* Send request to SBI task to trigger NF instance registration to NRF
* @param [void]
* @return void
*/
void trigger_nf_registration_request();
/*
* Send request to N11 task to trigger NF instance deregistration to NRF
* Send request to SBI task to trigger NF instance deregistration to NRF
* @param [void]
* @return void
*/
......
......@@ -73,7 +73,7 @@ amf_config::amf_config() {
nssf_addr.api_version = "v1";
instance = 0;
n2 = {};
n11 = {};
sbi = {};
sbi_api_version = "v1";
sbi_http2_port = 8080;
statistics_interval = 0;
......@@ -343,19 +343,19 @@ int amf_config::load(const std::string& config_file) {
new_if_cfg[AMF_CONFIG_STRING_INTERFACE_NGAP_AMF];
load_interface(n2_amf_cfg, n2);
// N11
const Setting& n11_cfg = new_if_cfg[AMF_CONFIG_STRING_INTERFACE_N11];
load_interface(n11_cfg, n11);
// SBI
const Setting& sbi_cfg = new_if_cfg[AMF_CONFIG_STRING_INTERFACE_SBI];
load_interface(sbi_cfg, sbi);
// SBI API VERSION
if (!(n11_cfg.lookupValue(
if (!(sbi_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");
}
// HTTP2 port
if (!(n11_cfg.lookupValue(
if (!(sbi_cfg.lookupValue(
AMF_CONFIG_STRING_SBI_HTTP2_PORT, sbi_http2_port))) {
Logger::amf_app().error(AMF_CONFIG_STRING_SBI_HTTP2_PORT "failed");
throw(AMF_CONFIG_STRING_SBI_HTTP2_PORT "failed");
......@@ -363,7 +363,7 @@ int amf_config::load(const std::string& config_file) {
// SMF
const Setting& smf_addr_pool =
n11_cfg[AMF_CONFIG_STRING_SMF_INSTANCES_POOL];
sbi_cfg[AMF_CONFIG_STRING_SMF_INSTANCES_POOL];
int count = smf_addr_pool.getLength();
for (int i = 0; i < count; i++) {
const Setting& smf_addr_item = smf_addr_pool[i];
......@@ -755,10 +755,10 @@ void amf_config::display() {
Logger::config().info(" Port ..................: %d", n2.port);
Logger::config().info("- SBI Networking:");
Logger::config().info(" Iface .................: %s", n11.if_name.c_str());
Logger::config().info(" Iface .................: %s", sbi.if_name.c_str());
Logger::config().info(
" IP Addr ...............: %s", inet_ntoa(n11.addr4));
Logger::config().info(" Port ..................: %d", n11.port);
" IP Addr ...............: %s", inet_ntoa(sbi.addr4));
Logger::config().info(" Port ..................: %d", sbi.port);
Logger::config().info(" HTTP2 port ............: %d", sbi_http2_port);
Logger::config().info(
" API version............: %s", sbi_api_version.c_str());
......@@ -916,9 +916,9 @@ std::string amf_config::get_amf_n1n2_message_subscribe_uri(
if (support_features.use_http2) {
sbi_port = sbi_http2_port;
} else {
sbi_port = n11.port;
sbi_port = sbi.port;
}
return std::string(inet_ntoa(*((struct in_addr*) &n11.addr4))) + ":" +
return std::string(inet_ntoa(*((struct in_addr*) &sbi.addr4))) + ":" +
std::to_string(sbi_port) + NAMF_COMMUNICATION_BASE + sbi_api_version +
"/ue-contexts/" + ue_cxt_id + "/n1-n2-messages/subscriptions";
}
......@@ -982,8 +982,8 @@ void amf_config::to_json(nlohmann::json& json_data) const {
json_data["auth_para"] = auth_para.to_json();
json_data["n2"] = n2.to_json();
json_data["n11"] = n11.to_json();
json_data["n11"]["sbi_http2_port"] = sbi_http2_port;
json_data["sbi"] = sbi.to_json();
json_data["sbi"]["sbi_http2_port"] = sbi_http2_port;
json_data["support_features"] = support_features.to_json();
......@@ -1060,8 +1060,8 @@ bool amf_config::from_json(nlohmann::json& json_data) {
if (json_data.find("n2") != json_data.end()) {
n2.from_json(json_data["n2"]);
}
if (json_data.find("n11") != json_data.end()) {
n11.from_json(json_data["n11"]);
if (json_data.find("sbi") != json_data.end()) {
sbi.from_json(json_data["sbi"]);
}
if (json_data.find("sbi_http2_port") != json_data.end()) {
......
......@@ -59,7 +59,7 @@
#define AMF_CONFIG_STRING_PPID "PPID"
#define AMF_CONFIG_STRING_SBI_HTTP2_PORT "HTTP2_PORT"
#define AMF_CONFIG_STRING_INTERFACE_N11 "N11"
#define AMF_CONFIG_STRING_INTERFACE_SBI "SBI"
#define AMF_CONFIG_STRING_SMF_INSTANCES_POOL "SMF_INSTANCES_POOL"
#define AMF_CONFIG_STRING_SMF_INSTANCE_ID "SMF_INSTANCE_ID"
#define AMF_CONFIG_STRING_SMF_INSTANCE_PORT "PORT"
......@@ -481,7 +481,7 @@ class amf_config {
unsigned int instance;
std::string pid_dir;
interface_cfg_t n2;
interface_cfg_t n11;
interface_cfg_t sbi;
itti_cfg_t itti;
std::string sbi_api_version;
unsigned int sbi_http2_port;
......
This diff is collapsed.
......@@ -48,7 +48,7 @@
#include "amf_app.hpp"
#include "amf_config.hpp"
#include "amf_n1.hpp"
#include "amf_n11.hpp"
#include "amf_sbi.hpp"
#include "amf_statistics.hpp"
#include "comUt.hpp"
#include "itti.hpp"
......@@ -1359,7 +1359,7 @@ void amf_n2::handle_itti_message(itti_ue_context_release_complete& itti_msg) {
uint32_t ran_ue_ngap_id = itti_msg.ueCtxRelCmpl->getRanUeNgapId();
// Change UE status from CM-CONNECTED to CM-IDLE
std::shared_ptr<nas_context> nc;
std::shared_ptr<nas_context> nc = {};
if (amf_n1_inst->is_amf_ue_id_2_nas_context(amf_ue_ngap_id))
nc = amf_n1_inst->amf_ue_id_2_nas_context(amf_ue_ngap_id);
else {
......@@ -1378,13 +1378,104 @@ void amf_n2::handle_itti_message(itti_ue_context_release_complete& itti_msg) {
amf_n1_inst->set_mobile_reachable_timer(nc, tid);
amf_n1_inst->set_mobile_reachable_timer_timeout(nc, false);
} else {
return;
}
// TODO: User Location Information IE
// TODO: Information on Recommended Cells & RAN Nodes for Paging IE
// TODO: Process Secondary RAT Usage Information IE if available
// send Nsmf_PDUSession_UpdateSMContext to SMF
// Get PDU Sessions in UE Context Release Complete and send
// Nsmf_PDUSession_UpdateSMContext to SMF
std::vector<PDUSessionResourceCxtRelCplItem_t> pdu_sessions_to_be_released;
itti_msg.ueCtxRelCmpl->getPduSessionResourceCxtRelCplList(
pdu_sessions_to_be_released);
// TODO: may consider releasing all exisiting PDU sessions
/*
if (pdu_sessions_to_be_released.size() == 0) {
string supi = "imsi-" + nc.get()->imsi;
std::vector<std::shared_ptr<pdu_session_context>> sessions_ctx;
if (!amf_app_inst->get_pdu_sessions_context(supi, sessions_ctx)) {
Logger::amf_n2().debug("No PDU Session Context found");
return;
} else {
for (auto pdu_session : sessions_ctx) {
PDUSessionResourceCxtRelCplItem_t item = {};
item.pduSessionId = pdu_session.get()->pdu_session_id;
pdu_sessions_to_be_released.push_back(item);
}
}
}
*/
// Send PDUSessionUpdateSMContextRequest to SMF for each PDU session
std::map<uint32_t, boost::shared_future<std::string>> curl_responses;
for (auto pdu_session : pdu_sessions_to_be_released) {
// Generate a promise and associate this promise to the curl handle
uint32_t promise_id = amf_app_inst->generate_promise_id();
Logger::amf_n2().debug("Promise ID generated %d", promise_id);
boost::shared_ptr<boost::promise<std::string>> p =
boost::make_shared<boost::promise<std::string>>();
boost::shared_future<std::string> f = p->get_future();
amf_app_inst->add_promise(promise_id, p);
curl_responses.emplace(pdu_session.pduSessionId, f);
Logger::amf_n2().debug(
"Sending ITTI to trigger PDUSessionUpdateSMContextRequest to SMF to "
"task TASK_AMF_SBI");
std::shared_ptr<itti_nsmf_pdusession_update_sm_context> itti_n11_msg =
std::make_shared<itti_nsmf_pdusession_update_sm_context>(
TASK_NGAP, TASK_AMF_SBI);
itti_n11_msg->pdu_session_id = pdu_session.pduSessionId;
// TODO:
itti_n11_msg->is_n2sm_set = false;
itti_n11_msg->amf_ue_ngap_id = amf_ue_ngap_id;
itti_n11_msg->ran_ue_ngap_id = ran_ue_ngap_id;
itti_n11_msg->promise_id = promise_id;
itti_n11_msg->up_cnx_state = "DEACTIVATED";
int ret = itti_inst->send_msg(itti_n11_msg);
if (0 != ret) {
Logger::ngap().error(
"Could not send ITTI message %s to task TASK_AMF_SBI",
itti_n11_msg->get_msg_name());
}
}
bool result = true;
while (!curl_responses.empty()) {
boost::future_status status;
// wait for timeout or ready
status = curl_responses.begin()->second.wait_for(
boost::chrono::milliseconds(FUTURE_STATUS_TIMEOUT_MS));
if (status == boost::future_status::ready) {
assert(curl_responses.begin()->second.is_ready());
assert(curl_responses.begin()->second.has_value());
assert(!curl_responses.begin()->second.has_exception());
// Wait for the result from APP and send reply to AMF
std::string pdu_session_id_str = curl_responses.begin()->second.get();
Logger::ngap().debug(
"Got result for PDU Session ID %d", curl_responses.begin()->first);
if (pdu_session_id_str.size() > 0) {
result = result && true;
} else {
result = false;
}
} else {
result = true;
}
curl_responses.erase(curl_responses.begin());
}
}
//------------------------------------------------------------------------------
......@@ -1605,10 +1696,10 @@ bool amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
Logger::amf_n2().debug(
"Sending ITTI to trigger PDUSessionUpdateSMContextRequest to SMF to "
"task TASK_AMF_N11");
"task TASK_AMF_SBI");
std::shared_ptr<itti_nsmf_pdusession_update_sm_context> itti_msg =
std::make_shared<itti_nsmf_pdusession_update_sm_context>(
TASK_NGAP, TASK_AMF_N11);
TASK_NGAP, TASK_AMF_SBI);
itti_msg->pdu_session_id = pduSessionIDValue;
itti_msg->n2sm =
......@@ -1623,7 +1714,7 @@ bool amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
int ret = itti_inst->send_msg(itti_msg);
if (0 != ret) {
Logger::ngap().error(
"Could not send ITTI message %s to task TASK_AMF_N11",
"Could not send ITTI message %s to task TASK_AMF_SBI",
itti_msg->get_msg_name());
}
}
......@@ -1766,10 +1857,10 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
Logger::amf_n2().debug(
"Sending ITTI to trigger PDUSessionUpdateSMContextRequest to SMF to "
"task TASK_AMF_N11");
"task TASK_AMF_SBI");
std::shared_ptr<itti_nsmf_pdusession_update_sm_context> itti_msg =
std::make_shared<itti_nsmf_pdusession_update_sm_context>(
TASK_NGAP, TASK_AMF_N11);
TASK_NGAP, TASK_AMF_SBI);
itti_msg->pdu_session_id = pdu_session_resource.pduSessionId;
itti_msg->n2sm = blk2bstr(
......@@ -1785,7 +1876,7 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
int ret = itti_inst->send_msg(itti_msg);
if (0 != ret) {
Logger::ngap().error(
"Could not send ITTI message %s to task TASK_AMF_N11",
"Could not send ITTI message %s to task TASK_AMF_SBI",
itti_msg->get_msg_name());
}
}
......@@ -1931,11 +2022,11 @@ void amf_n2::handle_itti_message(itti_handover_notify& itti_msg) {
Logger::amf_n2().debug(
"Sending ITTI to trigger PDUSessionUpdateSMContextRequest to SMF to "
"task TASK_AMF_N11");
"task TASK_AMF_SBI");
std::shared_ptr<itti_nsmf_pdusession_update_sm_context> itti_n11_msg =
std::make_shared<itti_nsmf_pdusession_update_sm_context>(
TASK_NGAP, TASK_AMF_N11);
TASK_NGAP, TASK_AMF_SBI);
itti_n11_msg->pdu_session_id = pdu_session.get()->pdu_session_id;
......@@ -1952,7 +2043,7 @@ void amf_n2::handle_itti_message(itti_handover_notify& itti_msg) {
int ret = itti_inst->send_msg(itti_n11_msg);
if (0 != ret) {
Logger::ngap().error(
"Could not send ITTI message %s to task TASK_AMF_N11",
"Could not send ITTI message %s to task TASK_AMF_SBI",
itti_n11_msg->get_msg_name());
}
}
......
......@@ -19,15 +19,15 @@
* contact@openairinterface.org
*/
/*! \file amf_n11.hpp
/*! \file amf_sbi.hpp
\brief
\author Keliang DU (BUPT), Tien-Thinh NGUYEN (EURECOM)
\date 2020
\email: contact@openairinterface.org
*/
#ifndef _AMF_N11_H_
#define _AMF_N11_H_
#ifndef _AMF_SBI_H_
#define _AMF_SBI_H_
#include <map>
#include <shared_mutex>
......@@ -35,7 +35,6 @@
#include "AuthenticationInfo.h"
#include "UEAuthenticationCtx.h"
#include "itti_msg_n11.hpp"
#include "itti_msg_sbi.hpp"
#include "pdu_session_context.hpp"
......@@ -45,10 +44,10 @@
namespace amf_application {
class amf_n11 {
class amf_sbi {
public:
amf_n11();
~amf_n11();
amf_sbi();
~amf_sbi();
/*
* Handle ITTI message (Nsmf_PDUSessionCreateSMContext) to create a new PDU
......@@ -90,34 +89,34 @@ class amf_n11 {
/*
* Handle ITTI message to get the Slice Selection Subscription Data from UDM
* @param [itti_n11_slice_selection_subscription_data&]: ITTI message
* @param [itti_sbi_slice_selection_subscription_data&]: ITTI message
* @return void
*/
void handle_itti_message(
itti_n11_slice_selection_subscription_data& itti_msg);
itti_sbi_slice_selection_subscription_data& itti_msg);
/*
* Handle ITTI message to get the Network Slice Selection Information from
* NSSF
* @param [itti_n11_network_slice_selection_information&]: ITTI message
* @param [itti_sbi_network_slice_selection_information&]: ITTI message
* @return void
*/
void handle_itti_message(
itti_n11_network_slice_selection_information& itti_msg);
itti_sbi_network_slice_selection_information& itti_msg);
/*
* Handle ITTI message to reroute N1 message to the targer AMF
* @param [itti_n11_n1_message_notify&]: ITTI message
* @param [itti_sbi_n1_message_notify&]: ITTI message
* @return void
*/
void handle_itti_message(itti_n11_n1_message_notify& itti_msg);
void handle_itti_message(itti_sbi_n1_message_notify& itti_msg);
/*
* Handle ITTI message to discover NF instance information from NRF
* @param [itti_n11_nf_instance_discovery&]: ITTI message
* @param [itti_sbi_nf_instance_discovery&]: ITTI message
* @return void
*/
void handle_itti_message(itti_n11_nf_instance_discovery& itti_msg);
void handle_itti_message(itti_sbi_nf_instance_discovery& itti_msg);
/*
* Handle request to create a new PDU Session
......@@ -151,11 +150,11 @@ class amf_n11 {
/*
* Handle ITTI message to register to NRF
* @param [itti_n11_register_nf_instance_request&]: ITTI message
* @param [itti_sbi_register_nf_instance_request&]: ITTI message
* @return void
*/
void register_nf_instance(
std::shared_ptr<itti_n11_register_nf_instance_request> msg);
std::shared_ptr<itti_sbi_register_nf_instance_request> msg);
/*
* Send the request to update PDU session context at SMF
......
......@@ -32,6 +32,12 @@
#include <string>
const uint32_t SD_NO_VALUE = 0xFFFFFF;
const uint8_t SST_MAX_STANDARDIZED_VALUE = 127;
const uint8_t SST_LENGTH = 1;
const uint8_t SD_LENGTH = 3;
typedef struct s_nssai // section 28.4, TS23.003
{
uint8_t sST;
......
......@@ -69,9 +69,6 @@ constexpr uint64_t SECONDS_SINCE_FIRST_EPOCH = 2208988800;
#define NAS_MESSAGE_DOWNLINK 1
#define NAS_MESSAGE_UPLINK 0
const uint32_t SD_NO_VALUE = 0xFFFFFF;
const uint8_t SST_MAX_STANDARDIZED_VALUE = 127;
typedef enum {
PlainNasMsg = 0x0,
IntegrityProtected = 0x1,
......
......@@ -36,7 +36,7 @@ void comUt::print_buffer(
if (!app.compare("amf_app")) Logger::amf_app().debug(commit.c_str());
if (!app.compare("amf_n1")) Logger::amf_n1().debug(commit.c_str());
if (!app.compare("amf_server")) Logger::amf_server().debug(commit.c_str());
if (!app.compare("amf_n11")) Logger::amf_n11().debug(commit.c_str());
if (!app.compare("amf_sbi")) Logger::amf_sbi().debug(commit.c_str());
#if DEBUG_IS_ON
for (int i = 0; i < len; i++) printf("%x ", buf[i]);
printf("\n");
......
......@@ -76,8 +76,8 @@ void Logger::_init(
m_itti = new _Logger("itti ", m_sinks, ss.str().c_str());
m_amf_n2 = new _Logger("amf_n2 ", m_sinks, ss.str().c_str());
m_amf_n1 = new _Logger("amf_n1 ", m_sinks, ss.str().c_str());
m_amf_n11 = new _Logger("amf_n11", m_sinks, ss.str().c_str());
m_amf_server = new _Logger("amf_sbi", m_sinks, ss.str().c_str());
m_amf_sbi = new _Logger("amf_sbi", m_sinks, ss.str().c_str());
m_amf_server = new _Logger("amf_server", m_sinks, ss.str().c_str());
}
//------------------------------------------------------------------------------
......
......@@ -92,7 +92,7 @@ class Logger {
static _Logger& itti() { return *singleton().m_itti; }
static _Logger& amf_n2() { return *singleton().m_amf_n2; }
static _Logger& amf_n1() { return *singleton().m_amf_n1; }
static _Logger& amf_n11() { return *singleton().m_amf_n11; }
static _Logger& amf_sbi() { return *singleton().m_amf_sbi; }
static _Logger& amf_server() { return *singleton().m_amf_server; }
private:
......@@ -121,7 +121,7 @@ class Logger {
_Logger* m_itti;
_Logger* m_amf_n2;
_Logger* m_amf_n1;
_Logger* m_amf_n11;
_Logger* m_amf_sbi;
_Logger* m_amf_server;
};
......
......@@ -38,7 +38,6 @@ typedef enum {
TASK_NGAP,
TASK_AMF_N2,
TASK_AMF_N1,
TASK_AMF_N11,
TASK_AMF_APP,
TASK_AMF_SBI,
AMF_SERVER,
......@@ -85,15 +84,15 @@ typedef enum {
REROUTE_NAS_REQ,
NSMF_PDU_SESSION_CREATE_SM_CTX,
NSMF_PDU_SESSION_UPDATE_SM_CTX,
N11_REGISTER_NF_INSTANCE_REQUEST,
N11_REGISTER_NF_INSTANCE_RESPONSE,
N11_UPDATE_NF_INSTANCE_REQUEST,
N11_UPDATE_NF_INSTANCE_RESPONSE,
N11_DEREGISTER_NF_INSTANCE,
N11_SLICE_SELECTION_SUBSCRIPTION_DATA,
N11_NETWORK_SLICE_SELECTION_INFORMATION,
N11_NF_INSTANCE_DISCOVERY,
N11_N1_MESSAGE_NOTIFY,
SBI_N1_MESSAGE_NOTIFY,
SBI_REGISTER_NF_INSTANCE_REQUEST,
SBI_REGISTER_NF_INSTANCE_RESPONSE,
SBI_UPDATE_NF_INSTANCE_REQUEST,
SBI_UPDATE_NF_INSTANCE_RESPONSE,
SBI_DEREGISTER_NF_INSTANCE,
SBI_SLICE_SELECTION_SUBSCRIPTION_DATA,
SBI_NETWORK_SLICE_SELECTION_INFORMATION,
SBI_NF_INSTANCE_DISCOVERY,
SBI_AMF_CONFIGURATION,
SBI_UPDATE_AMF_CONFIGURATION,
SBI_EVENT_EXPOSURE_REQUEST,
......
/*
* 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
*/
#ifndef _ITTI_N11_MSG_H_
#define _ITTI_N11_MSG_H_
#include <string>
#include "amf.hpp"
#include "amf_profile.hpp"
#include "bstrlib.h"
#include "itti_msg.hpp"
#include "SliceInfoForRegistration.h"
class itti_msg_n11 : public itti_msg {
public:
itti_msg_n11(
const itti_msg_type_t msg_type, const task_id_t origin,
const task_id_t destination)
: itti_msg(msg_type, origin, destination) {}
itti_msg_n11(const itti_msg_n11& i) : itti_msg(i) {
ran_ue_ngap_id = i.ran_ue_ngap_id;
amf_ue_ngap_id = i.amf_ue_ngap_id;
}
public:
long amf_ue_ngap_id;
uint32_t ran_ue_ngap_id;
};
class itti_nsmf_pdusession_create_sm_context : public itti_msg_n11 {
public:
itti_nsmf_pdusession_create_sm_context(
const task_id_t origin, const task_id_t destination)
: itti_msg_n11(NSMF_PDU_SESSION_CREATE_SM_CTX, origin, destination) {}
itti_nsmf_pdusession_create_sm_context(
const itti_nsmf_pdusession_create_sm_context& i)
: itti_msg_n11(i) {}
public:
uint8_t req_type;
uint8_t pdu_sess_id;
bstring dnn;
bstring sm_msg;
snssai_t snssai;
plmn_t plmn;
};
class itti_pdu_session_resource_setup_response : public itti_msg_n11 {
public:
itti_pdu_session_resource_setup_response(
const task_id_t origin, const task_id_t destination)
: itti_msg_n11(PDU_SESSION_RESOURCE_SETUP_RESPONSE, origin, destination) {
}
itti_pdu_session_resource_setup_response(
const itti_pdu_session_resource_setup_response& i)
: itti_msg_n11(i) {}
public:
uint8_t pdu_session_id;
bstring n2sm;
};
class itti_nsmf_pdusession_update_sm_context : public itti_msg_n11 {
public:
itti_nsmf_pdusession_update_sm_context(
const task_id_t origin, const task_id_t destination)
: itti_msg_n11(NSMF_PDU_SESSION_UPDATE_SM_CTX, origin, destination) {
is_n2sm_set = false;
promise_id = 0;
}
itti_nsmf_pdusession_update_sm_context(
const itti_nsmf_pdusession_update_sm_context& i)
: itti_msg_n11(i) {
pdu_session_id = i.pdu_session_id;
n2sm = i.n2sm;
is_n2sm_set = i.is_n2sm_set;
n2sm_info_type = i.n2sm_info_type;
promise_id = i.promise_id;
}
public:
std::string supi;
uint8_t pdu_session_id;
bstring n2sm;
bool is_n2sm_set;
std::string n2sm_info_type;
uint32_t ran_ue_ngap_id;
long amf_ue_ngap_id;
uint32_t promise_id;
std::string ho_state;
};
class itti_nsmf_pdusession_release_sm_context : public itti_msg_n11 {
public:
itti_nsmf_pdusession_release_sm_context(
const task_id_t origin, const task_id_t destination)
: itti_msg_n11(NSMF_PDU_SESSION_RELEASE_SM_CTX, origin, destination) {}
itti_nsmf_pdusession_release_sm_context(
const itti_nsmf_pdusession_release_sm_context& i)
: itti_msg_n11(i) {
supi = i.supi;
pdu_session_id = i.pdu_session_id;
promise_id = i.promise_id;
context_location = i.context_location;
}
public:
std::string supi;
uint8_t pdu_session_id;
uint32_t promise_id;
std::string context_location;
};
//-----------------------------------------------------------------------------
class itti_n11_register_nf_instance_request : public itti_msg_n11 {
public:
itti_n11_register_nf_instance_request(
const task_id_t orig, const task_id_t dest)
: itti_msg_n11(N11_REGISTER_NF_INSTANCE_REQUEST, orig, dest),
http_version(1) {}
const char* get_msg_name() { return "N11_REGISTER_NF_INSTANCE_REQUEST"; };
amf_application::amf_profile profile;
uint8_t http_version;
};
//-----------------------------------------------------------------------------
class itti_n11_register_nf_instance_response : public itti_msg_n11 {
public:
itti_n11_register_nf_instance_response(
const task_id_t orig, const task_id_t dest)
: itti_msg_n11(N11_REGISTER_NF_INSTANCE_RESPONSE, orig, dest),
http_version(1) {}
const char* get_msg_name() { return "N11_REGISTER_NF_INSTANCE_RESPONSE"; };
amf_application::amf_profile profile;
uint8_t http_version;
uint8_t http_response_code;
};
//-----------------------------------------------------------------------------
class itti_n11_update_nf_instance_request : public itti_msg_n11 {
public:
itti_n11_update_nf_instance_request(
const task_id_t orig, const task_id_t dest)
: itti_msg_n11(N11_UPDATE_NF_INSTANCE_REQUEST, orig, dest),
http_version(1) {}
const char* get_msg_name() { return "N11_UPDATE_NF_INSTANCE_REQUEST"; };
// std::vector<oai::amf::model::PatchItem> patch_items;
uint8_t http_version;
std::string smf_instance_id;
};
//-----------------------------------------------------------------------------
class itti_n11_update_nf_instance_response : public itti_msg_n11 {
public:
itti_n11_update_nf_instance_response(
const task_id_t orig, const task_id_t dest)
: itti_msg_n11(N11_UPDATE_NF_INSTANCE_RESPONSE, orig, dest),
http_version(1) {}
const char* get_msg_name() { return "N11_UPDATE_NF_INSTANCE_RESPONSE"; };
uint8_t http_version;
std::string amf_instance_id;
uint8_t http_response_code;
};
//-----------------------------------------------------------------------------
class itti_n11_deregister_nf_instance : public itti_msg_n11 {
public:
itti_n11_deregister_nf_instance(const task_id_t orig, const task_id_t dest)
: itti_msg_n11(N11_DEREGISTER_NF_INSTANCE, orig, dest), http_version(1) {}
const char* get_msg_name() { return "N11_DEREGISTER_NF_INSTANCE"; };
uint8_t http_version;
std::string amf_instance_id;
};
//-----------------------------------------------------------------------------
class itti_n11_slice_selection_subscription_data : public itti_msg_n11 {
public:
itti_n11_slice_selection_subscription_data(
const task_id_t orig, const task_id_t dest)
: itti_msg_n11(N11_SLICE_SELECTION_SUBSCRIPTION_DATA, orig, dest),
http_version(1) {}
const char* get_msg_name() {
return "N11_SLICE_SELECTION_SUBSCRIPTION_DATA";
};
uint8_t http_version;
std::string supi;
plmn_t plmn;
uint32_t promise_id;
};
//-----------------------------------------------------------------------------
class itti_n11_network_slice_selection_information : public itti_msg_n11 {
public:
itti_n11_network_slice_selection_information(
const task_id_t orig, const task_id_t dest)
: itti_msg_n11(N11_NETWORK_SLICE_SELECTION_INFORMATION, orig, dest),
http_version(1) {}
const char* get_msg_name() {
return "N11_NETWORK_SLICE_SELECTION_INFORMATION";
};
uint8_t http_version;
std::string nf_instance_id;
oai::amf::model::SliceInfoForRegistration slice_info;
// plmn_t plmn;
tai_t tai;
uint32_t promise_id;
};
//-----------------------------------------------------------------------------
class itti_n11_nf_instance_discovery : public itti_msg_n11 {
public:
itti_n11_nf_instance_discovery(const task_id_t orig, const task_id_t dest)
: itti_msg_n11(N11_NF_INSTANCE_DISCOVERY, orig, dest),
target_amf_set_is_set(false),
http_version(1) {}
const char* get_msg_name() { return "N11_NF_INSTANCE_DISCOVERY"; };
uint8_t http_version;
std::string target_amf_set;
bool target_amf_set_is_set;
std::string target_nf_type;
std::string nrf_amf_set;
uint32_t promise_id;
};
//-----------------------------------------------------------------------------
class itti_n11_n1_message_notify : public itti_msg_n11 {
public:
itti_n11_n1_message_notify(const task_id_t orig, const task_id_t dest)
: itti_msg_n11(N11_N1_MESSAGE_NOTIFY, orig, dest), http_version(1) {}
const char* get_msg_name() { return "N11_N1_MESSAGE_NOTIFY"; };
uint8_t http_version;
std::string target_amf_uri;
std::string supi;
bstring registration_request;
};
#endif
......@@ -20,7 +20,7 @@
*/
/*
* itti_msg_sbi.hpp
* itti_sbi_msg.hpp
*
* Date: 2021
* Company KCL
......@@ -35,10 +35,127 @@
#include "amf_msg.hpp"
#include "N1MessageNotification.h"
#include "UeN1N2InfoSubscriptionCreateData.h"
#include "amf.hpp"
#include "amf_profile.hpp"
#include "bstrlib.h"
#include "itti_msg.hpp"
#include "SliceInfoForRegistration.h"
// using namespace oai::amf::model;
using namespace amf_application;
class itti_msg_n11 : public itti_msg {
public:
itti_msg_n11(
const itti_msg_type_t msg_type, const task_id_t origin,
const task_id_t destination)
: itti_msg(msg_type, origin, destination) {}
itti_msg_n11(const itti_msg_n11& i) : itti_msg(i) {
ran_ue_ngap_id = i.ran_ue_ngap_id;
amf_ue_ngap_id = i.amf_ue_ngap_id;
}
public:
long amf_ue_ngap_id;
uint32_t ran_ue_ngap_id;
};
class itti_nsmf_pdusession_create_sm_context : public itti_msg_n11 {
public:
itti_nsmf_pdusession_create_sm_context(
const task_id_t origin, const task_id_t destination)
: itti_msg_n11(NSMF_PDU_SESSION_CREATE_SM_CTX, origin, destination) {}
itti_nsmf_pdusession_create_sm_context(
const itti_nsmf_pdusession_create_sm_context& i)
: itti_msg_n11(i) {}
public:
uint8_t req_type;
uint8_t pdu_sess_id;
bstring dnn;
bstring sm_msg;
snssai_t snssai;
plmn_t plmn;
};
class itti_pdu_session_resource_setup_response : public itti_msg_n11 {
public:
itti_pdu_session_resource_setup_response(
const task_id_t origin, const task_id_t destination)
: itti_msg_n11(PDU_SESSION_RESOURCE_SETUP_RESPONSE, origin, destination) {
}
itti_pdu_session_resource_setup_response(
const itti_pdu_session_resource_setup_response& i)
: itti_msg_n11(i) {}
public:
uint8_t pdu_session_id;
bstring n2sm;
};
class itti_nsmf_pdusession_update_sm_context : public itti_msg_n11 {
public:
itti_nsmf_pdusession_update_sm_context(
const task_id_t origin, const task_id_t destination)
: itti_msg_n11(NSMF_PDU_SESSION_UPDATE_SM_CTX, origin, destination) {
supi = {};
pdu_session_id = 0;
// n2sm = {};
is_n2sm_set = false;
n2sm_info_type = {};
ran_ue_ngap_id = 0;
amf_ue_ngap_id = 0;
promise_id = 0;
ho_state = {};
up_cnx_state = {};
}
itti_nsmf_pdusession_update_sm_context(
const itti_nsmf_pdusession_update_sm_context& i)
: itti_msg_n11(i) {
supi = i.supi;
pdu_session_id = i.pdu_session_id;
n2sm = i.n2sm;
is_n2sm_set = i.is_n2sm_set;
n2sm_info_type = i.n2sm_info_type;
promise_id = i.promise_id;
ho_state = i.ho_state;
up_cnx_state = i.up_cnx_state;
}
public:
std::string supi;
uint8_t pdu_session_id;
bstring n2sm;
bool is_n2sm_set;
std::string n2sm_info_type;
// uint32_t ran_ue_ngap_id;
// long amf_ue_ngap_id;
uint32_t promise_id;
std::string ho_state;
std::string up_cnx_state;
};
class itti_nsmf_pdusession_release_sm_context : public itti_msg_n11 {
public:
itti_nsmf_pdusession_release_sm_context(
const task_id_t origin, const task_id_t destination)
: itti_msg_n11(NSMF_PDU_SESSION_RELEASE_SM_CTX, origin, destination) {}
itti_nsmf_pdusession_release_sm_context(
const itti_nsmf_pdusession_release_sm_context& i)
: itti_msg_n11(i) {
supi = i.supi;
pdu_session_id = i.pdu_session_id;
promise_id = i.promise_id;
context_location = i.context_location;
}
public:
std::string supi;
uint8_t pdu_session_id;
uint32_t promise_id;
std::string context_location;
};
class itti_sbi_msg : public itti_msg {
public:
itti_sbi_msg(
......@@ -54,6 +171,138 @@ class itti_sbi_msg : public itti_msg {
}
};
//-----------------------------------------------------------------------------
class itti_sbi_register_nf_instance_request : public itti_sbi_msg {
public:
itti_sbi_register_nf_instance_request(
const task_id_t orig, const task_id_t dest)
: itti_sbi_msg(SBI_REGISTER_NF_INSTANCE_REQUEST, orig, dest),
http_version(1) {}
const char* get_msg_name() { return "SBI_REGISTER_NF_INSTANCE_REQUEST"; };
amf_application::amf_profile profile;
uint8_t http_version;
};
//-----------------------------------------------------------------------------
class itti_sbi_register_nf_instance_response : public itti_sbi_msg {
public:
itti_sbi_register_nf_instance_response(
const task_id_t orig, const task_id_t dest)
: itti_sbi_msg(SBI_REGISTER_NF_INSTANCE_RESPONSE, orig, dest),
http_version(1) {}
const char* get_msg_name() { return "SBI_REGISTER_NF_INSTANCE_RESPONSE"; };
amf_application::amf_profile profile;
uint8_t http_version;
uint8_t http_response_code;
};
//-----------------------------------------------------------------------------
class itti_sbi_update_nf_instance_request : public itti_sbi_msg {
public:
itti_sbi_update_nf_instance_request(
const task_id_t orig, const task_id_t dest)
: itti_sbi_msg(SBI_UPDATE_NF_INSTANCE_REQUEST, orig, dest),
http_version(1) {}
const char* get_msg_name() { return "SBI_UPDATE_NF_INSTANCE_REQUEST"; };
// std::vector<oai::amf::model::PatchItem> patch_items;
uint8_t http_version;
std::string smf_instance_id;
};
//-----------------------------------------------------------------------------
class itti_sbi_update_nf_instance_response : public itti_sbi_msg {
public:
itti_sbi_update_nf_instance_response(
const task_id_t orig, const task_id_t dest)
: itti_sbi_msg(SBI_UPDATE_NF_INSTANCE_RESPONSE, orig, dest),
http_version(1) {}
const char* get_msg_name() { return "SBI_UPDATE_NF_INSTANCE_RESPONSE"; };
uint8_t http_version;
std::string amf_instance_id;
uint8_t http_response_code;
};
//-----------------------------------------------------------------------------
class itti_sbi_deregister_nf_instance : public itti_sbi_msg {
public:
itti_sbi_deregister_nf_instance(const task_id_t orig, const task_id_t dest)
: itti_sbi_msg(SBI_DEREGISTER_NF_INSTANCE, orig, dest), http_version(1) {}
const char* get_msg_name() { return "SBI_DEREGISTER_NF_INSTANCE"; };
uint8_t http_version;
std::string amf_instance_id;
};
//-----------------------------------------------------------------------------
class itti_sbi_slice_selection_subscription_data : public itti_sbi_msg {
public:
itti_sbi_slice_selection_subscription_data(
const task_id_t orig, const task_id_t dest)
: itti_sbi_msg(SBI_SLICE_SELECTION_SUBSCRIPTION_DATA, orig, dest),
http_version(1) {}
const char* get_msg_name() {
return "SBI_SLICE_SELECTION_SUBSCRIPTION_DATA";
};
uint8_t http_version;
std::string supi;
plmn_t plmn;
uint32_t promise_id;
};
//-----------------------------------------------------------------------------
class itti_sbi_network_slice_selection_information : public itti_sbi_msg {
public:
itti_sbi_network_slice_selection_information(
const task_id_t orig, const task_id_t dest)
: itti_sbi_msg(SBI_NETWORK_SLICE_SELECTION_INFORMATION, orig, dest),
http_version(1) {}
const char* get_msg_name() {
return "SBI_NETWORK_SLICE_SELECTION_INFORMATION";
};
uint8_t http_version;
std::string nf_instance_id;
oai::amf::model::SliceInfoForRegistration slice_info;
// plmn_t plmn;
tai_t tai;
uint32_t promise_id;
};
//-----------------------------------------------------------------------------
class itti_sbi_nf_instance_discovery : public itti_sbi_msg {
public:
itti_sbi_nf_instance_discovery(const task_id_t orig, const task_id_t dest)
: itti_sbi_msg(SBI_NF_INSTANCE_DISCOVERY, orig, dest),
target_amf_set_is_set(false),
http_version(1) {}
const char* get_msg_name() { return "SBI_NF_INSTANCE_DISCOVERY"; };
uint8_t http_version;
std::string target_amf_set;
bool target_amf_set_is_set;
std::string target_nf_type;
std::string nrf_amf_set;
uint32_t promise_id;
};
//-----------------------------------------------------------------------------
class itti_sbi_n1_message_notify : public itti_sbi_msg {
public:
itti_sbi_n1_message_notify(const task_id_t orig, const task_id_t dest)
: itti_sbi_msg(SBI_N1_MESSAGE_NOTIFY, orig, dest), http_version(1) {}
const char* get_msg_name() { return "SBI_N1_MESSAGE_NOTIFY"; };
uint8_t http_version;
std::string target_amf_uri;
std::string supi;
bstring registration_request;
};
//-----------------------------------------------------------------------------
class itti_sbi_event_exposure_request : public itti_sbi_msg {
public:
......
#NAS Library - CODEOWNERS
Philippe MOREL
Sebastien ROUX
Lionel GAUTHIER
Keliang DU, BUPT
Tien Thinh NGUYEN, Eurecom
......@@ -19,13 +19,6 @@
* contact@openairinterface.org
*/
/*! \file 3gpp_ts24501.hpp
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef _3GPP_TS_24501_H_
#define _3GPP_TS_24501_H_
......@@ -188,4 +181,6 @@ static const std::vector<std::string> nas_ciphering_algorithm_list_e2str = {
#define PDU_SESSION_RELEASE_COMMAND 0b11010011
#define PDU_SESSION_RELEASE_COMPLETE 0b11010100
#define DEREGISTRATION_TYPE_MASK 0b00001000
#endif
/*
* 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
*/
#pragma once
constexpr uint8_t kIeIsOptional = true;
constexpr uint8_t kIeIsNotOptional = false;
constexpr uint8_t kIei5gmmCause = 0x58;
constexpr uint8_t kIei5gsmCapability = 0x28;
constexpr uint8_t kIei5gsDrxParameters = 0x51;
constexpr uint8_t kIei5gsmCongestionReAttemptIndicator = 0x61;
constexpr uint8_t kIei5gsmNetworkFeatureSupport = 0x17;
constexpr uint8_t kIei5gsMobileIdentityImeiSv = 0x77;
constexpr uint8_t kIei5gsMobileIdentityNonImeiSvPei = 0x78;
constexpr uint8_t kIei5gsRegistrationResult = 0x44;
constexpr uint8_t kIei5gsTrackingAreaIdentity = 0x52;
constexpr uint8_t kIei5gsTrackingAreaIdentityList = 0x54;
constexpr uint8_t kIei5gsUpdateType = 0x53;
constexpr uint8_t kIeiAdditionalInformation = 0x24;
constexpr uint8_t kIeiAllowedSscMode = 0x0f;
constexpr uint8_t kIeiAlwaysOnPduSessionIndication = 0x08;
constexpr uint8_t kIeiAlwaysOnPduSessionRequested = 0x0b;
constexpr uint8_t kIeiAtsssContainer = 0x77;
constexpr uint8_t kIeiAuthorizedQosFlowDescriptions = 0x79;
constexpr uint8_t kIeiAuthorizedQosRules = 0x7a;
constexpr uint8_t kIeiBackOffTimerValue = 0x37;
constexpr uint8_t kIeiControlPlaneOnlyIndication = 0x0c;
constexpr uint8_t kIeiDnn = 0x25;
constexpr uint8_t kIeiDsTtEthernetPortMacAddress = 0x6e;
constexpr uint8_t kIeiEapMessage = 0x78;
constexpr uint8_t kIeiEthernetHeaderCompressionConfiguration = 0x1f;
constexpr uint8_t kIeiExtendedDrxParameters = 0x6e;
constexpr uint8_t kIeiExtendedProtocolConfigurationOptions = 0x7b;
constexpr uint8_t kIeiIntegrityProtectionMaximumDataRate = 0x13;
constexpr uint8_t kIeiIpHeaderCompressionConfiguration = 0x66;
constexpr uint8_t kIeiMaPduSessionInformation = 0xa0;
constexpr uint8_t kIeiMappedEpsBearerContexts = 0x75;
constexpr uint8_t kIeiMaximumNumberOfSupportedPacketFilters = 0x55;
constexpr uint8_t kIeiNbN1ModeDrxParameters = 0x29;
constexpr uint8_t kIeiNSSAIAllowed = 0x15;
constexpr uint8_t kIeiNSSAIConfigured = 0x31;
constexpr uint8_t kIeiNSSAIPending = 0x39;
constexpr uint8_t kIeiOldPduSessionId = 0x59;
constexpr uint8_t kIeiPduAddress = 0x29;
constexpr uint8_t kIeiPduSessionId = 0x12;
constexpr uint8_t kIeiPduSessionType = 0x09;
constexpr uint8_t kIeiPortManagementInformationContainer = 0x74;
constexpr uint8_t kIeiReAttemptIndicator = 0x1d;
constexpr uint8_t kIeiRejectedNssaiRa = 0x11;
constexpr uint8_t kIeiRejectedNssaiRr = 0x69;
constexpr uint8_t kIeiRejectedNssaiDr = 0x6D;
constexpr uint8_t kIeiRejectedNssaiCuc = 0x11;
constexpr uint8_t kIeiReleaseAssistanceIndication = 0xf0;
constexpr uint8_t kIeiRequestedQosFlowDescriptions = 0x79;
constexpr uint8_t kIeiRequestedQosRules = 0x7a;
constexpr uint8_t kIeiRequestType = 0x80;
constexpr uint8_t kIeiRqTimerValue = 0x56;
constexpr uint8_t kIeiServingPlmnRateControlPsea = 0x18;
constexpr uint8_t kIeiServingPlmnRateControlPsmc = 0x1e;
constexpr uint8_t kIeiSessionAmbr = 0x2a;
constexpr uint8_t kIeiSmPduDnRequestContainer = 0x39;
constexpr uint8_t kIeiSNssai = 0x22;
constexpr uint8_t kIeiSscMode = 0x0a;
constexpr uint8_t kIeiSuggestedInterfaceIdentifier = 0x29;
constexpr uint8_t kIeiUeDsTtResidenceTime = 0x6f;
......@@ -19,13 +19,6 @@
* contact@openairinterface.org
*/
/*! \file nas_ie_header.hpp
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "5GMMCapability.hpp"
#include "5GSMobilityIdentity.hpp"
#include "5GSRegistrationType.hpp"
......@@ -87,3 +80,4 @@
#include "_5GS_Update_Type.hpp"
#include "nas_mm_plain_header.hpp"
#include "struct.hpp"
#include "Ie_Const.hpp"
......@@ -19,13 +19,6 @@
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "NSSAI.hpp"
#include <vector>
......@@ -37,16 +30,15 @@ using namespace nas;
//------------------------------------------------------------------------------
NSSAI::NSSAI(uint8_t iei) {
_iei = iei;
length = 0;
S_NSSAI = {};
_iei = iei;
length = 0;
}
//------------------------------------------------------------------------------
NSSAI::NSSAI(const uint8_t iei, std::vector<struct SNSSAI_s> nssai) {
_iei = iei;
length = 0;
S_NSSAI.assign(nssai.begin(), nssai.end());
S_NSSAIs.assign(nssai.begin(), nssai.end());
for (int i = 0; i < nssai.size(); i++) {
length += 2; // 1 for IEI and 1 for sst
if (nssai[i].sd != SD_NO_VALUE) length += SD_LENGTH;
......@@ -56,7 +48,7 @@ NSSAI::NSSAI(const uint8_t iei, std::vector<struct SNSSAI_s> nssai) {
}
//------------------------------------------------------------------------------
NSSAI::NSSAI() : _iei(), length(), S_NSSAI() {}
NSSAI::NSSAI() : _iei(), length(), S_NSSAIs() {}
//------------------------------------------------------------------------------
NSSAI::~NSSAI() {}
......@@ -66,7 +58,7 @@ void NSSAI::setS_NAASI(uint8_t SST) {}
//------------------------------------------------------------------------------
void NSSAI::getValue(std::vector<struct SNSSAI_s>& nssai) {
nssai.assign(S_NSSAI.begin(), S_NSSAI.end());
nssai.assign(S_NSSAIs.begin(), S_NSSAIs.end());
}
//------------------------------------------------------------------------------
......@@ -78,51 +70,48 @@ int NSSAI::encode2buffer(uint8_t* buf, int len) {
}
int encoded_size = 0;
if (_iei) {
*(buf + encoded_size) = _iei;
ENCODE_U8(buf + encoded_size, _iei, encoded_size);
}
ENCODE_U8(buf + encoded_size, length, encoded_size);
for (int i = 0; i < S_NSSAIs.size(); i++) {
int len_s_nssai = SST_LENGTH;
encoded_size++;
*(buf + encoded_size) = length;
*(buf + encoded_size) = S_NSSAIs.at(i).sst;
encoded_size++;
for (int i = 0; i < S_NSSAI.size(); i++) {
int len_s_nssai = SST_LENGTH;
if (S_NSSAIs.at(i).sd != SD_NO_VALUE) {
len_s_nssai += SD_LENGTH;
*(buf + encoded_size) = (S_NSSAIs.at(i).sd & 0x00ff0000) >> 16;
encoded_size++;
*(buf + encoded_size) = S_NSSAI.at(i).sst;
Logger::nas_mm().debug(
"Encoded NSSAI SD first octet (%x)", *(buf + encoded_size - 1));
*(buf + encoded_size) = (S_NSSAIs.at(i).sd & 0x0000ff00) >> 8;
encoded_size++;
Logger::nas_mm().debug(
"Encoded NSSAI SD second octet (%x)", *(buf + encoded_size - 1));
*(buf + encoded_size) = S_NSSAIs.at(i).sd & 0x000000ff;
encoded_size++;
Logger::nas_mm().debug(
"Encoded NSSAI SD third octet (%x)", *(buf + encoded_size - 1));
}
if (S_NSSAIs.at(i).mHplmnSst != -1) {
len_s_nssai += SST_LENGTH;
*(buf + encoded_size) = S_NSSAIs.at(i).mHplmnSst;
encoded_size++;
}
if (S_NSSAIs.at(i).mHplmnSd != SD_NO_VALUE) {
len_s_nssai += SD_LENGTH;
*(buf + encoded_size) = (S_NSSAIs.at(i).mHplmnSd & 0x00ff0000) >> 16;
encoded_size++;
*(buf + encoded_size) = (S_NSSAIs.at(i).mHplmnSd & 0x0000ff00) >> 8;
encoded_size++;
*(buf + encoded_size) = S_NSSAIs.at(i).mHplmnSd & 0x000000ff;
encoded_size++;
if (S_NSSAI.at(i).sd != SD_NO_VALUE) {
len_s_nssai += SD_LENGTH;
*(buf + encoded_size) = (S_NSSAI.at(i).sd & 0x00ff0000) >> 16;
encoded_size++;
Logger::nas_mm().debug(
"Encoded NSSAI SD first octet (%x)", *(buf + encoded_size - 1));
*(buf + encoded_size) = (S_NSSAI.at(i).sd & 0x0000ff00) >> 8;
encoded_size++;
Logger::nas_mm().debug(
"Encoded NSSAI SD second octet (%x)", *(buf + encoded_size - 1));
*(buf + encoded_size) = S_NSSAI.at(i).sd & 0x000000ff;
encoded_size++;
Logger::nas_mm().debug(
"Encoded NSSAI SD third octet (%x)", *(buf + encoded_size - 1));
}
if (S_NSSAI.at(i).mHplmnSst != -1) {
len_s_nssai += SST_LENGTH;
*(buf + encoded_size) = S_NSSAI.at(i).mHplmnSst;
encoded_size++;
}
if (S_NSSAI.at(i).mHplmnSd != SD_NO_VALUE) {
len_s_nssai += SD_LENGTH;
*(buf + encoded_size) = (S_NSSAI.at(i).mHplmnSd & 0x00ff0000) >> 16;
encoded_size++;
*(buf + encoded_size) = (S_NSSAI.at(i).mHplmnSd & 0x0000ff00) >> 8;
encoded_size++;
*(buf + encoded_size) = S_NSSAI.at(i).mHplmnSd & 0x000000ff;
encoded_size++;
}
*(buf + encoded_size - len_s_nssai - 1) = len_s_nssai;
}
} else {
// *(buf + encoded_size) = length - 1; encoded_size++;
// *(buf + encoded_size) = _value; encoded_size++; encoded_size++;
*(buf + encoded_size - len_s_nssai - 1) = len_s_nssai;
}
Logger::nas_mm().debug("Encoded NSSAI len (%d)", encoded_size);
return encoded_size;
}
......@@ -227,15 +216,12 @@ int NSSAI::decodefrombuffer(uint8_t* buf, int len, bool is_option) {
} break;
}
S_NSSAI.insert(S_NSSAI.end(), a);
S_NSSAIs.insert(S_NSSAIs.end(), a);
a = {0, 0, 0, 0};
}
for (int i = 0; i < S_NSSAI.size(); i++) {
Logger::nas_mm().debug(
"Decoded NSSAI SST (0x%x) SD (0x%x) hplmnSST (0x%x) hplmnSD (%d)",
S_NSSAI.at(i).sst, S_NSSAI.at(i).sd, S_NSSAI.at(i).mHplmnSst,
S_NSSAI.at(i).mHplmnSd);
for (int i = 0; i < S_NSSAIs.size(); i++) {
Logger::nas_mm().debug("Decoded NSSAI %s", S_NSSAIs.at(i).ToString());
}
Logger::nas_mm().debug("Decoded NSSAI len (%d)", decoded_size);
return decoded_size;
......
......@@ -34,8 +34,6 @@
#include "nas_ie_header.hpp"
#define SST_LENGTH 1
#define SD_LENGTH 3
namespace nas {
class NSSAI {
......@@ -52,7 +50,7 @@ class NSSAI {
private:
uint8_t _iei;
uint8_t length;
std::vector<struct SNSSAI_s> S_NSSAI;
std::vector<struct SNSSAI_s> S_NSSAIs;
};
} // namespace nas
......
This diff is collapsed.
......@@ -32,23 +32,36 @@
#include <stdint.h>
#include "nas_ie_header.hpp"
#include <optional>
namespace nas {
class S_NSSAI {
public:
S_NSSAI();
S_NSSAI(uint8_t iei);
S_NSSAI(const uint8_t iei, SNSSAI_s snssai);
// S_NSSAI(uint8_t iei);
S_NSSAI(std::optional<uint8_t> iei, SNSSAI_s snssai);
~S_NSSAI();
void setS_NSSAI(SNSSAI_s snssai);
// void setS_NSSAI(SNSSAI_s snssai);
int encode2buffer(uint8_t* buf, int len);
int decodefrombuffer(uint8_t* buf, int len, bool is_option);
void getValue(SNSSAI_s& snssai);
int decodefrombuffer(uint8_t* buf, int len, const bool is_option = true);
void getValue(SNSSAI_t& snssai);
void SetSNSSAI(
std::optional<int8_t> iei, uint8_t sst, std::optional<int32_t> sd,
std::optional<int8_t> mapped_hplmn_sst,
std::optional<int32_t> mapped_hplmn_sd);
uint8_t GetLength();
std::string ToString();
private:
uint8_t _iei;
// uint8_t _iei;
std::optional<int8_t> iei_;
uint8_t length;
SNSSAI_s SNSSAI;
// SNSSAI_s SNSSAI;
uint8_t sst_;
std::optional<int32_t> sd_;
std::optional<int8_t> mapped_hplmn_sst_;
std::optional<int32_t> mapped_hplmn_sd_;
};
} // namespace nas
......
......@@ -32,6 +32,10 @@
#include <iostream>
#include <vector>
#include "spdlog/fmt/fmt.h"
#include "3gpp_23.003.h"
extern "C" {
#include "TLVDecoder.h"
#include "TLVEncoder.h"
......@@ -55,6 +59,26 @@ typedef struct SNSSAI_s {
length = s.length;
return *this;
}
std::string ToString() {
std::string s;
s.append(fmt::format("SST {:#x}", sst));
if (length >= (SST_LENGTH + SD_LENGTH)) {
s.append(fmt::format(" SD {:#x}", sd));
}
if ((length == (SST_LENGTH + SST_LENGTH)) ||
(length >= (SST_LENGTH + SD_LENGTH + SST_LENGTH))) {
s.append(fmt::format(" M-HPLMN SST {:#x}", mHplmnSst));
}
if (length == (SST_LENGTH + SD_LENGTH + SST_LENGTH + SD_LENGTH)) {
s.append(fmt::format(" M-HPLMN SD {:#x}", mHplmnSd));
}
return s;
}
} SNSSAI_t;
typedef struct {
......@@ -62,15 +86,18 @@ typedef struct {
uint8_t ie_len;
bstring ie_value;
} IE_t;
typedef struct {
uint8_t ie_type;
uint16_t ie_len;
bstring ie_value;
} IE_t_E;
typedef struct {
uint8_t payloadContainerType : 4;
std::vector<IE_t> optionalIE;
} PayloadContainerEntry;
typedef struct IMEISV_s {
bstring identity;
} IMEISV_t;
......
......@@ -19,13 +19,6 @@
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "ULNASTransport.hpp"
#include "3gpp_ts24501.hpp"
......@@ -137,7 +130,7 @@ uint8_t ULNASTransport::getRequestType() {
//------------------------------------------------------------------------------
void ULNASTransport::setS_NSSAI(SNSSAI_s snssai) {
ie_s_nssai = new S_NSSAI(0x22, snssai);
ie_s_nssai = new S_NSSAI(std::optional<uint8_t>{kIeiSNssai}, snssai);
}
//------------------------------------------------------------------------------
......@@ -378,7 +371,7 @@ int ULNASTransport::decodefrombuffer(
Logger::nas_mm().debug("Decoding IEI (0x22)");
ie_s_nssai = new S_NSSAI();
decoded_size += ie_s_nssai->decodefrombuffer(
buf + decoded_size, len - decoded_size, true);
buf + decoded_size, len - decoded_size, kIeIsOptional);
octet = *(buf + decoded_size);
Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} break;
......
......@@ -29,9 +29,7 @@
#define FILE_TLV_DECODER_SEEN
#include "bstrlib.h"
//#include "log.h"
#include "common_defs.h"
//#include "log.h"
#define IES_DECODE_U8(bUFFER, dECODED, vALUE) \
DECODE_U8(bUFFER + dECODED, vALUE, dECODED)
......
......@@ -146,6 +146,10 @@ typedef struct {
OCTET_STRING_t pduSessionResourceReleaseResponseTransfer;
} PDUSessionResourceReleasedItem_t;
typedef struct {
uint8_t pduSessionId;
} PDUSessionResourceCxtRelCplItem_t;
typedef struct {
std::string ip_address;
uint32_t gtp_teid;
......
/*
* 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
*/
#include "PDUSessionResourceItemCxtRelCpl.hpp"
namespace ngap {
//------------------------------------------------------------------------------
PDUSessionResourceItemCxtRelCpl::PDUSessionResourceItemCxtRelCpl() {}
//------------------------------------------------------------------------------
PDUSessionResourceItemCxtRelCpl::~PDUSessionResourceItemCxtRelCpl() {}
//------------------------------------------------------------------------------
void PDUSessionResourceItemCxtRelCpl::setPDUSessionResourceItemCxtRelCpl(
const PDUSessionID& m_pDUSessionID) {
pDUSessionID = m_pDUSessionID;
}
//------------------------------------------------------------------------------
void PDUSessionResourceItemCxtRelCpl::getPDUSessionResourceItemCxtRelCpl(
PDUSessionID& m_pDUSessionID) {
m_pDUSessionID = pDUSessionID;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceItemCxtRelCpl::encode2PDUSessionResourceItemCxtRelCpl(
Ngap_PDUSessionResourceItemCxtRelCpl_t* pduSessionResourceItemCxtRelCpl) {
if (!pDUSessionID.encode2PDUSessionID(
pduSessionResourceItemCxtRelCpl->pDUSessionID))
return false;
return true;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceItemCxtRelCpl::decodefromPDUSessionResourceItemCxtRelCpl(
Ngap_PDUSessionResourceItemCxtRelCpl_t* pduSessionResourceItemCxtRelCpl) {
pDUSessionID.setPDUSessionID(pduSessionResourceItemCxtRelCpl->pDUSessionID);
return true;
}
} // namespace ngap
/*
* 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
*/
#ifndef _PDU_SESSION_RESOURCE_ITEM_REL_CPL_H_
#define _PDU_SESSION_RESOURCE_ITEM_REL_CPL_H_
#include "PDUSessionID.hpp"
extern "C" {
#include "Ngap_PDUSessionResourceItemCxtRelCpl.h"
}
namespace ngap {
class PDUSessionResourceItemCxtRelCpl {
public:
PDUSessionResourceItemCxtRelCpl();
virtual ~PDUSessionResourceItemCxtRelCpl();
void setPDUSessionResourceItemCxtRelCpl(const PDUSessionID& m_pDUSessionID);
void getPDUSessionResourceItemCxtRelCpl(PDUSessionID& m_pDUSessionID);
bool encode2PDUSessionResourceItemCxtRelCpl(
Ngap_PDUSessionResourceItemCxtRelCpl_t* pduSessionResourceItemCxtRelCpl);
bool decodefromPDUSessionResourceItemCxtRelCpl(
Ngap_PDUSessionResourceItemCxtRelCpl_t* pduSessionResourceItemCxtRelCpl);
private:
PDUSessionID pDUSessionID;
// OCTET_STRING_t pDUSessionResourceReleaseResponseTransfer;
};
} // namespace ngap
#endif
/*
* 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
*/
#include "PDUSessionResourceListCxtRelCpl.hpp"
namespace ngap {
//------------------------------------------------------------------------------
PDUSessionResourceListCxtRelCpl::PDUSessionResourceListCxtRelCpl() {}
//------------------------------------------------------------------------------
PDUSessionResourceListCxtRelCpl::~PDUSessionResourceListCxtRelCpl() {}
//------------------------------------------------------------------------------
void PDUSessionResourceListCxtRelCpl::setPDUSessionResourceListCxtRelCpl(
const std::vector<PDUSessionResourceItemCxtRelCpl>& list) {
cxtRelCplList = list;
}
//------------------------------------------------------------------------------
void PDUSessionResourceListCxtRelCpl::getPDUSessionResourceListCxtRelCpl(
std::vector<PDUSessionResourceItemCxtRelCpl>& list) {
list = cxtRelCplList;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceListCxtRelCpl::encode2PDUSessionResourceListCxtRelCpl(
Ngap_PDUSessionResourceListCxtRelCpl_t* pduSessionResourceListCxtRelCpl) {
for (auto& cxtRelCpl : cxtRelCplList) {
Ngap_PDUSessionResourceItemCxtRelCpl_t* item =
(Ngap_PDUSessionResourceItemCxtRelCpl_t*) calloc(
1, sizeof(Ngap_PDUSessionResourceItemCxtRelCpl_t));
if (!item) return false;
if (!cxtRelCpl.encode2PDUSessionResourceItemCxtRelCpl(item)) return false;
if (ASN_SEQUENCE_ADD(&pduSessionResourceListCxtRelCpl->list, item) != 0)
return false;
}
return true;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceListCxtRelCpl::decodefromPDUSessionResourceListCxtRelCpl(
const Ngap_PDUSessionResourceListCxtRelCpl_t&
pduSessionResourceListCxtRelCpl) {
for (int i = 0; i < pduSessionResourceListCxtRelCpl.list.count; i++) {
PDUSessionResourceItemCxtRelCpl item = {};
if (!item.decodefromPDUSessionResourceItemCxtRelCpl(
pduSessionResourceListCxtRelCpl.list.array[i]))
return false;
cxtRelCplList.push_back(item);
}
return true;
}
} // namespace ngap
/*
* 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
*/
#ifndef _PDU_SESSION_RESOURCE_LIST_CXT_REL_CPL_H_
#define _PDU_SESSION_RESOURCE_LIST_CXT_REL_CPL_H_
#include "PDUSessionResourceItemCxtRelCpl.hpp"
#include <vector>
extern "C" {
#include "Ngap_PDUSessionResourceItemCxtRelCpl.h"
#include "Ngap_PDUSessionResourceListCxtRelCpl.h"
}
namespace ngap {
class PDUSessionResourceListCxtRelCpl {
public:
PDUSessionResourceListCxtRelCpl();
virtual ~PDUSessionResourceListCxtRelCpl();
void setPDUSessionResourceListCxtRelCpl(
const std::vector<PDUSessionResourceItemCxtRelCpl>& list);
void getPDUSessionResourceListCxtRelCpl(
std::vector<PDUSessionResourceItemCxtRelCpl>& list);
bool encode2PDUSessionResourceListCxtRelCpl(
Ngap_PDUSessionResourceListCxtRelCpl_t* pduSessionResourceListCxtRelCpl);
bool decodefromPDUSessionResourceListCxtRelCpl(
const Ngap_PDUSessionResourceListCxtRelCpl_t&
pduSessionResourceListCxtRelCpl);
private:
std::vector<PDUSessionResourceItemCxtRelCpl> cxtRelCplList;
};
} // namespace ngap
#endif
......@@ -149,6 +149,66 @@ void UEContextReleaseCompleteMsg::getUserLocationInfoNR(
}
}
//------------------------------------------------------------------------------
void UEContextReleaseCompleteMsg::setPduSessionResourceCxtRelCplList(
const std::vector<PDUSessionResourceCxtRelCplItem_t>& list) {
std::vector<PDUSessionResourceItemCxtRelCpl> cxtRelCplList;
for (int i = 0; i < list.size(); i++) {
PDUSessionResourceItemCxtRelCpl item = {};
PDUSessionID pDUSessionID = {};
pDUSessionID.setPDUSessionID(list[i].pduSessionId);
item.setPDUSessionResourceItemCxtRelCpl(pDUSessionID);
cxtRelCplList.push_back(item);
}
pduSessionResourceListCxtRelCpl->setPDUSessionResourceListCxtRelCpl(
cxtRelCplList);
Ngap_UEContextReleaseComplete_IEs* ie =
(Ngap_UEContextReleaseComplete_IEs*) calloc(
1, sizeof(Ngap_UEContextReleaseComplete_IEs));
ie->id = Ngap_ProtocolIE_ID_id_PDUSessionResourceListCxtRelCpl;
ie->criticality = Ngap_Criticality_reject;
ie->value.present =
Ngap_UEContextReleaseComplete_IEs__value_PR_PDUSessionResourceListCxtRelCpl;
int ret =
pduSessionResourceListCxtRelCpl->encode2PDUSessionResourceListCxtRelCpl(
&ie->value.choice.PDUSessionResourceListCxtRelCpl);
if (!ret) {
Logger::ngap().error(
"Encode NGAP PDUSessionResourceReleasedListRelRes IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&ies->protocolIEs.list, ie);
if (ret != 0)
Logger::ngap().error(
"Encode NGAP PDUSessionResourceReleasedListRelRes IE error");
}
//------------------------------------------------------------------------------
bool UEContextReleaseCompleteMsg::getPduSessionResourceCxtRelCplList(
std::vector<PDUSessionResourceCxtRelCplItem_t>& list) {
std::vector<PDUSessionResourceItemCxtRelCpl> cxtRelCplList;
pduSessionResourceListCxtRelCpl->getPDUSessionResourceListCxtRelCpl(
cxtRelCplList);
for (auto& item : cxtRelCplList) {
PDUSessionResourceCxtRelCplItem_t rel = {};
PDUSessionID pDUSessionID = {};
item.getPDUSessionResourceItemCxtRelCpl(pDUSessionID);
pDUSessionID.getPDUSessionID(rel.pduSessionId);
list.push_back(rel);
}
return true;
}
//------------------------------------------------------------------------------
bool UEContextReleaseCompleteMsg::decodeFromPdu(Ngap_NGAP_PDU_t* ngapMsgPdu) {
ngapPdu = ngapMsgPdu;
......@@ -208,7 +268,28 @@ bool UEContextReleaseCompleteMsg::decodeFromPdu(Ngap_NGAP_PDU_t* ngapMsgPdu) {
} break;
// TODO: User Location Information
// TODO: Information on Recommended Cells and RAN Nodes for Paging
// TODO: PDU Session Resource List
case Ngap_ProtocolIE_ID_id_PDUSessionResourceListCxtRelCpl: {
if (ies->protocolIEs.list.array[i]->criticality ==
Ngap_Criticality_reject &&
ies->protocolIEs.list.array[i]->value.present ==
Ngap_UEContextReleaseComplete_IEs__value_PR_PDUSessionResourceListCxtRelCpl) {
pduSessionResourceListCxtRelCpl =
new PDUSessionResourceListCxtRelCpl();
if (!pduSessionResourceListCxtRelCpl
->decodefromPDUSessionResourceListCxtRelCpl(
ies->protocolIEs.list.array[i]
->value.choice.PDUSessionResourceListCxtRelCpl)) {
Logger::ngap().error(
"Decode NGAP PDUSessionResourceListCxtRelCpl IE error");
return false;
}
} else {
Logger::ngap().error(
"Decode NGAP PDUSessionResourceListCxtRelCpl IE error");
return false;
}
} break;
// TODO: Criticality Diagnostics
default: {
......
......@@ -24,6 +24,7 @@
#include "NgapUEMessage.hpp"
#include "UserLocationInformation.hpp"
#include "PDUSessionResourceListCxtRelCpl.hpp"
extern "C" {
#include "Ngap_UEContextReleaseComplete.h"
......@@ -44,13 +45,18 @@ class UEContextReleaseCompleteMsg : public NgapUEMessage {
void setUserLocationInfoNR(const NrCgi_t& cig, const Tai_t& tai);
void getUserLocationInfoNR(NrCgi_t& cig, Tai_t& tai);
void setPduSessionResourceCxtRelCplList(
const std::vector<PDUSessionResourceCxtRelCplItem_t>& list);
bool getPduSessionResourceCxtRelCplList(
std::vector<PDUSessionResourceCxtRelCplItem_t>& list);
private:
Ngap_UEContextReleaseComplete_t* ies;
// AMF_UE_NGAP_ID //Mandatory
// RAN_UE_NGAP_ID //Mandatory
UserLocationInformation* userLocationInformation; // Optional
// TODO: Information on Recommended Cells and RAN Nodes for Paging (Optional)
// TODO: PDU Session Resource List (Optional)
PDUSessionResourceListCxtRelCpl* pduSessionResourceListCxtRelCpl; // Optional
// TODO: Criticality Diagnostics (Optional)
};
......
......@@ -32,9 +32,9 @@
#include "PduSessionResourceModifyResponse.hpp"
#include "amf_app.hpp"
#include "amf_n1.hpp"
#include "amf_n11.hpp"
#include "amf_sbi.hpp"
#include "itti.hpp"
#include "itti_msg_n11.hpp"
#include "itti_msg_sbi.hpp"
#include "itti_msg_n2.hpp"
#include "logger.hpp"
#include "nas_context.hpp"
......@@ -166,9 +166,9 @@ int ngap_amf_handle_initial_context_setup_response(
transferIe, list[0].pduSessionResourceSetupResponseTransfer.size);
Logger::ngap().debug(
"Sending ITTI Initial Context Setup Response to TASK_AMF_N11");
"Sending ITTI Initial Context Setup Response to TASK_AMF_SBI");
itti_nsmf_pdusession_update_sm_context* itti_msg =
new itti_nsmf_pdusession_update_sm_context(TASK_NGAP, TASK_AMF_N11);
new itti_nsmf_pdusession_update_sm_context(TASK_NGAP, TASK_AMF_SBI);
itti_msg->pdu_session_id = list[0].pduSessionId;
itti_msg->n2sm = n2sm;
itti_msg->is_n2sm_set = true;
......@@ -181,7 +181,7 @@ int ngap_amf_handle_initial_context_setup_response(
int ret = itti_inst->send_msg(i);
if (0 != ret) {
Logger::ngap().error(
"Could not send ITTI message %s to task TASK_AMF_N11",
"Could not send ITTI message %s to task TASK_AMF_SBI",
i->get_msg_name());
}
return 0;
......@@ -205,7 +205,8 @@ int ngap_amf_handle_ue_radio_cap_indication(
UeRadioCapabilityInfoIndicationMsg* ueRadioCap =
new UeRadioCapabilityInfoIndicationMsg();
if (!ueRadioCap->decodeFromPdu(message_p)) {
Logger::ngap().error("Decoding UEContextReleaseRequest message error");
Logger::ngap().error(
"Decoding UE Radio Capability Indication message error");
return RETURNerror;
}
itti_ue_radio_capability_indication* itti_msg =
......@@ -310,10 +311,10 @@ int ngap_amf_handle_pdu_session_resource_release_response(
bstring n2sm = blk2bstr(
transferIe, list[0].pduSessionResourceReleaseResponseTransfer.size);
Logger::ngap().debug(
"Sending ITTI PDUSessionResourceReleaseResponse to TASK_AMF_N11");
"Sending ITTI PDUSessionResourceReleaseResponse to TASK_AMF_SBI");
itti_nsmf_pdusession_update_sm_context* itti_msg =
new itti_nsmf_pdusession_update_sm_context(TASK_NGAP, TASK_AMF_N11);
new itti_nsmf_pdusession_update_sm_context(TASK_NGAP, TASK_AMF_SBI);
itti_msg->pdu_session_id = list[0].pduSessionId;
itti_msg->n2sm = n2sm;
itti_msg->is_n2sm_set = true;
......@@ -326,7 +327,7 @@ int ngap_amf_handle_pdu_session_resource_release_response(
int ret = itti_inst->send_msg(i);
if (0 != ret) {
Logger::ngap().error(
"Could not send ITTI message %s to task TASK_AMF_N11",
"Could not send ITTI message %s to task TASK_AMF_SBI",
i->get_msg_name());
}
return 0;
......@@ -359,7 +360,7 @@ int ngap_amf_handle_pdu_session_resource_setup_response(
bstring n2sm = blk2bstr(
transferIe, list[0].pduSessionResourceSetupResponseTransfer.size);
itti_nsmf_pdusession_update_sm_context* itti_msg =
new itti_nsmf_pdusession_update_sm_context(TASK_NGAP, TASK_AMF_N11);
new itti_nsmf_pdusession_update_sm_context(TASK_NGAP, TASK_AMF_SBI);
long amf_ue_ngap_id = pduresp->getAmfUeNgapId();
if (!amf_n1_inst->is_amf_ue_id_2_nas_context(amf_ue_ngap_id)) {
Logger::ngap().error(
......@@ -381,7 +382,7 @@ int ngap_amf_handle_pdu_session_resource_setup_response(
int ret = itti_inst->send_msg(i);
if (0 != ret) {
Logger::ngap().error(
"Could not send ITTI message %s to task TASK_AMF_N11",
"Could not send ITTI message %s to task TASK_AMF_SBI",
i->get_msg_name());
}
return 0;
......@@ -495,11 +496,11 @@ int ngap_amf_handle_pdu_session_resource_modify_response(
buf, response_item.pduSessionResourceModifyResponseTransfer.size);
Logger::ngap().debug(
"Sending ITTI PDUSessionResourceModifyResponseTransfer to "
"TASK_AMF_N11");
"TASK_AMF_SBI");
std::shared_ptr<itti_nsmf_pdusession_update_sm_context> itti_msg =
std::make_shared<itti_nsmf_pdusession_update_sm_context>(
TASK_NGAP, TASK_AMF_N11);
TASK_NGAP, TASK_AMF_SBI);
itti_msg->pdu_session_id = response_item.pduSessionId;
itti_msg->n2sm = n2sm;
itti_msg->is_n2sm_set = true;
......@@ -510,7 +511,7 @@ int ngap_amf_handle_pdu_session_resource_modify_response(
int ret = itti_inst->send_msg(itti_msg);
if (0 != ret) {
Logger::ngap().error(
"Could not send ITTI message %s to task TASK_AMF_N11",
"Could not send ITTI message %s to task TASK_AMF_SBI",
itti_msg->get_msg_name());
}
}
......
......@@ -124,15 +124,15 @@ int main(int argc, char** argv) {
Logger::amf_app().debug("Initiating AMF server endpoints");
// AMF HTTP1 server
Pistache::Address addr(
std::string(inet_ntoa(*((struct in_addr*) &amf_cfg.n11.addr4))),
Pistache::Port(amf_cfg.n11.port));
std::string(inet_ntoa(*((struct in_addr*) &amf_cfg.sbi.addr4))),
Pistache::Port(amf_cfg.sbi.port));
amf_api_server_1 = new AMFApiServer(addr, amf_app_inst);
amf_api_server_1->init(2);
// std::thread amf_http1_manager(&AMFApiServer::start, amf_api_server_1);
amf_api_server_1->start();
// AMF HTTP2 server
amf_api_server_2 = new amf_http2_server(
conv::toString(amf_cfg.n11.addr4), amf_cfg.sbi_http2_port, amf_app_inst);
conv::toString(amf_cfg.sbi.addr4), amf_cfg.sbi_http2_port, amf_app_inst);
amf_api_server_2->init(1);
// std::thread amf_http2_manager(&amf_http2_server::start, amf_api_server_2);
amf_api_server_2->start();
......
......@@ -15,7 +15,7 @@
#include "itti.hpp"
#include "amf_app.hpp"
#include "amf_n11.hpp"
#include "amf_sbi.hpp"
#include "pdu_session_context.hpp"
#include "conversions.hpp"
#include "comUt.hpp"
......
......@@ -66,8 +66,8 @@ void SubscriptionsCollectionDocumentApiImplEventExposure::create_subscription(
if (sub_id != -1) {
std::string location =
std::string(inet_ntoa(*((struct in_addr*) &amf_cfg.n11.addr4))) + ":" +
std::to_string(amf_cfg.n11.port) + base + amf_cfg.sbi_api_version +
std::string(inet_ntoa(*((struct in_addr*) &amf_cfg.sbi.addr4))) + ":" +
std::to_string(amf_cfg.sbi.port) + base + amf_cfg.sbi_api_version +
"/namf-evts/" + std::to_string(sub_id);
json_data["subscriptionId"] = location;
......
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