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
c7ac1f5d
Commit
c7ac1f5d
authored
Nov 15, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First version with new DNN configuration
parent
10f169de
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
131 additions
and
237 deletions
+131
-237
etc/smf.conf
etc/smf.conf
+3
-3
src/smf_app/smf_app.cpp
src/smf_app/smf_app.cpp
+25
-15
src/smf_app/smf_config.cpp
src/smf_app/smf_config.cpp
+86
-171
src/smf_app/smf_config.hpp
src/smf_app/smf_config.hpp
+17
-48
No files found.
etc/smf.conf
View file @
c7ac1f5d
...
...
@@ -67,9 +67,9 @@ SMF =
DNN_LIST
= (
# IPV4_POOL, IPV6_POOL are index in IPV4_LIST, IPV6_LIST, PDU_SESSION_TYPE choice in {IPv4, IPv6, IPv4v6}
{
DNN_NI
=
"default"
;
PDU_SESSION_TYPE
=
"IPv4"
;
IPV4_
POOL
=
0
;
IPV6_POOL
= -
1
},
{
DNN_NI
=
"carrier.com"
;
PDU_SESSION_TYPE
=
"IPv4"
;
IPV4_
POOL
=
2
;
IPV6_POOL
= -
1
},
{
DNN_NI
=
"oai"
;
PDU_SESSION_TYPE
=
"IPv4"
;
IPV4_
POOL
=
1
;
IPV6_POOL
= -
1
}
{
DNN_NI
=
"default"
;
PDU_SESSION_TYPE
=
"IPv4"
;
IPV4_
RANGE
=
"12.1.1.2 - 12.1.1.128"
;
IPV6_PREFIX
=
"2001:1:2::/64"
},
{
DNN_NI
=
"carrier.com"
;
PDU_SESSION_TYPE
=
"IPv4"
;
IPV4_
RANGE
=
"12.1.1.2 - 12.1.1.128"
;
IPV6_PREFIX
=
"2001:1:2::/64"
},
{
DNN_NI
=
"oai"
;
PDU_SESSION_TYPE
=
"IPv4"
;
IPV4_
RANGE
=
"12.1.1.129 - 12.1.1.224"
;
IPV6_PREFIX
=
"3001:1:2::/64"
}
);
# DNS address communicated to UEs
...
...
src/smf_app/smf_app.cpp
View file @
c7ac1f5d
...
...
@@ -62,6 +62,7 @@
#include "smf_paa_dynamic.hpp"
#include "string.hpp"
#include "fqdn.hpp"
#include "smf_config.hpp"
extern
"C"
{
#include "dynamic_memory_check.h"
...
...
@@ -83,29 +84,38 @@ void smf_app_task(void*);
int
smf_app
::
apply_config
(
const
smf_config
&
cfg
)
{
Logger
::
smf_app
().
info
(
"Apply config..."
);
paa_t
paa
=
{};
for
(
int
ia
=
0
;
ia
<
cfg
.
num_dnn
;
ia
++
)
{
if
(
cfg
.
dnn
[
ia
].
pool_id_iv4
>=
0
)
{
int
pool_id
=
cfg
.
dnn
[
ia
].
pool_id_iv4
;
int
range
=
be32toh
(
cfg
.
ue_pool_range_high
[
pool_id
].
s_addr
)
-
be32toh
(
cfg
.
ue_pool_range_low
[
pool_id
].
s_addr
);
paa_t
paa
=
{};
int
pool_id
=
0
;
for
(
std
::
map
<
std
::
string
,
dnn_t
>::
const_iterator
it
=
cfg
.
dnns
.
begin
();
it
!=
cfg
.
dnns
.
end
();
it
++
)
{
if
((
it
->
second
.
pdu_session_type
.
pdu_session_type
==
PDU_SESSION_TYPE_E_IPV4
)
or
(
it
->
second
.
pdu_session_type
.
pdu_session_type
==
PDU_SESSION_TYPE_E_IPV4V6
))
{
int
range
=
be32toh
(
it
->
second
.
ue_pool_range_high
.
s_addr
)
-
be32toh
(
it
->
second
.
ue_pool_range_high
.
s_addr
);
paa_dynamic
::
get_instance
().
add_pool
(
cfg
.
dnn
[
ia
].
dnn
,
pool_id
,
cfg
.
ue_pool_range_low
[
pool_id
]
,
range
);
it
->
second
.
dnn
,
pool_id
,
it
->
second
.
ue_pool_range_low
,
range
);
// TODO: check with dnn_label
Logger
::
smf_app
().
info
(
"Applied config %s"
,
cfg
.
dnn
[
ia
]
.
dnn
.
c_str
());
paa
.
ipv4_address
=
cfg
.
ue_pool_range_low
[
pool_id
]
;
Logger
::
smf_app
().
info
(
"Applied config %s"
,
it
->
second
.
dnn
.
c_str
());
paa
.
ipv4_address
=
it
->
second
.
ue_pool_range_low
;
}
if
(
cfg
.
dnn
[
ia
].
pool_id_iv6
>=
0
)
{
int
pool_id
=
cfg
.
dnn
[
ia
].
pool_id_iv6
;
if
((
it
->
second
.
pdu_session_type
.
pdu_session_type
==
PDU_SESSION_TYPE_E_IPV6
)
or
(
it
->
second
.
pdu_session_type
.
pdu_session_type
==
PDU_SESSION_TYPE_E_IPV4V6
))
{
paa_dynamic
::
get_instance
().
add_pool
(
cfg
.
dnn
[
ia
].
dnn
,
pool_id
,
cfg
.
paa_pool6_prefix
[
pool_id
]
,
cfg
.
paa_pool6_prefix_len
[
pool_id
]
);
paa
.
ipv6_address
=
cfg
.
paa_pool6_prefix
[
pool_id
]
;
it
->
second
.
dnn
,
pool_id
,
it
->
second
.
paa_pool6_prefix
,
it
->
second
.
paa_pool6_prefix_len
);
paa
.
ipv6_address
=
it
->
second
.
paa_pool6_prefix
;
// TODO: check with dnn_label
Logger
::
smf_app
().
info
(
"Applied config for IPv6 %s"
,
cfg
.
dnn
[
ia
]
.
dnn
.
c_str
());
"Applied config for IPv6 %s"
,
it
->
second
.
dnn
.
c_str
());
}
pool_id
++
;
}
Logger
::
smf_app
().
info
(
"Applied config"
);
...
...
src/smf_app/smf_config.cpp
View file @
c7ac1f5d
This diff is collapsed.
Click to expand it.
src/smf_app/smf_config.hpp
View file @
c7ac1f5d
...
...
@@ -81,6 +81,8 @@
#define SMF_CONFIG_STRING_PDU_SESSION_TYPE "PDU_SESSION_TYPE"
#define SMF_CONFIG_STRING_IPV4_POOL "IPV4_POOL"
#define SMF_CONFIG_STRING_IPV6_POOL "IPV6_POOL"
#define SMF_CONFIG_STRING_IPV4_RANGE "IPV4_RANGE"
#define SMF_CONFIG_STRING_IPV6_PREFIX "IPV6_PREFIX"
#define SMF_ABORT_ON_ERROR true
#define SMF_WARN_ON_ERROR false
...
...
@@ -169,6 +171,19 @@ typedef struct itti_cfg_s {
util
::
thread_sched_params
async_cmd_sched_params
;
}
itti_cfg_t
;
typedef
struct
dnn_s
{
std
::
string
dnn
;
std
::
string
dnn_label
;
bool
is_ipv4
;
bool
is_ipv6
;
int
pool_id_iv4
;
int
pool_id_iv6
;
struct
in_addr
ue_pool_range_low
;
struct
in_addr
ue_pool_range_high
;
struct
in6_addr
paa_pool6_prefix
;
uint8_t
paa_pool6_prefix_len
;
pdu_session_type_t
pdu_session_type
;
}
dnn_t
;
class
smf_config
{
private:
int
load_itti
(
const
libconfig
::
Setting
&
itti_cfg
,
itti_cfg_t
&
cfg
);
...
...
@@ -195,32 +210,7 @@ class smf_config {
struct
in6_addr
default_dnsv6
;
struct
in6_addr
default_dns_secv6
;
#define SMF_NUM_DNN_MAX 5
int
num_dnn
;
struct
{
std
::
string
dnn
;
std
::
string
dnn_label
;
int
pool_id_iv4
;
int
pool_id_iv6
;
pdu_session_type_t
pdu_session_type
;
}
dnn
[
SMF_NUM_DNN_MAX
];
int
num_ue_pool
;
#define SMF_NUM_UE_POOL_MAX 96
struct
in_addr
ue_pool_range_low
[
SMF_NUM_UE_POOL_MAX
];
struct
in_addr
ue_pool_range_high
[
SMF_NUM_UE_POOL_MAX
];
struct
in_addr
ue_pool_network
[
SMF_NUM_UE_POOL_MAX
];
struct
in_addr
ue_pool_netmask
[
SMF_NUM_UE_POOL_MAX
];
// computed from config, UE IP adresses that matches
// ue_pool_network[]/ue_pool_netmask[] but do not match ue_pool_range_low[] -
// ue_pool_range_high[]
// The problem here is that OpenFlow do not deal with ip ranges but with
// netmasks
std
::
vector
<
struct
in_addr
>
ue_pool_excluded
[
SMF_NUM_UE_POOL_MAX
];
int
num_paa6_pool
;
struct
in6_addr
paa_pool6_prefix
[
SMF_NUM_UE_POOL_MAX
];
uint8_t
paa_pool6_prefix_len
[
SMF_NUM_UE_POOL_MAX
];
std
::
map
<
std
::
string
,
dnn_t
>
dnns
;
bool
force_push_pco
;
uint
ue_mtu
;
...
...
@@ -281,33 +271,12 @@ class smf_config {
uint8_t
num_session_management_subscription
;
smf_config
()
:
m_rw_lock
(),
num_dnn
(
0
),
pid_dir
(),
instance
(
0
),
n4
(),
sbi
(),
itti
(),
upfs
()
{
for
(
int
i
=
0
;
i
<
SMF_NUM_DNN_MAX
;
i
++
)
{
dnn
[
i
]
=
{};
}
:
m_rw_lock
(),
pid_dir
(),
instance
(
0
),
n4
(),
sbi
(),
itti
(),
upfs
()
{
default_dnsv4
.
s_addr
=
INADDR_ANY
;
default_dns_secv4
.
s_addr
=
INADDR_ANY
;
default_dnsv6
=
in6addr_any
;
default_dns_secv6
=
in6addr_any
;
num_ue_pool
=
0
;
num_paa6_pool
=
0
;
for
(
int
i
=
0
;
i
<
SMF_NUM_UE_POOL_MAX
;
i
++
)
{
ue_pool_range_low
[
i
]
=
{};
ue_pool_range_high
[
i
]
=
{};
ue_pool_network
[
i
]
=
{};
ue_pool_netmask
[
i
]
=
{};
paa_pool6_prefix
[
i
]
=
{};
paa_pool6_prefix_len
[
i
]
=
{};
ue_pool_excluded
[
i
]
=
{};
}
force_push_pco
=
true
;
ue_mtu
=
1358
;
...
...
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