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-Simple
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
CommunityXG
OpenXG-SMF-Simple
Commits
436db8a8
Commit
436db8a8
authored
Nov 20, 2020
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue for NsmfEventExposure
parent
592f594d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
12 deletions
+38
-12
src/smf_app/smf_app.cpp
src/smf_app/smf_app.cpp
+7
-5
src/smf_app/smf_app.hpp
src/smf_app/smf_app.hpp
+3
-3
src/smf_app/smf_event.cpp
src/smf_app/smf_event.cpp
+4
-1
src/smf_app/smf_n11.cpp
src/smf_app/smf_n11.cpp
+24
-3
No files found.
src/smf_app/smf_app.cpp
View file @
436db8a8
...
...
@@ -1680,21 +1680,23 @@ void smf_app::trigger_http_response(const uint32_t &http_code,
//---------------------------------------------------------------------------------------------
void
smf_app
::
add_event_subscription
(
evsub_id_t
sub_id
,
smf_event_t
ev
,
std
::
shared_ptr
<
smf_subscription
>
ss
)
{
Logger
::
smf_app
().
debug
(
"Add an Event subscription (Sub ID %d, Event %d)"
,
sub_id
,
(
uint8_t
)
ev
);
std
::
unique_lock
lock
(
m_smf_event_subscriptions
);
smf_event_subscriptions
.
emplace
(
std
::
make_pair
(
sub_id
,
ev
),
ss
);
}
//---------------------------------------------------------------------------------------------
void
smf_app
::
get_ee_subscriptions
(
smf_event_t
ev
,
std
::
vector
<
std
::
shared_ptr
<
smf_subscription
>>
subscriptions
)
{
void
smf_app
::
get_ee_subscriptions
(
smf_event_t
ev
,
std
::
vector
<
std
::
shared_ptr
<
smf_subscription
>>
&
subscriptions
)
{
for
(
auto
const
&
i
:
smf_event_subscriptions
)
{
if
(
i
.
first
.
second
==
ev
){
subscriptions
.
push_back
(
i
.
second
);
if
((
uint8_t
)
std
::
get
<
1
>
(
i
.
first
)
==
(
uint8_t
)
ev
){
Logger
::
smf_app
().
debug
(
"Found an event subscription (Event ID %d, Event %d)"
,
(
uint8_t
)
std
::
get
<
0
>
(
i
.
first
),
(
uint8_t
)
ev
);
subscriptions
.
push_back
(
i
.
second
);
}
}
}
//---------------------------------------------------------------------------------------------
void
smf_app
::
get_ee_subscriptions
(
evsub_id_t
sub_id
,
std
::
vector
<
std
::
shared_ptr
<
smf_subscription
>>
subscriptions
)
{
void
smf_app
::
get_ee_subscriptions
(
evsub_id_t
sub_id
,
std
::
vector
<
std
::
shared_ptr
<
smf_subscription
>>
&
subscriptions
)
{
for
(
auto
const
&
i
:
smf_event_subscriptions
)
{
if
(
i
.
first
.
first
==
sub_id
){
subscriptions
.
push_back
(
i
.
second
);
...
...
@@ -1704,7 +1706,7 @@ void smf_app::get_ee_subscriptions(evsub_id_t sub_id, std::vector<std::shared_pt
//---------------------------------------------------------------------------------------------
//std::vector<std::shared_ptr<smf_subscription>> subscriptions
void
smf_app
::
get_ee_subscriptions
(
smf_event_t
ev
,
supi64_t
supi
,
pdu_session_id_t
pdu_session_id
,
std
::
shared_ptr
<
smf_subscription
>
subscription
)
{
void
smf_app
::
get_ee_subscriptions
(
smf_event_t
ev
,
supi64_t
supi
,
pdu_session_id_t
pdu_session_id
,
std
::
shared_ptr
<
smf_subscription
>
&
subscription
)
{
for
(
auto
const
&
i
:
smf_event_subscriptions
)
{
if
((
i
.
first
.
second
==
ev
)
&&
(
i
.
second
->
supi
==
supi
)
&&
(
i
.
second
->
pdu_session_id
==
pdu_session_id
)){
subscription
=
i
.
second
;
...
...
src/smf_app/smf_app.hpp
View file @
436db8a8
...
...
@@ -698,10 +698,10 @@ class smf_app {
* @param [std::vector<std::shared_ptr<smf_subscription>>] subscriptions: list of the subscription associated with this event type
* @return vector
*/
void
get_ee_subscriptions
(
smf_event_t
ev
,
std
::
vector
<
std
::
shared_ptr
<
smf_subscription
>>
subscriptions
);
void
get_ee_subscriptions
(
evsub_id_t
sub_id
,
std
::
vector
<
std
::
shared_ptr
<
smf_subscription
>>
subscriptions
);
void
get_ee_subscriptions
(
smf_event_t
ev
,
std
::
vector
<
std
::
shared_ptr
<
smf_subscription
>>
&
subscriptions
);
void
get_ee_subscriptions
(
evsub_id_t
sub_id
,
std
::
vector
<
std
::
shared_ptr
<
smf_subscription
>>
&
subscriptions
);
void
get_ee_subscriptions
(
smf_event_t
ev
,
supi64_t
supi
,
pdu_session_id_t
pdu_session_id
,
std
::
shared_ptr
<
smf_subscription
>
subscription
);
void
get_ee_subscriptions
(
smf_event_t
ev
,
supi64_t
supi
,
pdu_session_id_t
pdu_session_id
,
std
::
shared_ptr
<
smf_subscription
>
&
subscription
);
...
...
src/smf_app/smf_event.cpp
View file @
436db8a8
...
...
@@ -109,6 +109,7 @@ boost::signals2::connection smf_event::subscribe_ee_pdu_session_release(
void
smf_event
::
trigger_ee_pdu_session_release
(
supi64_t
supi
,
pdu_session_id_t
pdu_session_id
,
uint8_t
http_version
)
{
Logger
::
smf_app
().
debug
(
"Trigger Event Exposure PDU Session Release event notification"
);
pdu_session_release_sig
(
supi
,
pdu_session_id
,
http_version
);
}
...
...
@@ -118,7 +119,7 @@ void smf_event::send_ee_pdu_session_release(supi64_t supi,
uint8_t
http_version
)
{
Logger
::
smf_app
().
debug
(
"Send request to N11 to triger PDU Session Release Notification, 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
;
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
)
{
...
...
@@ -148,5 +149,7 @@ void smf_event::send_ee_pdu_session_release(supi64_t supi,
"Could not send ITTI message %s to task TASK_SMF_N11"
,
itti_msg
->
get_msg_name
());
}
}
else
{
Logger
::
smf_app
().
debug
(
"No suscription available for this event"
);
}
}
src/smf_app/smf_n11.cpp
View file @
436db8a8
...
...
@@ -531,6 +531,24 @@ void smf_n11::notify_subscribed_event(
headers
=
curl_slist_append
(
headers
,
"Content-Type: application/json"
);
headers
=
curl_slist_append
(
headers
,
"charsets: utf-8"
);
std
::
vector
<
std
::
string
>
bodys
=
{};
//store body for all the request
for
(
auto
i
:
msg
->
event_notifs
)
{
//Fill the json part
nlohmann
::
json
json_data
=
{};
json_data
[
"notifId"
]
=
i
.
get_notif_id
();
auto
event_notifs
=
nlohmann
::
json
::
array
();
nlohmann
::
json
event_notif
=
{};
event_notif
[
"event"
]
=
i
.
get_smf_event
();
event_notif
[
"pduSeId"
]
=
i
.
get_pdu_session_id
();
event_notif
[
"timeStamp"
]
=
"timestamp"
;
//TODO: remove hardcoded
event_notifs
.
push_back
(
event_notif
);
json_data
[
"eventNotifs"
]
=
event_notifs
;
std
::
string
body
=
json_data
.
dump
();
bodys
.
push_back
(
body
);
}
int
index
=
0
;
//create and add an easy handle to a multi curl request
for
(
auto
i
:
msg
->
event_notifs
)
{
//CURL *temp = curl_create_handle(i.get_notif_uri(), &data );
...
...
@@ -540,17 +558,20 @@ void smf_n11::notify_subscribed_event(
CURL
*
curl
=
curl_easy_init
();
if
(
curl
){
std
::
string
url
=
i
.
get_notif_uri
()
;
Logger
::
smf_n11
().
debug
(
"Send notification to NF with URI: %s"
,
url
);
Logger
::
smf_n11
().
debug
(
"Send notification to NF with URI: %s"
,
url
.
c_str
()
);
curl_easy_setopt
(
curl
,
CURLOPT_HTTPHEADER
,
headers
);
curl_easy_setopt
(
curl
,
CURLOPT_URL
,
url
.
c_str
()
);
curl_easy_setopt
(
curl
,
CURLOPT_HTTP
GE
T
,
1
);
curl_easy_setopt
(
curl
,
CURLOPT_HTTP
POS
T
,
1
);
curl_easy_setopt
(
curl
,
CURLOPT_TIMEOUT_MS
,
100L
);
// Hook up data handling function.
curl_easy_setopt
(
curl
,
CURLOPT_WRITEFUNCTION
,
&
callback
);
curl_easy_setopt
(
curl
,
CURLOPT_WRITEDATA
,
data
);
curl_easy_setopt
(
curl
,
CURLOPT_WRITEDATA
,
httpData
.
get
()
);
curl_easy_setopt
(
curl
,
CURLOPT_FOLLOWLOCATION
,
1L
);
curl_easy_setopt
(
curl
,
CURLOPT_POSTFIELDSIZE
,
bodys
.
at
(
index
).
length
());
curl_easy_setopt
(
curl
,
CURLOPT_POSTFIELDS
,
bodys
.
at
(
index
).
c_str
());
}
curl_multi_add_handle
(
m_curl_multi
,
curl
);
index
++
;
}
curl_multi_perform
(
m_curl_multi
,
&
still_running
);
...
...
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