Commit 328ca05c authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Merge branch 'pre_release' into 'develop'

Code Cleanup

See merge request oai/cn5g/oai-cn5g-smf!15
parents c9ab2b62 a7507ffb
......@@ -19,8 +19,6 @@ openair-cn5g-smf
├── common: Common header files
│   ├── msg: ITTI messages definitions.
│   └── utils: Common utilities.
├── gtpv1u: Generic GTPV1-U stack implementation.
├── gtpv2c: Generic GTPV2-C stack implementation.
├── itti: Inter task interface.
├── nas: NAS protocol implememtation.
├── ngap: NGAP protocol implememtation.
......
......@@ -91,8 +91,7 @@ COPY --from=oai-smf-builder /usr/local/lib/libpistache.so /usr/local/lib/
COPY --from=oai-smf-builder /usr/local/lib/libnghttp2_asio.so.1 /usr/local/lib/
COPY --from=oai-smf-builder /usr/lib/x86_64-linux-gnu/libboost_system.so.1.65.1 /usr/lib/x86_64-linux-gnu/
COPY --from=oai-smf-builder /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.65.1 /usr/lib/x86_64-linux-gnu/
COPY --from=oai-smf-builder /openair-smf/build/smf/build/libNAS.so /usr/local/lib/
COPY --from=oai-smf-builder /openair-smf/build/smf/build/libSMF_API.so /usr/local/lib/
COPY --from=oai-smf-builder /openair-smf/build/smf/build/nas/libNAS.so /usr/local/lib/
RUN ldconfig
# Copying template configuration files
......
set(SMF_API_SERVER_DIR "${SRC_TOP_DIR}/api-server")
include_directories(${SMF_API_SERVER_DIR}/api)
include_directories(${SMF_API_SERVER_DIR}/impl)
include_directories(${SMF_API_SERVER_DIR}/model)
include_directories(${SMF_API_SERVER_DIR}/)
include_directories(${SRC_TOP_DIR}/utils/bstr)
include_directories(${SRC_TOP_DIR}/smf_app)
include_directories(${SRC_TOP_DIR}/itti)
include_directories(${SRC_TOP_DIR}/common)
include_directories(${SRC_TOP_DIR}/common/msg)
include_directories(${SRC_TOP_DIR}/common/utils)
include_directories(${SRC_TOP_DIR}/common/nas)
include_directories(${SRC_TOP_DIR}/common/ngap)
include_directories(${SRC_TOP_DIR}/pfcp)
include_directories(${SRC_TOP_DIR}/nas/ies)
include_directories(${SRC_TOP_DIR}/nas/sm/msg)
include_directories(${SRC_TOP_DIR}/ngap/asn1c)
include_directories(${SRC_TOP_DIR}/ngap/ies)
include_directories(${SRC_TOP_DIR}/udp)
include_directories(${SRC_TOP_DIR}/../build/ext/spdlog/include)
file(GLOB SMF_API_SERVER_src_files
${SMF_API_SERVER_DIR}/smf-http2-server.cpp
${SMF_API_SERVER_DIR}/smf-api-server.cpp
${SMF_API_SERVER_DIR}/model/*.cpp
${SMF_API_SERVER_DIR}/api/*.cpp
${SMF_API_SERVER_DIR}/impl/*.cpp
)
add_library(SMF_API STATIC
${SMF_API_SERVER_src_files})
\ No newline at end of file
......@@ -220,10 +220,13 @@ void IndividualSMContextApiImpl::update_sm_context(
response.headers().add<Pistache::Http::Header::ContentType>(
Pistache::Http::Mime::MediaType(
"multipart/related; boundary=" + std::string(CURL_MIME_BOUNDARY)));
} else {
} else if (json_data.size() > 0 ){
response.headers().add<Pistache::Http::Header::ContentType>(
Pistache::Http::Mime::MediaType("application/json"));
body = json_data.dump().c_str();
} else {
response.send(Pistache::Http::Code(sm_context_response.get_http_code()));
return;
}
response.send(Pistache::Http::Code(sm_context_response.get_http_code()),
......
......@@ -38,8 +38,7 @@
#include <stdint.h>
#include <string>
extern const char *interface_type2char[];
//extern const char *interface_type2char[];
namespace gtpv2c {
struct gtpc_exception : public std::exception {
......@@ -1337,6 +1336,49 @@ struct interface_type_s {
//------------------------------------------------------------------------------
std::string toString() const {
const char* interface_type2char[40] = {
"S1_U_ENODEB_GTP_U",
"S1_U_SGW_GTP_U",
"S12_RNC_GTP_U",
"S12_SGW_GTP_U",
"S5_S8_SGW_GTP_U",
"S5_S8_PGW_GTP_U",
"S5_S8_SGW_GTP_C",
"S5_S8_PGW_GTP_C",
"S5_S8_SGW_PMIPv6",
"S5_S8_PGW_PMIPv6",
"S11_MME_GTP_C",
"S11_S4_SGW_GTP_C",
"S10_MME_GTP_C",
"S3_MME_GTP_C",
"S3_SGSN_GTP_C",
"S4_SGSN_GTP_U",
"S4_SGW_GTP_U",
"S4_SGSN_GTP_C",
"S16_SGSN_GTP_C",
"ENODEB_GTP_U_DL_DATA_FORWARDING",
"ENODEB_GTP_U_UL_DATA_FORWARDING",
"RNC_GTP_U_DATA_FORWARDING",
"SGSN_GTP_U_DATA_FORWARDING",
"SGW_UPF_GTP_U_DL_DATA_FORWARDING",
"SM_MBMS_GW_GTP_C",
"SN_MBMS_GW_GTP_C",
"SM_MME_GTP_C",
"SN_SGSN_GTP_C",
"SGW_GTP_U_UL_DATA_FORWARDING",
"SN_SGSN_GTP_U",
"S2B_EPDG_GTP_C",
"S2B_U_EPDG_GTP_U",
"S2B_PGW_GTP_C",
"S2B_U_PGW_GTP_U",
"S2A_TWAN_GTP_U",
"S2A_TWAN_GTP_C",
"S2A_PGW_GTP_C",
"S2A_PGW_GTP_U",
"S11_MME_GTP_U",
"S11_SGW_GTP_U"};
if ((interface_type >= INTERFACE_TYPE_MIN)
&& (interface_type <= INTERFACE_TYPE_MAX)) {
return std::string(interface_type2char[interface_type]);
......
......@@ -18,13 +18,14 @@
# For more information about the OpenAirInterface (OAI) Software Alliance:
# contact@openairinterface.org
################################################################################
set(ITTI_DIR ${CMAKE_CURRENT_SOURCE_DIR}/itti)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/itti)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/msg)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/nas)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ngap)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/utils)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
include_directories(${SRC_TOP_DIR}/../build/ext/spdlog/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
add_library(3GPP_COMMON_TYPES STATIC
${CMAKE_CURRENT_SOURCE_DIR}/logger.cpp
......
......@@ -56,8 +56,6 @@ void Logger::_init(const char *app, const bool log_stdout,
ss << "[%Y-%m-%dT%H:%M:%S.%f] [" << app << "] [%n] [%l] %v";
m_async_cmd = new _Logger("async_c ", m_sinks, ss.str().c_str());
m_gtpv1_u = new _Logger("gtpv1_u ", m_sinks, ss.str().c_str());
m_gtpv2_c = new _Logger("gtpv2_c ", m_sinks, ss.str().c_str());
m_itti = new _Logger("itti ", m_sinks, ss.str().c_str());
m_smf_app = new _Logger("smf_app ", m_sinks, ss.str().c_str());
m_system = new _Logger("system ", m_sinks, ss.str().c_str());
......
......@@ -89,12 +89,6 @@ class Logger {
static _Logger& async_cmd() {
return *singleton().m_async_cmd;
}
static _Logger& gtpv1_u() {
return *singleton().m_gtpv1_u;
}
static _Logger& gtpv2_c() {
return *singleton().m_gtpv2_c;
}
static _Logger& itti() {
return *singleton().m_itti;
}
......@@ -146,8 +140,6 @@ class Logger {
std::string m_pattern;
_Logger *m_async_cmd;
_Logger *m_gtpv1_u;
_Logger *m_gtpv2_c;
_Logger *m_itti;
_Logger *m_smf_app;
_Logger *m_system;
......
This diff is collapsed.
This diff is collapsed.
################################################################################
# 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
################################################################################
add_library(GTPV2C STATIC
3gpp_29.274.cpp
gtpv2c.cpp
)
include_directories(${SRC_TOP_DIR}/common)
include_directories(${SRC_TOP_DIR}/common/msg)
include_directories(${SRC_TOP_DIR}/common/utils)
include_directories(${SRC_TOP_DIR}/gtpv2c)
include_directories(${SRC_TOP_DIR}/itti)
include_directories(${SRC_TOP_DIR}/udp)
include_directories(${SRC_TOP_DIR}/../build/ext/spdlog/include)
This diff is collapsed.
/*
* 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
*/
/*! \file gtpv2c.hpp
\brief
\author Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#ifndef FILE_GTPV2C_HPP_SEEN
#define FILE_GTPV2C_HPP_SEEN
#include "3gpp_29.274.hpp"
#include "endpoint.hpp"
#include "itti.hpp"
#include "udp.hpp"
#include "uint_generator.hpp"
#include <iostream>
#include <map>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "msg_gtpv2c.hpp"
namespace gtpv2c {
static const uint16_t default_port = 2123;
class gtpv2c_procedure {
public:
std::shared_ptr<gtpv2c_msg> retry_msg;
endpoint remote_endpoint;
teid_t local_teid; // for peer not responding
timer_id_t retry_timer_id;
timer_id_t proc_cleanup_timer_id;
uint64_t gtpc_tx_id;
uint8_t initial_msg_type; // sent or received
uint8_t triggered_msg_type; // sent or received
uint8_t retry_count;
// Could add customized N3, and customized T3:
// T3-RESPONSE timer and N3-REQUESTS counter setting is implementation
// dependent. That is, the timers and counters may be configurable per procedure. Multileg communications (e.g. Create
// Session Requests and Responses) however require longer timer values and possibly a higher number of retransmission
// attempts compared to single leg communication.
gtpv2c_procedure() :
retry_msg(),
remote_endpoint(),
local_teid(0),
retry_timer_id(0),
proc_cleanup_timer_id(0),
gtpc_tx_id(0),
initial_msg_type(0),
triggered_msg_type(0),
retry_count(0) {}
gtpv2c_procedure(const gtpv2c_procedure& p) :
retry_msg(p.retry_msg),
remote_endpoint(p.remote_endpoint),
local_teid(p.local_teid),
retry_timer_id(p.retry_timer_id),
proc_cleanup_timer_id(p.proc_cleanup_timer_id),
gtpc_tx_id(p.gtpc_tx_id),
initial_msg_type(p.initial_msg_type),
triggered_msg_type(p.triggered_msg_type),
retry_count(p.retry_count) {}
};
enum gtpv2c_transaction_action {
DELETE_TX = 0,
CONTINUE_TX
};
class gtpv2c_stack : public udp_application {
#define GTPV2C_T3_RESPONSE_MS 1000
#define GTPV2C_N3_REQUESTS 3
#define GTPV2C_PROC_TIME_OUT_MS ((GTPV2C_T3_RESPONSE_MS) * (GTPV2C_N3_REQUESTS + 1) + 1000)
protected:
uint32_t id;
udp_server udp_s;
udp_server udp_s_allocated;
// seems no need for atomic
uint32_t seq_num;
std::mutex m_seq_num;
uint32_t restart_counter;
std::map<uint64_t, uint32_t> gtpc_tx_id2seq_num;
std::map<timer_id_t, uint32_t> proc_cleanup_timers;
std::map<timer_id_t, uint32_t> msg_out_retry_timers;
std::map<uint32_t , gtpv2c_procedure> pending_procedures;
static const char* msg_type2cstr[256];
uint32_t get_next_seq_num();
static uint64_t generate_gtpc_tx_id() {
return util::uint_uid_generator<uint64_t>::get_instance().get_uid();
}
static bool check_initial_message_type(const uint8_t initial);
static bool check_triggered_message_type(const uint8_t initial, const uint8_t triggered);
void start_proc_cleanup_timer(gtpv2c_procedure& p, uint32_t time_out_milli_seconds, const task_id_t& task_id, const uint32_t& seq_num);
void start_msg_retry_timer(gtpv2c_procedure& p, uint32_t time_out_milli_seconds, const task_id_t& task_id, const uint32_t& seq_num);
void stop_msg_retry_timer(gtpv2c_procedure& p);
void stop_msg_retry_timer(timer_id_t& t);
void stop_proc_cleanup_timer(gtpv2c_procedure& p);
void notify_ul_error(const gtpv2c_procedure& p, const cause_value_e cause);
public:
static const uint8_t version = 2;
gtpv2c_stack(const std::string& ip_address, const unsigned short port_num, const util::thread_sched_params& sched_param);
virtual void handle_receive(char* recv_buffer, const std::size_t bytes_transferred, const endpoint& r_endpoint);
virtual void notify_ul_error(const endpoint& r_endpoint, const teid_t l_teid, const cause_value_e cause, const uint64_t gtpc_tx_id);
void handle_receive_message_cb(const gtpv2c_msg& msg, const endpoint& r_endpoint, const task_id_t& task_id, bool& error, uint64_t& gtpc_tx_id);
// Path mangement messages
virtual uint32_t send_initial_message(const endpoint& r_endpoint, const gtpv2c_echo_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id);
virtual void send_triggered_message(const endpoint& r_endpoint, const gtpv2c_echo_response& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a = DELETE_TX);
// Tunnel management messages
virtual uint32_t send_initial_message(const endpoint& r_endpoint, const teid_t r_teid, const teid_t l_teid, const gtpv2c_create_session_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id);
virtual uint32_t send_initial_message(const endpoint& r_endpoint, const teid_t r_teid, const teid_t l_teid, const gtpv2c_delete_session_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id);
virtual uint32_t send_initial_message(const endpoint& r_endpoint, const teid_t r_teid, const teid_t l_teid, const gtpv2c_modify_bearer_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id);
virtual uint32_t send_initial_message(const endpoint& r_endpoint, const teid_t r_teid, const teid_t l_teid, const gtpv2c_release_access_bearers_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id);
virtual uint32_t send_initial_message(const endpoint& r_endpoint, const teid_t r_teid, const teid_t l_teid, const gtpv2c_downlink_data_notification& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id);
virtual void send_triggered_message(const endpoint& r_endpoint, const teid_t teid, const gtpv2c_create_session_response& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a = DELETE_TX);
virtual void send_triggered_message(const endpoint& r_endpoint, const teid_t teid, const gtpv2c_delete_session_response& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a = DELETE_TX);
virtual void send_triggered_message(const endpoint& r_endpoint, const teid_t teid, const gtpv2c_modify_bearer_response& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a = DELETE_TX);
virtual void send_triggered_message(const endpoint& r_endpoint, const teid_t teid, const gtpv2c_release_access_bearers_response& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a = DELETE_TX);
virtual void send_triggered_message(const endpoint& r_endpoint, const teid_t teid, const gtpv2c_downlink_data_notification_acknowledge& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a = DELETE_TX);
void time_out_event(const uint32_t timer_id, const task_id_t& task_id, bool &error);
};
} // namespace gtpv2c
#endif /* FILE_GTPV2C_HPP_SEEN */
This diff is collapsed.
......@@ -34,8 +34,6 @@ typedef enum {
TASK_FIRST = 0,
TASK_ITTI_TIMER = TASK_FIRST,
TASK_ASYNC_SHELL_CMD,
TASK_GTPV1_U,
TASK_GTPV2_C,
TASK_SMF_APP,
TASK_SMF_N4,
TASK_SMF_N10,
......
################################################################################
# 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
################################################################################
#for NAS
set(NAS_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(NAS_DIR "${SRC_TOP_DIR}/nas")
include_directories(${NAS_DIR})
include_directories(${NAS_DIR}/ies)
include_directories(${NAS_DIR}/network)
include_directories(${NAS_DIR}/mm/msg)
include_directories(${NAS_DIR}/mm)
include_directories(${NAS_DIR}/mm/msg)
include_directories(${NAS_DIR}/sm)
include_directories(${NAS_DIR}/sm/msg)
include_directories(${NAS_DIR}/security)
include_directories(${SRC_TOP_DIR}/utils)
include_directories(${SRC_TOP_DIR}/utils/bstr)
include_directories(${SRC_TOP_DIR}/nas/security)
include_directories(${SRC_TOP_DIR}/common)
include_directories(${SRC_TOP_DIR}/common/nas)
include_directories(${SRC_TOP_DIR}/ngap/asn1c)
include_directories(${SRC_TOP_DIR}/ngap/ies)
include_directories(${SRC_TOP_DIR}/common)
include_directories(${SRC_TOP_DIR}/common/msg)
include_directories(${SRC_TOP_DIR}/common/utils)
include_directories(${SRC_TOP_DIR}/common/nas)
include_directories(${SRC_TOP_DIR}/common/ngap)
file(GLOB NAS_src_files
${NAS_DIR}/*.c
${NAS_DIR}/ies/*.c
......@@ -50,11 +30,14 @@ file(GLOB NAS_src_files
${SRC_TOP_DIR}/utils/obj_hashtable.c
${SRC_TOP_DIR}/utils/TLVDecoder.c
${SRC_TOP_DIR}/utils/TLVEncoder.c
${SRC_TOP_DIR}/utils/dynamic_memory_check.c
${SRC_TOP_DIR}/utils/backtrace.c
${SRC_TOP_DIR}/utils/bstr/*.c
${SRC_TOP_DIR}/utils/multipartparser.c
${SRC_TOP_DIR}/nas/security/*.c
${SRC_TOP_DIR}/common/dynamic_memory_check.c
${SRC_TOP_DIR}/common/backtrace.c
${SRC_TOP_DIR}/common/*.c
${SRC_TOP_DIR}/ngap/asn1c/*.c
${SRC_TOP_DIR}/ngap/ies/*.c
)
add_library(NAS ${NAS_DIR}/nas_message.c ${NAS_src_files} ${NETTLE_LIBRARIES} ${CRYPTO_LIBRARIES})
add_library(NAS ${NAS_src_files} ${NETTLE_LIBRARIES} ${CRYPTO_LIBRARIES})
\ No newline at end of file
......@@ -266,101 +266,45 @@ endif(STATIC_LINKING)
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../src/common ${CMAKE_CURRENT_BINARY_DIR}/common)
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../src/common/utils ${CMAKE_CURRENT_BINARY_DIR}/utils)
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../src/gtpv2c ${CMAKE_CURRENT_BINARY_DIR}/gtpv2c)
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../src/pfcp ${CMAKE_CURRENT_BINARY_DIR}/pfcp)
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../src/udp ${CMAKE_CURRENT_BINARY_DIR}/udp)
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../src/api-server ${CMAKE_CURRENT_BINARY_DIR}/api-server)
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../src/nas ${CMAKE_CURRENT_BINARY_DIR}/nas)
#ENABLE_TESTING()
#ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../src/test ${CMAKE_CURRENT_BINARY_DIR}/test)
################################################################################
# Specific part for oai_smf folder
#SMF_API
set(SMF_API_SERVER_DIR "${SRC_TOP_DIR}/api-server")
file(GLOB SMF_API_SERVER_src_files
${SMF_API_SERVER_DIR}/smf-http2-server.cpp
${SMF_API_SERVER_DIR}/smf-api-server.cpp
${SMF_API_SERVER_DIR}/model/*.cpp
${SMF_API_SERVER_DIR}/api/*.cpp
${SMF_API_SERVER_DIR}/impl/*.cpp
)
set(SMF_API_SERVER_include_files
${SMF_API_SERVER_DIR}/api
${SMF_API_SERVER_DIR}/impl
${SMF_API_SERVER_DIR}/model
${SMF_API_SERVER_DIR}
)
add_library(SMF_API ${SMF_API_SERVER_src_files})
#for NAS
set(NAS_DIR "${SRC_TOP_DIR}/nas")
file(GLOB NAS_src_files
${NAS_DIR}/*.c
${NAS_DIR}/ies/*.c
${NAS_DIR}/network/*.c
${NAS_DIR}/mm/msg/*.c
${NAS_DIR}/mm/*.c
${NAS_DIR}/sm/*.c
${NAS_DIR}/sm/msg/*.c
${SRC_TOP_DIR}/utils/conversions.c
${SRC_TOP_DIR}/utils/pid_file.c
${SRC_TOP_DIR}/utils/hashtable.c
${SRC_TOP_DIR}/utils/obj_hashtable.c
${SRC_TOP_DIR}/utils/TLVDecoder.c
${SRC_TOP_DIR}/utils/TLVEncoder.c
${SRC_TOP_DIR}/utils/dynamic_memory_check.c
${SRC_TOP_DIR}/utils/backtrace.c
${SRC_TOP_DIR}/utils/bstr/*.c
${SRC_TOP_DIR}/utils/multipartparser.c
${SRC_TOP_DIR}/nas/security/*.c
${SRC_TOP_DIR}/common/*.c
${SRC_TOP_DIR}/ngap/asn1c/*.c
${SRC_TOP_DIR}/ngap/ies/*.c
)
set(NAS_include_files
${NAS_DIR}/ies
${NAS_DIR}/network
${NAS_DIR}/mm
${NAS_DIR}/mm/msg
${NAS_DIR}/sm
${NAS_DIR}/sm/msg
${NAS_DIR}
${NAS_DIR}/security
${SRC_TOP_DIR}/utils
${SRC_TOP_DIR}/utils/bstr
${SRC_TOP_DIR}/ngap/asn1c
${SRC_TOP_DIR}/ngap/ies
${SRC_TOP_DIR}/common
)
add_library(NAS ${NAS_src_files} ${NETTLE_LIBRARIES} ${CRYPTO_LIBRARIES})
set(NGAP_include_files
${SRC_TOP_DIR}/ngap/asn1c
${SRC_TOP_DIR}/ngap/ies
${SRC_TOP_DIR}/common/ngap
)
add_definitions("-DPACKAGE_NAME=\"SMF\"")
include_directories(${SRC_TOP_DIR}/smf_app)
include_directories(${SRC_TOP_DIR}/oai_smf)
include_directories(${SRC_TOP_DIR}/common)
include_directories(${SRC_TOP_DIR}/itti)
include_directories(${SRC_TOP_DIR}/common)
include_directories(${SRC_TOP_DIR}/common/msg)
include_directories(${SRC_TOP_DIR}/common/nas)
include_directories(${SRC_TOP_DIR}/common/ngap)
include_directories(${SRC_TOP_DIR}/common/utils)
include_directories(${SRC_TOP_DIR}/gtpv2c)
include_directories(${SRC_TOP_DIR}/pfcp)
include_directories(${SRC_TOP_DIR}/udp)
include_directories(${SRC_TOP_DIR}/../build/ext/spdlog/include)
include_directories(${SMF_API_SERVER_include_files})
include_directories(${NAS_include_files})
include_directories(${NGAP_include_files})
include_directories(${SRC_TOP_DIR}/api-server)
include_directories(${SRC_TOP_DIR}/api-server/api)
include_directories(${SRC_TOP_DIR}/api-server/impl)
include_directories(${SRC_TOP_DIR}/api-server/model)
include_directories(${SRC_TOP_DIR}/nas)
include_directories(${SRC_TOP_DIR}/nas/ies)
include_directories(${SRC_TOP_DIR}/nas/mm)
include_directories(${SRC_TOP_DIR}/nas/mm/msg)
include_directories(${SRC_TOP_DIR}/nas/sm)
include_directories(${SRC_TOP_DIR}/nas/sm/msg)
include_directories(${SRC_TOP_DIR}/nas/security)
include_directories(${SRC_TOP_DIR}/ngap)
include_directories(${SRC_TOP_DIR}/ngap/asn1c)
include_directories(${SRC_TOP_DIR}/ngap/ies)
include_directories(${SRC_TOP_DIR}/utils)
include_directories(${SRC_TOP_DIR}/utils/bstr)
add_executable(smf
${SRC_TOP_DIR}/oai_smf/main.cpp
......@@ -377,5 +321,5 @@ IF(STATIC_LINKING)
ENDIF(STATIC_LINKING)
target_link_libraries (smf ${ASAN}
-Wl,--start-group CN_UTILS SMF UDP GTPV2C PFCP 3GPP_COMMON_TYPES SMF_API -lnettle ${NETTLE_LIBRARIES} ${CRYPTO_LIBRARIES} -lnghttp2_asio -lboost_system -lboost_thread -lssl -lcrypto NAS gflags glog dl double-conversion folly -Wl,--end-group pthread m rt config++ event boost_system pistache curl)
-Wl,--start-group CN_UTILS SMF UDP PFCP 3GPP_COMMON_TYPES SMF_API -lnettle ${NETTLE_LIBRARIES} ${CRYPTO_LIBRARIES} -lnghttp2_asio -lboost_system -lboost_thread -lssl -lcrypto NAS gflags glog dl double-conversion folly -Wl,--end-group pthread m rt config++ event boost_system pistache curl)
\ No newline at end of file
......@@ -36,7 +36,6 @@
#include <stdlib.h> // srand
#include <unistd.h> // get_pid(), pause()
using namespace gtpv2c;
using namespace smf;
using namespace util;
using namespace std;
......
......@@ -19,7 +19,7 @@
* contact@openairinterface.org
*/
/*! \file gtpv2c.cpp
/*! \file pfcp.cpp
\brief
\author Lionel Gauthier
\company Eurecom
......
......@@ -22,14 +22,27 @@ include_directories(${SRC_TOP_DIR}/common)
include_directories(${SRC_TOP_DIR}/common/msg)
include_directories(${SRC_TOP_DIR}/common/utils)
include_directories(${SRC_TOP_DIR}/common/ngap)
include_directories(${SRC_TOP_DIR}/common/nas)
include_directories(${SRC_TOP_DIR}/itti)
include_directories(${SRC_TOP_DIR}/gtpv2c)
include_directories(${SRC_TOP_DIR}/pfcp)
include_directories(${SRC_TOP_DIR}/smf)
include_directories(${SRC_TOP_DIR}/ngap)
include_directories(${SRC_TOP_DIR}/ngap/asn1c)
include_directories(${SRC_TOP_DIR}/ngap/ies)
include_directories(${SRC_TOP_DIR}/nas)
include_directories(${SRC_TOP_DIR}/nas/ies)
include_directories(${SRC_TOP_DIR}/nas/sm/msg)
include_directories(${SRC_TOP_DIR}/nas/mm)
include_directories(${SRC_TOP_DIR}/nas/mm/msg)
include_directories(${SRC_TOP_DIR}/nas/sm)
include_directories(${SRC_TOP_DIR}/nas/sm/msg)
include_directories(${SRC_TOP_DIR}/nas/security)
include_directories(${SRC_TOP_DIR}/udp)
include_directories(${SRC_TOP_DIR}/../build/ext/spdlog/include)
include_directories(${SRC_TOP_DIR}/api-server/api)
include_directories(${SRC_TOP_DIR}/api-server/impl)
include_directories(${SRC_TOP_DIR}/api-server/model)
include_directories(${SRC_TOP_DIR}/api-server/)
add_library (SMF STATIC
${SRC_TOP_DIR}/common/ngap/ngap_common.c
......
......@@ -503,7 +503,12 @@ void smf_app::handle_itti_msg(itti_n11_create_sm_context_response &m) {
Logger::smf_app().debug(
"PDU Session Create SM Context: Set promise with ID %d to ready", m.pid);
pdu_session_create_sm_context_response sm_context_response = { };
sm_context_create_promises[m.pid]->set_value(m.res);
std::shared_lock lock(m_sm_context_create_promises);
if (sm_context_create_promises.count(m.pid) > 0 ){
sm_context_create_promises[m.pid]->set_value(m.res);
//Remove this promise from list
sm_context_create_promises.erase(m.pid);
}
}
//------------------------------------------------------------------------------
......@@ -511,7 +516,12 @@ void smf_app::handle_itti_msg(itti_n11_update_sm_context_response &m) {
Logger::smf_app().debug(
"PDU Session Update SM Context: Set promise with ID %d to ready", m.pid);
pdu_session_update_sm_context_response sm_context_response = { };
sm_context_update_promises[m.pid]->set_value(m.res);
std::shared_lock lock(m_sm_context_update_promises);
if (sm_context_update_promises.count(m.pid) > 0 ){
sm_context_update_promises[m.pid]->set_value(m.res);
//Remove this promise from list
sm_context_update_promises.erase(m.pid);
}
}
//------------------------------------------------------------------------------
......@@ -519,7 +529,12 @@ void smf_app::handle_itti_msg(itti_n11_release_sm_context_response &m) {
Logger::smf_app().debug(
"PDU Session Release SM Context: Set promise with ID %d to ready", m.pid);
pdu_session_release_sm_context_response sm_context_response = { };
sm_context_release_promises[m.pid]->set_value(m.res);
std::shared_lock lock(m_sm_context_release_promises);
if (sm_context_release_promises.count(m.pid) > 0 ){
sm_context_release_promises[m.pid]->set_value(m.res);
//Remove this promise from list
sm_context_release_promises.erase(m.pid);
}
}
//------------------------------------------------------------------------------
......@@ -762,6 +777,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
//Step 4. Verify the session is already existed
if (is_scid_2_smf_context(supi64, dnn, snssai, pdu_session_id)) {
//TODO: should delete the local context (including and any associated resources in the UPF and PCF) and create a new one
Logger::smf_app().warn(
"PDU Session already existed (SUPI " SUPI_64_FMT ", DNN %s, NSSAI (sst %d, sd %s), PDU Session ID %d)",
supi64, dnn.c_str(), snssai.sST, snssai.sD.c_str(), pdu_session_id);
......
......@@ -45,7 +45,7 @@
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include "3gpp_29.274.hpp"
//#include "3gpp_29.274.hpp"
#include "common_defs.h"
#include "epc.h"
#include "if.hpp"
......
......@@ -41,7 +41,6 @@
#include "3gpp_29.244.h"
#include "3gpp_29.274.h"
#include "gtpv2c.hpp"
#include "pfcp.hpp"
#include "smf.h"
......
......@@ -1220,14 +1220,14 @@ void smf_context::handle_pdu_session_create_sm_context_request(
bool find_pdu = sd.get()->find_pdu_session(pdu_session_id, sp);
if (nullptr == sp.get()) {
Logger::smf_app().debug("Create a new PDN connection");
Logger::smf_app().debug("Create a new PDU session");
sp = std::shared_ptr<smf_pdu_session>(new smf_pdu_session());
sp.get()->pdn_type.pdn_type = smreq->req.get_pdu_session_type();
sp.get()->pdu_session_id = pdu_session_id;
sp.get()->amf_id = smreq->req.get_serving_nf_id(); //amf id
sd->insert_pdu_session(sp);
} else {
Logger::smf_app().debug("PDN connection is already existed!");
Logger::smf_app().debug("PDU session is already existed!");
//trigger to send reply to AMF
smf_app_inst->trigger_http_response(
http_status_code_e::HTTP_STATUS_CODE_406_NOT_ACCEPTABLE, smreq->pid,
......@@ -2317,6 +2317,9 @@ void smf_context::handle_pdu_session_update_sm_context_request(
sm_context_resp_pending->session_procedure_type = procedure_type;
//don't need to create a procedure to update UPF
smf_app_inst->trigger_http_response(
http_status_code_e::HTTP_STATUS_CODE_200_OK,
smreq->pid, N11_SESSION_UPDATE_SM_CONTEXT_RESPONSE);
}
break;
......
......@@ -39,7 +39,6 @@
#include "itti.hpp"
#include "itti_msg_n4_restore.hpp"
#include "logger.hpp"
#include "msg_gtpv2c.hpp"
#include "smf_app.hpp"
#include "smf_config.hpp"
#include "smf_pfcp_association.hpp"
......
......@@ -34,13 +34,12 @@
#include <set>
#include "3gpp_29.244.hpp"
#include "3gpp_29.274.hpp"
//#include "3gpp_29.274.hpp"
#include "itti_msg_n11.hpp"
#include "itti_msg_n4.hpp"
#include "itti_msg_n4_restore.hpp"
#include "itti_msg_nx.hpp"
#include "msg_pfcp.hpp"
#include "msg_gtpv2c.hpp"
#include "uint_generator.hpp"
#include "smf_msg.hpp"
......
......@@ -1485,7 +1485,7 @@ bool pdu_session_establishment(uint8_t pid, uint8_t context_id,
bool status = false;
if (send_pdu_session_establishment_request(pid, smf_ip_address, http_version,
port)) {
usleep(100000);
//usleep(100000);
status = send_pdu_session_update_sm_context_establishment(context_id,
smf_ip_address,
http_version,
......@@ -1576,10 +1576,14 @@ void test_all_procedures_for_multiple_threads(std::string smf_ip_address,
//bool status = false;
std::thread t1(&send_pdu_session_establishment_request, pid, smf_ip_address,
/* std::thread t1(&send_pdu_session_establishment_request, pid, smf_ip_address,
http_version, port);
std::thread t2(&send_pdu_session_update_sm_context_establishment, context_id,
smf_ip_address, http_version, port);
*/
std::thread t1(&pdu_session_establishment, pid, context_id, smf_ip_address,
http_version, port);
std::thread t3(&send_pdu_session_update_sm_context_ue_service_request,
context_id, smf_ip_address, http_version, port);
std::thread t4(&send_pdu_session_update_sm_context_ue_service_request_step2,
......@@ -1602,7 +1606,7 @@ void test_all_procedures_for_multiple_threads(std::string smf_ip_address,
//send_release_sm_context_request(pid, smf_ip_address, http_version, port);
t1.join();
t2.join();
// t2.join();
t3.join();
t4.join();
t5.join();
......@@ -1662,11 +1666,11 @@ int main(int argc, char *argv[]) {
uint8_t context_id = 1;
uint8_t pid = 1;
test_all_procedures_for_one_session(pid, context_id, smf_ip_address,
http_version, port);
//test_all_procedures_for_one_session(pid, context_id, smf_ip_address,
// http_version, port);
//test_session_establishment_multiple_threads(smf_ip_address, http_version, port);
//test_all_procedures_for_multiple_threads(smf_ip_address, http_version,
// port);
test_all_procedures_for_multiple_threads(smf_ip_address, http_version,
port);
return 0;
}
......@@ -22,15 +22,10 @@ include_directories(${SRC_TOP_DIR}/common)
include_directories(${SRC_TOP_DIR}/common/msg)
include_directories(${SRC_TOP_DIR}/common/utils)
include_directories(${SRC_TOP_DIR}/itti)
include_directories(${SRC_TOP_DIR}/gtpv1u)
include_directories(${SRC_TOP_DIR}/gtpv2c)
include_directories(${SRC_TOP_DIR}/pfcp)
include_directories(${SRC_TOP_DIR}/udp)
include_directories(${SRC_TOP_DIR}/../build/ext/spdlog/include)
add_library (UDP STATIC
udp.cpp
)
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