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
c9770cf5
Commit
c9770cf5
authored
May 22, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add customize API for FlexCN
parent
9f8cb6b5
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
277 additions
and
112 deletions
+277
-112
src/common/3gpp_29.508.h
src/common/3gpp_29.508.h
+2
-1
src/smf_app/smf_context.cpp
src/smf_app/smf_context.cpp
+243
-105
src/smf_app/smf_context.hpp
src/smf_app/smf_context.hpp
+9
-2
src/smf_app/smf_event.cpp
src/smf_app/smf_event.cpp
+9
-1
src/smf_app/smf_event.hpp
src/smf_app/smf_event.hpp
+5
-0
src/smf_app/smf_event_sig.hpp
src/smf_app/smf_event_sig.hpp
+6
-1
src/smf_app/smf_procedure.cpp
src/smf_app/smf_procedure.cpp
+3
-2
No files found.
src/common/3gpp_29.508.h
View file @
c9770cf5
...
@@ -30,7 +30,8 @@ typedef enum smf_event_e {
...
@@ -30,7 +30,8 @@ typedef enum smf_event_e {
SMF_EVENT_PDU_SES_REL
=
3
,
SMF_EVENT_PDU_SES_REL
=
3
,
SMF_EVENT_PLMN_CH
=
4
,
SMF_EVENT_PLMN_CH
=
4
,
SMF_EVENT_UE_IP_CH
=
5
,
SMF_EVENT_UE_IP_CH
=
5
,
SMF_EVENT_DDDS
=
6
SMF_EVENT_DDDS
=
6
,
SMF_EVENT_FLEXCN
=
99
}
smf_event_t
;
}
smf_event_t
;
static
const
std
::
vector
<
std
::
string
>
smf_event_e2str
=
{
static
const
std
::
vector
<
std
::
string
>
smf_event_e2str
=
{
...
...
src/smf_app/smf_context.cpp
View file @
c9770cf5
...
@@ -3083,10 +3083,10 @@ void smf_context::handle_ee_pdu_session_release(
...
@@ -3083,10 +3083,10 @@ void smf_context::handle_ee_pdu_session_release(
ev_notif
.
set_supi
(
supi
);
ev_notif
.
set_supi
(
supi
);
ev_notif
.
set_notif_uri
(
i
.
get
()
->
notif_uri
);
ev_notif
.
set_notif_uri
(
i
.
get
()
->
notif_uri
);
ev_notif
.
set_notif_id
(
i
.
get
()
->
notif_id
);
ev_notif
.
set_notif_id
(
i
.
get
()
->
notif_id
);
//custom json e.g., for FlexCN
//
custom json e.g., for FlexCN
//nlohmann::json cj = {};
//
nlohmann::json cj = {};
//cj["ue_ipv4_addr"] = "12.1.1.2";
//
cj["ue_ipv4_addr"] = "12.1.1.2";
//cj[""]
//
cj[""]
itti_msg
->
event_notifs
.
push_back
(
ev_notif
);
itti_msg
->
event_notifs
.
push_back
(
ev_notif
);
}
}
...
@@ -3103,7 +3103,6 @@ void smf_context::handle_ee_pdu_session_release(
...
@@ -3103,7 +3103,6 @@ void smf_context::handle_ee_pdu_session_release(
}
}
}
}
void
smf_context
::
handle_pdu_session_status_change
(
void
smf_context
::
handle_pdu_session_status_change
(
scid_t
scid
,
const
std
::
string
&
status
,
uint8_t
http_version
)
{
scid_t
scid
,
const
std
::
string
&
status
,
uint8_t
http_version
)
{
Logger
::
smf_app
().
debug
(
Logger
::
smf_app
().
debug
(
...
@@ -3157,7 +3156,8 @@ void smf_context::handle_pdu_session_status_change(
...
@@ -3157,7 +3156,8 @@ void smf_context::handle_pdu_session_status_change(
}
}
Logger
::
smf_app
().
debug
(
Logger
::
smf_app
().
debug
(
"Send request to N11 to triger PDU Session Status Change Notification (Event "
"Send request to N11 to triger PDU Session Status Change Notification "
"(Event "
"Exposure), SUPI "
SUPI_64_FMT
" , PDU Session ID %d, HTTP version %d"
,
"Exposure), SUPI "
SUPI_64_FMT
" , PDU Session ID %d, HTTP version %d"
,
supi
,
pdu_session_id
,
http_version
);
supi
,
pdu_session_id
,
http_version
);
...
@@ -3180,7 +3180,7 @@ void smf_context::handle_pdu_session_status_change(
...
@@ -3180,7 +3180,7 @@ void smf_context::handle_pdu_session_status_change(
ev_notif
.
set_smf_event
(
smf_event_t
::
SMF_EVENT_PDU_SES_REL
);
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_uri
(
i
.
get
()
->
notif_uri
);
ev_notif
.
set_notif_id
(
i
.
get
()
->
notif_id
);
ev_notif
.
set_notif_id
(
i
.
get
()
->
notif_id
);
//
custom json e.g., for FlexCN
//
custom json e.g., for FlexCN
nlohmann
::
json
cj
=
{};
nlohmann
::
json
cj
=
{};
if
(
sp
.
get
()
!=
nullptr
)
{
if
(
sp
.
get
()
!=
nullptr
)
{
if
(
sp
->
ipv4
)
{
if
(
sp
->
ipv4
)
{
...
@@ -3206,15 +3206,153 @@ void smf_context::handle_pdu_session_status_change(
...
@@ -3206,15 +3206,153 @@ void smf_context::handle_pdu_session_status_change(
}
}
}
}
void
smf_context
::
handle_flexcn_event
(
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
=
{};
void
smf_context
::
trigger_pdu_session_status_change
(
scid_t
scid
,
const
std
::
string
&
status
,
uint8_t
http_version
){
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 smd_pdu_session
std
::
shared_ptr
<
smf_pdu_session
>
sp
=
{};
bool
find_pdn
=
sd
.
get
()
->
find_pdu_session
(
pdu_session_id
,
sp
);
event_sub
.
ee_pdu_session_status
(
if
(
nullptr
==
sp
.
get
())
{
scid
,
status
,
http_version
);
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_FLEXCN
,
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_FLEXCN
);
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
->
ipv4
)
{
cj
[
"ue_ipv4_addr"
]
=
conv
::
toString
(
sp
->
ipv4_address
);
}
cj
[
"pdu_session_type"
]
=
sp
->
pdu_session_type
.
toString
();
cj
[
"snssai"
][
"sst"
]
=
scf
->
nssai
.
sST
;
cj
[
"snssai"
][
"sd"
]
=
scf
->
nssai
.
sD
;
cj
[
"dnn"
]
=
scf
->
dnn
;
cj
[
"amf_addr"
]
=
scf
->
amf_addr
;
// if (scf->upf_node_id.node_id_type == pfcp::NODE_ID_TYPE_IPV4_ADDRESS)
// cj["upf_addr"] = inet_ntoa(scf->upf_node_id.u1.ipv4_address);
std
::
vector
<
smf_qos_flow
>
flows
=
{};
sp
->
get_qos_flows
(
flows
);
if
(
flows
.
size
()
>
0
)
{
cj
[
"qos_flow"
]
=
nlohmann
::
json
::
array
();
for
(
auto
f
:
flows
)
{
nlohmann
::
json
tmp
=
{};
tmp
[
"qfi"
]
=
(
uint8_t
)
f
.
qfi
.
qfi
;
if
(
f
.
ul_fteid
.
v4
)
tmp
[
"upf_addr"
][
"ipv4"
]
=
inet_ntoa
(
f
.
ul_fteid
.
ipv4_address
);
if
(
f
.
ul_fteid
.
v6
)
{
char
str_addr6
[
INET6_ADDRSTRLEN
];
if
(
inet_ntop
(
AF_INET6
,
&
f
.
ul_fteid
.
ipv6_address
,
str_addr6
,
sizeof
(
str_addr6
)))
{
tmp
[
"upf_addr"
][
"ipv6"
]
=
str_addr6
;
}
}
if
(
f
.
dl_fteid
.
v4
)
tmp
[
"an_addr"
][
"ipv4"
]
=
inet_ntoa
(
f
.
dl_fteid
.
ipv4_address
);
if
(
f
.
dl_fteid
.
v6
)
{
char
str_addr6
[
INET6_ADDRSTRLEN
];
if
(
inet_ntop
(
AF_INET6
,
&
f
.
dl_fteid
.
ipv6_address
,
str_addr6
,
sizeof
(
str_addr6
)))
{
tmp
[
"an_addr"
][
"ipv6"
]
=
str_addr6
;
}
}
cj
[
"qos_flow"
].
push_back
(
tmp
);
}
}
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"
);
}
}
void
smf_context
::
trigger_flexcn_event
(
scid_t
scid
,
uint8_t
http_version
)
{
event_sub
.
ee_flexcn
(
scid
,
http_version
);
}
}
void
smf_context
::
trigger_pdu_session_status_change
(
scid_t
scid
,
const
std
::
string
&
status
,
uint8_t
http_version
)
{
event_sub
.
ee_pdu_session_status
(
scid
,
status
,
http_version
);
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
smf_context
::
update_qos_info
(
void
smf_context
::
update_qos_info
(
...
...
src/smf_app/smf_context.hpp
View file @
c9770cf5
...
@@ -579,6 +579,9 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
...
@@ -579,6 +579,9 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
event_sub
.
subscribe_ee_pdu_session_status_change
(
boost
::
bind
(
event_sub
.
subscribe_ee_pdu_session_status_change
(
boost
::
bind
(
&
smf_context
::
handle_pdu_session_status_change
,
this
,
_1
,
_2
,
_3
));
&
smf_context
::
handle_pdu_session_status_change
,
this
,
_1
,
_2
,
_3
));
// Subscribe to FlexCN event
ee_flexcn
=
event_sub
.
subscribe_ee_flexcn_event
(
boost
::
bind
(
&
smf_context
::
handle_flexcn_event
,
this
,
_1
,
_2
));
}
}
smf_context
(
smf_context
&
b
)
=
delete
;
smf_context
(
smf_context
&
b
)
=
delete
;
...
@@ -1038,8 +1041,11 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
...
@@ -1038,8 +1041,11 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
void
handle_pdu_session_status_change
(
void
handle_pdu_session_status_change
(
scid_t
scid
,
const
std
::
string
&
status
,
uint8_t
http_version
);
scid_t
scid
,
const
std
::
string
&
status
,
uint8_t
http_version
);
void
trigger_pdu_session_status_change
(
scid_t
scid
,
const
std
::
string
&
status
,
uint8_t
http_version
);
void
trigger_pdu_session_status_change
(
scid_t
scid
,
const
std
::
string
&
status
,
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
);
/*
/*
* Update QoS information in the Response message according to the content of
* Update QoS information in the Response message according to the content of
* decoded NAS msg
* decoded NAS msg
...
@@ -1092,6 +1098,7 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
...
@@ -1092,6 +1098,7 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
bs2
::
connection
sm_context_status_connection
;
bs2
::
connection
sm_context_status_connection
;
bs2
::
connection
pdu_session_status_connection
;
bs2
::
connection
pdu_session_status_connection
;
bs2
::
connection
ee_pdu_session_release_connection
;
bs2
::
connection
ee_pdu_session_release_connection
;
bs2
::
connection
ee_flexcn
;
};
};
}
// namespace smf
}
// namespace smf
...
...
src/smf_app/smf_event.cpp
View file @
c9770cf5
...
@@ -42,12 +42,20 @@ bs2::connection smf_event::subscribe_sm_context_status(
...
@@ -42,12 +42,20 @@ bs2::connection smf_event::subscribe_sm_context_status(
return
sm_context_status
.
connect
(
sig
);
return
sm_context_status
.
connect
(
sig
);
}
}
//------------------------------------------------------------------------------
bs2
::
connection
smf_event
::
subscribe_ee_pdu_session_status_change
(
bs2
::
connection
smf_event
::
subscribe_ee_pdu_session_status_change
(
const
ee_pdu_session_status_sig_t
::
slot_type
&
sig
)
{
const
ee_pdu_session_status_sig_t
::
slot_type
&
sig
)
{
return
ee_pdu_session_status
.
connect
(
sig
);
return
ee_pdu_session_status
.
connect
(
sig
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
bs2
::
connection
smf_event
::
subscribe_ee_pdu_session_release
(
bs2
::
connection
smf_event
::
subscribe_ee_pdu_session_release
(
const
ee_pdu_session_release_sig_t
::
slot_type
&
sig
)
{
const
ee_pdu_session_release_sig_t
::
slot_type
&
sig
)
{
return
ee_pdu_session_release
.
connect
(
sig
);
return
ee_pdu_session_release
.
connect
(
sig
);
}
}
//------------------------------------------------------------------------------
bs2
::
connection
smf_event
::
subscribe_ee_flexcn_event
(
const
ee_flexcn_sig_t
::
slot_type
&
sig
)
{
return
ee_flexcn
.
connect
(
sig
);
}
src/smf_app/smf_event.hpp
View file @
c9770cf5
...
@@ -76,6 +76,9 @@ class smf_event {
...
@@ -76,6 +76,9 @@ class smf_event {
bs2
::
connection
subscribe_ee_pdu_session_status_change
(
bs2
::
connection
subscribe_ee_pdu_session_status_change
(
const
ee_pdu_session_status_sig_t
::
slot_type
&
sig
);
const
ee_pdu_session_status_sig_t
::
slot_type
&
sig
);
bs2
::
connection
subscribe_ee_flexcn_event
(
const
ee_flexcn_sig_t
::
slot_type
&
sig
);
private:
private:
sm_context_status_sig_t
sm_context_status_sig_t
sm_context_status
;
// Signal for SM Context status update
sm_context_status
;
// Signal for SM Context status update
...
@@ -84,6 +87,8 @@ class smf_event {
...
@@ -84,6 +87,8 @@ class smf_event {
ee_pdu_session_release_sig_t
ee_pdu_session_release_sig_t
ee_pdu_session_release
;
// Signal for SM Context status update
ee_pdu_session_release
;
// Signal for SM Context status update
ee_flexcn_sig_t
ee_flexcn
;
// Signal for FlexCN Event
};
};
}
// namespace smf
}
// namespace smf
#endif
/* FILE_SMF_EVENT_HPP_SEEN */
#endif
/* FILE_SMF_EVENT_HPP_SEEN */
src/smf_app/smf_event_sig.hpp
View file @
c9770cf5
...
@@ -63,7 +63,12 @@ typedef bs2::signal_type<
...
@@ -63,7 +63,12 @@ typedef bs2::signal_type<
// TODO: UP Path Change
// TODO: UP Path Change
// TODO: PLMN Change
// TODO: PLMN Change
// TODO: Downlink data delivery status
// TODO: Downlink data delivery status
// TODO: Customized APIs for FlexCN
// Signal for FlexCN event (for Event Exposure)
// SCID, HTTP version
typedef
bs2
::
signal_type
<
void
(
scid_t
,
uint8_t
),
bs2
::
keywords
::
mutex_type
<
bs2
::
dummy_mutex
>>::
type
ee_flexcn_sig_t
;
}
// namespace smf
}
// namespace smf
#endif
/* FILE_SMF_EVENT_SIG_HPP_SEEN */
#endif
/* FILE_SMF_EVENT_SIG_HPP_SEEN */
src/smf_app/smf_procedure.cpp
View file @
c9770cf5
...
@@ -1133,11 +1133,12 @@ void session_update_sm_context_procedure::handle_itti_msg(
...
@@ -1133,11 +1133,12 @@ void session_update_sm_context_procedure::handle_itti_msg(
// Update PDU session status to ACTIVE
// Update PDU session status to ACTIVE
sps
->
set_pdu_session_status
(
pdu_session_status_e
::
PDU_SESSION_ACTIVE
);
sps
->
set_pdu_session_status
(
pdu_session_status_e
::
PDU_SESSION_ACTIVE
);
// set UpCnxState to
DE
ACTIVATED
// set UpCnxState to ACTIVATED
sps
->
set_upCnx_state
(
upCnx_state_e
::
UPCNX_STATE_ACTIVATED
);
sps
->
set_upCnx_state
(
upCnx_state_e
::
UPCNX_STATE_ACTIVATED
);
//Trigger Event_exposure event
//
Trigger Event_exposure event
scid_t
scid
=
sc
.
get
()
->
get_scid
();
scid_t
scid
=
sc
.
get
()
->
get_scid
();
sc
.
get
()
->
trigger_pdu_session_status_change
(
scid
,
"ACTIVATED"
,
1
);
sc
.
get
()
->
trigger_pdu_session_status_change
(
scid
,
"ACTIVATED"
,
1
);
sc
.
get
()
->
trigger_flexcn_event
(
scid
,
1
);
}
break
;
}
break
;
// UE-Triggered Service Request Procedure (Step 1)
// 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