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
9b11f6d8
Commit
9b11f6d8
authored
Dec 08, 2022
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleanup for logging
parent
1616bd9a
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
38 additions
and
38 deletions
+38
-38
src/api-server/api/NFStatusNotifyApi.cpp
src/api-server/api/NFStatusNotifyApi.cpp
+1
-1
src/common/smf.h
src/common/smf.h
+4
-4
src/common/utils/fqdn.cpp
src/common/utils/fqdn.cpp
+2
-2
src/smf_app/smf_app.cpp
src/smf_app/smf_app.cpp
+4
-2
src/smf_app/smf_config.cpp
src/smf_app/smf_config.cpp
+4
-2
src/smf_app/smf_context.cpp
src/smf_app/smf_context.cpp
+4
-4
src/smf_app/smf_pfcp_association.cpp
src/smf_app/smf_pfcp_association.cpp
+15
-17
src/smf_app/smf_pfcp_association.hpp
src/smf_app/smf_pfcp_association.hpp
+2
-2
src/smf_app/smf_sbi.cpp
src/smf_app/smf_sbi.cpp
+2
-4
No files found.
src/api-server/api/NFStatusNotifyApi.cpp
View file @
9b11f6d8
...
@@ -58,7 +58,7 @@ void NFStatusNotifyApi::notify_nf_status_handler(
...
@@ -58,7 +58,7 @@ void NFStatusNotifyApi::notify_nf_status_handler(
const
Pistache
::
Rest
::
Request
&
request
,
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
response
)
{
Pistache
::
Http
::
ResponseWriter
response
)
{
Logger
::
smf_api_server
().
info
(
"Received a NFStatusNotify message"
);
Logger
::
smf_api_server
().
info
(
"Received a NFStatusNotify message"
);
Logger
::
smf_api_server
().
debug
(
"Message body: %s
\n
"
,
request
.
body
().
c_str
());
Logger
::
smf_api_server
().
debug
(
"Message body: %s"
,
request
.
body
().
c_str
());
// Getting the body param
// Getting the body param
NotificationData
notificationData
;
NotificationData
notificationData
;
...
...
src/common/smf.h
View file @
9b11f6d8
...
@@ -445,10 +445,10 @@ typedef struct snssai_upf_info_item_s {
...
@@ -445,10 +445,10 @@ typedef struct snssai_upf_info_item_s {
std
::
string
to_string
()
const
{
std
::
string
to_string
()
const
{
std
::
string
s
=
{};
std
::
string
s
=
{};
s
.
append
(
"
SNSSAI Info:
"
+
snssai
.
toString
()
+
", "
);
s
.
append
(
"
{
"
+
snssai
.
toString
()
+
", "
);
if
(
dnn_upf_info_list
.
size
()
>
0
)
{
if
(
dnn_upf_info_list
.
size
()
>
0
)
{
s
.
append
(
"
DNN UPF Info list:
{"
);
s
.
append
(
"{"
);
for
(
auto
dnn_upf
:
dnn_upf_info_list
)
{
for
(
auto
dnn_upf
:
dnn_upf_info_list
)
{
s
.
append
(
dnn_upf
.
to_string
());
s
.
append
(
dnn_upf
.
to_string
());
...
@@ -493,11 +493,11 @@ typedef struct upf_info_s {
...
@@ -493,11 +493,11 @@ typedef struct upf_info_s {
std
::
string
s
=
{};
std
::
string
s
=
{};
// TODO: Interface UPF Info List
// TODO: Interface UPF Info List
if
(
!
snssai_upf_info_list
.
empty
())
{
if
(
!
snssai_upf_info_list
.
empty
())
{
s
.
append
(
"SNSSAI UPF Info: "
);
s
.
append
(
"S
-
NSSAI UPF Info: "
);
for
(
auto
sn
:
snssai_upf_info_list
)
{
for
(
auto
sn
:
snssai_upf_info_list
)
{
s
.
append
(
"{"
+
sn
.
snssai
.
toString
()
+
", "
);
s
.
append
(
"{"
+
sn
.
snssai
.
toString
()
+
", "
);
for
(
auto
d
:
sn
.
dnn_upf_info_list
)
{
for
(
auto
d
:
sn
.
dnn_upf_info_list
)
{
s
.
append
(
"{DNN = "
+
d
.
dnn
+
"}
,
"
);
s
.
append
(
"{DNN = "
+
d
.
dnn
+
"} "
);
}
}
s
.
append
(
"};"
);
s
.
append
(
"};"
);
}
}
...
...
src/common/utils/fqdn.cpp
View file @
9b11f6d8
...
@@ -34,11 +34,11 @@ bool fqdn::resolve(
...
@@ -34,11 +34,11 @@ bool fqdn::resolve(
const
std
::
string
&
host_name
,
std
::
string
&
address
,
uint32_t
&
port
,
const
std
::
string
&
host_name
,
std
::
string
&
address
,
uint32_t
&
port
,
uint8_t
&
addr_type
,
const
std
::
string
&
protocol
)
{
uint8_t
&
addr_type
,
const
std
::
string
&
protocol
)
{
int
tries
=
0
;
int
tries
=
0
;
Logger
::
smf_app
().
debug
(
"Resolving a DNS (name %s)"
,
host_name
.
c_str
());
//
Logger::smf_app().debug("Resolving a DNS (name %s)", host_name.c_str());
while
(
tries
<
MAX_NB_RESOLVE_TRIES
)
{
while
(
tries
<
MAX_NB_RESOLVE_TRIES
)
{
try
{
try
{
boost
::
asio
::
io_context
io_context
=
{};
boost
::
asio
::
io_context
io_context
=
{};
Logger
::
smf_app
().
debug
(
"Resolving DNS Try #%u"
,
tries
+
1
);
//
Logger::smf_app().debug("Resolving DNS Try #%u", tries + 1);
boost
::
asio
::
ip
::
tcp
::
resolver
resolver
{
io_context
};
boost
::
asio
::
ip
::
tcp
::
resolver
resolver
{
io_context
};
boost
::
asio
::
ip
::
tcp
::
resolver
::
results_type
endpoints
=
boost
::
asio
::
ip
::
tcp
::
resolver
::
results_type
endpoints
=
...
...
src/smf_app/smf_app.cpp
View file @
9b11f6d8
...
@@ -1423,7 +1423,7 @@ bool smf_app::handle_nf_status_notification(
...
@@ -1423,7 +1423,7 @@ bool smf_app::handle_nf_status_notification(
if
(
!
found
)
{
if
(
!
found
)
{
// Add a new UPF node
// Add a new UPF node
Logger
::
smf_app
().
debug
(
Logger
::
smf_app
().
debug
(
"Add a new UPF node
, FQDN
%s"
,
upf_fqdn
.
c_str
());
"Add a new UPF node
with FQDN:
%s"
,
upf_fqdn
.
c_str
());
// pfcp::node_id_t n = {};
// pfcp::node_id_t n = {};
n
.
node_id_type
=
pfcp
::
NODE_ID_TYPE_FQDN
;
n
.
node_id_type
=
pfcp
::
NODE_ID_TYPE_FQDN
;
n
.
fqdn
=
upf_fqdn
;
n
.
fqdn
=
upf_fqdn
;
...
@@ -1448,7 +1448,8 @@ bool smf_app::handle_nf_status_notification(
...
@@ -1448,7 +1448,8 @@ bool smf_app::handle_nf_status_notification(
if
(
!
found
)
{
if
(
!
found
)
{
// Add a new UPF node
// Add a new UPF node
Logger
::
smf_app
().
debug
(
Logger
::
smf_app
().
debug
(
"Add a new UPF node, Ipv4 Addr %s"
,
inet_ntoa
(
ipv4_addrs
[
0
]));
"Add a new UPF node with Ipv4 Addr: %s"
,
inet_ntoa
(
ipv4_addrs
[
0
]));
if
(
n
.
node_id_type
==
pfcp
::
NODE_ID_TYPE_UNKNOWN
)
if
(
n
.
node_id_type
==
pfcp
::
NODE_ID_TYPE_UNKNOWN
)
n
.
node_id_type
=
pfcp
::
NODE_ID_TYPE_IPV4_ADDRESS
;
n
.
node_id_type
=
pfcp
::
NODE_ID_TYPE_IPV4_ADDRESS
;
n
.
u1
.
ipv4_address
.
s_addr
=
ipv4_addrs
[
0
].
s_addr
;
n
.
u1
.
ipv4_address
.
s_addr
=
ipv4_addrs
[
0
].
s_addr
;
...
@@ -2287,6 +2288,7 @@ void smf_app::generate_smf_profile() {
...
@@ -2287,6 +2288,7 @@ void smf_app::generate_smf_profile() {
//---------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------
void
smf_app
::
register_to_nrf
()
{
void
smf_app
::
register_to_nrf
()
{
Logger
::
smf_app
().
debug
(
"Register SMF with NRF"
);
// Create a NF profile to this instance
// Create a NF profile to this instance
generate_smf_profile
();
generate_smf_profile
();
// Send request to N11 to send NF registration to NRF
// Send request to N11 to send NF registration to NRF
...
...
src/smf_app/smf_config.cpp
View file @
9b11f6d8
...
@@ -1044,10 +1044,12 @@ void smf_config::display() {
...
@@ -1044,10 +1044,12 @@ void smf_config::display() {
Logger
::
smf_app
().
info
(
" Secondary DNS v6 ....: %s"
,
str_addr6
);
Logger
::
smf_app
().
info
(
" Secondary DNS v6 ....: %s"
,
str_addr6
);
}
}
Logger
::
smf_app
().
info
(
"- CSCF:"
);
Logger
::
smf_app
().
info
(
Logger
::
smf_app
().
info
(
" CSCF .........: %s"
,
inet_ntoa
(
*
((
struct
in_addr
*
)
&
default_cscfv4
)));
" CSCF IPv4 ...........: %s"
,
inet_ntoa
(
*
((
struct
in_addr
*
)
&
default_cscfv4
)));
if
(
inet_ntop
(
AF_INET6
,
&
default_cscfv6
,
str_addr6
,
sizeof
(
str_addr6
)))
{
if
(
inet_ntop
(
AF_INET6
,
&
default_cscfv6
,
str_addr6
,
sizeof
(
str_addr6
)))
{
Logger
::
smf_app
().
info
(
" CSCF
v6
......: %s"
,
str_addr6
);
Logger
::
smf_app
().
info
(
" CSCF
IPv6 .....
......: %s"
,
str_addr6
);
}
}
Logger
::
smf_app
().
info
(
"- Default UE MTU: %d"
,
ue_mtu
);
Logger
::
smf_app
().
info
(
"- Default UE MTU: %d"
,
ue_mtu
);
...
...
src/smf_app/smf_context.cpp
View file @
9b11f6d8
...
@@ -373,11 +373,11 @@ std::string smf_pdu_session::toString() const {
...
@@ -373,11 +373,11 @@ std::string smf_pdu_session::toString() const {
if
(
pdu_session_status
==
pdu_session_status_e
::
PDU_SESSION_INACTIVE
)
if
(
pdu_session_status
==
pdu_session_status_e
::
PDU_SESSION_INACTIVE
)
is_released
=
true
;
is_released
=
true
;
if
(
!
is_released
)
{
if
(
!
is_released
)
{
s
.
append
(
"
\t
PDU Session ID:
\t
"
)
s
.
append
(
"
\t
PDU Session ID:
\t
\t\t
"
)
.
append
(
std
::
to_string
((
uint8_t
)
pdu_session_id
))
.
append
(
std
::
to_string
((
uint8_t
)
pdu_session_id
))
.
append
(
"
\n
"
);
.
append
(
"
\n
"
);
s
.
append
(
"
\t
DNN:
\t\t\t
"
).
append
(
dnn
).
append
(
"
\n
"
);
s
.
append
(
"
\t
DNN:
\t\t\t
"
).
append
(
dnn
).
append
(
"
\n
"
);
s
.
append
(
"
\t
SNSSAI:
\t\t\t
"
).
append
(
snssai
.
toString
()).
append
(
"
\n
"
);
s
.
append
(
"
\t
S
-
NSSAI:
\t\t\t
"
).
append
(
snssai
.
toString
()).
append
(
"
\n
"
);
s
.
append
(
"
\t
PDN type:
\t\t
"
)
s
.
append
(
"
\t
PDN type:
\t\t
"
)
.
append
(
pdu_session_type
.
toString
())
.
append
(
pdu_session_type
.
toString
())
.
append
(
"
\n
"
);
.
append
(
"
\n
"
);
...
@@ -391,11 +391,11 @@ std::string smf_pdu_session::toString() const {
...
@@ -391,11 +391,11 @@ std::string smf_pdu_session::toString() const {
.
append
(
conv
::
toString
(
ipv6_address
))
.
append
(
conv
::
toString
(
ipv6_address
))
.
append
(
"
\n
"
);
.
append
(
"
\n
"
);
if
(
default_qfi
.
qfi
)
{
if
(
default_qfi
.
qfi
)
{
s
.
append
(
"
\t
Default QFI:
\t
"
)
s
.
append
(
"
\t
Default QFI:
\t
\t
"
)
.
append
(
std
::
to_string
(
default_qfi
.
qfi
))
.
append
(
std
::
to_string
(
default_qfi
.
qfi
))
.
append
(
"
\n
"
);
.
append
(
"
\n
"
);
}
else
{
}
else
{
s
.
append
(
"
\t
Default QFI:
\t
"
).
append
(
"No QFI available"
).
append
(
"
\n
"
);
s
.
append
(
"
\t
Default QFI:
\t
\t
"
).
append
(
"No QFI available"
).
append
(
"
\n
"
);
}
}
if
(
!
is_released
)
{
if
(
!
is_released
)
{
s
.
append
(
"
\t
SEID:
\t\t\t
"
).
append
(
std
::
to_string
(
seid
)).
append
(
"
\n
"
);
s
.
append
(
"
\t
SEID:
\t\t\t
"
).
append
(
std
::
to_string
(
seid
)).
append
(
"
\n
"
);
...
...
src/smf_app/smf_pfcp_association.cpp
View file @
9b11f6d8
...
@@ -49,8 +49,7 @@ edge edge::from_upf_info(const upf_info_t& upf_info) {
...
@@ -49,8 +49,7 @@ edge edge::from_upf_info(const upf_info_t& upf_info) {
edge
e
=
{};
edge
e
=
{};
snssai_upf_info_item_s
snssai_item
=
{};
snssai_upf_info_item_s
snssai_item
=
{};
Logger
::
smf_app
().
debug
(
Logger
::
smf_app
().
debug
(
"UPF info: %s"
,
upf_info
.
to_string
().
c_str
());
"Edge from UPF info, UPF info %s"
,
upf_info
.
to_string
().
c_str
());
for
(
auto
&
snssai
:
upf_info
.
snssai_upf_info_list
)
{
for
(
auto
&
snssai
:
upf_info
.
snssai_upf_info_list
)
{
snssai_item
.
snssai
=
snssai
.
snssai
;
snssai_item
.
snssai
=
snssai
.
snssai
;
...
@@ -63,8 +62,8 @@ edge edge::from_upf_info(const upf_info_t& upf_info) {
...
@@ -63,8 +62,8 @@ edge edge::from_upf_info(const upf_info_t& upf_info) {
snssai_item
.
dnn_upf_info_list
.
insert
(
snssai_item
.
dnn_upf_info_list
.
insert
(
item
.
dnn_upf_info_list
.
begin
(),
item
.
dnn_upf_info_list
.
end
());
item
.
dnn_upf_info_list
.
begin
(),
item
.
dnn_upf_info_list
.
end
());
item
.
dnn_upf_info_list
=
snssai_item
.
dnn_upf_info_list
;
item
.
dnn_upf_info_list
=
snssai_item
.
dnn_upf_info_list
;
Logger
::
smf_app
().
debug
(
//
Logger::smf_app().debug(
"Updated item info: %s"
,
snssai_item
.
to_string
().
c_str
());
//
"Updated item info: %s", snssai_item.to_string().c_str());
break
;
break
;
}
}
}
}
...
@@ -73,12 +72,12 @@ edge edge::from_upf_info(const upf_info_t& upf_info) {
...
@@ -73,12 +72,12 @@ edge edge::from_upf_info(const upf_info_t& upf_info) {
}
}
if
(
!
e
.
snssai_dnns
.
empty
())
{
if
(
!
e
.
snssai_dnns
.
empty
())
{
Logger
::
smf_app
().
debug
(
"
Edge from UPF info
"
);
Logger
::
smf_app
().
debug
(
"
Link info:
"
);
for
(
const
auto
s
:
e
.
snssai_dnns
)
{
for
(
const
auto
s
:
e
.
snssai_dnns
)
{
Logger
::
smf_app
().
debug
(
"
info:
%s"
,
s
.
to_string
().
c_str
());
Logger
::
smf_app
().
debug
(
"%s"
,
s
.
to_string
().
c_str
());
}
}
}
else
{
}
else
{
Logger
::
smf_app
().
debug
(
"
Edge from UPF info
, empty"
);
Logger
::
smf_app
().
debug
(
"
Link info from UPF
, empty"
);
}
}
return
e
;
return
e
;
}
}
...
@@ -127,18 +126,17 @@ bool edge::serves_network(
...
@@ -127,18 +126,17 @@ bool edge::serves_network(
const
std
::
string
&
dnn
,
const
snssai_t
&
snssai
,
const
std
::
string
&
dnn
,
const
snssai_t
&
snssai
,
const
std
::
unordered_set
<
std
::
string
>&
dnais
,
const
std
::
unordered_set
<
std
::
string
>&
dnais
,
std
::
string
&
matched_dnai
)
const
{
std
::
string
&
matched_dnai
)
const
{
Logger
::
smf_app
().
debug
(
//
Logger::smf_app().debug(
"Serves Network, DNN %s, S-NSSAI %s"
,
dnn
.
c_str
(),
//
"Serves Network, DNN %s, S-NSSAI %s", dnn.c_str(),
snssai
.
toString
().
c_str
());
//
snssai.toString().c_str());
// just create a snssai_upf_info_item for fast lookup
// just create a snssai_upf_info_item for fast lookup
snssai_upf_info_item_s
snssai_item
=
{};
snssai_upf_info_item_s
snssai_item
=
{};
snssai_item
.
snssai
=
snssai
;
snssai_item
.
snssai
=
snssai
;
// For debugging purpose
// For debugging purpose
if
(
!
snssai_dnns
.
empty
())
{
if
(
!
snssai_dnns
.
empty
())
{
Logger
::
smf_app
().
debug
(
"S-NSSAI UPF info list"
);
Logger
::
smf_app
().
debug
(
"S-NSSAI UPF info list
:
"
);
for
(
const
auto
&
s
:
snssai_dnns
)
{
for
(
const
auto
&
s
:
snssai_dnns
)
{
Logger
::
smf_app
().
debug
(
Logger
::
smf_app
().
debug
(
"%s"
,
s
.
to_string
().
c_str
());
"S-NSSAI UPF info item %s"
,
s
.
to_string
().
c_str
());
}
}
}
}
...
@@ -366,7 +364,7 @@ bool pfcp_association::find_interface_edge(
...
@@ -366,7 +364,7 @@ bool pfcp_association::find_interface_edge(
// just guess that this UPF has a N3 or N6 interface
// just guess that this UPF has a N3 or N6 interface
if
(
upf_info
.
interface_upf_info_list
.
empty
())
{
if
(
upf_info
.
interface_upf_info_list
.
empty
())
{
Logger
::
smf_app
().
info
(
Logger
::
smf_app
().
info
(
"UPF Interface list is
t
empty: Assume that the UPF has a N3 and a N6 "
"UPF Interface list is empty: Assume that the UPF has a N3 and a N6 "
"interface."
);
"interface."
);
edge
e
=
edge
::
from_upf_info
(
upf_info
);
edge
e
=
edge
::
from_upf_info
(
upf_info
);
e
.
type
=
type_match
;
e
.
type
=
type_match
;
...
@@ -864,8 +862,8 @@ bool pfcp_associations::add_peer_candidate_node(
...
@@ -864,8 +862,8 @@ bool pfcp_associations::add_peer_candidate_node(
std
::
make_shared
<
pfcp_association
>
(
node_id
);
std
::
make_shared
<
pfcp_association
>
(
node_id
);
s
->
set_upf_node_profile
(
profile
);
s
->
set_upf_node_profile
(
profile
);
pending_associations
.
push_back
(
s
);
pending_associations
.
push_back
(
s
);
Logger
::
smf_app
().
info
(
"Added a pending association candidate"
);
//
Logger::smf_app().info("Added a pending association candidate");
s
->
display
();
//
s->display();
return
true
;
return
true
;
}
}
...
...
src/smf_app/smf_pfcp_association.hpp
View file @
9b11f6d8
...
@@ -329,10 +329,10 @@ struct edge {
...
@@ -329,10 +329,10 @@ struct edge {
// only print name of UPF when nw instance is empty
// only print name of UPF when nw instance is empty
// otherwise output is too long and redundant
// otherwise output is too long and redundant
if
(
association
&&
nw_instance
.
empty
())
{
if
(
association
&&
nw_instance
.
empty
())
{
output
.
append
(
"("
).
append
(
association
->
get_printable_name
()).
append
(
")"
);
output
.
append
(
"("
).
append
(
association
->
get_printable_name
()).
append
(
")
"
);
}
}
if
(
!
snssai_dnns
.
empty
())
{
if
(
!
snssai_dnns
.
empty
())
{
output
.
append
(
"S-NSSAI UPF info list: { "
);
output
.
append
(
"
,
S-NSSAI UPF info list: { "
);
for
(
const
auto
&
s
:
snssai_dnns
)
{
for
(
const
auto
&
s
:
snssai_dnns
)
{
output
.
append
(
" "
).
append
(
s
.
to_string
()).
append
(
", "
);
output
.
append
(
" "
).
append
(
s
.
to_string
()).
append
(
", "
);
}
}
...
...
src/smf_app/smf_sbi.cpp
View file @
9b11f6d8
...
@@ -796,12 +796,10 @@ void smf_sbi::subscribe_upf_status_notify(
...
@@ -796,12 +796,10 @@ void smf_sbi::subscribe_upf_status_notify(
"available (HTTP version %d)"
,
"available (HTTP version %d)"
,
msg
->
http_version
);
msg
->
http_version
);
Logger
::
smf_sbi
().
debug
(
Logger
::
smf_sbi
().
debug
(
"NRF's URL: %s"
,
msg
->
url
.
c_str
());
"Send NFStatusNotify to NRF, NRF URL %s"
,
msg
->
url
.
c_str
());
std
::
string
body
=
msg
->
json_data
.
dump
();
std
::
string
body
=
msg
->
json_data
.
dump
();
Logger
::
smf_sbi
().
debug
(
Logger
::
smf_sbi
().
debug
(
"Message body: %s"
,
body
.
c_str
());
"Send NFStatusNotify to NRF, msg body: %s"
,
body
.
c_str
());
std
::
string
response_data
=
{};
std
::
string
response_data
=
{};
// Generate a promise and associate this promise to the curl handle
// Generate a promise and associate this promise to the curl handle
...
...
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