Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-SMF
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-SMF
Commits
682223fb
Commit
682223fb
authored
Feb 23, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace N11/N10 by SBI
parent
fe06e1a6
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
160 additions
and
164 deletions
+160
-164
src/api-server/impl/IndividualSMContextApiImpl.cpp
src/api-server/impl/IndividualSMContextApiImpl.cpp
+2
-2
src/api-server/impl/NFStatusNotifyApiImpl.cpp
src/api-server/impl/NFStatusNotifyApiImpl.cpp
+1
-1
src/api-server/impl/SMContextsCollectionApiImpl.cpp
src/api-server/impl/SMContextsCollectionApiImpl.cpp
+1
-1
src/api-server/impl/SubscriptionsCollectionApiImpl.cpp
src/api-server/impl/SubscriptionsCollectionApiImpl.cpp
+1
-1
src/api-server/smf-http2-server.cpp
src/api-server/smf-http2-server.cpp
+3
-3
src/common/logger.cpp
src/common/logger.cpp
+1
-2
src/common/logger.hpp
src/common/logger.hpp
+2
-4
src/itti/itti_msg.hpp
src/itti/itti_msg.hpp
+1
-2
src/smf_app/CMakeLists.txt
src/smf_app/CMakeLists.txt
+1
-1
src/smf_app/smf_app.cpp
src/smf_app/smf_app.cpp
+19
-19
src/smf_app/smf_context.cpp
src/smf_app/smf_context.cpp
+18
-18
src/smf_app/smf_procedure.cpp
src/smf_app/smf_procedure.cpp
+3
-3
src/smf_app/smf_sbi.cpp
src/smf_app/smf_sbi.cpp
+98
-98
src/smf_app/smf_sbi.hpp
src/smf_app/smf_sbi.hpp
+9
-9
No files found.
src/api-server/impl/IndividualSMContextApiImpl.cpp
View file @
682223fb
...
...
@@ -80,7 +80,7 @@ void IndividualSMContextApiImpl::release_sm_context(
// Handle the itti_n11_release_sm_context_request message in smf_app
std
::
shared_ptr
<
itti_n11_release_sm_context_request
>
itti_msg
=
std
::
make_shared
<
itti_n11_release_sm_context_request
>
(
TASK_SMF_
N11
,
TASK_SMF_APP
,
promise_id
,
smContextRef
);
TASK_SMF_
SBI
,
TASK_SMF_APP
,
promise_id
,
smContextRef
);
itti_msg
->
req
=
sm_context_req_msg
;
itti_msg
->
http_version
=
1
;
m_smf_app
->
handle_pdu_session_release_sm_context_request
(
itti_msg
);
...
...
@@ -133,7 +133,7 @@ void IndividualSMContextApiImpl::update_sm_context(
// Handle the itti_n11_update_sm_context_request message in smf_app
std
::
shared_ptr
<
itti_n11_update_sm_context_request
>
itti_msg
=
std
::
make_shared
<
itti_n11_update_sm_context_request
>
(
TASK_SMF_
N11
,
TASK_SMF_APP
,
promise_id
,
smContextRef
);
TASK_SMF_
SBI
,
TASK_SMF_APP
,
promise_id
,
smContextRef
);
itti_msg
->
req
=
sm_context_req_msg
;
itti_msg
->
http_version
=
1
;
m_smf_app
->
handle_pdu_session_update_sm_context_request
(
itti_msg
);
...
...
src/api-server/impl/NFStatusNotifyApiImpl.cpp
View file @
682223fb
...
...
@@ -65,7 +65,7 @@ void NFStatusNotifyApiImpl::receive_nf_status_notification(
// Handle the message in smf_app
std
::
shared_ptr
<
itti_sbi_notification_data
>
itti_msg
=
std
::
make_shared
<
itti_sbi_notification_data
>
(
TASK_SMF_
N11
,
TASK_SMF_APP
);
std
::
make_shared
<
itti_sbi_notification_data
>
(
TASK_SMF_
SBI
,
TASK_SMF_APP
);
itti_msg
->
notification_msg
=
notification_msg
;
itti_msg
->
http_version
=
1
;
...
...
src/api-server/impl/SMContextsCollectionApiImpl.cpp
View file @
682223fb
...
...
@@ -92,7 +92,7 @@ void SMContextsCollectionApiImpl::post_sm_contexts(
// Handle the pdu_session_create_sm_context_request message in smf_app
std
::
shared_ptr
<
itti_n11_create_sm_context_request
>
itti_msg
=
std
::
make_shared
<
itti_n11_create_sm_context_request
>
(
TASK_SMF_
N11
,
TASK_SMF_APP
,
promise_id
);
TASK_SMF_
SBI
,
TASK_SMF_APP
,
promise_id
);
itti_msg
->
req
=
sm_context_req_msg
;
itti_msg
->
http_version
=
1
;
m_smf_app
->
handle_pdu_session_create_sm_context_request
(
itti_msg
);
...
...
src/api-server/impl/SubscriptionsCollectionApiImpl.cpp
View file @
682223fb
...
...
@@ -74,7 +74,7 @@ void SubscriptionsCollectionApiImpl::create_individual_subcription(
// Handle the message in smf_app
std
::
shared_ptr
<
itti_sbi_event_exposure_request
>
itti_msg
=
std
::
make_shared
<
itti_sbi_event_exposure_request
>
(
TASK_SMF_
N11
,
TASK_SMF_APP
);
TASK_SMF_
SBI
,
TASK_SMF_APP
);
itti_msg
->
event_exposure
=
event_exposure
;
itti_msg
->
http_version
=
1
;
...
...
src/api-server/smf-http2-server.cpp
View file @
682223fb
...
...
@@ -345,7 +345,7 @@ void smf_http2_server::create_sm_contexts_handler(
// Handle the pdu_session_create_sm_context_request message in smf_app
std
::
shared_ptr
<
itti_n11_create_sm_context_request
>
itti_msg
=
std
::
make_shared
<
itti_n11_create_sm_context_request
>
(
TASK_SMF_
N11
,
TASK_SMF_APP
,
promise_id
);
TASK_SMF_
SBI
,
TASK_SMF_APP
,
promise_id
);
itti_msg
->
req
=
sm_context_req_msg
;
itti_msg
->
http_version
=
2
;
m_smf_app
->
handle_pdu_session_create_sm_context_request
(
itti_msg
);
...
...
@@ -410,7 +410,7 @@ void smf_http2_server::update_sm_context_handler(
// Handle the itti_n11_update_sm_context_request message in smf_app
std
::
shared_ptr
<
itti_n11_update_sm_context_request
>
itti_msg
=
std
::
make_shared
<
itti_n11_update_sm_context_request
>
(
TASK_SMF_
N11
,
TASK_SMF_APP
,
promise_id
,
smf_ref
);
TASK_SMF_
SBI
,
TASK_SMF_APP
,
promise_id
,
smf_ref
);
itti_msg
->
req
=
sm_context_req_msg
;
itti_msg
->
http_version
=
2
;
m_smf_app
->
handle_pdu_session_update_sm_context_request
(
itti_msg
);
...
...
@@ -495,7 +495,7 @@ void smf_http2_server::release_sm_context_handler(
"request from AMF."
);
std
::
shared_ptr
<
itti_n11_release_sm_context_request
>
itti_msg
=
std
::
make_shared
<
itti_n11_release_sm_context_request
>
(
TASK_SMF_
N11
,
TASK_SMF_APP
,
promise_id
,
smf_ref
);
TASK_SMF_
SBI
,
TASK_SMF_APP
,
promise_id
,
smf_ref
);
itti_msg
->
req
=
sm_context_req_msg
;
itti_msg
->
scid
=
smf_ref
;
itti_msg
->
http_version
=
2
;
...
...
src/common/logger.cpp
View file @
682223fb
...
...
@@ -63,8 +63,7 @@ void Logger::_init(
m_smf_n1
=
new
_Logger
(
"smf_n1 "
,
m_sinks
,
ss
.
str
().
c_str
());
m_smf_n2
=
new
_Logger
(
"smf_n2 "
,
m_sinks
,
ss
.
str
().
c_str
());
m_smf_n4
=
new
_Logger
(
"smf_n4 "
,
m_sinks
,
ss
.
str
().
c_str
());
m_smf_n10
=
new
_Logger
(
"smf_n10"
,
m_sinks
,
ss
.
str
().
c_str
());
m_smf_n11
=
new
_Logger
(
"smf_n11"
,
m_sinks
,
ss
.
str
().
c_str
());
m_smf_sbi
=
new
_Logger
(
"smf_sbi"
,
m_sinks
,
ss
.
str
().
c_str
());
m_smf_api_server
=
new
_Logger
(
"sbi_srv"
,
m_sinks
,
ss
.
str
().
c_str
());
}
...
...
src/common/logger.hpp
View file @
682223fb
...
...
@@ -86,8 +86,7 @@ class Logger {
static
_Logger
&
smf_n1
()
{
return
*
singleton
().
m_smf_n1
;
}
static
_Logger
&
smf_n2
()
{
return
*
singleton
().
m_smf_n2
;
}
static
_Logger
&
smf_n4
()
{
return
*
singleton
().
m_smf_n4
;
}
static
_Logger
&
smf_n10
()
{
return
*
singleton
().
m_smf_n10
;
}
static
_Logger
&
smf_n11
()
{
return
*
singleton
().
m_smf_n11
;
}
static
_Logger
&
smf_sbi
()
{
return
*
singleton
().
m_smf_sbi
;
}
static
_Logger
&
smf_api_server
()
{
return
*
singleton
().
m_smf_api_server
;
}
private:
...
...
@@ -116,8 +115,7 @@ class Logger {
_Logger
*
m_smf_n1
;
_Logger
*
m_smf_n2
;
_Logger
*
m_smf_n4
;
_Logger
*
m_smf_n10
;
_Logger
*
m_smf_n11
;
_Logger
*
m_smf_sbi
;
_Logger
*
m_smf_api_server
;
};
...
...
src/itti/itti_msg.hpp
View file @
682223fb
...
...
@@ -36,8 +36,7 @@ typedef enum {
TASK_ASYNC_SHELL_CMD
,
TASK_SMF_APP
,
TASK_SMF_N4
,
TASK_SMF_N10
,
TASK_SMF_N11
,
TASK_SMF_SBI
,
TASK_MAX
,
TASK_NONE
,
TASK_ALL
=
255
...
...
src/smf_app/CMakeLists.txt
View file @
682223fb
...
...
@@ -55,7 +55,7 @@ add_library (SMF STATIC
smf_pco.cpp
smf_procedure.cpp
smf_n4.cpp
smf_
n11
.cpp
smf_
sbi
.cpp
smf_event.cpp
smf_profile.cpp
smf_subscription.cpp
...
...
src/smf_app/smf_app.cpp
View file @
682223fb
...
...
@@ -56,7 +56,7 @@
#include "smf.h"
#include "smf_event.hpp"
#include "smf_n1.hpp"
#include "smf_
n11
.hpp"
#include "smf_
sbi
.hpp"
#include "smf_n4.hpp"
#include "smf_paa_dynamic.hpp"
#include "string.hpp"
...
...
@@ -72,7 +72,7 @@ extern util::async_shell_cmd* async_shell_cmd_inst;
extern
smf_app
*
smf_app_inst
;
extern
smf_config
smf_cfg
;
smf_n4
*
smf_n4_inst
=
nullptr
;
smf_
n11
*
smf_n11
_inst
=
nullptr
;
smf_
sbi
*
smf_sbi
_inst
=
nullptr
;
extern
itti_mw
*
itti_inst
;
void
smf_app_task
(
void
*
);
...
...
@@ -327,7 +327,7 @@ smf_app::smf_app(const std::string& config_file)
try
{
smf_n4_inst
=
new
smf_n4
();
smf_
n11_inst
=
new
smf_n11
();
smf_
sbi_inst
=
new
smf_sbi
();
}
catch
(
std
::
exception
&
e
)
{
Logger
::
smf_app
().
error
(
"Cannot create SMF_APP: %s"
,
e
.
what
());
throw
;
...
...
@@ -923,7 +923,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
if
(
not
use_local_configuration_subscription_data
(
dnn_selection_mode
))
{
Logger
::
smf_app
().
debug
(
"Retrieve Session Management Subscription data from the UDM"
);
if
(
smf_
n11
_inst
->
get_sm_data
(
supi64
,
dnn
,
snssai
,
subscription
))
{
if
(
smf_
sbi
_inst
->
get_sm_data
(
supi64
,
dnn
,
snssai
,
subscription
))
{
// update dnn_context with subscription info
sc
.
get
()
->
insert_dnn_subscription
(
snssai
,
subscription
);
}
else
{
...
...
@@ -1175,7 +1175,7 @@ void smf_app::trigger_pdu_session_modification(
std
::
shared_ptr
<
itti_nx_trigger_pdu_session_modification
>
itti_msg
=
std
::
make_shared
<
itti_nx_trigger_pdu_session_modification
>
(
TASK_SMF_APP
,
TASK_SMF_
N11
);
TASK_SMF_APP
,
TASK_SMF_
SBI
);
itti_msg
->
http_version
=
http_version
;
// step 1. collect the necessary information
...
...
@@ -1552,7 +1552,7 @@ void smf_app::timer_nrf_heartbeat_timeout(
std
::
shared_ptr
<
itti_n11_update_nf_instance_request
>
itti_msg
=
std
::
make_shared
<
itti_n11_update_nf_instance_request
>
(
TASK_SMF_APP
,
TASK_SMF_
N11
);
TASK_SMF_APP
,
TASK_SMF_
SBI
);
oai
::
smf_server
::
model
::
PatchItem
patch_item
=
{};
//{"op":"replace","path":"/nfStatus", "value": "REGISTERED"}
...
...
@@ -1565,7 +1565,7 @@ void smf_app::timer_nrf_heartbeat_timeout(
int
ret
=
itti_inst
->
send_msg
(
itti_msg
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_app
().
error
(
"Could not send ITTI message %s to task TASK_SMF_
N11
"
,
"Could not send ITTI message %s to task TASK_SMF_
SBI
"
,
itti_msg
->
get_msg_name
());
}
else
{
Logger
::
smf_app
().
debug
(
...
...
@@ -1716,7 +1716,7 @@ void smf_app::trigger_create_context_error_response(
std
::
shared_ptr
<
itti_n11_create_sm_context_response
>
itti_msg
=
std
::
make_shared
<
itti_n11_create_sm_context_response
>
(
TASK_SMF_
N11
,
TASK_SMF_APP
,
promise_id
);
TASK_SMF_
SBI
,
TASK_SMF_APP
,
promise_id
);
pdu_session_create_sm_context_response
sm_context_response
=
{};
nlohmann
::
json
json_data
=
{};
to_json
(
json_data
,
sm_context
);
...
...
@@ -1746,7 +1746,7 @@ void smf_app::trigger_update_context_error_response(
std
::
shared_ptr
<
itti_n11_update_sm_context_response
>
itti_msg
=
std
::
make_shared
<
itti_n11_update_sm_context_response
>
(
TASK_SMF_
N11
,
TASK_SMF_APP
,
promise_id
);
TASK_SMF_
SBI
,
TASK_SMF_APP
,
promise_id
);
pdu_session_update_sm_context_response
sm_context_response
=
{};
nlohmann
::
json
json_data
=
{};
to_json
(
json_data
,
smContextUpdateError
);
...
...
@@ -1776,7 +1776,7 @@ void smf_app::trigger_update_context_error_response(
std
::
shared_ptr
<
itti_n11_update_sm_context_response
>
itti_msg
=
std
::
make_shared
<
itti_n11_update_sm_context_response
>
(
TASK_SMF_
N11
,
TASK_SMF_APP
,
promise_id
);
TASK_SMF_
SBI
,
TASK_SMF_APP
,
promise_id
);
pdu_session_update_sm_context_response
sm_context_response
=
{};
nlohmann
::
json
json_data
=
{};
to_json
(
json_data
,
smContextUpdateError
);
...
...
@@ -1802,7 +1802,7 @@ void smf_app::trigger_http_response(
case
N11_SESSION_RELEASE_SM_CONTEXT_RESPONSE
:
{
std
::
shared_ptr
<
itti_n11_release_sm_context_response
>
itti_msg
=
std
::
make_shared
<
itti_n11_release_sm_context_response
>
(
TASK_SMF_
N11
,
TASK_SMF_APP
,
promise_id
);
TASK_SMF_
SBI
,
TASK_SMF_APP
,
promise_id
);
pdu_session_release_sm_context_response
sm_context_response
=
{};
sm_context_response
.
set_http_code
(
http_code
);
itti_msg
->
res
=
sm_context_response
;
...
...
@@ -1817,7 +1817,7 @@ void smf_app::trigger_http_response(
case
N11_SESSION_CREATE_SM_CONTEXT_RESPONSE
:
{
std
::
shared_ptr
<
itti_n11_create_sm_context_response
>
itti_msg
=
std
::
make_shared
<
itti_n11_create_sm_context_response
>
(
TASK_SMF_
N11
,
TASK_SMF_APP
,
promise_id
);
TASK_SMF_
SBI
,
TASK_SMF_APP
,
promise_id
);
pdu_session_create_sm_context_response
sm_context_response
=
{};
sm_context_response
.
set_http_code
(
http_code
);
itti_msg
->
res
=
sm_context_response
;
...
...
@@ -1832,7 +1832,7 @@ void smf_app::trigger_http_response(
case
N11_SESSION_UPDATE_SM_CONTEXT_RESPONSE
:
{
std
::
shared_ptr
<
itti_n11_update_sm_context_response
>
itti_msg
=
std
::
make_shared
<
itti_n11_update_sm_context_response
>
(
TASK_SMF_
N11
,
TASK_SMF_APP
,
promise_id
);
TASK_SMF_
SBI
,
TASK_SMF_APP
,
promise_id
);
pdu_session_update_sm_context_response
sm_context_response
=
{};
sm_context_response
.
set_http_code
(
http_code
);
itti_msg
->
res
=
sm_context_response
;
...
...
@@ -1989,12 +1989,12 @@ void smf_app::trigger_nf_registration_request() {
std
::
shared_ptr
<
itti_n11_register_nf_instance_request
>
itti_msg
=
std
::
make_shared
<
itti_n11_register_nf_instance_request
>
(
TASK_SMF_APP
,
TASK_SMF_
N11
);
TASK_SMF_APP
,
TASK_SMF_
SBI
);
itti_msg
->
profile
=
nf_instance_profile
;
int
ret
=
itti_inst
->
send_msg
(
itti_msg
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_app
().
error
(
"Could not send ITTI message %s to task TASK_SMF_
N11
"
,
"Could not send ITTI message %s to task TASK_SMF_
SBI
"
,
itti_msg
->
get_msg_name
());
}
}
...
...
@@ -2006,12 +2006,12 @@ void smf_app::trigger_nf_deregistration() {
std
::
shared_ptr
<
itti_n11_deregister_nf_instance
>
itti_msg
=
std
::
make_shared
<
itti_n11_deregister_nf_instance
>
(
TASK_SMF_APP
,
TASK_SMF_
N11
);
TASK_SMF_APP
,
TASK_SMF_
SBI
);
itti_msg
->
smf_instance_id
=
smf_instance_id
;
int
ret
=
itti_inst
->
send_msg
(
itti_msg
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_app
().
error
(
"Could not send ITTI message %s to task TASK_SMF_
N11
"
,
"Could not send ITTI message %s to task TASK_SMF_
SBI
"
,
itti_msg
->
get_msg_name
());
}
}
...
...
@@ -2024,7 +2024,7 @@ void smf_app::trigger_upf_status_notification_subscribe() {
std
::
shared_ptr
<
itti_n11_subscribe_upf_status_notify
>
itti_msg
=
std
::
make_shared
<
itti_n11_subscribe_upf_status_notify
>
(
TASK_SMF_APP
,
TASK_SMF_
N11
);
TASK_SMF_APP
,
TASK_SMF_
SBI
);
nlohmann
::
json
json_data
=
{};
// TODO: remove hardcoded values
...
...
@@ -2049,7 +2049,7 @@ void smf_app::trigger_upf_status_notification_subscribe() {
int
ret
=
itti_inst
->
send_msg
(
itti_msg
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_app
().
error
(
"Could not send ITTI message %s to task TASK_SMF_
N11
"
,
"Could not send ITTI message %s to task TASK_SMF_
SBI
"
,
itti_msg
->
get_msg_name
());
}
}
src/smf_app/smf_context.cpp
View file @
682223fb
...
...
@@ -42,7 +42,7 @@
#include "smf_config.hpp"
#include "smf_event.hpp"
#include "smf_n1.hpp"
#include "smf_
n11
.hpp"
#include "smf_
sbi
.hpp"
#include "smf_n2.hpp"
#include "smf_paa_dynamic.hpp"
#include "smf_pfcp_association.hpp"
...
...
@@ -836,7 +836,7 @@ void smf_context::handle_itti_msg(
session_report_msg
.
set_json_data
(
json_data
);
itti_n11_session_report_request
*
itti_n11
=
new
itti_n11_session_report_request
(
TASK_SMF_APP
,
TASK_SMF_
N11
);
new
itti_n11_session_report_request
(
TASK_SMF_APP
,
TASK_SMF_
SBI
);
itti_n11
->
http_version
=
1
;
// use HTTPv1 for the moment
std
::
shared_ptr
<
itti_n11_session_report_request
>
itti_n11_report
=
std
::
shared_ptr
<
itti_n11_session_report_request
>
(
itti_n11
);
...
...
@@ -844,13 +844,13 @@ void smf_context::handle_itti_msg(
// send ITTI message to N11 interface to trigger N1N2MessageTransfer
// towards AMFs
Logger
::
smf_app
().
info
(
"Sending ITTI message %s to task TASK_SMF_
N11
"
,
"Sending ITTI message %s to task TASK_SMF_
SBI
"
,
itti_n11_report
->
get_msg_name
());
ret
=
itti_inst
->
send_msg
(
itti_n11_report
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_app
().
error
(
"Could not send ITTI message %s to task TASK_SMF_
N11
"
,
"Could not send ITTI message %s to task TASK_SMF_
SBI
"
,
itti_n11_report
->
get_msg_name
());
}
}
...
...
@@ -1260,7 +1260,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
// receiving the response from UPF
itti_n11_create_sm_context_response
*
sm_context_resp
=
new
itti_n11_create_sm_context_response
(
TASK_SMF_APP
,
TASK_SMF_
N11
,
smreq
->
pid
);
TASK_SMF_APP
,
TASK_SMF_
SBI
,
smreq
->
pid
);
std
::
shared_ptr
<
itti_n11_create_sm_context_response
>
sm_context_resp_pending
=
std
::
shared_ptr
<
itti_n11_create_sm_context_response
>
(
sm_context_resp
);
...
...
@@ -1476,7 +1476,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
"Send ITTI msg to SMF APP to trigger the response of Server"
);
std
::
shared_ptr
<
itti_n11_create_sm_context_response
>
itti_msg
=
std
::
make_shared
<
itti_n11_create_sm_context_response
>
(
TASK_SMF_
N11
,
TASK_SMF_APP
,
smreq
->
pid
);
TASK_SMF_
SBI
,
TASK_SMF_APP
,
smreq
->
pid
);
pdu_session_create_sm_context_response
sm_context_response
=
{};
std
::
string
smContextRef
=
std
::
to_string
(
smreq
->
scid
);
...
...
@@ -1595,12 +1595,12 @@ void smf_context::handle_pdu_session_create_sm_context_request(
// send ITTI message to N11 to trigger N1N2MessageTransfer towards AMFs
Logger
::
smf_app
().
info
(
"Sending ITTI message %s to task TASK_SMF_
N11
"
,
"Sending ITTI message %s to task TASK_SMF_
SBI
"
,
sm_context_resp_pending
->
get_msg_name
());
int
ret
=
itti_inst
->
send_msg
(
sm_context_resp_pending
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_app
().
error
(
"Could not send ITTI message %s to task TASK_SMF_
N11
"
,
"Could not send ITTI message %s to task TASK_SMF_
SBI
"
,
sm_context_resp_pending
->
get_msg_name
());
}
}
...
...
@@ -2297,7 +2297,7 @@ void smf_context::handle_pdu_session_update_sm_context_request(
// when receiving the response from UPF
itti_n11_update_sm_context_response
*
n11_sm_context_resp
=
new
itti_n11_update_sm_context_response
(
TASK_SMF_
N11
,
TASK_SMF_APP
,
smreq
->
pid
);
TASK_SMF_
SBI
,
TASK_SMF_APP
,
smreq
->
pid
);
std
::
shared_ptr
<
itti_n11_update_sm_context_response
>
sm_context_resp_pending
=
std
::
shared_ptr
<
itti_n11_update_sm_context_response
>
(
n11_sm_context_resp
);
...
...
@@ -2623,7 +2623,7 @@ void smf_context::handle_pdu_session_update_sm_context_request(
int
ret
=
itti_inst
->
send_msg
(
sm_context_resp_pending
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_app
().
error
(
"Could not send ITTI message %s to task TASK_SMF_
N11
"
,
"Could not send ITTI message %s to task TASK_SMF_
SBI
"
,
sm_context_resp_pending
->
get_msg_name
());
}
}
...
...
@@ -2666,7 +2666,7 @@ void smf_context::handle_pdu_session_release_sm_context_request(
itti_n11_release_sm_context_response
*
n11_sm_context_resp
=
new
itti_n11_release_sm_context_response
(
TASK_SMF_
N11
,
TASK_SMF_APP
,
smreq
->
pid
);
TASK_SMF_
SBI
,
TASK_SMF_APP
,
smreq
->
pid
);
std
::
shared_ptr
<
itti_n11_release_sm_context_response
>
sm_context_resp_pending
=
...
...
@@ -2781,7 +2781,7 @@ void smf_context::handle_pdu_session_modification_network_requested(
fmt
::
format
(
NAMF_COMMUNICATION_N1N2_MESSAGE_TRANSFER_URL
,
supi_str
.
c_str
());
itti_msg
->
msg
.
set_amf_url
(
url
);
Logger
::
smf_
n11
().
debug
(
Logger
::
smf_
app
().
debug
(
"N1N2MessageTransfer will be sent to AMF with URL: %s"
,
url
.
c_str
());
// Fill the json part
...
...
@@ -2811,12 +2811,12 @@ void smf_context::handle_pdu_session_modification_network_requested(
// Step 3. Send ITTI message to N11 interface to trigger N1N2MessageTransfer
// towards AMFs
Logger
::
smf_app
().
info
(
"Sending ITTI message %s to task TASK_SMF_
N11
"
,
itti_msg
->
get_msg_name
());
"Sending ITTI message %s to task TASK_SMF_
SBI
"
,
itti_msg
->
get_msg_name
());
int
ret
=
itti_inst
->
send_msg
(
itti_msg
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_app
().
error
(
"Could not send ITTI message %s to task TASK_SMF_
N11
"
,
"Could not send ITTI message %s to task TASK_SMF_
SBI
"
,
itti_msg
->
get_msg_name
());
}
}
...
...
@@ -2970,7 +2970,7 @@ void smf_context::handle_sm_context_status_change(
"Send ITTI msg to SMF N11 to trigger the status notification"
);
std
::
shared_ptr
<
itti_n11_notify_sm_context_status
>
itti_msg
=
std
::
make_shared
<
itti_n11_notify_sm_context_status
>
(
TASK_SMF_APP
,
TASK_SMF_
N11
);
TASK_SMF_APP
,
TASK_SMF_
SBI
);
itti_msg
->
scid
=
scid
;
itti_msg
->
sm_context_status
=
status
;
itti_msg
->
amf_status_uri
=
scf
.
get
()
->
amf_status_uri
;
...
...
@@ -2979,7 +2979,7 @@ void smf_context::handle_sm_context_status_change(
int
ret
=
itti_inst
->
send_msg
(
itti_msg
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_app
().
error
(
"Could not send ITTI message %s to task TASK_SMF_
N11
"
,
"Could not send ITTI message %s to task TASK_SMF_
SBI
"
,
itti_msg
->
get_msg_name
());
}
}
...
...
@@ -3002,7 +3002,7 @@ void smf_context::handle_ee_pdu_session_release(
"Send ITTI msg to SMF N11 to trigger the event notification"
);
std
::
shared_ptr
<
itti_n11_notify_subscribed_event
>
itti_msg
=
std
::
make_shared
<
itti_n11_notify_subscribed_event
>
(
TASK_SMF_APP
,
TASK_SMF_
N11
);
TASK_SMF_APP
,
TASK_SMF_
SBI
);
for
(
auto
i
:
subscriptions
)
{
event_notification
ev_notif
=
{};
...
...
@@ -3020,7 +3020,7 @@ void smf_context::handle_ee_pdu_session_release(
int
ret
=
itti_inst
->
send_msg
(
itti_msg
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_app
().
error
(
"Could not send ITTI message %s to task TASK_SMF_
N11
"
,
"Could not send ITTI message %s to task TASK_SMF_
SBI
"
,
itti_msg
->
get_msg_name
());
}
}
else
{
...
...
src/smf_app/smf_procedure.cpp
View file @
682223fb
...
...
@@ -44,7 +44,7 @@
#include "smf_config.hpp"
#include "smf_context.hpp"
#include "smf_n1.hpp"
#include "smf_
n11
.hpp"
#include "smf_
sbi
.hpp"
#include "smf_n2.hpp"
#include "smf_pfcp_association.hpp"
#include "ProblemDetails.h"
...
...
@@ -443,7 +443,7 @@ void session_create_sm_context_procedure::handle_itti_msg(
fmt
::
format
(
NAMF_COMMUNICATION_N1N2_MESSAGE_TRANSFER_URL
,
supi_str
.
c_str
());
n11_triggered_pending
->
res
.
set_amf_url
(
url
);
Logger
::
smf_
n11
().
debug
(
Logger
::
smf_
app
().
debug
(
"N1N2MessageTransfer will be sent to AMF with URL: %s"
,
url
.
c_str
());
// Fill the json part
...
...
@@ -495,7 +495,7 @@ void session_create_sm_context_procedure::handle_itti_msg(
int
ret
=
itti_inst
->
send_msg
(
n11_triggered_pending
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_app
().
error
(
"Could not send ITTI message %s to task TASK_SMF_
N11
"
,
"Could not send ITTI message %s to task TASK_SMF_
SBI
"
,
n11_triggered_pending
->
get_msg_name
());
}
}
...
...
src/smf_app/smf_
n11
.cpp
→
src/smf_app/smf_
sbi
.cpp
View file @
682223fb
...
...
@@ -19,7 +19,7 @@
* contact@openairinterface.org
*/
/*! \file smf_
n11
.cpp
/*! \file smf_
sbi
.cpp
\brief
\author Lionel GAUTHIER, Tien-Thinh NGUYEN
\company Eurecom
...
...
@@ -27,7 +27,7 @@
\email: lionel.gauthier@eurecom.fr, tien-thinh.nguyen@eurecom.fr
*/
#include "smf_
n11
.hpp"
#include "smf_
sbi
.hpp"
#include <stdexcept>
...
...
@@ -55,9 +55,9 @@ using namespace smf;
using
json
=
nlohmann
::
json
;
extern
itti_mw
*
itti_inst
;
extern
smf_
n11
*
smf_n11
_inst
;
extern
smf_
sbi
*
smf_sbi
_inst
;
extern
smf_config
smf_cfg
;
void
smf_
n11
_task
(
void
*
);
void
smf_
sbi
_task
(
void
*
);
// To read content of the response from AMF
static
std
::
size_t
callback
(
...
...
@@ -68,8 +68,8 @@ static std::size_t callback(
}
//------------------------------------------------------------------------------
void
smf_
n11
_task
(
void
*
args_p
)
{
const
task_id_t
task_id
=
TASK_SMF_
N11
;
void
smf_
sbi
_task
(
void
*
args_p
)
{
const
task_id_t
task_id
=
TASK_SMF_
SBI
;
itti_inst
->
notify_task_ready
(
task_id
);
do
{
...
...
@@ -77,55 +77,55 @@ void smf_n11_task(void* args_p) {
auto
*
msg
=
shared_msg
.
get
();
switch
(
msg
->
msg_type
)
{
case
N11_SESSION_CREATE_SM_CONTEXT_RESPONSE
:
smf_
n11
_inst
->
send_n1n2_message_transfer_request
(
smf_
sbi
_inst
->
send_n1n2_message_transfer_request
(
std
::
static_pointer_cast
<
itti_n11_create_sm_context_response
>
(
shared_msg
));
break
;
case
NX_TRIGGER_SESSION_MODIFICATION
:
smf_
n11
_inst
->
send_n1n2_message_transfer_request
(
smf_
sbi
_inst
->
send_n1n2_message_transfer_request
(
std
::
static_pointer_cast
<
itti_nx_trigger_pdu_session_modification
>
(
shared_msg
));
break
;
case
N11_SESSION_REPORT_RESPONSE
:
smf_
n11
_inst
->
send_n1n2_message_transfer_request
(
smf_
sbi
_inst
->
send_n1n2_message_transfer_request
(
std
::
static_pointer_cast
<
itti_n11_session_report_request
>
(
shared_msg
));
break
;
case
N11_SESSION_NOTIFY_SM_CONTEXT_STATUS
:
smf_
n11
_inst
->
send_sm_context_status_notification
(
smf_
sbi
_inst
->
send_sm_context_status_notification
(
std
::
static_pointer_cast
<
itti_n11_notify_sm_context_status
>
(
shared_msg
));
break
;
case
N11_NOTIFY_SUBSCRIBED_EVENT
:
smf_
n11
_inst
->
notify_subscribed_event
(
smf_
sbi
_inst
->
notify_subscribed_event
(
std
::
static_pointer_cast
<
itti_n11_notify_subscribed_event
>
(
shared_msg
));
break
;
case
N11_REGISTER_NF_INSTANCE_REQUEST
:
smf_
n11
_inst
->
register_nf_instance
(
smf_
sbi
_inst
->
register_nf_instance
(
std
::
static_pointer_cast
<
itti_n11_register_nf_instance_request
>
(
shared_msg
));
break
;
case
N11_UPDATE_NF_INSTANCE_REQUEST
:
smf_
n11
_inst
->
update_nf_instance
(
smf_
sbi
_inst
->
update_nf_instance
(
std
::
static_pointer_cast
<
itti_n11_update_nf_instance_request
>
(
shared_msg
));
break
;
case
N11_DEREGISTER_NF_INSTANCE
:
smf_
n11
_inst
->
deregister_nf_instance
(
smf_
sbi
_inst
->
deregister_nf_instance
(
std
::
static_pointer_cast
<
itti_n11_deregister_nf_instance
>
(
shared_msg
));
break
;
case
N11_SUBSCRIBE_UPF_STATUS_NOTIFY
:
smf_
n11
_inst
->
subscribe_upf_status_notify
(
smf_
sbi
_inst
->
subscribe_upf_status_notify
(
std
::
static_pointer_cast
<
itti_n11_subscribe_upf_status_notify
>
(
shared_msg
));
break
;
...
...
@@ -136,32 +136,32 @@ void smf_n11_task(void* args_p) {
case
TERMINATE
:
if
(
itti_msg_terminate
*
terminate
=
dynamic_cast
<
itti_msg_terminate
*>
(
msg
))
{
Logger
::
smf_
n11
().
info
(
"Received terminate message"
);
Logger
::
smf_
sbi
().
info
(
"Received terminate message"
);
return
;
}
break
;
default:
Logger
::
smf_
n11
().
info
(
"no handler for msg type %d"
,
msg
->
msg_type
);
Logger
::
smf_
sbi
().
info
(
"no handler for msg type %d"
,
msg
->
msg_type
);
}
}
while
(
true
);
}
//------------------------------------------------------------------------------
smf_
n11
::
smf_n11
()
{
Logger
::
smf_
n11
().
startup
(
"Starting..."
);
if
(
itti_inst
->
create_task
(
TASK_SMF_
N11
,
smf_n11
_task
,
nullptr
))
{
Logger
::
smf_
n11
().
error
(
"Cannot create task TASK_SMF_N11
"
);
throw
std
::
runtime_error
(
"Cannot create task TASK_SMF_
N11
"
);
smf_
sbi
::
smf_sbi
()
{
Logger
::
smf_
sbi
().
startup
(
"Starting..."
);
if
(
itti_inst
->
create_task
(
TASK_SMF_
SBI
,
smf_sbi
_task
,
nullptr
))
{
Logger
::
smf_
sbi
().
error
(
"Cannot create task TASK_SMF_SBI
"
);
throw
std
::
runtime_error
(
"Cannot create task TASK_SMF_
SBI
"
);
}
Logger
::
smf_
n11
().
startup
(
"Started"
);
Logger
::
smf_
sbi
().
startup
(
"Started"
);
}
//------------------------------------------------------------------------------
void
smf_
n11
::
send_n1n2_message_transfer_request
(
void
smf_
sbi
::
send_n1n2_message_transfer_request
(
std
::
shared_ptr
<
itti_n11_create_sm_context_response
>
sm_context_res
)
{
Logger
::
smf_
n11
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"Send Communication_N1N2MessageTransfer to AMF (HTTP version %d)"
,
sm_context_res
->
http_version
);
...
...
@@ -186,7 +186,7 @@ void smf_n11::send_n1n2_message_transfer_request(
multipart_related_content_part_e
::
NAS
);
}
Logger
::
smf_
n11
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"Send Communication_N1N2MessageTransfer to AMF, body %s"
,
body
.
c_str
());
uint32_t
str_len
=
body
.
length
();
...
...
@@ -238,18 +238,18 @@ void smf_n11::send_n1n2_message_transfer_request(
try
{
response_data
=
json
::
parse
(
*
httpData
.
get
());
}
catch
(
json
::
exception
&
e
)
{
Logger
::
smf_
n11
().
warn
(
"Could not get the cause from the response"
);
Logger
::
smf_
sbi
().
warn
(
"Could not get the cause from the response"
);
// Set the default Cause
response_data
[
"cause"
]
=
"504 Gateway Timeout"
;
}
Logger
::
smf_
n11
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"Response from AMF, Http Code: %d, cause %s"
,
httpCode
,
response_data
[
"cause"
].
dump
().
c_str
());
// send response to APP to process
itti_n11_n1n2_message_transfer_response_status
*
itti_msg
=
new
itti_n11_n1n2_message_transfer_response_status
(
TASK_SMF_
N11
,
TASK_SMF_APP
);
TASK_SMF_
SBI
,
TASK_SMF_APP
);
itti_msg
->
set_response_code
(
httpCode
);
itti_msg
->
set_scid
(
sm_context_res
->
scid
);
itti_msg
->
set_procedure_type
(
session_management_procedures_type_e
::
...
...
@@ -266,7 +266,7 @@ void smf_n11::send_n1n2_message_transfer_request(
itti_msg
);
int
ret
=
itti_inst
->
send_msg
(
i
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_
n11
().
error
(
Logger
::
smf_
sbi
().
error
(
"Could not send ITTI message %s to task TASK_SMF_APP"
,
i
->
get_msg_name
());
}
...
...
@@ -279,10 +279,10 @@ void smf_n11::send_n1n2_message_transfer_request(
}
//------------------------------------------------------------------------------
void
smf_
n11
::
send_n1n2_message_transfer_request
(
void
smf_
sbi
::
send_n1n2_message_transfer_request
(
std
::
shared_ptr
<
itti_nx_trigger_pdu_session_modification
>
sm_session_modification
)
{
Logger
::
smf_
n11
().
debug
(
"Send Communication_N1N2MessageTransfer to AMF"
);
Logger
::
smf_
sbi
().
debug
(
"Send Communication_N1N2MessageTransfer to AMF"
);
mime_parser
parser
=
{};
std
::
string
body
;
...
...
@@ -356,9 +356,9 @@ void smf_n11::send_n1n2_message_transfer_request(
try
{
response_data
=
json
::
parse
(
*
httpData
.
get
());
}
catch
(
json
::
exception
&
e
)
{
Logger
::
smf_
n11
().
warn
(
"Could not get the cause from the response"
);
Logger
::
smf_
sbi
().
warn
(
"Could not get the cause from the response"
);
}
Logger
::
smf_
n11
().
debug
(
"Response from AMF, Http Code: %d"
,
httpCode
);
Logger
::
smf_
sbi
().
debug
(
"Response from AMF, Http Code: %d"
,
httpCode
);
curl_slist_free_all
(
headers
);
curl_easy_cleanup
(
curl
);
...
...
@@ -368,9 +368,9 @@ void smf_n11::send_n1n2_message_transfer_request(
}
//------------------------------------------------------------------------------
void
smf_
n11
::
send_n1n2_message_transfer_request
(
void
smf_
sbi
::
send_n1n2_message_transfer_request
(
std
::
shared_ptr
<
itti_n11_session_report_request
>
report_msg
)
{
Logger
::
smf_
n11
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"Send Communication_N1N2MessageTransfer to AMF (Network-initiated "
"Service Request)"
);
...
...
@@ -444,18 +444,18 @@ void smf_n11::send_n1n2_message_transfer_request(
try
{
response_data
=
json
::
parse
(
*
httpData
.
get
());
}
catch
(
json
::
exception
&
e
)
{
Logger
::
smf_
n11
().
warn
(
"Could not get the cause from the response"
);
Logger
::
smf_
sbi
().
warn
(
"Could not get the cause from the response"
);
// Set the default Cause
response_data
[
"cause"
]
=
"504 Gateway Timeout"
;
}
Logger
::
smf_
n11
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"Response from AMF, Http Code: %d, cause %s"
,
httpCode
,
response_data
[
"cause"
].
dump
().
c_str
());
// send response to APP to process
itti_n11_n1n2_message_transfer_response_status
*
itti_msg
=
new
itti_n11_n1n2_message_transfer_response_status
(
TASK_SMF_
N11
,
TASK_SMF_APP
);
TASK_SMF_
SBI
,
TASK_SMF_APP
);
itti_msg
->
set_response_code
(
httpCode
);
itti_msg
->
set_procedure_type
(
session_management_procedures_type_e
::
SERVICE_REQUEST_NETWORK_TRIGGERED
);
...
...
@@ -468,7 +468,7 @@ void smf_n11::send_n1n2_message_transfer_request(
itti_msg
);
int
ret
=
itti_inst
->
send_msg
(
i
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_
n11
().
error
(
Logger
::
smf_
sbi
().
error
(
"Could not send ITTI message %s to task TASK_SMF_APP"
,
i
->
get_msg_name
());
}
...
...
@@ -481,12 +481,12 @@ void smf_n11::send_n1n2_message_transfer_request(
}
//------------------------------------------------------------------------------
void
smf_
n11
::
send_sm_context_status_notification
(
void
smf_
sbi
::
send_sm_context_status_notification
(
std
::
shared_ptr
<
itti_n11_notify_sm_context_status
>
sm_context_status
)
{
Logger
::
smf_
n11
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"Send SM Context Status Notification to AMF(HTTP version %d)"
,
sm_context_status
->
http_version
);
Logger
::
smf_
n11
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"AMF URI: %s"
,
sm_context_status
->
amf_status_uri
.
c_str
());
nlohmann
::
json
json_data
=
{};
...
...
@@ -529,7 +529,7 @@ void smf_n11::send_sm_context_status_notification(
res
=
curl_easy_perform
(
curl
);
curl_easy_getinfo
(
curl
,
CURLINFO_RESPONSE_CODE
,
&
httpCode
);
Logger
::
smf_
n11
().
debug
(
"Response from AMF, Http Code: %d"
,
httpCode
);
Logger
::
smf_
sbi
().
debug
(
"Response from AMF, Http Code: %d"
,
httpCode
);
// TODO: in case of "307 temporary redirect"
curl_easy_cleanup
(
curl
);
...
...
@@ -538,9 +538,9 @@ void smf_n11::send_sm_context_status_notification(
}
//-----------------------------------------------------------------------------------------------------
void
smf_
n11
::
notify_subscribed_event
(
void
smf_
sbi
::
notify_subscribed_event
(
std
::
shared_ptr
<
itti_n11_notify_subscribed_event
>
msg
)
{
Logger
::
smf_
n11
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"Send notification for the subscribed event to the subscription"
);
int
still_running
=
0
,
numfds
=
0
,
res
=
0
;
...
...
@@ -588,7 +588,7 @@ void smf_n11::notify_subscribed_event(
CURL
*
curl
=
curl_easy_init
();
if
(
curl
)
{
std
::
string
url
=
i
.
get_notif_uri
();
Logger
::
smf_
n11
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"Send notification to NF with URI: %s"
,
url
.
c_str
());
curl_easy_setopt
(
curl
,
CURLOPT_HTTPHEADER
,
headers
);
curl_easy_setopt
(
curl
,
CURLOPT_URL
,
url
.
c_str
());
...
...
@@ -611,7 +611,7 @@ void smf_n11::notify_subscribed_event(
do
{
res
=
curl_multi_wait
(
m_curl_multi
,
NULL
,
0
,
1000
,
&
numfds
);
if
(
res
!=
CURLM_OK
)
{
Logger
::
smf_
n11
().
debug
(
"curl_multi_wait() returned %d!"
,
res
);
Logger
::
smf_
sbi
().
debug
(
"curl_multi_wait() returned %d!"
,
res
);
}
curl_multi_perform
(
m_curl_multi
,
&
still_running
);
}
while
(
still_running
);
...
...
@@ -625,25 +625,25 @@ void smf_n11::notify_subscribed_event(
res
=
curl_easy_getinfo
(
curl
,
CURLINFO_EFFECTIVE_URL
,
&
url
);
if
(
return_code
!=
CURLE_OK
)
{
Logger
::
smf_
n11
().
debug
(
"CURL error code %d!"
,
curl_msg
->
data
.
result
);
Logger
::
smf_
sbi
().
debug
(
"CURL error code %d!"
,
curl_msg
->
data
.
result
);
continue
;
}
// Get HTTP status code
curl_easy_getinfo
(
curl
,
CURLINFO_RESPONSE_CODE
,
&
http_status_code
);
Logger
::
smf_
n11
().
debug
(
"HTTP status code %d!"
,
http_status_code
);
Logger
::
smf_
sbi
().
debug
(
"HTTP status code %d!"
,
http_status_code
);
// remove this handle from the multi session and end this handle
curl_multi_remove_handle
(
m_curl_multi
,
curl
);
curl_easy_cleanup
(
curl
);
}
else
{
Logger
::
smf_
n11
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"Error after curl_multi_info_read(), CURLMsg %s"
,
curl_msg
->
msg
);
}
}
}
//-----------------------------------------------------------------------------------------------------
CURL
*
smf_
n11
::
curl_create_handle
(
CURL
*
smf_
sbi
::
curl_create_handle
(
event_notification
&
ev_notif
,
std
::
string
*
httpData
)
{
// create handle for a curl request
struct
curl_slist
*
headers
=
NULL
;
...
...
@@ -655,7 +655,7 @@ CURL* smf_n11::curl_create_handle(
if
(
curl
)
{
std
::
string
url
=
ev_notif
.
get_notif_uri
();
Logger
::
smf_
n11
().
debug
(
"Send notification to NF with URI: %s"
,
url
);
Logger
::
smf_
sbi
().
debug
(
"Send notification to NF with URI: %s"
,
url
);
curl_easy_setopt
(
curl
,
CURLOPT_HTTPHEADER
,
headers
);
curl_easy_setopt
(
curl
,
CURLOPT_URL
,
url
.
c_str
());
// curl_easy_setopt(curl, CURLOPT_PRIVATE, str);
...
...
@@ -671,9 +671,9 @@ CURL* smf_n11::curl_create_handle(
}
//-----------------------------------------------------------------------------------------------------
void
smf_
n11
::
register_nf_instance
(
void
smf_
sbi
::
register_nf_instance
(
std
::
shared_ptr
<
itti_n11_register_nf_instance_request
>
msg
)
{
Logger
::
smf_
n11
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"Send NF Instance Registration to NRF (HTTP version %d)"
,
msg
->
http_version
);
nlohmann
::
json
json_data
=
{};
...
...
@@ -685,11 +685,11 @@ void smf_n11::register_nf_instance(
smf_cfg
.
nrf_addr
.
api_version
+
NNRF_NF_REGISTER_URL
+
msg
->
profile
.
get_nf_instance_id
();
Logger
::
smf_
n11
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"Send NF Instance Registration to NRF, NRF URL %s"
,
url
.
c_str
());
std
::
string
body
=
json_data
.
dump
();
Logger
::
smf_
n11
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"Send NF Instance Registration to NRF, msg body:
\n
%s"
,
body
.
c_str
());
curl_global_init
(
CURL_GLOBAL_ALL
);
...
...
@@ -725,7 +725,7 @@ void smf_n11::register_nf_instance(
res
=
curl_easy_perform
(
curl
);
curl_easy_getinfo
(
curl
,
CURLINFO_RESPONSE_CODE
,
&
httpCode
);
Logger
::
smf_
n11
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"NF Instance Registration, response from NRF, HTTP Code: %d"
,
httpCode
);
if
(
static_cast
<
http_response_codes_e
>
(
httpCode
)
==
...
...
@@ -734,18 +734,18 @@ void smf_n11::register_nf_instance(
try
{
response_data
=
json
::
parse
(
*
httpData
.
get
());
}
catch
(
json
::
exception
&
e
)
{
Logger
::
smf_
n11
().
warn
(
Logger
::
smf_
sbi
().
warn
(
"NF Instance Registration, could not parse json from the NRF "
"response"
);
}
Logger
::
smf_
n11
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"NF Instance Registration, response from NRF, json data:
\n
%s"
,
response_data
.
dump
().
c_str
());
// send response to APP to process
std
::
shared_ptr
<
itti_n11_register_nf_instance_response
>
itti_msg
=
std
::
make_shared
<
itti_n11_register_nf_instance_response
>
(
TASK_SMF_
N11
,
TASK_SMF_APP
);
TASK_SMF_
SBI
,
TASK_SMF_APP
);
itti_msg
->
http_response_code
=
httpCode
;
itti_msg
->
http_version
=
msg
->
http_version
;
Logger
::
smf_app
().
debug
(
"Registered SMF profile (from NRF)"
);
...
...
@@ -753,12 +753,12 @@ void smf_n11::register_nf_instance(
int
ret
=
itti_inst
->
send_msg
(
itti_msg
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_
n11
().
error
(
Logger
::
smf_
sbi
().
error
(
"Could not send ITTI message %s to task TASK_SMF_APP"
,
itti_msg
->
get_msg_name
());
}
}
else
{
Logger
::
smf_
n11
().
warn
(
Logger
::
smf_
sbi
().
warn
(
"NF Instance Registration, could not get response from NRF"
);
}
...
...
@@ -769,9 +769,9 @@ void smf_n11::register_nf_instance(
}
//-----------------------------------------------------------------------------------------------------
void
smf_
n11
::
update_nf_instance
(
void
smf_
sbi
::
update_nf_instance
(
std
::
shared_ptr
<
itti_n11_update_nf_instance_request
>
msg
)
{
Logger
::
smf_
n11
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"Send NF Update to NRF (HTTP version %d)"
,
msg
->
http_version
);
nlohmann
::
json
json_data
=
nlohmann
::
json
::
array
();
...
...
@@ -781,7 +781,7 @@ void smf_n11::update_nf_instance(
json_data
.
push_back
(
item
);
}
std
::
string
body
=
json_data
.
dump
();
Logger
::
smf_
n11
().
debug
(
"Send NF Update to NRF, Msg body %s"
,
body
.
c_str
());
Logger
::
smf_
sbi
().
debug
(
"Send NF Update to NRF, Msg body %s"
,
body
.
c_str
());
std
::
string
url
=
std
::
string
(
inet_ntoa
(
*
((
struct
in_addr
*
)
&
smf_cfg
.
nrf_addr
.
ipv4_addr
)))
+
...
...
@@ -789,7 +789,7 @@ void smf_n11::update_nf_instance(
smf_cfg
.
nrf_addr
.
api_version
+
NNRF_NF_REGISTER_URL
+
msg
->
smf_instance_id
;
Logger
::
smf_
n11
().
debug
(
"Send NF Update to NRF, NRF URL %s"
,
url
.
c_str
());
Logger
::
smf_
sbi
().
debug
(
"Send NF Update to NRF, NRF URL %s"
,
url
.
c_str
());
curl_global_init
(
CURL_GLOBAL_ALL
);
CURL
*
curl
=
curl
=
curl_easy_init
();
...
...
@@ -825,32 +825,32 @@ void smf_n11::update_nf_instance(
res
=
curl_easy_perform
(
curl
);
curl_easy_getinfo
(
curl
,
CURLINFO_RESPONSE_CODE
,
&
httpCode
);
Logger
::
smf_
n11
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"NF Update, response from NRF, HTTP Code: %d"
,
httpCode
);
if
((
static_cast
<
http_response_codes_e
>
(
httpCode
)
==
http_response_codes_e
::
HTTP_RESPONSE_CODE_OK
)
or
(
static_cast
<
http_response_codes_e
>
(
httpCode
)
==
http_response_codes_e
::
HTTP_RESPONSE_CODE_NO_CONTENT
))
{
Logger
::
smf_
n11
().
debug
(
"NF Update, got successful response from NRF"
);
Logger
::
smf_
sbi
().
debug
(
"NF Update, got successful response from NRF"
);
// TODO: in case of response containing NF profile
// send response to APP to process
std
::
shared_ptr
<
itti_n11_update_nf_instance_response
>
itti_msg
=
std
::
make_shared
<
itti_n11_update_nf_instance_response
>
(
TASK_SMF_
N11
,
TASK_SMF_APP
);
TASK_SMF_
SBI
,
TASK_SMF_APP
);
itti_msg
->
http_response_code
=
httpCode
;
itti_msg
->
http_version
=
msg
->
http_version
;
itti_msg
->
smf_instance_id
=
msg
->
smf_instance_id
;
int
ret
=
itti_inst
->
send_msg
(
itti_msg
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_
n11
().
error
(
Logger
::
smf_
sbi
().
error
(
"Could not send ITTI message %s to task TASK_SMF_APP"
,
itti_msg
->
get_msg_name
());
}
}
else
{
Logger
::
smf_
n11
().
warn
(
"NF Update, could not get response from NRF"
);
Logger
::
smf_
sbi
().
warn
(
"NF Update, could not get response from NRF"
);
}
curl_slist_free_all
(
headers
);
...
...
@@ -860,9 +860,9 @@ void smf_n11::update_nf_instance(
}
//-----------------------------------------------------------------------------------------------------
void
smf_
n11
::
deregister_nf_instance
(
void
smf_
sbi
::
deregister_nf_instance
(
std
::
shared_ptr
<
itti_n11_deregister_nf_instance
>
msg
)
{
Logger
::
smf_
n11
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"Send NF De-register to NRF (HTTP version %d)"
,
msg
->
http_version
);
std
::
string
url
=
...
...
@@ -871,7 +871,7 @@ void smf_n11::deregister_nf_instance(
smf_cfg
.
nrf_addr
.
api_version
+
NNRF_NF_REGISTER_URL
+
msg
->
smf_instance_id
;
Logger
::
smf_
n11
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"Send NF De-register to NRF (NRF URL %s)"
,
url
.
c_str
());
curl_global_init
(
CURL_GLOBAL_ALL
);
...
...
@@ -905,18 +905,18 @@ void smf_n11::deregister_nf_instance(
res
=
curl_easy_perform
(
curl
);
curl_easy_getinfo
(
curl
,
CURLINFO_RESPONSE_CODE
,
&
httpCode
);
Logger
::
smf_
n11
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"NF De-register, response from NRF, HTTP Code: %d"
,
httpCode
);
if
((
static_cast
<
http_response_codes_e
>
(
httpCode
)
==
http_response_codes_e
::
HTTP_RESPONSE_CODE_OK
)
or
(
static_cast
<
http_response_codes_e
>
(
httpCode
)
==
http_response_codes_e
::
HTTP_RESPONSE_CODE_NO_CONTENT
))
{
Logger
::
smf_
n11
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"NF De-register, got successful response from NRF"
);
}
else
{
Logger
::
smf_
n11
().
warn
(
"NF De-register, could not get response from NRF"
);
Logger
::
smf_
sbi
().
warn
(
"NF De-register, could not get response from NRF"
);
}
curl_slist_free_all
(
headers
);
...
...
@@ -926,18 +926,18 @@ void smf_n11::deregister_nf_instance(
}
//-----------------------------------------------------------------------------------------------------
void
smf_
n11
::
subscribe_upf_status_notify
(
void
smf_
sbi
::
subscribe_upf_status_notify
(
std
::
shared_ptr
<
itti_n11_subscribe_upf_status_notify
>
msg
)
{
Logger
::
smf_
n11
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"Send NFSubscribeNotify to NRF to be notified when a new UPF becomes "
"available (HTTP version %d)"
,
msg
->
http_version
);
Logger
::
smf_
n11
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"Send NFStatusNotify to NRF, NRF URL %s"
,
msg
->
url
.
c_str
());
std
::
string
body
=
msg
->
json_data
.
dump
();
Logger
::
smf_
n11
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"Send NFStatusNotify to NRF, msg body: %s"
,
body
.
c_str
());
curl_global_init
(
CURL_GLOBAL_ALL
);
...
...
@@ -973,18 +973,18 @@ void smf_n11::subscribe_upf_status_notify(
res
=
curl_easy_perform
(
curl
);
curl_easy_getinfo
(
curl
,
CURLINFO_RESPONSE_CODE
,
&
httpCode
);
Logger
::
smf_
n11
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"NFSubscribeNotify, response from NRF, HTTP Code: %d"
,
httpCode
);
if
((
static_cast
<
http_response_codes_e
>
(
httpCode
)
==
http_response_codes_e
::
HTTP_RESPONSE_CODE_CREATED
)
or
(
static_cast
<
http_response_codes_e
>
(
httpCode
)
==
http_response_codes_e
::
HTTP_RESPONSE_CODE_NO_CONTENT
))
{
Logger
::
smf_
n11
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"NFSubscribeNotify, got successful response from NRF"
);
}
else
{
Logger
::
smf_
n11
().
warn
(
Logger
::
smf_
sbi
().
warn
(
"NFSubscribeNotify, could not get response from NRF"
);
}
...
...
@@ -995,7 +995,7 @@ void smf_n11::subscribe_upf_status_notify(
}
//------------------------------------------------------------------------------
bool
smf_
n11
::
get_sm_data
(
bool
smf_
sbi
::
get_sm_data
(
const
supi64_t
&
supi
,
const
std
::
string
&
dnn
,
const
snssai_t
&
snssai
,
std
::
shared_ptr
<
session_management_subscription
>
subscription
)
{
// retrieve a UE's Session Management Subscription Data
...
...
@@ -1013,7 +1013,7 @@ bool smf_n11::get_sm_data(
":"
+
std
::
to_string
(
smf_cfg
.
udm_addr
.
port
)
+
NUDM_SDM_BASE
+
smf_cfg
.
udm_addr
.
api_version
+
fmt
::
format
(
NUDM_SDM_GET_SM_DATA_URL
,
std
::
to_string
(
supi
));
Logger
::
smf_
n10
().
debug
(
"UDM's URL: %s "
,
url
.
c_str
());
Logger
::
smf_
sbi
().
debug
(
"UDM's URL: %s "
,
url
.
c_str
());
if
(
curl
)
{
CURLcode
res
=
{};
...
...
@@ -1035,21 +1035,21 @@ bool smf_n11::get_sm_data(
while
(
numRetries
<
UDM_NUMBER_RETRIES
)
{
res
=
curl_easy_perform
(
curl
);
curl_easy_getinfo
(
curl
,
CURLINFO_RESPONSE_CODE
,
&
httpCode
);
Logger
::
smf_
n10
().
debug
(
"Response from UDM, HTTP Code: %d "
,
httpCode
);
Logger
::
smf_
sbi
().
debug
(
"Response from UDM, HTTP Code: %d "
,
httpCode
);
if
(
static_cast
<
http_response_codes_e
>
(
httpCode
)
==
http_response_codes_e
::
HTTP_RESPONSE_CODE_OK
)
{
Logger
::
smf_
n10
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"Got successful response from UDM, URL: %s "
,
url
.
c_str
());
try
{
jsonData
=
nlohmann
::
json
::
parse
(
*
httpData
.
get
());
break
;
}
catch
(
json
::
exception
&
e
)
{
Logger
::
smf_
n10
().
warn
(
"Could not parse json data from UDM"
);
Logger
::
smf_
sbi
().
warn
(
"Could not parse json data from UDM"
);
}
numRetries
++
;
}
else
{
Logger
::
smf_
n10
().
warn
(
Logger
::
smf_
sbi
().
warn
(
"Could not get response from UDM, URL %s, retry ..."
,
url
.
c_str
());
// retry
numRetries
++
;
...
...
@@ -1060,12 +1060,12 @@ bool smf_n11::get_sm_data(
// process the response
if
(
!
jsonData
.
empty
())
{
Logger
::
smf_
n10
().
debug
(
"Response from UDM %s"
,
jsonData
.
dump
().
c_str
());
Logger
::
smf_
sbi
().
debug
(
"Response from UDM %s"
,
jsonData
.
dump
().
c_str
());
// retrieve SessionManagementSubscription and store in the context
for
(
nlohmann
::
json
::
iterator
it
=
jsonData
[
"dnnConfigurations"
].
begin
();
it
!=
jsonData
[
"dnnConfigurations"
].
end
();
++
it
)
{
Logger
::
smf_
n10
().
debug
(
"DNN %s"
,
it
.
key
().
c_str
());
Logger
::
smf_
sbi
().
debug
(
"DNN %s"
,
it
.
key
().
c_str
());
try
{
std
::
shared_ptr
<
dnn_configuration_t
>
dnn_configuration
=
std
::
make_shared
<
dnn_configuration_t
>
();
...
...
@@ -1073,7 +1073,7 @@ bool smf_n11::get_sm_data(
pdu_session_type_e
::
PDU_SESSION_TYPE_E_IPV4
);
std
::
string
default_session_type
=
it
.
value
()[
"pduSessionTypes"
][
"defaultSessionType"
];
Logger
::
smf_
n10
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"Default session type %s"
,
default_session_type
.
c_str
());
if
(
default_session_type
.
compare
(
"IPV4"
)
==
0
)
{
pdu_session_type
.
pdu_session_type
=
...
...
@@ -1091,7 +1091,7 @@ bool smf_n11::get_sm_data(
// Ssc_Mode
ssc_mode_t
ssc_mode
(
ssc_mode_e
::
SSC_MODE_1
);
std
::
string
default_ssc_mode
=
it
.
value
()[
"sscModes"
][
"defaultSscMode"
];
Logger
::
smf_
n10
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"Default SSC Mode %s"
,
default_ssc_mode
.
c_str
());
if
(
default_ssc_mode
.
compare
(
"SSC_MODE_1"
)
==
0
)
{
dnn_configuration
->
ssc_modes
.
default_ssc_mode
=
...
...
@@ -1121,14 +1121,14 @@ bool smf_n11::get_sm_data(
it
.
value
()[
"sessionAmbr"
][
"uplink"
];
dnn_configuration
->
session_ambr
.
downlink
=
it
.
value
()[
"sessionAmbr"
][
"downlink"
];
Logger
::
smf_
n10
().
debug
(
Logger
::
smf_
sbi
().
debug
(
"Session AMBR Uplink %s, Downlink %s"
,
dnn_configuration
->
session_ambr
.
uplink
.
c_str
(),
dnn_configuration
->
session_ambr
.
downlink
.
c_str
());
subscription
->
insert_dnn_configuration
(
it
.
key
(),
dnn_configuration
);
}
catch
(
nlohmann
::
json
::
exception
&
e
)
{
Logger
::
smf_
n10
().
warn
(
Logger
::
smf_
sbi
().
warn
(
"Exception message %s, exception id %d "
,
e
.
what
(),
e
.
id
);
return
false
;
}
...
...
@@ -1140,6 +1140,6 @@ bool smf_n11::get_sm_data(
}
//------------------------------------------------------------------------------
void
smf_
n11
::
subscribe_sm_data
()
{
void
smf_
sbi
::
subscribe_sm_data
()
{
// TODO:
}
src/smf_app/smf_
n11
.hpp
→
src/smf_app/smf_
sbi
.hpp
View file @
682223fb
...
...
@@ -19,15 +19,15 @@
* contact@openairinterface.org
*/
/*! \file smf_
n11
.hpp
/*! \file smf_
sbi
.hpp
\author Lionel GAUTHIER, Tien-Thinh NGUYEN
\company Eurecom
\date 2019
\email: lionel.gauthier@eurecom.fr, tien-thinh.nguyen@eurecom.fr
*/
#ifndef FILE_SMF_
N11
_HPP_SEEN
#define FILE_SMF_
N11
_HPP_SEEN
#ifndef FILE_SMF_
SBI
_HPP_SEEN
#define FILE_SMF_
SBI
_HPP_SEEN
#include <map>
#include <thread>
...
...
@@ -39,17 +39,17 @@
namespace
smf
{
#define TASK_SMF_
N11
_TIMEOUT_NRF_HEARTBEAT_REQUEST 1
#define TASK_SMF_
SBI
_TIMEOUT_NRF_HEARTBEAT_REQUEST 1
class
smf_
n11
{
class
smf_
sbi
{
private:
std
::
thread
::
id
thread_id
;
std
::
thread
thread
;
public:
smf_
n11
();
smf_
n11
(
smf_n11
const
&
)
=
delete
;
void
operator
=
(
smf_
n11
const
&
)
=
delete
;
smf_
sbi
();
smf_
sbi
(
smf_sbi
const
&
)
=
delete
;
void
operator
=
(
smf_
sbi
const
&
)
=
delete
;
/*
* Send N1N2 Message Transfer Request to AMF
...
...
@@ -164,4 +164,4 @@ class smf_n11 {
void
subscribe_sm_data
();
};
}
// namespace smf
#endif
/* FILE_SMF_
N11
_HPP_SEEN */
#endif
/* FILE_SMF_
SBI
_HPP_SEEN */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment