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
db8776ae
Commit
db8776ae
authored
May 24, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First version for UE IP Addr change
parent
8f3a9122
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
192 additions
and
13 deletions
+192
-13
src/smf_app/smf_context.cpp
src/smf_app/smf_context.cpp
+138
-7
src/smf_app/smf_context.hpp
src/smf_app/smf_context.hpp
+11
-0
src/smf_app/smf_event.cpp
src/smf_app/smf_event.cpp
+6
-0
src/smf_app/smf_event.hpp
src/smf_app/smf_event.hpp
+6
-2
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
+16
-0
src/smf_app/smf_msg.hpp
src/smf_app/smf_msg.hpp
+7
-4
src/smf_app/smf_procedure.cpp
src/smf_app/smf_procedure.cpp
+2
-0
No files found.
src/smf_app/smf_context.cpp
View file @
db8776ae
...
...
@@ -112,6 +112,15 @@ void smf_qos_flow::deallocate_ressources() {
(
uint8_t
)
qfi
.
qfi
);
}
//------------------------------------------------------------------------------
void
smf_pdu_session
::
get_pdu_session_id
(
uint32_t
&
psi
)
const
{
psi
=
pdu_session_id
;
}
//------------------------------------------------------------------------------
uint32_t
smf_pdu_session
::
get_pdu_session_id
()
const
{
return
pdu_session_id
;
}
//------------------------------------------------------------------------------
void
smf_pdu_session
::
set
(
const
paa_t
&
paa
)
{
switch
(
paa
.
pdu_session_type
.
pdu_session_type
)
{
...
...
@@ -3208,6 +3217,128 @@ void smf_context::handle_pdu_session_status_change(
}
}
//------------------------------------------------------------------------------
void
smf_context
::
handle_ue_ip_change
(
scid_t
scid
,
uint8_t
http_version
)
{
Logger
::
smf_app
().
debug
(
"Send request to N11 to triger FlexCN, "
"SMF Context ID "
SCID_FMT
" "
,
scid
);
// get the smf context
std
::
shared_ptr
<
smf_context_ref
>
scf
=
{};
if
(
smf_app_inst
->
is_scid_2_smf_context
(
scid
))
{
scf
=
smf_app_inst
->
scid_2_smf_context
(
scid
);
}
else
{
Logger
::
smf_app
().
warn
(
"Context associated with this id "
SCID_FMT
" does not exit!"
,
scid
);
return
;
}
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
(
smf_app_inst
->
is_supi_2_smf_context
(
supi64
))
{
sc
=
smf_app_inst
->
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!"
);
return
;
}
}
// get smf_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!"
);
return
;
}
Logger
::
smf_app
().
debug
(
"Send request to N11 to triger FlexCN (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_UE_IP_CH
,
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
);
// SUPI
ev_notif
.
set_pdu_session_id
(
pdu_session_id
);
// PDU session ID
ev_notif
.
set_smf_event
(
smf_event_t
::
SMF_EVENT_UE_IP_CH
);
ev_notif
.
set_notif_uri
(
i
.
get
()
->
notif_uri
);
ev_notif
.
set_notif_id
(
i
.
get
()
->
notif_id
);
// timestamp
std
::
time_t
time_epoch_ntp
=
std
::
time
(
nullptr
);
uint64_t
tv_ntp
=
time_epoch_ntp
+
SECONDS_SINCE_FIRST_EPOCH
;
ev_notif
.
set_timestamp
(
std
::
to_string
(
tv_ntp
));
// New UE IPv4
if
(
sp
->
ipv4
)
{
ev_notif
.
set_ad_ipv4_addr
(
conv
::
toString
(
sp
->
ipv4_address
));
}
// New UE IPv6 Prefix
if
(
sp
->
ipv6
)
{
char
str_addr6
[
INET6_ADDRSTRLEN
];
if
(
inet_ntop
(
AF_INET6
,
&
sp
->
ipv6_address
,
str_addr6
,
sizeof
(
str_addr6
)))
{
// TODO
// ev_notif.set_ad_ipv6_prefix(conv::toString(sp->ipv4_address));
}
}
// TODO: Release UE IP address/prefix as "reIpv4Addr", "reIpv6Prefix"
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"
);
}
}
//------------------------------------------------------------------------------
void
smf_context
::
trigger_ue_ip_change
(
scid_t
scid
,
uint8_t
http_version
)
{
event_sub
.
ee_ue_ip_change
(
scid
,
http_version
);
}
//------------------------------------------------------------------------------
void
smf_context
::
handle_flexcn_event
(
scid_t
scid
,
uint8_t
http_version
)
{
Logger
::
smf_app
().
debug
(
...
...
@@ -3253,7 +3384,7 @@ void smf_context::handle_flexcn_event(scid_t scid, uint8_t http_version) {
return
;
}
}
// get sm
d
_pdu_session
// get sm
f
_pdu_session
std
::
shared_ptr
<
smf_pdu_session
>
sp
=
{};
bool
find_pdn
=
sd
.
get
()
->
find_pdu_session
(
pdu_session_id
,
sp
);
...
...
@@ -3287,6 +3418,11 @@ void smf_context::handle_flexcn_event(scid_t scid, uint8_t http_version) {
ev_notif
.
set_smf_event
(
smf_event_t
::
SMF_EVENT_FLEXCN
);
ev_notif
.
set_notif_uri
(
i
.
get
()
->
notif_uri
);
ev_notif
.
set_notif_id
(
i
.
get
()
->
notif_id
);
// timestamp
std
::
time_t
time_epoch_ntp
=
std
::
time
(
nullptr
);
uint64_t
tv_ntp
=
time_epoch_ntp
+
SECONDS_SINCE_FIRST_EPOCH
;
ev_notif
.
set_timestamp
(
std
::
to_string
(
tv_ntp
));
// custom json e.g., for FlexCN
nlohmann
::
json
cj
=
{};
// PLMN
...
...
@@ -3305,7 +3441,7 @@ void smf_context::handle_flexcn_event(scid_t scid, uint8_t http_version) {
char
str_addr6
[
INET6_ADDRSTRLEN
];
if
(
inet_ntop
(
AF_INET6
,
&
sp
->
ipv6_address
,
str_addr6
,
sizeof
(
str_addr6
)))
{
cj
[
"ue_ipv6_
addr
"
]
=
str_addr6
;
cj
[
"ue_ipv6_
prefix
"
]
=
str_addr6
;
}
}
// PDU Session Type
...
...
@@ -3353,11 +3489,6 @@ void smf_context::handle_flexcn_event(scid_t scid, uint8_t http_version) {
}
}
// timestamp
std
::
time_t
time_epoch_ntp
=
std
::
time
(
nullptr
);
uint64_t
tv_ntp
=
time_epoch_ntp
+
SECONDS_SINCE_FIRST_EPOCH
;
cj
[
"timeStamp"
]
=
std
::
to_string
(
tv_ntp
);
ev_notif
.
set_custom_info
(
cj
);
itti_msg
->
event_notifs
.
push_back
(
ev_notif
);
}
...
...
src/smf_app/smf_context.hpp
View file @
db8776ae
...
...
@@ -135,6 +135,9 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> {
smf_pdu_session
(
smf_pdu_session
&
b
)
=
delete
;
void
get_pdu_session_id
(
uint32_t
&
psi
)
const
;
uint32_t
get_pdu_session_id
()
const
;
/*
* Set UE Address for this session
* @param [paa_t &] paa: PAA
...
...
@@ -579,6 +582,10 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
event_sub
.
subscribe_ee_pdu_session_status_change
(
boost
::
bind
(
&
smf_context
::
handle_pdu_session_status_change
,
this
,
_1
,
_2
,
_3
));
// Subscribe to UE IP Change Event
ee_ue_ip_change_connection
=
event_sub
.
subscribe_ee_ue_ip_change
(
boost
::
bind
(
&
smf_context
::
handle_ue_ip_change
,
this
,
_1
,
_2
));
// Subscribe to FlexCN event
ee_flexcn
=
event_sub
.
subscribe_ee_flexcn_event
(
boost
::
bind
(
&
smf_context
::
handle_flexcn_event
,
this
,
_1
,
_2
));
...
...
@@ -1044,6 +1051,9 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
void
trigger_pdu_session_status_change
(
scid_t
scid
,
const
std
::
string
&
status
,
uint8_t
http_version
);
void
trigger_ue_ip_change
(
scid_t
scid
,
uint8_t
http_version
);
void
handle_ue_ip_change
(
scid_t
scid
,
uint8_t
http_version
);
void
trigger_flexcn_event
(
scid_t
scid
,
uint8_t
http_version
);
void
handle_flexcn_event
(
scid_t
scid
,
uint8_t
http_version
);
/*
...
...
@@ -1098,6 +1108,7 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
bs2
::
connection
sm_context_status_connection
;
bs2
::
connection
pdu_session_status_connection
;
bs2
::
connection
ee_pdu_session_release_connection
;
bs2
::
connection
ee_ue_ip_change_connection
;
bs2
::
connection
ee_flexcn
;
};
}
// namespace smf
...
...
src/smf_app/smf_event.cpp
View file @
db8776ae
...
...
@@ -54,6 +54,12 @@ bs2::connection smf_event::subscribe_ee_pdu_session_release(
return
ee_pdu_session_release
.
connect
(
sig
);
}
//------------------------------------------------------------------------------
bs2
::
connection
smf_event
::
subscribe_ee_ue_ip_change
(
const
ee_ue_ip_change_sig_t
::
slot_type
&
sig
)
{
return
ee_ue_ip_change
.
connect
(
sig
);
}
//------------------------------------------------------------------------------
bs2
::
connection
smf_event
::
subscribe_ee_flexcn_event
(
const
ee_flexcn_sig_t
::
slot_type
&
sig
)
{
...
...
src/smf_app/smf_event.hpp
View file @
db8776ae
...
...
@@ -76,6 +76,9 @@ class smf_event {
bs2
::
connection
subscribe_ee_pdu_session_status_change
(
const
ee_pdu_session_status_sig_t
::
slot_type
&
sig
);
bs2
::
connection
subscribe_ee_ue_ip_change
(
const
ee_ue_ip_change_sig_t
::
slot_type
&
sig
);
bs2
::
connection
subscribe_ee_flexcn_event
(
const
ee_flexcn_sig_t
::
slot_type
&
sig
);
...
...
@@ -85,8 +88,9 @@ class smf_event {
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
ee_flexcn_sig_t
ee_flexcn
;
// Signal for FlexCN Event
ee_pdu_session_release
;
// Signal for SM Context status update
ee_ue_ip_change_sig_t
ee_ue_ip_change
;
// Signal for UE IP Addr change
ee_flexcn_sig_t
ee_flexcn
;
// Signal for FlexCN Event
};
}
// namespace smf
#endif
/* FILE_SMF_EVENT_HPP_SEEN */
src/smf_app/smf_event_sig.hpp
View file @
db8776ae
...
...
@@ -59,6 +59,12 @@ typedef bs2::signal_type<
ee_pdu_session_release_sig_t
;
// TODO: ee_ue_ip_address_change_sig_t; //UI IP Address, UE ID
// Signal for Event exposure
// UE Addr Change, SUPI, PDU SessionID, HTTP version
typedef
bs2
::
signal_type
<
void
(
supi64_t
,
uint8_t
),
bs2
::
keywords
::
mutex_type
<
bs2
::
dummy_mutex
>>::
type
ee_ue_ip_change_sig_t
;
// TODO: Access Type Change
// TODO: UP Path Change
// TODO: PLMN Change
...
...
src/smf_app/smf_msg.cpp
View file @
db8776ae
...
...
@@ -877,11 +877,27 @@ void event_exposure_msg::set_event_subs(
void
event_notification
::
set_smf_event
(
const
smf_event_t
&
ev
)
{
m_event
=
ev
;
}
//-----------------------------------------------------------------------------
smf_event_t
event_notification
::
get_smf_event
()
const
{
return
m_event
;
}
//-----------------------------------------------------------------------------
void
event_notification
::
set_timestamp
(
const
std
::
string
&
ss
)
{
m_timestamp
=
ss
;
}
//-----------------------------------------------------------------------------
void
event_notification
::
get_timestamp
(
std
::
string
&
ss
)
const
{
ss
=
m_timestamp
;
}
//-----------------------------------------------------------------------------
std
::
string
event_notification
::
get_timestamp
()
const
{
return
m_timestamp
;
}
//-----------------------------------------------------------------------------
supi64_t
event_notification
::
get_supi
()
const
{
return
m_supi
;
...
...
src/smf_app/smf_msg.hpp
View file @
db8776ae
...
...
@@ -565,6 +565,10 @@ class event_notification {
void
set_smf_event
(
const
smf_event_t
&
ev
);
smf_event_t
get_smf_event
()
const
;
void
set_timestamp
(
const
std
::
string
&
ss
);
void
get_timestamp
(
std
::
string
&
ss
)
const
;
std
::
string
get_timestamp
()
const
;
void
set_supi
(
const
supi64_t
&
supi
);
supi64_t
get_supi
()
const
;
bool
is_supi_is_set
()
const
;
...
...
@@ -588,14 +592,13 @@ class event_notification {
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;
std
::
string
m_notif_uri
;
// m_NotifUri;
std
::
string
m_notif_id
;
// m_NotifId;
smf_event_t
m_event
;
// SmfEvent
// std::string m_TimeS
tamp;
std
::
string
m_times
tamp
;
supi64_t
m_supi
;
bool
m_supi_is_set
;
...
...
src/smf_app/smf_procedure.cpp
View file @
db8776ae
...
...
@@ -1138,7 +1138,9 @@ void session_update_sm_context_procedure::handle_itti_msg(
// Trigger Event_exposure event
scid_t
scid
=
sc
.
get
()
->
get_scid
();
sc
.
get
()
->
trigger_pdu_session_status_change
(
scid
,
"ACTIVATED"
,
1
);
sc
.
get
()
->
trigger_ue_ip_change
(
scid
,
1
);
sc
.
get
()
->
trigger_flexcn_event
(
scid
,
1
);
}
break
;
// UE-Triggered Service Request Procedure (Step 1)
...
...
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