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
2277d810
Unverified
Commit
2277d810
authored
Jul 01, 2021
by
kharade
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fqdn added in NFProfile
parent
052e1ce7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
2 deletions
+85
-2
src/smf_app/smf_profile.cpp
src/smf_app/smf_profile.cpp
+45
-2
src/smf_app/smf_profile.hpp
src/smf_app/smf_profile.hpp
+40
-0
No files found.
src/smf_app/smf_profile.cpp
View file @
2277d810
...
...
@@ -152,6 +152,16 @@ void nf_profile::add_snssai(const snssai_t& s) {
snssais
.
push_back
(
s
);
}
//------------------------------------------------------------------------------
void
nf_profile
::
set_fqdn
(
const
std
::
string
&
fqdN
)
{
fqdn
=
fqdN
;
}
//------------------------------------------------------------------------------
std
::
string
nf_profile
::
get_fqdn
()
const
{
return
fqdn
;
}
//------------------------------------------------------------------------------
void
nf_profile
::
set_nf_ipv4_addresses
(
const
std
::
vector
<
struct
in_addr
>&
a
)
{
ipv4_addresses
=
a
;
...
...
@@ -162,6 +172,16 @@ void nf_profile::add_nf_ipv4_addresses(const struct in_addr& a) {
ipv4_addresses
.
push_back
(
a
);
}
//------------------------------------------------------------------------------
void
nf_profile
::
set_nf_ipv6_addresses
(
const
std
::
vector
<
struct
in6_addr
>&
a
)
{
ipv6_addresses
=
a
;
}
//------------------------------------------------------------------------------
void
nf_profile
::
add_nf_ipv6_addresses
(
const
struct
in6_addr
&
a
)
{
ipv6_addresses
.
push_back
(
a
);
}
//------------------------------------------------------------------------------
void
nf_profile
::
get_nf_ipv4_addresses
(
std
::
vector
<
struct
in_addr
>&
a
)
const
{
a
=
ipv4_addresses
;
...
...
@@ -185,7 +205,9 @@ void nf_profile::display() const {
for
(
auto
s
:
snssais
)
{
Logger
::
smf_app
().
debug
(
"
\t\t
SST, SD: %d, %s"
,
s
.
sST
,
s
.
sD
.
c_str
());
}
if
(
!
fqdn
.
empty
())
{
Logger
::
smf_app
().
debug
(
"
\t
FQDN: %s"
,
fqdn
.
c_str
());
}
// IPv4 Addresses
if
(
ipv4_addresses
.
size
()
>
0
)
{
Logger
::
smf_app
().
debug
(
"
\t
IPv4 Addr:"
);
...
...
@@ -193,6 +215,13 @@ void nf_profile::display() const {
for
(
auto
address
:
ipv4_addresses
)
{
Logger
::
smf_app
().
debug
(
"
\t\t
%s"
,
inet_ntoa
(
address
));
}
// IPv6 Addresses
// if (ipv6_addresses.size() > 0) {
// Logger::smf_app().debug("\tIPv6 Addr:");
// }
// for (auto address : ipv6_addresses) {
// Logger::smf_app().debug("\t\t %s", inet_ntoa(address));
// }
}
//------------------------------------------------------------------------------
...
...
@@ -210,12 +239,20 @@ void nf_profile::to_json(nlohmann::json& data) const {
tmp
[
"sd"
]
=
s
.
sD
;
data
[
"sNssais"
].
push_back
(
tmp
);
}
if
(
!
fqdn
.
empty
())
{
data
[
"fqdn"
]
=
fqdn
;
}
// ipv4_addresses
data
[
"ipv4Addresses"
]
=
nlohmann
::
json
::
array
();
for
(
auto
address
:
ipv4_addresses
)
{
data
[
"ipv4Addresses"
].
push_back
(
inet_ntoa
(
address
));
}
// // ipv6_addresses
// data["ipv6Addresses"] = nlohmann::json::array();
// for (auto address : ipv6_addresses) {
// nlohmann::json tmp = inet_ntoa(address);
// data["ipv6Addresses"].push_back(tmp);
// }
data
[
"priority"
]
=
priority
;
data
[
"capacity"
]
=
capacity
;
}
...
...
@@ -251,6 +288,10 @@ void nf_profile::from_json(const nlohmann::json& data) {
}
}
if
(
data
.
find
(
"fqdn"
)
!=
data
.
end
())
{
fqdn
=
data
[
"fqdn"
].
get
<
std
::
string
>
();
}
if
(
data
.
find
(
"ipv4Addresses"
)
!=
data
.
end
())
{
nlohmann
::
json
addresses
=
data
[
"ipv4Addresses"
];
...
...
@@ -268,6 +309,8 @@ void nf_profile::from_json(const nlohmann::json& data) {
}
}
// ToDo: ipv6Addresses
if
(
data
.
find
(
"priority"
)
!=
data
.
end
())
{
priority
=
data
[
"priority"
].
get
<
int
>
();
}
...
...
src/smf_app/smf_profile.hpp
View file @
2277d810
...
...
@@ -51,7 +51,9 @@ class nf_profile : public std::enable_shared_from_this<nf_profile> {
:
nf_type
(
"NF_TYPE_UNKNOWN"
),
heartBeat_timer
(
0
),
snssais
(),
fqdn
(),
ipv4_addresses
(),
ipv6_addresses
(),
priority
(
0
),
capacity
(
0
)
{
nf_instance_name
=
""
;
...
...
@@ -62,7 +64,9 @@ class nf_profile : public std::enable_shared_from_this<nf_profile> {
:
nf_instance_id
(
id
),
heartBeat_timer
(
0
),
snssais
(),
fqdn
(),
ipv4_addresses
(),
ipv6_addresses
(),
priority
(
0
),
capacity
(
0
),
nf_type
(
"NF_TYPE_UNKNOWN"
)
{
...
...
@@ -74,7 +78,9 @@ class nf_profile : public std::enable_shared_from_this<nf_profile> {
nf_instance_id
=
s
.
nf_instance_id
;
heartBeat_timer
=
s
.
heartBeat_timer
;
snssais
=
s
.
snssais
;
fqdn
=
s
.
fqdn
;
ipv4_addresses
=
s
.
ipv4_addresses
;
ipv6_addresses
=
s
.
ipv6_addresses
;
priority
=
s
.
priority
;
capacity
=
s
.
capacity
;
nf_type
=
s
.
nf_type
;
...
...
@@ -244,6 +250,20 @@ class nf_profile : public std::enable_shared_from_this<nf_profile> {
*/
void
get_nf_snssais
(
std
::
vector
<
snssai_t
>&
s
)
const
;
/*
* Get NF fqdn
* @param
* @return [std::string] nf fqdn
*/
std
::
string
get_fqdn
()
const
;
/*
* Set NF fqdn
* @param [const fqdn_t &] fqdn: nf fqdn
* @return void
*/
void
set_fqdn
(
const
std
::
string
&
fqdn
);
/*
* Set NF instance ipv4_addresses
* @param [std::vector<struct in_addr> &] a: ipv4_addresses
...
...
@@ -251,6 +271,20 @@ class nf_profile : public std::enable_shared_from_this<nf_profile> {
*/
void
set_nf_ipv4_addresses
(
const
std
::
vector
<
struct
in_addr
>&
a
);
/*
* Set NF instance ipv6_addresses
* @param [std::vector<struct in6_addr> &] a: ipv6_addresses
* @return void
*/
void
set_nf_ipv6_addresses
(
const
std
::
vector
<
struct
in6_addr
>&
a
);
/*
* Add an IPv6 address to the list of addresses
* @param [const struct in_addr &] a: ipv6_address
* @return void
*/
void
add_nf_ipv6_addresses
(
const
struct
in6_addr
&
a
);
/*
* Add an IPv4 address to the list of addresses
* @param [const struct in_addr &] a: ipv4_address
...
...
@@ -294,7 +328,9 @@ class nf_profile : public std::enable_shared_from_this<nf_profile> {
std
::
string
nf_status
;
int32_t
heartBeat_timer
;
std
::
vector
<
snssai_t
>
snssais
;
std
::
string
fqdn
;
std
::
vector
<
struct
in_addr
>
ipv4_addresses
;
std
::
vector
<
struct
in6_addr
>
ipv6_addresses
;
uint16_t
priority
;
uint16_t
capacity
;
};
...
...
@@ -309,7 +345,9 @@ class smf_profile : public nf_profile {
nf_instance_id
=
s
.
nf_instance_id
;
heartBeat_timer
=
s
.
heartBeat_timer
;
snssais
=
s
.
snssais
;
ipv6_addresses
=
s
.
ipv6_addresses
;
ipv4_addresses
=
s
.
ipv4_addresses
;
fqdn
=
s
.
fqdn
;
priority
=
s
.
priority
;
capacity
=
s
.
capacity
;
nf_type
=
s
.
nf_type
;
...
...
@@ -429,7 +467,9 @@ class upf_profile : public nf_profile {
nf_instance_id
=
s
.
nf_instance_id
;
heartBeat_timer
=
s
.
heartBeat_timer
;
snssais
=
s
.
snssais
;
ipv6_addresses
=
s
.
ipv6_addresses
;
ipv4_addresses
=
s
.
ipv4_addresses
;
fqdn
=
s
.
fqdn
;
priority
=
s
.
priority
;
capacity
=
s
.
capacity
;
nf_type
=
s
.
nf_type
;
...
...
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