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
35ed4c43
Commit
35ed4c43
authored
Apr 01, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add customized info for FlexCN
parent
fcc61f82
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
177 additions
and
1 deletion
+177
-1
src/smf_app/smf_app.cpp
src/smf_app/smf_app.cpp
+126
-1
src/smf_app/smf_app.hpp
src/smf_app/smf_app.hpp
+12
-0
src/smf_app/smf_context.cpp
src/smf_app/smf_context.cpp
+4
-0
src/smf_app/smf_event.cpp
src/smf_app/smf_event.cpp
+4
-0
src/smf_app/smf_event.hpp
src/smf_app/smf_event.hpp
+6
-0
src/smf_app/smf_event_sig.hpp
src/smf_app/smf_event_sig.hpp
+6
-0
src/smf_app/smf_msg.cpp
src/smf_app/smf_msg.cpp
+10
-0
src/smf_app/smf_msg.hpp
src/smf_app/smf_msg.hpp
+4
-0
src/smf_app/smf_sbi.cpp
src/smf_app/smf_sbi.cpp
+5
-0
No files found.
src/smf_app/smf_app.cpp
View file @
35ed4c43
...
...
@@ -323,13 +323,19 @@ smf_app::smf_app(const std::string& config_file)
m_scid2smf_context
(),
m_sm_context_create_promises
(),
m_sm_context_update_promises
(),
m_sm_context_release_promises
()
{
m_sm_context_release_promises
(),
event_sub
(){
Logger
::
smf_app
().
startup
(
"Starting..."
);
supi2smf_context
=
{};
set_seid_n4
=
{};
seid_n4_generator
=
0
;
// Subscribe to sm context status change
pdu_session_status_connection
=
event_sub
.
subscribe_ee_pdu_session_status_change
(
boost
::
bind
(
&
smf_app
::
handle_pdu_session_status_change
,
this
,
_1
,
_2
,
_3
));
apply_config
(
smf_cfg
);
if
(
itti_inst
->
create_task
(
TASK_SMF_APP
,
smf_app_task
,
nullptr
))
{
...
...
@@ -616,6 +622,18 @@ void smf_app::handle_itti_msg(itti_n11_update_pdu_session_status& m) {
pdu_session_status_e2str
.
at
(
static_cast
<
int
>
(
m
.
pdu_session_status
))
.
c_str
());
update_pdu_session_status
(
m
.
scid
,
m
.
pdu_session_status
);
if
((
m
.
pdu_session_status
==
pdu_session_status_e
::
PDU_SESSION_ACTIVE
)
or
(
m
.
pdu_session_status
==
pdu_session_status_e
::
PDU_SESSION_INACTIVE
)){
Logger
::
smf_app
().
info
(
"Notify PDU Session Status change"
);
std
::
string
status
;
if
(
m
.
pdu_session_status
==
pdu_session_status_e
::
PDU_SESSION_ACTIVE
)
status
=
"ESTABLISHED"
;
else
status
=
"RELEASED"
;
event_sub
.
ee_pdu_session_status
(
m
.
scid
,
status
,
1
);
}
}
//------------------------------------------------------------------------------
...
...
@@ -2091,3 +2109,110 @@ void smf_app::trigger_upf_status_notification_subscribe() {
itti_msg
->
get_msg_name
());
}
}
void
smf_app
::
handle_pdu_session_status_change
(
scid_t
scid
,
const
std
::
string
&
status
,
uint8_t
http_version
)
{
Logger
::
smf_app
().
debug
(
"Send request to N11 to triger PDU Session Status Change Notification, "
"SMF Context ID "
SCID_FMT
" "
,
scid
);
// get the smf context
std
::
shared_ptr
<
smf_context_ref
>
scf
=
{};
if
(
is_scid_2_smf_context
(
scid
))
{
scf
=
scid_2_smf_context
(
scid
);
}
else
{
Logger
::
smf_app
().
warn
(
"Context associated with this id "
SCID_FMT
" does not exit!"
,
scid
);
}
supi_t
supi
=
scf
.
get
()
->
supi
;
supi64_t
supi64
=
smf_supi_to_u64
(
supi
);
pdu_session_id_t
pdu_session_id
=
scf
.
get
()
->
pdu_session_id
;
std
::
shared_ptr
<
smf_context
>
sc
=
{};
if
(
is_supi_2_smf_context
(
supi64
))
{
sc
=
supi_2_smf_context
(
supi64
);
Logger
::
smf_app
().
debug
(
"Retrieve SMF context with SUPI "
SUPI_64_FMT
""
,
supi64
);
}
else
{
Logger
::
smf_app
().
warn
(
"Could not retrieve the corresponding SMF context with "
"Supi "
SUPI_64_FMT
"!"
,
supi64
);
}
// get dnn context
std
::
shared_ptr
<
dnn_context
>
sd
=
{};
if
(
!
sc
.
get
()
->
find_dnn_context
(
scf
.
get
()
->
nssai
,
scf
.
get
()
->
dnn
,
sd
))
{
if
(
nullptr
==
sd
.
get
())
{
Logger
::
smf_app
().
warn
(
"Could not retrieve the corresponding DNN context!"
);
}
}
// get smd_pdu_session
std
::
shared_ptr
<
smf_pdu_session
>
sp
=
{};
bool
find_pdn
=
sd
.
get
()
->
find_pdu_session
(
pdu_session_id
,
sp
);
if
(
nullptr
==
sp
.
get
())
{
Logger
::
smf_app
().
warn
(
"Could not retrieve the corresponding SMF PDU Session context!"
);
}
Logger
::
smf_app
().
debug
(
"Send request to N11 to triger PDU Session Status Change Notification (Event "
"Exposure), SUPI "
SUPI_64_FMT
" , PDU Session ID %d, HTTP version %d"
,
supi
,
pdu_session_id
,
http_version
);
std
::
vector
<
std
::
shared_ptr
<
smf_subscription
>>
subscriptions
=
{};
smf_app_inst
->
get_ee_subscriptions
(
smf_event_t
::
SMF_EVENT_PDU_SES_REL
,
subscriptions
);
if
(
subscriptions
.
size
()
>
0
)
{
// Send request to N11 to trigger the notification to the subscribed event
Logger
::
smf_app
().
debug
(
"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_SBI
);
for
(
auto
i
:
subscriptions
)
{
event_notification
ev_notif
=
{};
ev_notif
.
set_supi
(
supi64
);
ev_notif
.
set_pdu_session_id
(
pdu_session_id
);
ev_notif
.
set_smf_event
(
smf_event_t
::
SMF_EVENT_PDU_SES_REL
);
ev_notif
.
set_notif_uri
(
i
.
get
()
->
notif_uri
);
ev_notif
.
set_notif_id
(
i
.
get
()
->
notif_id
);
//custom json e.g., for FlexCN
nlohmann
::
json
cj
=
{};
if
(
sp
.
get
()
!=
nullptr
)
{
if
(
sp
->
ipv4
)
{
cj
[
"ue_ipv4_addr"
]
=
conv
::
toString
(
sp
->
ipv4_address
);
}
cj
[
"pdu_session_type"
]
=
sp
->
pdu_session_type
.
toString
();
}
ev_notif
.
set_custom_info
(
cj
);
itti_msg
->
event_notifs
.
push_back
(
ev_notif
);
}
itti_msg
->
http_version
=
http_version
;
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_SBI"
,
itti_msg
->
get_msg_name
());
}
}
else
{
Logger
::
smf_app
().
debug
(
"No subscription available for this event"
);
}
}
src/smf_app/smf_app.hpp
View file @
35ed4c43
...
...
@@ -148,6 +148,12 @@ class smf_app {
std
::
string
smf_instance_id
;
// SMF instance id
timer_id_t
timer_nrf_heartbeat
;
// for Event Handling
smf_event
event_sub
;
bs2
::
connection
pdu_session_status_connection
;
bs2
::
connection
ee_pdu_session_release_connection
;
/*
* Apply the config from the configuration file for DNN pools
* @param [const smf_config &cfg] cfg
...
...
@@ -212,6 +218,9 @@ class smf_app {
virtual
~
smf_app
()
{
Logger
::
smf_app
().
debug
(
"Delete SMF_APP instance..."
);
// Disconnect the boost connection
if
(
pdu_session_status_connection
.
connected
())
pdu_session_status_connection
.
disconnect
();
// TODO: Unregister NRF
}
...
...
@@ -532,6 +541,9 @@ class smf_app {
oai
::
smf_server
::
model
::
ProblemDetails
&
problem_details
,
uint8_t
&
http_code
);
void
handle_pdu_session_status_change
(
scid_t
scid
,
const
std
::
string
&
status
,
uint8_t
http_version
);
/*
* Trigger pdu session modification
* @param [const supi_t &] supi
...
...
src/smf_app/smf_context.cpp
View file @
35ed4c43
...
...
@@ -3083,6 +3083,10 @@ void smf_context::handle_ee_pdu_session_release(
ev_notif
.
set_supi
(
supi
);
ev_notif
.
set_notif_uri
(
i
.
get
()
->
notif_uri
);
ev_notif
.
set_notif_id
(
i
.
get
()
->
notif_id
);
//custom json e.g., for FlexCN
//nlohmann::json cj = {};
//cj["ue_ipv4_addr"] = "12.1.1.2";
//cj[""]
itti_msg
->
event_notifs
.
push_back
(
ev_notif
);
}
...
...
src/smf_app/smf_event.cpp
View file @
35ed4c43
...
...
@@ -42,6 +42,10 @@ bs2::connection smf_event::subscribe_sm_context_status(
return
sm_context_status
.
connect
(
sig
);
}
bs2
::
connection
smf_event
::
subscribe_ee_pdu_session_status_change
(
const
ee_pdu_session_status_sig_t
::
slot_type
&
sig
)
{
return
ee_pdu_session_status
.
connect
(
sig
);
}
//------------------------------------------------------------------------------
bs2
::
connection
smf_event
::
subscribe_ee_pdu_session_release
(
const
ee_pdu_session_release_sig_t
::
slot_type
&
sig
)
{
...
...
src/smf_app/smf_event.hpp
View file @
35ed4c43
...
...
@@ -73,9 +73,15 @@ class smf_event {
bs2
::
connection
subscribe_ee_pdu_session_release
(
const
ee_pdu_session_release_sig_t
::
slot_type
&
sig
);
bs2
::
connection
subscribe_ee_pdu_session_status_change
(
const
ee_pdu_session_status_sig_t
::
slot_type
&
sig
);
private:
sm_context_status_sig_t
sm_context_status
;
// Signal for SM Context status update
ee_pdu_session_status_sig_t
ee_pdu_session_status
;
// Signal for PDU Session status change
ee_pdu_session_release_sig_t
ee_pdu_session_release
;
// Signal for SM Context status update
};
...
...
src/smf_app/smf_event_sig.hpp
View file @
35ed4c43
...
...
@@ -44,6 +44,12 @@ typedef bs2::signal_type<
void
(
scid_t
,
const
std
::
string
&
,
uint8_t
),
bs2
::
keywords
::
mutex_type
<
bs2
::
dummy_mutex
>>::
type
sm_context_status_sig_t
;
// Signal for PDU session status change (for Event Exposure)
// SCID, PDU Session Status, HTTP version
typedef
bs2
::
signal_type
<
void
(
scid_t
,
const
std
::
string
&
,
uint8_t
),
bs2
::
keywords
::
mutex_type
<
bs2
::
dummy_mutex
>>::
type
ee_pdu_session_status_sig_t
;
// Signal for Event exposure
// PDU session Release, SUPI, PDU SessionID, HTTP version
typedef
bs2
::
signal_type
<
...
...
src/smf_app/smf_msg.cpp
View file @
35ed4c43
...
...
@@ -966,6 +966,16 @@ std::string event_notification::get_notif_id() const {
return
m_notif_id
;
}
//------------------------------------------------------------------------------
void
event_notification
::
set_custom_info
(
const
nlohmann
::
json
&
c
)
{
custom_info
=
c
;
}
//------------------------------------------------------------------------------
void
event_notification
::
get_custom_info
(
nlohmann
::
json
&
c
)
const
{
c
=
custom_info
;
}
//-----------------------------------------------------------------------------
void
data_notification_msg
::
set_notification_event_type
(
const
std
::
string
&
type
)
{
...
...
src/smf_app/smf_msg.hpp
View file @
35ed4c43
...
...
@@ -585,8 +585,12 @@ class event_notification {
std
::
string
get_notif_uri
()
const
;
void
set_notif_id
(
std
::
string
const
&
value
);
std
::
string
get_notif_id
()
const
;
void
set_custom_info
(
const
nlohmann
::
json
&
c
);
void
get_custom_info
(
nlohmann
::
json
&
c
)
const
;
private:
nlohmann
::
json
custom_info
;
// store extra json data
std
::
string
m_notif_uri
;
// m_NotifUri;
std
::
string
m_notif_id
;
// m_NotifId;
...
...
src/smf_app/smf_sbi.cpp
View file @
35ed4c43
...
...
@@ -572,12 +572,17 @@ void smf_sbi::notify_subscribed_event(
event_notif
[
"event"
]
=
i
.
get_smf_event
();
event_notif
[
"pduSeId"
]
=
i
.
get_pdu_session_id
();
event_notif
[
"supi"
]
=
std
::
to_string
(
i
.
get_supi
());
//customized data
nlohmann
::
json
customized_data
=
{};
i
.
get_custom_info
(
customized_data
);
event_notif
[
"customized_data"
]
=
customized_data
;
// timestamp
std
::
time_t
time_epoch_ntp
=
std
::
time
(
nullptr
);
uint64_t
tv_ntp
=
time_epoch_ntp
+
SECONDS_SINCE_FIRST_EPOCH
;
event_notif
[
"timeStamp"
]
=
std
::
to_string
(
tv_ntp
);
event_notifs
.
push_back
(
event_notif
);
json_data
[
"eventNotifs"
]
=
event_notifs
;
std
::
string
body
=
json_data
.
dump
();
bodys
.
push_back
(
body
);
}
...
...
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