Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-AMF
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
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-AMF
Commits
e0ccb169
Commit
e0ccb169
authored
Sep 07, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Send Notificatio to subscribed NFs
parent
5df62e5d
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
151 additions
and
17 deletions
+151
-17
src/amf-app/amf_msg.cpp
src/amf-app/amf_msg.cpp
+10
-0
src/amf-app/amf_msg.hpp
src/amf-app/amf_msg.hpp
+3
-1
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+31
-13
src/amf-app/amf_n11.cpp
src/amf-app/amf_n11.cpp
+46
-2
src/amf-app/amf_n11.hpp
src/amf-app/amf_n11.hpp
+3
-0
src/amf-app/amf_subscription.hpp
src/amf-app/amf_subscription.hpp
+1
-1
src/common/3gpp_29.518.h
src/common/3gpp_29.518.h
+55
-0
src/common/amf.hpp
src/common/amf.hpp
+2
-0
No files found.
src/amf-app/amf_msg.cpp
View file @
e0ccb169
...
...
@@ -139,6 +139,16 @@ std::string event_notification::get_subs_change_notify_correlation_id() const {
return
m_subs_change_notify_correlation_id
;
}
//-----------------------------------------------------------------------------
void
event_notification
::
add_report
(
const
amf_event_report_t
&
report
)
{
m_report_list
.
push_back
(
report
);
}
//-----------------------------------------------------------------------------
std
::
vector
<
amf_event_report_t
>
event_notification
::
get_reports
()
const
{
return
m_report_list
;
}
//-----------------------------------------------------------------------------
void
data_notification_msg
::
set_notification_event_type
(
const
std
::
string
&
type
)
{
...
...
src/amf-app/amf_msg.hpp
View file @
e0ccb169
...
...
@@ -86,6 +86,8 @@ class event_notification {
std
::
string
get_notify_correlation_id
()
const
;
void
set_subs_change_notify_correlation_id
(
std
::
string
const
&
value
);
std
::
string
get_subs_change_notify_correlation_id
()
const
;
void
add_report
(
const
amf_event_report_t
&
report
);
std
::
vector
<
amf_event_report_t
>
get_reports
()
const
;
private:
std
::
string
m_notify_correlation_id
;
// notifyCorrelationId
...
...
@@ -93,7 +95,7 @@ class event_notification {
std
::
string
m_subs_change_notify_correlation_id
;
// SubsChangeNotifyCorrelationId;
bool
m_subs_change_notify_correlation_id_is_set
;
// std::vector<AmfEventReport> m_report_list; //
Report List
std
::
vector
<
amf_event_report_t
>
m_report_list
;
//
Report List
bool
m_report_list_is_set
;
};
...
...
src/amf-app/amf_n1.cpp
View file @
e0ccb169
...
...
@@ -2811,23 +2811,41 @@ void amf_n1::get_5gmm_state(
void
amf_n1
::
handle_ue_reachability_status_change
(
std
::
string
supi
,
uint8_t
http_version
)
{
Logger
::
amf_n1
().
debug
(
"Send request to SBI to triger UE Reachability
Status Notification
(SUPI "
"Send request to SBI to triger UE Reachability
Report
(SUPI "
"%s )"
,
supi
.
c_str
());
std
::
vector
<
std
::
shared_ptr
<
amf_subscription
>>
subscriptions
=
{};
amf_app_inst
->
get_ee_subscriptions
(
amf_event_type_t
::
REACHABILITY_REPORT
,
subscriptions
);
if
(
subscriptions
.
size
()
>
0
)
{
// Send request to SBI to trigger the notification to the subscribed event
Logger
::
amf_app
().
debug
(
"Send ITTI msg to AMF SBI to trigger the event notification"
);
std
::
shared_ptr
<
itti_sbi_notify_subscribed_event
>
itti_msg
=
std
::
make_shared
<
itti_sbi_notify_subscribed_event
>
(
TASK_AMF_N1
,
TASK_AMF_N11
);
// TODO:
itti_msg
->
notif_id
=
""
;
//
itti_msg->notif_id = "";
itti_msg
->
http_version
=
1
;
// std::vector<amf_application::event_notification> event_notifs;
for
(
auto
i
:
subscriptions
)
{
event_notification
ev_notif
=
{};
ev_notif
.
set_notify_correlation_id
(
i
.
get
()
->
notify_correlation_id
);
// ev_notif.set_subs_change_notify_correlation_id(i.get()->notify_uri);
amf_event_report_t
report
=
{};
ev_notif
.
add_report
(
report
);
itti_msg
->
event_notifs
.
push_back
(
ev_notif
);
}
int
ret
=
itti_inst
->
send_msg
(
itti_msg
);
if
(
0
!=
ret
)
{
Logger
::
amf_n1
().
error
(
"Could not send ITTI message %s to task TASK_AMF_N11"
,
itti_msg
->
get_msg_name
());
}
}
}
src/amf-app/amf_n11.cpp
View file @
e0ccb169
...
...
@@ -132,7 +132,13 @@ void amf_n11_task(void*) {
dynamic_cast
<
itti_n11_register_nf_instance_request
*>
(
msg
);
// TODO: Handle ITTI
}
break
;
case
SBI_NOTIFY_SUBSCRIBED_EVENT
:
{
Logger
::
amf_n11
().
info
(
"Receive Notify Subscribed Event Request, handling ..."
);
itti_sbi_notify_subscribed_event
*
m
=
dynamic_cast
<
itti_sbi_notify_subscribed_event
*>
(
msg
);
amf_n11_inst
->
handle_itti_message
(
ref
(
*
m
));
}
break
;
default:
{
Logger
::
amf_n11
().
info
(
"Receive unknown message type %d"
,
msg
->
msg_type
);
...
...
@@ -448,7 +454,45 @@ void amf_n11::handle_itti_message(
remote_uri
,
json_part
,
""
,
""
,
itti_msg
.
supi
,
psc
.
get
()
->
pdu_session_id
);
}
// SMF selection
//------------------------------------------------------------------------------
void
amf_n11
::
handle_itti_message
(
itti_sbi_notify_subscribed_event
&
itti_msg
)
{
Logger
::
amf_n11
().
debug
(
"Send notification for the subscribed event to the subscription"
);
for
(
auto
i
:
itti_msg
.
event_notifs
)
{
// Fill the json part
nlohmann
::
json
json_data
=
{};
json_data
[
"notifyCorrelationId"
]
=
i
.
get_notify_correlation_id
();
auto
report_lists
=
nlohmann
::
json
::
array
();
nlohmann
::
json
report
=
{};
std
::
vector
<
amf_event_report_t
>
reports
=
i
.
get_reports
();
for
(
auto
r
:
reports
)
{
report
[
"type"
]
=
amf_event_type_e2str
.
at
(
static_cast
<
uint8_t
>
(
r
.
m_type
));
report
[
"state"
][
"active"
]
=
"TRUE"
;
if
(
r
.
m_supi_is_set
)
{
report
[
"supi"
]
=
r
.
m_supi
;
// TODO
}
// timestamp
std
::
time_t
time_epoch_ntp
=
std
::
time
(
nullptr
);
uint64_t
tv_ntp
=
time_epoch_ntp
+
SECONDS_SINCE_FIRST_EPOCH
;
report
[
"timeStamp"
]
=
std
::
to_string
(
tv_ntp
);
report_lists
.
push_back
(
report
);
}
json_data
[
"reportList"
]
=
report_lists
;
std
::
string
body
=
json_data
.
dump
();
std
::
string
response_data
;
std
::
string
url
=
i
.
get_notify_correlation_id
();
curl_http_client
(
url
,
"POST"
,
body
,
response_data
);
// TODO: process the response
}
return
;
}
//------------------------------------------------------------------------------
bool
amf_n11
::
smf_selection_from_configuration
(
std
::
string
&
smf_addr
,
std
::
string
&
smf_api_version
)
{
...
...
src/amf-app/amf_n11.hpp
View file @
e0ccb169
...
...
@@ -36,6 +36,7 @@
#include "AuthenticationInfo.h"
#include "UEAuthenticationCtx.h"
#include "itti_msg_n11.hpp"
#include "itti_msg_sbi.hpp"
#include "pdu_session_context.hpp"
namespace
amf_application
{
...
...
@@ -53,6 +54,8 @@ class amf_n11 {
void
handle_itti_message
(
itti_nsmf_pdusession_update_sm_context
&
itti_msg
);
void
handle_itti_message
(
itti_nsmf_pdusession_release_sm_context
&
itti_msg
);
void
handle_itti_message
(
itti_pdu_session_resource_setup_response
&
itti_msg
);
void
handle_itti_message
(
itti_sbi_notify_subscribed_event
&
itti_msg
);
void
send_pdu_session_update_sm_context_request
(
std
::
string
supi
,
std
::
shared_ptr
<
pdu_session_context
>
psc
,
std
::
string
smf_addr
,
bstring
sm_msg
,
std
::
string
dnn
);
...
...
src/amf-app/amf_subscription.hpp
View file @
e0ccb169
...
...
@@ -44,7 +44,7 @@ class amf_subscription {
amf_event_type_t
ev_type
;
supi64_t
supi
;
std
::
string
notify_correlation_id
;
std
::
string
notify_uri
;
std
::
string
notify_uri
;
// subsChangeNotifyUri ?
std
::
string
nf_id
;
};
...
...
src/common/3gpp_29.518.h
View file @
e0ccb169
...
...
@@ -74,4 +74,59 @@ typedef struct amf_event_s {
// refId:
}
amf_event_t
;
typedef
struct
amf_event_state_s
{
bool
m_active
;
int32_t
m_remain_reports
;
bool
m_remain_reports_is_set
;
int32_t
m_remain_duration
;
bool
m_remain_duration_is_set
;
}
amf_event_state_t
;
typedef
enum
ue_reachability_e
{
UNREACHABLE
=
1
,
REACHABLE
=
2
,
REGULATORY_ONLY
=
3
}
ue_reachability_t
;
typedef
struct
amf_event_report_s
{
amf_event_type_t
m_type
;
// Mandatory
amf_event_state_t
m_state
;
// Mandatory
std
::
string
m_TimeStamp
;
// Mandatory
ue_reachability_t
m_reachability
;
bool
m_reachability_is_set
;
std
::
string
m_supi
;
bool
m_supi_is_set
;
std
::
string
m_subscription_id
;
bool
m_subscription_id_is_set
;
bool
m_any_ue
;
bool
m_any_ue_is_set
;
/*
std::vector<AmfEventArea> m_AreaList;
bool m_AreaListIsSet;
int32_t m_RefId;
bool m_RefIdIsSet;
std::string m_Gpsi;
bool m_GpsiIsSet;
std::string m_Pei;
bool m_PeiIsSet;
UserLocation m_Location;
bool m_LocationIsSet;
std::string m_Timezone;
bool m_TimezoneIsSet;
std::vector<AccessType> m_AccessTypeList;
bool m_AccessTypeListIsSet;
std::vector<RmInfo> m_RmInfoList;
bool m_RmInfoListIsSet;
std::vector<CmInfo> m_CmInfoList;
bool m_CmInfoListIsSet;
//CommunicationFailure m_CommFailure;
// bool m_CommFailureIsSet;
// int32_t m_NumberOfUes;
// bool m_NumberOfUesIsSet;
// std::vector<_5GsUserStateInfo> m_r_5gsUserStateList;
// bool m_r_5gsUserStateListIsSet;
*/
}
amf_event_report_t
;
#endif
src/common/amf.hpp
View file @
e0ccb169
...
...
@@ -150,4 +150,6 @@ typedef uint32_t evsub_id_t;
#define INVALID_EVSUB_ID ((evsub_id_t) 0x00000000)
#define UNASSIGNED_EVSUB_ID ((evsub_id_t) 0x00000000)
constexpr
uint64_t
SECONDS_SINCE_FIRST_EPOCH
=
2208988800
;
#endif
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