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
06729cf0
Commit
06729cf0
authored
Nov 28, 2022
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix_develop_ue_rel16' into ue_triggered_pdu_session_release
parents
3d122038
89235dea
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
397 additions
and
145 deletions
+397
-145
src/api-server/api/NFStatusNotifyApi.cpp
src/api-server/api/NFStatusNotifyApi.cpp
+4
-0
src/common/3gpp_29.244.h
src/common/3gpp_29.244.h
+7
-0
src/common/smf.h
src/common/smf.h
+69
-17
src/common/utils/conversions.cpp
src/common/utils/conversions.cpp
+7
-3
src/common/utils/fqdn.cpp
src/common/utils/fqdn.cpp
+74
-2
src/common/utils/fqdn.hpp
src/common/utils/fqdn.hpp
+2
-0
src/smf_app/smf_app.cpp
src/smf_app/smf_app.cpp
+27
-9
src/smf_app/smf_context.cpp
src/smf_app/smf_context.cpp
+8
-2
src/smf_app/smf_pfcp_association.cpp
src/smf_app/smf_pfcp_association.cpp
+162
-77
src/smf_app/smf_pfcp_association.hpp
src/smf_app/smf_pfcp_association.hpp
+23
-2
src/smf_app/smf_profile.cpp
src/smf_app/smf_profile.cpp
+13
-32
src/smf_app/smf_sbi.cpp
src/smf_app/smf_sbi.cpp
+1
-1
No files found.
src/api-server/api/NFStatusNotifyApi.cpp
View file @
06729cf0
...
...
@@ -21,6 +21,7 @@
#include "NFStatusNotifyApi.h"
#include "Helpers.h"
#include "logger.hpp"
#include "smf_config.hpp"
extern
smf
::
smf_config
smf_cfg
;
...
...
@@ -56,6 +57,9 @@ void NFStatusNotifyApi::setupRoutes() {
void
NFStatusNotifyApi
::
notify_nf_status_handler
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
response
)
{
Logger
::
smf_api_server
().
info
(
"Received a NFStatusNotify message"
);
Logger
::
smf_api_server
().
debug
(
"Message body: %s
\n
"
,
request
.
body
().
c_str
());
// Getting the body param
NotificationData
notificationData
;
...
...
src/common/3gpp_29.244.h
View file @
06729cf0
...
...
@@ -1026,6 +1026,13 @@ struct node_id_s {
struct
in6_addr
ipv6_address
;
}
u1
;
std
::
string
fqdn
;
// should be in union but problem with virtual ~
node_id_s
()
{
node_id_type
=
node_id_type_value_e
::
NODE_ID_TYPE_UNKNOWN
;
u1
.
ipv4_address
.
s_addr
=
INADDR_ANY
;
u1
.
ipv6_address
=
in6addr_any
;
fqdn
=
{};
}
bool
operator
==
(
const
struct
node_id_s
&
i
)
const
{
if
(
i
.
node_id_type
!=
this
->
node_id_type
)
return
false
;
switch
(
i
.
node_id_type
)
{
...
...
src/common/smf.h
View file @
06729cf0
...
...
@@ -22,14 +22,15 @@
#ifndef FILE_SMF_SEEN
#define FILE_SMF_SEEN
#include "3gpp_29.274.h"
#include "3gpp_29.571.h"
#include "3gpp_24.501.h"
#include <nlohmann/json.hpp>
#include <boost/algorithm/string.hpp>
#include <map>
#include <
vector
>
#include <
nlohmann/json.hpp
>
#include <unordered_set>
#include <vector>
#include "3gpp_24.501.h"
#include "3gpp_29.274.h"
#include "3gpp_29.571.h"
typedef
uint64_t
supi64_t
;
#define SUPI_64_FMT "%" SCNu64
...
...
@@ -85,13 +86,21 @@ typedef struct s_nssai // section 28.4, TS23.003
uint32_t
sd
;
s_nssai
(
const
uint8_t
&
m_sst
,
const
uint32_t
m_sd
)
:
sst
(
m_sst
),
sd
(
m_sd
)
{}
s_nssai
(
const
uint8_t
&
m_sst
,
const
std
::
string
m_sd
)
:
sst
(
m_sst
)
{
sd
=
0xFFFFFF
;
sd
=
SD_NO_VALUE
;
if
(
m_sd
.
empty
())
return
;
uint8_t
base
=
10
;
try
{
sd
=
std
::
stoul
(
m_sd
,
nullptr
,
10
);
if
(
m_sd
.
size
()
>
2
)
{
if
(
boost
::
iequals
(
m_sd
.
substr
(
0
,
2
),
"0x"
))
{
base
=
16
;
}
}
sd
=
std
::
stoul
(
m_sd
,
nullptr
,
base
);
}
catch
(
const
std
::
exception
&
e
)
{
Logger
::
smf_app
().
warn
(
"Error when converting from string to int for
snssai.
SD, error: %s"
,
Logger
::
smf_app
().
error
(
"Error when converting from string to int for
S-NSSAI
SD, error: %s"
,
e
.
what
());
sd
=
SD_NO_VALUE
;
}
}
s_nssai
()
:
sst
(),
sd
()
{}
...
...
@@ -212,8 +221,8 @@ enum class sm_context_status_e {
SM_CONTEXT_STATUS_RELEASED
=
1
};
static
const
std
::
vector
<
std
::
string
>
sm_context_status_e2str
=
{
"ACTIVE"
,
"RELEASED"
};
static
const
std
::
vector
<
std
::
string
>
sm_context_status_e2str
=
{
"ACTIVE"
,
"RELEASED"
};
typedef
struct
qos_profile_gbr_s
{
gfbr_t
gfbr
;
// Guaranteed Flow Bit Rate
...
...
@@ -346,7 +355,7 @@ typedef struct nf_service_s {
s
.
append
(
service_instance_id
);
s
.
append
(
", Service name: "
);
s
.
append
(
service_name
);
for
(
auto
v
:
versions
)
{
for
(
const
auto
&
v
:
versions
)
{
s
.
append
(
v
.
to_string
());
}
s
.
append
(
", Scheme: "
);
...
...
@@ -381,11 +390,38 @@ typedef struct dnn_upf_info_item_s {
return
std
::
hash
<
std
::
string
>
()(
dnn
);
}
}
dnn_upf_info_item_t
;
std
::
string
to_string
()
const
{
std
::
string
s
=
{};
s
.
append
(
"DNN = "
).
append
(
dnn
).
append
(
", "
);
if
(
dnai_list
.
size
()
>
0
)
{
s
.
append
(
"DNAI list: {"
);
for
(
const
auto
&
dnai
:
dnai_list
)
{
s
.
append
(
"DNAI = "
).
append
(
dnai
).
append
(
", "
);
}
s
.
append
(
"}, "
);
}
if
(
dnai_nw_instance_list
.
size
()
>
0
)
{
s
.
append
(
"DNAI NW Instance list: {"
);
for
(
const
auto
&
dnai_nw
:
dnai_nw_instance_list
)
{
s
.
append
(
"("
).
append
(
dnai_nw
.
first
).
append
(
", "
).
append
(
dnai_nw
.
second
).
append
(
"),"
);
}
s
.
append
(
"}, "
);
}
return
s
;
}
}
dnn_upf_info_item_t
;
typedef
struct
snssai_upf_info_item_s
{
snssai_t
snssai
;
std
::
unordered_set
<
dnn_upf_info_item_t
,
dnn_upf_info_item_t
>
mutable
snssai_t
snssai
;
mutable
std
::
unordered_set
<
dnn_upf_info_item_t
,
dnn_upf_info_item_t
>
dnn_upf_info_list
;
snssai_upf_info_item_s
&
operator
=
(
const
snssai_upf_info_item_s
&
s
)
{
...
...
@@ -395,13 +431,29 @@ typedef struct snssai_upf_info_item_s {
}
bool
operator
==
(
const
snssai_upf_info_item_s
&
s
)
const
{
return
snssai
==
s
.
snssai
;
return
(
snssai
==
s
.
snssai
)
and
(
dnn_upf_info_list
==
s
.
dnn_upf_info_list
)
;
}
size_t
operator
()(
const
snssai_upf_info_item_s
&
)
const
{
return
snssai
.
operator
()(
snssai
);
}
std
::
string
to_string
()
const
{
std
::
string
s
=
{};
s
.
append
(
"SNSSAI Info: "
+
snssai
.
toString
()
+
", "
);
if
(
dnn_upf_info_list
.
size
()
>
0
)
{
s
.
append
(
"DNN UPF Info list: {"
);
for
(
auto
dnn_upf
:
dnn_upf_info_list
)
{
s
.
append
(
dnn_upf
.
to_string
());
}
s
.
append
(
"}, "
);
}
return
s
;
}
}
snssai_upf_info_item_t
;
typedef
struct
interface_upf_info_item_s
{
...
...
src/common/utils/conversions.cpp
View file @
06729cf0
...
...
@@ -181,10 +181,14 @@ void conv::plmnToMccMnc(
//------------------------------------------------------------------------------
struct
in_addr
conv
::
fromString
(
const
std
::
string
addr4
)
{
unsigned
char
buf
[
sizeof
(
struct
in6_addr
)]
=
{};
int
s
=
inet_pton
(
AF_INET
,
addr4
.
c_str
(),
buf
);
struct
in_addr
*
ia
=
(
struct
in_addr
*
)
buf
;
return
*
ia
;
struct
in_addr
ipv4_addr
;
ipv4_addr
.
s_addr
=
INADDR_ANY
;
if
(
inet_pton
(
AF_INET
,
addr4
.
c_str
(),
buf
)
==
1
)
{
memcpy
(
&
ipv4_addr
,
buf
,
sizeof
(
struct
in_addr
));
}
return
ipv4_addr
;
}
//------------------------------------------------------------------------------
std
::
string
conv
::
toString
(
const
struct
in_addr
&
inaddr
)
{
std
::
string
s
=
{};
...
...
src/common/utils/fqdn.cpp
View file @
06729cf0
...
...
@@ -21,6 +21,7 @@
#include "fqdn.hpp"
#include "logger.hpp"
#include "string.hpp"
#include <boost/asio.hpp>
#include <iostream>
#include <chrono>
...
...
@@ -37,7 +38,7 @@ bool fqdn::resolve(
while
(
tries
<
MAX_NB_RESOLVE_TRIES
)
{
try
{
boost
::
asio
::
io_context
io_context
=
{};
Logger
::
smf_app
().
debug
(
"Resolving DNS Try #%u"
,
tries
);
Logger
::
smf_app
().
debug
(
"Resolving DNS Try #%u"
,
tries
+
1
);
boost
::
asio
::
ip
::
tcp
::
resolver
resolver
{
io_context
};
boost
::
asio
::
ip
::
tcp
::
resolver
::
results_type
endpoints
=
...
...
@@ -73,6 +74,77 @@ bool fqdn::resolve(
return
false
;
}
bool
fqdn
::
resolve
(
pfcp
::
node_id_t
&
node_id
)
{
Logger
::
smf_app
().
debug
(
"Resolving an FQDN/IP Addr for an UPF node"
);
// Resolve IP addr from FQDN
if
(
node_id
.
node_id_type
==
pfcp
::
NODE_ID_TYPE_FQDN
)
{
// Don't need to do if IP addr already available
if
(
node_id
.
u1
.
ipv4_address
.
s_addr
!=
INADDR_ANY
)
return
true
;
// Resolve if FQDN available
if
(
!
node_id
.
fqdn
.
empty
())
{
Logger
::
smf_app
().
debug
(
"FQDN %s"
,
node_id
.
fqdn
.
c_str
());
std
::
string
ip_addr_str
=
{};
uint32_t
port
=
{
0
};
uint8_t
addr_type
=
{
0
};
struct
in_addr
ipv4_addr
=
{};
if
(
!
fqdn
::
resolve
(
node_id
.
fqdn
,
ip_addr_str
,
port
,
addr_type
))
{
Logger
::
smf_app
().
warn
(
"Resolve FQDN %s: cannot resolve the hostname!"
,
node_id
.
fqdn
.
c_str
());
return
false
;
}
switch
(
addr_type
)
{
case
0
:
{
node_id
.
u1
.
ipv4_address
.
s_addr
=
conv
::
fromString
(
ip_addr_str
).
s_addr
;
Logger
::
smf_app
().
debug
(
"Resolve FQDN %s, IP Addr %s"
,
node_id
.
fqdn
.
c_str
(),
ip_addr_str
.
c_str
());
}
break
;
case
1
:
{
// TODO
Logger
::
smf_app
().
warn
(
"Resolve FQDN: %s. IPv6 Addr, this mode has not been "
"supported yet!"
,
node_id
.
fqdn
.
c_str
());
return
false
;
}
break
;
default:
Logger
::
smf_app
().
warn
(
"Unknown Address type"
);
return
false
;
}
}
else
{
return
false
;
// No FQDN available
}
// Resolve hostname from an IP Addr
}
else
if
(
node_id
.
node_id_type
==
pfcp
::
NODE_ID_TYPE_IPV4_ADDRESS
)
{
// Don't need to do reserve_resolve if FQDN is already available
if
(
!
node_id
.
fqdn
.
empty
())
{
return
true
;
}
else
{
std
::
string
hostname
=
{};
std
::
string
ip_str
=
conv
::
toString
(
node_id
.
u1
.
ipv4_address
);
if
(
!
fqdn
::
reverse_resolve
(
ip_str
,
hostname
))
{
Logger
::
smf_app
().
warn
(
"Could not resolve hostname for IP address %s"
,
ip_str
.
c_str
());
return
false
;
}
else
{
node_id
.
fqdn
=
hostname
;
Logger
::
smf_app
().
debug
(
"Resolve IP Addr %s, FQDN %s"
,
ip_str
.
c_str
(),
node_id
.
fqdn
.
c_str
());
}
return
true
;
}
}
else
{
// Don't support IPv6 for the moment
return
false
;
}
return
true
;
}
bool
fqdn
::
reverse_resolve
(
const
std
::
string
&
ip_addr
,
std
::
string
&
host_name
)
{
Logger
::
smf_app
().
debug
(
"Resolving an IP address (name %s)"
,
ip_addr
.
c_str
());
int
tries
=
0
;
...
...
@@ -107,4 +179,4 @@ bool fqdn::reverse_resolve(const std::string& ip_addr, std::string& host_name) {
}
}
return
false
;
}
\ No newline at end of file
}
src/common/utils/fqdn.hpp
View file @
06729cf0
...
...
@@ -28,6 +28,7 @@
#ifndef FILE_FQDN_HPP_SEEN
#define FILE_FQDN_HPP_SEEN
#include <string>
#include "3gpp_29.244.h"
class
fqdn
{
public:
/*
...
...
@@ -41,6 +42,7 @@ class fqdn {
const
std
::
string
&
host_name
,
std
::
string
&
address
,
uint32_t
&
port
,
uint8_t
&
addr_type
,
const
std
::
string
&
protocol
=
"http"
);
static
bool
resolve
(
pfcp
::
node_id_t
&
node_id
);
/**
* @brief Resolves an IP address to get the hostname
* @param ip_address to resolve
...
...
src/smf_app/smf_app.cpp
View file @
06729cf0
...
...
@@ -399,10 +399,13 @@ void smf_app::start_nf_registration_discovery() {
//------------------------------------------------------------------------------
void
smf_app
::
start_upf_association
(
const
pfcp
::
node_id_t
&
node_id
)
{
Logger
::
smf_app
().
debug
(
"Start a PFCP Association procedure with an UPF"
);
std
::
time_t
time_epoch
=
std
::
time
(
nullptr
);
uint64_t
tv_ntp
=
time_epoch
+
SECONDS_SINCE_FIRST_EPOCH
;
pfcp_associations
::
get_instance
().
add_peer_candidate_node
(
node_id
);
pfcp
::
node_id_t
node_id_tmp
=
node_id
;
fqdn
::
resolve
(
node_id_tmp
);
// Resolve FQDN/IP addr if necessary
pfcp_associations
::
get_instance
().
add_peer_candidate_node
(
node_id_tmp
);
std
::
shared_ptr
<
itti_n4_association_setup_request
>
n4_asc
=
std
::
shared_ptr
<
itti_n4_association_setup_request
>
(
new
itti_n4_association_setup_request
(
TASK_SMF_APP
,
TASK_SMF_N4
));
...
...
@@ -438,9 +441,12 @@ void smf_app::start_upf_association(const pfcp::node_id_t& node_id) {
//------------------------------------------------------------------------------
void
smf_app
::
start_upf_association
(
const
pfcp
::
node_id_t
&
node_id
,
const
upf_profile
&
profile
)
{
Logger
::
smf_app
().
debug
(
"Start a PFCP Association procedure with an UPF"
);
std
::
time_t
time_epoch
=
std
::
time
(
nullptr
);
uint64_t
tv_ntp
=
time_epoch
+
SECONDS_SINCE_FIRST_EPOCH
;
pfcp
::
node_id_t
node_id_tmp
=
node_id
;
fqdn
::
resolve
(
node_id_tmp
);
// Resolve FQDN/IP addr if necessary
pfcp_associations
::
get_instance
().
add_peer_candidate_node
(
node_id
,
profile
);
std
::
shared_ptr
<
itti_n4_association_setup_request
>
n4_asc
=
std
::
shared_ptr
<
itti_n4_association_setup_request
>
(
...
...
@@ -690,6 +696,11 @@ void smf_app::handle_itti_msg(
graph
->
start_asynch_dfs_procedure
(
true
,
empty_flow
);
graph
->
dfs_next_upf
(
dl_edges
,
ul_edges
,
current_upf
);
if
(
!
current_upf
)
{
Logger
::
smf_app
().
warn
(
"Could not select UPF in graph!"
);
return
;
}
up_node_id
=
current_upf
->
node_id
;
std
::
shared_ptr
<
itti_n4_session_failure_indication
>
...
...
@@ -1450,15 +1461,21 @@ bool smf_app::handle_nf_status_notification(
// Add a new UPF node
Logger
::
smf_app
().
debug
(
"Add a new UPF node, Ipv4 Addr %s"
,
inet_ntoa
(
ipv4_addrs
[
0
]));
// pfcp::node_id_t n = {};
if
(
n
.
node_id_type
==
pfcp
::
NODE_ID_TYPE_UNKNOWN
)
n
.
node_id_type
=
pfcp
::
NODE_ID_TYPE_IPV4_ADDRESS
;
n
.
u1
.
ipv4_address
.
s_addr
=
ipv4_addrs
[
0
].
s_addr
;
/*smf_cfg.upfs.push_back(n);
upf_profile* upf_node_profile =
dynamic_cast<upf_profile*>(profile.get());
start_upf_association(n, std::ref(*upf_node_profile));
*/
// Do reserve_resolve to find FQDN if not available
if
(
n
.
fqdn
.
empty
())
{
std
::
string
hostname
=
{};
std
::
string
ip_str
=
conv
::
toString
(
n
.
u1
.
ipv4_address
);
if
(
!
fqdn
::
reverse_resolve
(
ip_str
,
hostname
))
{
Logger
::
smf_app
().
debug
(
"Could not resolve hostname for IP address %s"
,
ip_str
.
c_str
());
}
else
{
n
.
fqdn
=
hostname
;
}
}
}
else
{
Logger
::
smf_app
().
debug
(
"UPF node already exist (%s)"
,
inet_ntoa
(
ipv4_addrs
[
0
]));
...
...
@@ -1473,7 +1490,7 @@ bool smf_app::handle_nf_status_notification(
// Trigger N4 association request with retry if needed
std
::
shared_ptr
<
itti_n4_association_retry
>
itti_msg
=
std
::
make_shared
<
itti_n4_association_retry
>
(
TASK_SMF_
N4
,
TASK_SMF_APP
);
TASK_SMF_
APP
,
TASK_SMF_APP
);
itti_msg
->
node_id
=
n
;
itti_msg
->
profile
=
std
::
ref
(
*
upf_node_profile
);
int
ret
=
itti_inst
->
send_msg
(
itti_msg
);
...
...
@@ -1483,7 +1500,8 @@ bool smf_app::handle_nf_status_notification(
itti_msg
->
get_msg_name
());
}
}
else
{
Logger
::
smf_app
().
debug
(
"No IP Addr/FQDN found"
);
Logger
::
smf_app
().
debug
(
"No IP Addr/FQDN found or UPF node already exist"
);
return
false
;
}
}
...
...
src/smf_app/smf_context.cpp
View file @
06729cf0
...
...
@@ -400,6 +400,9 @@ std::string smf_pdu_session::toString() const {
if
(
!
is_released
)
{
s
.
append
(
"
\t
SEID:
\t\t\t
"
).
append
(
std
::
to_string
(
seid
)).
append
(
"
\n
"
);
}
/*
// TODO as FTEID is not updated here, it is confusing to have null output
We need a complete QoS handling refactor
if (default_qfi.qfi) {
s.append("\tDefault ");
for (auto it : qos_flows) {
...
...
@@ -407,7 +410,9 @@ std::string smf_pdu_session::toString() const {
s.append(it.second.toString());
}
}
}
*/
if
(
policy_ptr
)
{
s
.
append
(
"
\t
Policy Decision:"
).
append
(
"
\n
"
);
...
...
@@ -3782,8 +3787,9 @@ bool smf_context::find_dnn_subscription(
Logger
::
smf_app
().
info
(
"Find a DNN Subscription with key: %ld (SST %d, SD %ld (0x%x)), map size "
"%d"
,
(
uint8_t
)
snssai
.
sst
,
snssai
.
sd
,
snssai
.
sd
,
dnn_subscriptions
.
size
());
"%ld"
,
key
,
(
uint8_t
)
snssai
.
sst
,
snssai
.
sd
,
snssai
.
sd
,
dnn_subscriptions
.
size
());
std
::
unique_lock
<
std
::
recursive_mutex
>
lock
(
m_context
);
if
(
dnn_subscriptions
.
count
(
key
)
>
0
)
{
...
...
src/smf_app/smf_pfcp_association.cpp
View file @
06729cf0
This diff is collapsed.
Click to expand it.
src/smf_app/smf_pfcp_association.hpp
View file @
06729cf0
...
...
@@ -92,6 +92,7 @@ class pfcp_association {
timer_association
=
ITTI_INVALID_TIMER_ID
;
timer_graceful_release
=
ITTI_INVALID_TIMER_ID
;
}
pfcp_association
(
const
pfcp
::
node_id_t
&
node_id
,
pfcp
::
recovery_time_stamp_t
&
recovery_time_stamp
)
...
...
@@ -129,6 +130,7 @@ class pfcp_association {
timer_association
=
ITTI_INVALID_TIMER_ID
;
timer_graceful_release
=
ITTI_INVALID_TIMER_ID
;
}
pfcp_association
(
pfcp_association
const
&
p
)
:
node_id
(
p
.
node_id
),
hash_node_id
(
p
.
hash_node_id
),
...
...
@@ -190,8 +192,21 @@ class pfcp_association {
bool
find_upf_edge
(
const
std
::
shared_ptr
<
pfcp_association
>&
other_upf
,
edge
&
out_edge
);
/**
* @brief Get the readble name of the UPF associated with this association
* @param void
* @return string representing the name of the UPF associated with this
* association
*/
std
::
string
get_printable_name
();
/*
* Print related-information for this association
* @param void
* @return void:
*/
void
display
();
private:
bool
find_interface_edge
(
const
iface_type
&
type_match
,
std
::
vector
<
edge
>&
edges
);
...
...
@@ -313,6 +328,13 @@ struct edge {
if
(
association
&&
nw_instance
.
empty
())
{
output
.
append
(
"("
).
append
(
association
->
get_printable_name
()).
append
(
")"
);
}
if
(
!
snssai_dnns
.
empty
())
{
output
.
append
(
"S-NSSAI UPF info list: { "
);
for
(
const
auto
&
s
:
snssai_dnns
)
{
output
.
append
(
" "
).
append
(
s
.
to_string
()).
append
(
", "
);
}
output
.
append
(
"}"
);
}
return
output
;
}
};
...
...
@@ -615,8 +637,7 @@ class pfcp_associations {
pfcp
::
node_id_t
&
node_id
,
pfcp
::
up_function_features_s
&
function_features
);
bool
get_association
(
const
pfcp
::
node_id_t
&
node_id
,
std
::
shared_ptr
<
pfcp_association
>&
sa
)
const
;
const
pfcp
::
node_id_t
&
node_id
,
std
::
shared_ptr
<
pfcp_association
>&
sa
);
bool
get_association
(
const
pfcp
::
fseid_t
&
cp_fseid
,
std
::
shared_ptr
<
pfcp_association
>&
sa
)
const
;
...
...
src/smf_app/smf_profile.cpp
View file @
06729cf0
...
...
@@ -27,11 +27,12 @@
\email: Tien-Thinh.Nguyen@eurecom.fr
*/
#include "smf_profile.hpp"
#include "3gpp_conversions.hpp"
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include "logger.hpp"
#include "smf_profile.hpp"
#include "string.hpp"
using
namespace
std
;
...
...
@@ -282,17 +283,11 @@ void nf_profile::from_json(const nlohmann::json& data) {
if
(
data
.
find
(
"sNssais"
)
!=
data
.
end
())
{
for
(
auto
it
:
data
[
"sNssais"
])
{
snssai_t
s
=
{};
s
.
sst
=
it
[
"sst"
].
get
<
int
>
();
s
.
sd
=
0xFFFFFF
;
try
{
s
.
sd
=
std
::
stoul
(
it
[
"sd"
].
get
<
std
::
string
>
(),
nullptr
,
10
);
}
catch
(
const
std
::
exception
&
e
)
{
Logger
::
smf_app
().
warn
(
"Error when converting from string to int for snssai.SD, error: %s"
,
e
.
what
());
s
.
sd
=
SD_NO_VALUE
;
if
(
it
.
find
(
"sst"
)
!=
it
.
end
())
s
.
sst
=
it
[
"sst"
].
get
<
int
>
();
if
(
it
.
find
(
"sd"
)
!=
it
.
end
())
{
xgpp_conv
::
sd_string_to_int
(
it
[
"sd"
].
get
<
std
::
string
>
(),
s
.
sd
);
}
// s.sD = it["sd"].get<std::string>();
snssais
.
push_back
(
s
);
}
}
...
...
@@ -472,20 +467,13 @@ void smf_profile::from_json(const nlohmann::json& data) {
for
(
auto
it
:
snssai_smf_info_list
)
{
snssai_smf_info_item_t
smf_info_item
=
{};
smf_info_item
.
snssai
.
sd
=
SD_NO_VALUE
;
if
(
it
.
find
(
"sNssai"
)
!=
it
.
end
())
{
if
(
it
[
"sNssai"
].
find
(
"sst"
)
!=
it
[
"sNssai"
].
end
())
smf_info_item
.
snssai
.
sst
=
it
[
"sNssai"
][
"sst"
].
get
<
int
>
();
if
(
it
[
"sNssai"
].
find
(
"sd"
)
!=
it
[
"sNssai"
].
end
())
{
smf_info_item
.
snssai
.
sd
=
0xFFFFFF
;
try
{
smf_info_item
.
snssai
.
sd
=
std
::
stoul
(
it
[
"sNssai"
][
"sd"
].
get
<
std
::
string
>
(),
nullptr
,
10
);
}
catch
(
const
std
::
exception
&
e
)
{
Logger
::
smf_app
().
warn
(
"Error when converting from string to int for snssai.SD, "
"error: %s"
,
e
.
what
());
}
xgpp_conv
::
sd_string_to_int
(
it
[
"sNssai"
][
"sd"
].
get
<
std
::
string
>
(),
smf_info_item
.
snssai
.
sd
);
}
}
if
(
it
.
find
(
"dnnSmfInfoList"
)
!=
it
.
end
())
{
...
...
@@ -629,20 +617,13 @@ void upf_profile::from_json(const nlohmann::json& data) {
for
(
auto
it
:
snssai_upf_info_list
)
{
snssai_upf_info_item_t
upf_info_item
=
{};
upf_info_item
.
snssai
.
sd
=
SD_NO_VALUE
;
if
(
it
.
find
(
"sNssai"
)
!=
it
.
end
())
{
if
(
it
[
"sNssai"
].
find
(
"sst"
)
!=
it
[
"sNssai"
].
end
())
upf_info_item
.
snssai
.
sst
=
it
[
"sNssai"
][
"sst"
].
get
<
int
>
();
if
(
it
[
"sNssai"
].
find
(
"sd"
)
!=
it
[
"sNssai"
].
end
())
{
upf_info_item
.
snssai
.
sd
=
0xFFFFFF
;
try
{
upf_info_item
.
snssai
.
sd
=
std
::
stoul
(
it
[
"sNssai"
][
"sd"
].
get
<
std
::
string
>
(),
nullptr
,
10
);
}
catch
(
const
std
::
exception
&
e
)
{
Logger
::
smf_app
().
warn
(
"Error when converting from string to int for snssai.SD, "
"error: %s"
,
e
.
what
());
}
xgpp_conv
::
sd_string_to_int
(
it
[
"sNssai"
][
"sd"
].
get
<
std
::
string
>
(),
upf_info_item
.
snssai
.
sd
);
}
}
if
(
it
.
find
(
"dnnUpfInfoList"
)
!=
it
.
end
())
{
...
...
src/smf_app/smf_sbi.cpp
View file @
06729cf0
...
...
@@ -927,7 +927,7 @@ bool smf_sbi::get_sm_data(
}
if
(
jsonData
[
"singleNssai"
].
find
(
"sd"
)
!=
jsonData
[
"singleNssai"
].
end
())
{
std
::
string
sd_str
=
jsonData
[
"singleNssai"
][
"sd"
];
uint32_t
sd
=
0xFFFFFF
;
uint32_t
sd
=
SD_NO_VALUE
;
xgpp_conv
::
sd_string_to_int
(
jsonData
[
"singleNssai"
][
"sd"
].
get
<
std
::
string
>
(),
sd
);
if
(
sd
!=
snssai
.
sd
)
{
...
...
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