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
bda05ffa
Commit
bda05ffa
authored
Aug 02, 2021
by
Hung Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[feature] support ddds event exposure | still missing data for this feature
parent
1e2f4413
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
120 additions
and
142 deletions
+120
-142
src/smf_app/smf_context.cpp
src/smf_app/smf_context.cpp
+82
-133
src/smf_app/smf_event_sig.hpp
src/smf_app/smf_event_sig.hpp
+2
-2
src/smf_app/smf_msg.cpp
src/smf_app/smf_msg.cpp
+15
-0
src/smf_app/smf_msg.hpp
src/smf_app/smf_msg.hpp
+11
-2
src/smf_app/smf_procedure.cpp
src/smf_app/smf_procedure.cpp
+2
-0
src/smf_app/smf_sbi.cpp
src/smf_app/smf_sbi.cpp
+8
-5
No files found.
src/smf_app/smf_context.cpp
View file @
bda05ffa
...
...
@@ -3119,49 +3119,81 @@ void smf_context::trigger_ddds(scid_t scid, uint8_t http_version) {
//------------------------------------------------------------------------------
void
smf_context
::
handle_ddds
(
scid_t
scid
,
uint8_t
http_version
)
{
// Logger::smf_app().debug(
// "Send request to N11 to triger PDU Session Release 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(supi);
// 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_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);
// }
// 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");
// }
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
);
}
std
::
vector
<
std
::
shared_ptr
<
smf_subscription
>>
subscriptions
=
{};
smf_app_inst
->
get_ee_subscriptions
(
smf_event_t
::
SMF_EVENT_DDDS
,
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_DDDS
);
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
));
// DDDS Status
// TODO: where to get this information in SMF???
oai
::
smf_server
::
model
::
DddStatus
ddds
=
oai
::
smf_server
::
model
::
DddStatus
();
ev_notif
.
set_Ddds
(
ddds
);
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"
);
}
}
...
...
@@ -3484,7 +3516,7 @@ void smf_context::handle_plmn_change(scid_t scid, uint8_t http_version) {
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
;
//
pdu_session_id_t pdu_session_id = scf.get()->pdu_session_id;
std
::
shared_ptr
<
smf_context
>
sc
=
{};
...
...
@@ -3499,31 +3531,6 @@ void smf_context::handle_plmn_change(scid_t scid, uint8_t http_version) {
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_FLEXCN
,
subscriptions
);
...
...
@@ -3539,8 +3546,8 @@ void smf_context::handle_plmn_change(scid_t scid, uint8_t http_version) {
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_pdu_session_id(pdu_session_id); // PDU session ID
ev_notif
.
set_smf_event
(
smf_event_t
::
SMF_EVENT_
PLMN_CH
);
ev_notif
.
set_notif_uri
(
i
.
get
()
->
notif_uri
);
ev_notif
.
set_notif_id
(
i
.
get
()
->
notif_id
);
// timestamp
...
...
@@ -3548,73 +3555,15 @@ void smf_context::handle_plmn_change(scid_t scid, uint8_t http_version) {
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
plmn_t
plmn
=
{};
std
::
string
mcc
,
mnc
;
sc
->
get_plmn
(
plmn
);
conv
::
plmnToMccMnc
(
plmn
,
mcc
,
mnc
);
cj
[
"plmn"
][
"mcc"
]
=
mcc
;
cj
[
"plmn"
][
"mnc"
]
=
mnc
;
// UE IPv4
if
(
sp
->
ipv4
)
{
cj
[
"ue_ipv4_addr"
]
=
conv
::
toString
(
sp
->
ipv4_address
);
}
// UE IPv6
if
(
sp
->
ipv6
)
{
char
str_addr6
[
INET6_ADDRSTRLEN
];
if
(
inet_ntop
(
AF_INET6
,
&
sp
->
ipv6_address
,
str_addr6
,
sizeof
(
str_addr6
)))
{
cj
[
"ue_ipv6_prefix"
]
=
str_addr6
;
}
}
// PDU Session Type
cj
[
"pdu_session_type"
]
=
sp
->
pdu_session_type
.
toString
();
// NSSAI
cj
[
"snssai"
][
"sst"
]
=
scf
->
nssai
.
sST
;
cj
[
"snssai"
][
"sd"
]
=
scf
->
nssai
.
sD
;
// DNN
cj
[
"dnn"
]
=
scf
->
dnn
;
// Serving AMF addr
cj
[
"amf_addr"
]
=
scf
->
amf_addr
;
// QoS flows associated with this session
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
;
// UL FTeid IPv4/IPv6 (UPF)
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
;
}
}
// DL FTeid Ipv4/v6 (AN)
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
);
oai
::
smf_server
::
model
::
PlmnId
plmnid
;
plmnid
.
setMcc
(
mcc
);
plmnid
.
setMnc
(
mnc
);
ev_notif
.
set_PlmnId
(
plmnid
);
itti_msg
->
event_notifs
.
push_back
(
ev_notif
);
}
...
...
src/smf_app/smf_event_sig.hpp
View file @
bda05ffa
...
...
@@ -62,12 +62,12 @@ typedef bs2::signal_type<
// TODO: UP Path Change
// TODO: PLMN Change
typedef
bs2
::
signal_type
<
void
(
s
upi64
_t
,
uint8_t
),
bs2
::
keywords
::
mutex_type
<
bs2
::
dummy_mutex
>>::
type
void
(
s
cid
_t
,
uint8_t
),
bs2
::
keywords
::
mutex_type
<
bs2
::
dummy_mutex
>>::
type
ee_plmn_change_sig_t
;
// TODO: Downlink data delivery status
typedef
bs2
::
signal_type
<
void
(
s
upi64
_t
,
uint8_t
),
bs2
::
keywords
::
mutex_type
<
bs2
::
dummy_mutex
>>::
type
void
(
s
cid
_t
,
uint8_t
),
bs2
::
keywords
::
mutex_type
<
bs2
::
dummy_mutex
>>::
type
ee_ddds_sig_t
;
// Signal for FlexCN event (for Event Exposure)
...
...
src/smf_app/smf_msg.cpp
View file @
bda05ffa
...
...
@@ -883,6 +883,21 @@ smf_event_t event_notification::get_smf_event() const {
return
m_event
;
}
//-----------------------------------------------------------------------------
// ddds change
void
event_notification
::
set_Ddds
(
oai
::
smf_server
::
model
::
DddStatus
const
&
value
){
m_DddStatus
=
value
;
m_DddStatusIsSet
=
true
;
}
oai
::
smf_server
::
model
::
DddStatus
event_notification
::
get_ddds
()
const
{
return
m_DddStatus
;
}
bool
event_notification
::
is_ddds_is_set
()
const
{
return
m_DddStatusIsSet
;
}
//-----------------------------------------------------------------------------
void
event_notification
::
set_timestamp
(
const
std
::
string
&
ss
)
{
m_timestamp
=
ss
;
...
...
src/smf_app/smf_msg.hpp
View file @
bda05ffa
...
...
@@ -40,6 +40,7 @@
#include "pistache/http.h"
#include "smf_profile.hpp"
#include "PlmnId.h"
#include "DddStatus.h"
extern
"C"
{
#include "QOSRules.h"
...
...
@@ -589,6 +590,12 @@ class event_notification {
oai
::
smf_server
::
model
::
PlmnId
get_plmnid
()
const
;
bool
is_plmnid_is_set
()
const
;
// ddds change
void
set_Ddds
(
oai
::
smf_server
::
model
::
DddStatus
const
&
value
);
oai
::
smf_server
::
model
::
DddStatus
get_ddds
()
const
;
bool
is_ddds_is_set
()
const
;
void
set_pdu_session_id
(
const
pdu_session_id_t
value
);
pdu_session_id_t
get_pdu_session_id
()
const
;
bool
is_psi_is_set
()
const
;
...
...
@@ -621,6 +628,10 @@ class event_notification {
oai
::
smf_server
::
model
::
PlmnId
m_PlmnId
;
bool
m_PlmnIdIsSet
;
// for ddds change
oai
::
smf_server
::
model
::
DddStatus
m_DddStatus
;
bool
m_DddStatusIsSet
;
// for an access type change
// AccessType m_AccType;
// bool m_AccTypeIsSet;
...
...
@@ -655,8 +666,6 @@ class event_notification {
// bool m_AdIpv6PrefixIsSet;
// Ipv6Prefix m_ReIpv6Prefix;
// bool m_ReIpv6PrefixIsSet;
// DddStatus m_DddStatus;
// bool m_DddStatusIsSet;
// std::string m_MaxWaitTime;
// bool m_MaxWaitTimeIsSet;
};
...
...
src/smf_app/smf_procedure.cpp
View file @
bda05ffa
...
...
@@ -1138,6 +1138,8 @@ void session_update_sm_context_procedure::handle_itti_msg(
// Trigger Event_exposure event
scid_t
scid
=
sc
.
get
()
->
get_scid
();
sc
.
get
()
->
trigger_ue_ip_change
(
scid
,
1
);
sc
.
get
()
->
trigger_plmn_change
(
scid
,
1
);
sc
.
get
()
->
trigger_ddds
(
scid
,
1
);
sc
.
get
()
->
trigger_flexcn_event
(
scid
,
1
);
}
break
;
...
...
src/smf_app/smf_sbi.cpp
View file @
bda05ffa
...
...
@@ -583,13 +583,16 @@ void smf_sbi::notify_subscribed_event(
// add support for plmn change.
if
(
i
.
is_plmnid_is_set
())
{
oai
::
smf_server
::
model
::
PlmnId
plmnid
=
i
.
get_plmnid
();
nlohmann
::
json
plmnid_data
=
{};
//oai::smf_server::model::
to_json
(
plmnid_data
,
plmnid
);
event_notif
[
"plmnId"
]
=
plmnid_data
;
event_notif
[
"plmnId"
]
=
i
.
get_plmnid
();
}
// add support for ddds
if
(
i
.
is_ddds_is_set
())
{
//TODO: change this one to the real value when finished the event for ddds
// event_notif["dddStatus"] = i.get_ddds();
event_notif
[
"dddStatus"
]
=
"TRANSMITTED"
;
}
// customized data
nlohmann
::
json
customized_data
=
{};
i
.
get_custom_info
(
customized_data
);
...
...
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