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
d58209b6
Commit
d58209b6
authored
Jan 27, 2023
by
Stefan Spettel
Committed by
Raphael Defosseux
Jan 27, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(smf - upf): Use NWI from config file when no UPF profile is associated
* Remove USE_NETWORK_INSTANCE config parameter
parent
f7f6cfa3
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
83 deletions
+41
-83
etc/smf.conf
etc/smf.conf
+0
-2
src/smf_app/smf_config.cpp
src/smf_app/smf_config.cpp
+22
-64
src/smf_app/smf_config.hpp
src/smf_app/smf_config.hpp
+9
-9
src/smf_app/smf_pfcp_association.cpp
src/smf_app/smf_pfcp_association.cpp
+8
-6
src/smf_app/smf_pfcp_association.hpp
src/smf_app/smf_pfcp_association.hpp
+0
-2
src/smf_app/smf_profile.hpp
src/smf_app/smf_profile.hpp
+2
-0
No files found.
etc/smf.conf
View file @
d58209b6
...
...
@@ -123,8 +123,6 @@ SMF =
USE_FQDN_DNS
=
"{{ env["
USE_FQDN_DNS
"] if "
USE_FQDN_DNS
" in env.keys() else 'no' }}"
;
# Default: 1
HTTP_VERSION
= {{
env
[
"HTTP_VERSION"
]
if
"HTTP_VERSION"
in
env
.
keys
()
else
'1'
}};
# Set yes if network instance is to be used for given UPF
USE_NETWORK_INSTANCE
=
"{{ env["
USE_NETWORK_INSTANCE
"] if "
USE_NETWORK_INSTANCE
" in env.keys() else 'no' }}"
;
# Set yes if UE USAGE REPORTING is to be done at UPF
ENABLE_USAGE_REPORTING
=
"{{ env["
ENABLE_USAGE_REPORTING
"] if "
ENABLE_USAGE_REPORTING
" in env.keys() else 'no' }}"
}
...
...
src/smf_app/smf_config.cpp
View file @
d58209b6
...
...
@@ -566,14 +566,6 @@ int smf_config::load(const string& config_file) {
SMF_CONFIG_STRING_SUPPORT_FEATURES_SBI_HTTP_VERSION
,
httpVersion
);
http_version
=
httpVersion
;
support_features
.
lookupValue
(
SMF_CONFIG_STRING_SUPPORT_FEATURES_USE_NETWORK_INSTANCE
,
opt
);
if
(
boost
::
iequals
(
opt
,
"yes"
))
{
use_nwi
=
true
;
}
else
{
use_nwi
=
false
;
}
support_features
.
lookupValue
(
SMF_CONFIG_STRING_SUPPORT_FEATURES_ENABLE_USAGE_REPORTING
,
opt
);
if
(
boost
::
iequals
(
opt
,
"yes"
))
{
...
...
@@ -787,7 +779,7 @@ int smf_config::load(const string& config_file) {
}
}
// Network Instance
if
(
upf_cfg
.
exists
(
SMF_CONFIG_STRING_NWI_LIST
)
&
use_nwi
)
{
if
(
upf_cfg
.
exists
(
SMF_CONFIG_STRING_NWI_LIST
))
{
const
Setting
&
nwi_cfg
=
upf_cfg
[
SMF_CONFIG_STRING_NWI_LIST
];
count
=
nwi_cfg
.
getLength
();
// Check if NWI list for given UPF is present
...
...
@@ -1076,8 +1068,6 @@ void smf_config::display() {
Logger
::
smf_app
().
info
(
" Use FQDN ...........................: %s"
,
use_fqdn_dns
?
"Yes"
:
"No"
);
Logger
::
smf_app
().
info
(
" Use NWI ...........................: %s"
,
use_nwi
?
"Yes"
:
"No"
);
Logger
::
smf_app
().
info
(
"- DNN configurations:"
);
...
...
@@ -1239,59 +1229,27 @@ std::string smf_config::get_default_dnn() {
}
//------------------------------------------------------------------------------
bool
smf_config
::
get_nwi_list_index
(
bool
nwi_enabled
,
uint8_t
nwi_list_index
,
pfcp
::
node_id_t
node_id
)
{
if
(
node_id
.
node_id_type
==
pfcp
::
NODE_ID_TYPE_IPV4_ADDRESS
)
{
for
(
int
i
=
0
;
i
<
upf_nwi_list
.
size
();
i
++
)
{
if
(
node_id
.
u1
.
ipv4_address
.
s_addr
==
upf_nwi_list
[
i
].
upf_id
.
u1
.
ipv4_address
.
s_addr
)
{
nwi_list_index
=
i
;
nwi_enabled
=
true
;
return
true
;
}
}
nwi_enabled
=
false
;
return
false
;
}
if
(
node_id
.
node_id_type
==
pfcp
::
NODE_ID_TYPE_FQDN
)
{
// Resove FQDN here because, node id type is always IPV4_ADDRESS in
// upf_nwi_list
unsigned
char
buf_in_addr
[
sizeof
(
struct
in_addr
)
+
1
];
unsigned
int
upf_port
=
{
0
};
uint8_t
addr_type
=
{
0
};
std
::
string
address
=
{};
struct
in_addr
ipv4_Address
;
fqdn
::
resolve
(
node_id
.
fqdn
,
address
,
upf_port
,
addr_type
,
""
);
if
(
inet_pton
(
AF_INET
,
util
::
trim
(
address
).
c_str
(),
buf_in_addr
)
==
1
)
{
memcpy
(
&
ipv4_Address
,
buf_in_addr
,
sizeof
(
struct
in_addr
));
}
else
{
Logger
::
smf_app
().
error
(
"FQDN resolve failed for get_nwi_list_index"
);
}
for
(
int
i
=
0
;
i
<
upf_nwi_list
.
size
();
i
++
)
{
if
(
ipv4_Address
.
s_addr
==
upf_nwi_list
[
i
].
upf_id
.
u1
.
ipv4_address
.
s_addr
)
{
nwi_list_index
=
i
;
nwi_enabled
=
true
;
return
true
;
std
::
string
smf_config
::
get_nwi
(
const
pfcp
::
node_id_t
&
node_id
,
const
iface_type
&
type
)
{
// Note Stefan: In all cases, resolving should happen before this step and the
// IP address is set
for
(
const
auto
&
upf_nwi
:
upf_nwi_list
)
{
if
(
upf_nwi
.
upf_id
.
u1
.
ipv4_address
.
s_addr
==
node_id
.
u1
.
ipv4_address
.
s_addr
)
{
switch
(
type
)
{
case
iface_type
:
:
N3
:
return
upf_nwi
.
domain_access
;
case
iface_type
:
:
N6
:
return
upf_nwi
.
domain_core
;
case
iface_type
:
:
N9
:
Logger
::
smf_app
().
warn
(
"N9 interface type not supported for locally configured NWI"
);
return
""
;
default:
Logger
::
smf_app
().
error
(
"Unsupported enum parameter in get_nwi"
);
return
""
;
}
}
nwi_enabled
=
false
;
return
false
;
}
return
false
;
}
//------------------------------------------------------------------------------
std
::
string
smf_config
::
get_nwi
(
const
std
::
vector
<
interface_upf_info_item_t
>&
int_list
,
const
std
::
string
&
int_type
)
{
std
::
string
nwi
=
{};
for
(
auto
ui
:
int_list
)
{
if
(
!
ui
.
interface_type
.
compare
(
int_type
))
nwi
=
ui
.
network_instance
;
}
Logger
::
smf_app
().
debug
(
"Interface Type - %s, NWI - %s"
,
int_type
.
c_str
(),
nwi
.
c_str
());
return
nwi
;
}
//------------------------------------------------------------------------------
return
""
;
}
\ No newline at end of file
src/smf_app/smf_config.hpp
View file @
d58209b6
...
...
@@ -41,6 +41,7 @@
#include "3gpp_29.244.h"
#include "pfcp.hpp"
#include "smf.h"
#include "smf_profile.hpp"
#define SMF_CONFIG_STRING_SMF_CONFIG "SMF"
#define SMF_CONFIG_STRING_PID_DIRECTORY "PID_DIRECTORY"
...
...
@@ -157,8 +158,6 @@
"FORCE_PUSH_PROTOCOL_CONFIGURATION_OPTIONS"
#define SMF_CONFIG_STRING_SUPPORT_FEATURES_USE_FQDN_DNS "USE_FQDN_DNS"
#define SMF_CONFIG_STRING_SUPPORT_FEATURES_SBI_HTTP_VERSION "HTTP_VERSION"
#define SMF_CONFIG_STRING_SUPPORT_FEATURES_USE_NETWORK_INSTANCE \
"USE_NETWORK_INSTANCE"
#define SMF_CONFIG_STRING_SUPPORT_FEATURES_ENABLE_USAGE_REPORTING \
"ENABLE_USAGE_REPORTING"
...
...
@@ -245,7 +244,6 @@ class smf_config {
bool
use_local_pcc_rules
;
bool
use_fqdn_dns
;
unsigned
int
http_version
;
bool
use_nwi
;
bool
enable_ur
;
std
::
vector
<
pfcp
::
node_id_t
>
upfs
;
...
...
@@ -340,7 +338,6 @@ class smf_config {
discover_upf
=
false
;
discover_pcf
=
false
;
use_fqdn_dns
=
false
;
use_nwi
=
false
;
};
~
smf_config
();
void
lock
()
{
m_rw_lock
.
lock
();
};
...
...
@@ -352,11 +349,14 @@ class smf_config {
bool
is_dotted_dnn_handled
(
const
std
::
string
&
dnn
,
const
pdu_session_type_t
&
pdn_session_type
);
std
::
string
get_default_dnn
();
bool
get_nwi_list_index
(
bool
nwi_enabled
,
uint8_t
nwi_list_index
,
pfcp
::
node_id_t
node_id
);
std
::
string
get_nwi
(
const
std
::
vector
<
interface_upf_info_item_t
>&
int_list
,
const
std
::
string
&
int_type
);
/**
* Returns network instance of iface_type typ. If not found, empty string is
* returned
* @param node_id IP address or FQDN to match against configuration
* @return NWI or empty string
*/
std
::
string
get_nwi
(
const
pfcp
::
node_id_t
&
node_id
,
const
iface_type
&
type
);
};
}
// namespace smf
...
...
src/smf_app/smf_pfcp_association.cpp
View file @
d58209b6
...
...
@@ -894,12 +894,14 @@ void upf_graph::insert_into_graph(const std::shared_ptr<pfcp_association>& sa) {
"just add the node"
);
Logger
::
smf_app
().
info
(
"Assume that the UPF has a N3 and a N6 interface."
);
edge
n3_edge
=
{};
n3_edge
.
type
=
iface_type
::
N3
;
n3_edge
.
uplink
=
false
;
edge
n6_edge
=
{};
n6_edge
.
type
=
iface_type
::
N6
;
n6_edge
.
uplink
=
true
;
edge
n3_edge
=
{};
n3_edge
.
type
=
iface_type
::
N3
;
n3_edge
.
nw_instance
=
smf_cfg
.
get_nwi
(
sa
->
node_id
,
iface_type
::
N3
);
n3_edge
.
uplink
=
false
;
edge
n6_edge
=
{};
n6_edge
.
type
=
iface_type
::
N6
;
n6_edge
.
nw_instance
=
smf_cfg
.
get_nwi
(
sa
->
node_id
,
iface_type
::
N6
);
n6_edge
.
uplink
=
true
;
add_upf_graph_edge
(
sa
,
n3_edge
);
add_upf_graph_edge
(
sa
,
n6_edge
);
...
...
src/smf_app/smf_pfcp_association.hpp
View file @
d58209b6
...
...
@@ -47,8 +47,6 @@ namespace smf {
#define PFCP_ASSOCIATION_HEARTBEAT_MAX_RETRIES 2
#define PFCP_ASSOCIATION_GRACEFUL_RELEASE_PERIOD 5
enum
iface_type
{
N9
,
N6
,
N3
};
struct
edge
;
class
pfcp_association
{
...
...
src/smf_app/smf_profile.hpp
View file @
d58209b6
...
...
@@ -44,6 +44,8 @@
namespace
smf
{
enum
class
iface_type
{
N9
,
N6
,
N3
};
using
namespace
std
;
class
nf_profile
:
public
std
::
enable_shared_from_this
<
nf_profile
>
{
public:
...
...
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