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