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
2e3e9ee2
Commit
2e3e9ee2
authored
Jan 05, 2022
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleanup for Event Exposure
parent
51cd6e5c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
28 deletions
+19
-28
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+0
-8
src/amf-app/amf_n11.cpp
src/amf-app/amf_n11.cpp
+19
-20
No files found.
src/amf-app/amf_n1.cpp
View file @
2e3e9ee2
...
...
@@ -3176,8 +3176,6 @@ void amf_n1::handle_ue_location_change(
std
::
make_shared
<
itti_sbi_notify_subscribed_event
>
(
TASK_AMF_N1
,
TASK_AMF_N11
);
// TODO:
// itti_msg->notif_id = "";
itti_msg
->
http_version
=
1
;
for
(
auto
i
:
subscriptions
)
{
...
...
@@ -3233,8 +3231,6 @@ void amf_n1::handle_ue_reachability_status_change(
std
::
make_shared
<
itti_sbi_notify_subscribed_event
>
(
TASK_AMF_N1
,
TASK_AMF_N11
);
// TODO:
// itti_msg->notif_id = "";
itti_msg
->
http_version
=
1
;
for
(
auto
i
:
subscriptions
)
{
...
...
@@ -3295,8 +3291,6 @@ void amf_n1::handle_ue_registration_state_change(
std
::
make_shared
<
itti_sbi_notify_subscribed_event
>
(
TASK_AMF_N1
,
TASK_AMF_N11
);
// TODO:
// itti_msg->notif_id = "";
itti_msg
->
http_version
=
1
;
for
(
auto
i
:
subscriptions
)
{
...
...
@@ -3364,8 +3358,6 @@ void amf_n1::handle_ue_connectivity_state_change(
std
::
make_shared
<
itti_sbi_notify_subscribed_event
>
(
TASK_AMF_N1
,
TASK_AMF_N11
);
// TODO:
// itti_msg->notif_id = "";
itti_msg
->
http_version
=
1
;
for
(
auto
i
:
subscriptions
)
{
...
...
src/amf-app/amf_n11.cpp
View file @
2e3e9ee2
...
...
@@ -530,8 +530,7 @@ void amf_n11::handle_itti_message(
//------------------------------------------------------------------------------
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"
);
Logger
::
amf_n11
().
debug
(
"Send notification for the subscribed events"
);
for
(
auto
i
:
itti_msg
.
event_notifs
)
{
// Fill the json part
...
...
@@ -636,10 +635,10 @@ void amf_n11::handle_post_sm_context_response_error(
//------------------------------------------------------------------------------
void
amf_n11
::
curl_http_client
(
std
::
string
remote
U
ri
,
std
::
string
jsonData
,
std
::
string
n1SmMsg
,
std
::
string
remote
_u
ri
,
std
::
string
jsonData
,
std
::
string
n1SmMsg
,
std
::
string
n2SmMsg
,
std
::
string
supi
,
uint8_t
pdu_session_id
,
uint8_t
http_version
,
uint32_t
promise_id
)
{
Logger
::
amf_n11
().
debug
(
"Call SMF service: %s"
,
remote
U
ri
.
c_str
());
Logger
::
amf_n11
().
debug
(
"Call SMF service: %s"
,
remote
_u
ri
.
c_str
());
uint8_t
number_parts
=
0
;
mime_parser
parser
=
{};
...
...
@@ -696,7 +695,7 @@ void amf_n11::curl_http_client(
}
headers
=
curl_slist_append
(
headers
,
content_type
.
c_str
());
curl_easy_setopt
(
curl
,
CURLOPT_HTTPHEADER
,
headers
);
curl_easy_setopt
(
curl
,
CURLOPT_URL
,
remote
U
ri
.
c_str
());
curl_easy_setopt
(
curl
,
CURLOPT_URL
,
remote
_u
ri
.
c_str
());
curl_easy_setopt
(
curl
,
CURLOPT_HTTPGET
,
1
);
curl_easy_setopt
(
curl
,
CURLOPT_TIMEOUT_MS
,
CURL_TIMEOUT_MS
);
curl_easy_setopt
(
curl
,
CURLOPT_INTERFACE
,
amf_cfg
.
n11
.
if_name
.
c_str
());
...
...
@@ -741,7 +740,7 @@ void amf_n11::curl_http_client(
http_response_codes_e
::
HTTP_RESPONSE_CODE_0
)
{
// TODO: should be removed
Logger
::
amf_n11
().
error
(
"Cannot get response when calling %s"
,
remote
U
ri
.
c_str
());
"Cannot get response when calling %s"
,
remote
_u
ri
.
c_str
());
// free curl before returning
curl_slist_free_all
(
headers
);
curl_easy_cleanup
(
curl
);
...
...
@@ -758,7 +757,7 @@ void amf_n11::curl_http_client(
json_data_response
=
response
;
}
Logger
::
amf_n11
().
info
(
"J
son
part %s"
,
json_data_response
.
c_str
());
Logger
::
amf_n11
().
info
(
"J
SON
part %s"
,
json_data_response
.
c_str
());
if
((
static_cast
<
http_response_codes_e
>
(
httpCode
)
!=
http_response_codes_e
::
HTTP_RESPONSE_CODE_200_OK
)
&&
...
...
@@ -784,7 +783,7 @@ void amf_n11::curl_http_client(
response_data
=
nlohmann
::
json
::
parse
(
json_data_response
);
}
catch
(
nlohmann
::
json
::
exception
&
e
)
{
Logger
::
amf_n11
().
warn
(
"Could not get J
son
content from the response"
);
"Could not get J
SON
content from the response"
);
// Set the default Cause
response_data
[
"error"
][
"cause"
]
=
"504 Gateway Timeout"
;
}
...
...
@@ -827,7 +826,7 @@ void amf_n11::curl_http_client(
try
{
response_data
=
nlohmann
::
json
::
parse
(
json_data_response
);
}
catch
(
nlohmann
::
json
::
exception
&
e
)
{
Logger
::
amf_n11
().
warn
(
"Could not get J
son
content from the response"
);
Logger
::
amf_n11
().
warn
(
"Could not get J
SON
content from the response"
);
curl_slist_free_all
(
headers
);
curl_easy_cleanup
(
curl
);
curl_global_cleanup
();
...
...
@@ -1333,7 +1332,7 @@ bool amf_n11::send_ue_authentication_request(
"UE Authentication, response from AUSF
\n
, %s "
,
tmp
.
c_str
());
}
catch
(
nlohmann
::
json
::
exception
&
e
)
{
Logger
::
amf_n11
().
warn
(
"UE Authentication, could not parse J
son
from the AUSF "
"UE Authentication, could not parse J
SON
from the AUSF "
"response"
);
// TODO: error handling
return
false
;
...
...
@@ -1355,15 +1354,15 @@ bool amf_n11::send_ue_authentication_request(
//-----------------------------------------------------------------------------------------------------
// From AMF_N1, need to be reworked
void
amf_n11
::
curl_http_client
(
std
::
string
remote
Uri
,
std
::
string
method
,
std
::
string
msgB
ody
,
std
::
string
remote
_uri
,
std
::
string
method
,
std
::
string
msg_b
ody
,
std
::
string
&
response
,
uint8_t
http_version
)
{
Logger
::
amf_n11
().
info
(
"Send HTTP message to %s"
,
remote
U
ri
.
c_str
());
Logger
::
amf_n11
().
info
(
"HTTP message Body: %s"
,
msg
B
ody
.
c_str
());
Logger
::
amf_n11
().
info
(
"Send HTTP message to %s"
,
remote
_u
ri
.
c_str
());
Logger
::
amf_n11
().
info
(
"HTTP message Body: %s"
,
msg
_b
ody
.
c_str
());
uint32_t
str_len
=
msg
B
ody
.
length
();
uint32_t
str_len
=
msg
_b
ody
.
length
();
char
*
body_data
=
(
char
*
)
malloc
(
str_len
+
1
);
memset
(
body_data
,
0
,
str_len
+
1
);
memcpy
((
void
*
)
body_data
,
(
void
*
)
msg
B
ody
.
c_str
(),
str_len
);
memcpy
((
void
*
)
body_data
,
(
void
*
)
msg
_b
ody
.
c_str
(),
str_len
);
curl_global_init
(
CURL_GLOBAL_ALL
);
CURL
*
curl
=
curl_easy_init
();
...
...
@@ -1377,7 +1376,7 @@ void amf_n11::curl_http_client(
headers
=
curl_slist_append
(
headers
,
content_type
.
c_str
());
curl_easy_setopt
(
curl
,
CURLOPT_HTTPHEADER
,
headers
);
}
curl_easy_setopt
(
curl
,
CURLOPT_URL
,
remote
U
ri
.
c_str
());
curl_easy_setopt
(
curl
,
CURLOPT_URL
,
remote
_u
ri
.
c_str
());
if
(
method
.
compare
(
"POST"
)
==
0
)
curl_easy_setopt
(
curl
,
CURLOPT_HTTPPOST
,
1
);
else
if
(
method
.
compare
(
"PATCH"
)
==
0
)
...
...
@@ -1411,7 +1410,7 @@ void amf_n11::curl_http_client(
curl_easy_setopt
(
curl
,
CURLOPT_HEADERDATA
,
httpHeaderData
.
get
());
if
((
method
.
compare
(
"POST"
)
==
0
)
or
(
method
.
compare
(
"PATCH"
)
==
0
)
or
(
method
.
compare
(
"PUT"
)
==
0
))
{
curl_easy_setopt
(
curl
,
CURLOPT_POSTFIELDSIZE
,
msg
B
ody
.
length
());
curl_easy_setopt
(
curl
,
CURLOPT_POSTFIELDSIZE
,
msg
_b
ody
.
length
());
curl_easy_setopt
(
curl
,
CURLOPT_POSTFIELDS
,
body_data
);
}
...
...
@@ -1423,11 +1422,11 @@ void amf_n11::curl_http_client(
std
::
string
json_data_response
=
{};
std
::
string
resMsg
=
{};
bool
is_response_ok
=
true
;
Logger
::
amf_n11
().
info
(
"Get response with
http
code (%d)"
,
httpCode
);
Logger
::
amf_n11
().
info
(
"Get response with
HTTP
code (%d)"
,
httpCode
);
if
(
httpCode
==
0
)
{
Logger
::
amf_n11
().
info
(
"Cannot get response when calling %s"
,
remote
U
ri
.
c_str
());
"Cannot get response when calling %s"
,
remote
_u
ri
.
c_str
());
// free curl before returning
curl_slist_free_all
(
headers
);
curl_easy_cleanup
(
curl
);
...
...
@@ -1451,7 +1450,7 @@ void amf_n11::curl_http_client(
try
{
response_data
=
nlohmann
::
json
::
parse
(
json_data_response
);
}
catch
(
nlohmann
::
json
::
exception
&
e
)
{
Logger
::
amf_n11
().
info
(
"Could not get J
son
content from the response"
);
Logger
::
amf_n11
().
info
(
"Could not get J
SON
content from the response"
);
// Set the default Cause
response_data
[
"error"
][
"cause"
]
=
"504 Gateway Timeout"
;
}
...
...
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