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
df9f9dd3
Unverified
Commit
df9f9dd3
authored
Aug 30, 2021
by
kharade
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optional filed up_interface from upfinfo
parent
49a3ced2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
97 additions
and
6 deletions
+97
-6
src/api-server/model/InterfaceUpfInfoItem.cpp
src/api-server/model/InterfaceUpfInfoItem.cpp
+8
-2
src/api-server/model/InterfaceUpfInfoItem.h
src/api-server/model/InterfaceUpfInfoItem.h
+6
-3
src/common/smf.h
src/common/smf.h
+9
-0
src/smf_app/smf_profile.cpp
src/smf_app/smf_profile.cpp
+74
-1
No files found.
src/api-server/model/InterfaceUpfInfoItem.cpp
View file @
df9f9dd3
...
...
@@ -63,10 +63,16 @@ void from_json(const nlohmann::json& j, InterfaceUpfInfoItem& o) {
}
}
UPInterfaceType
InterfaceUpfInfoItem
::
getInterfaceType
()
const
{
// UPInterfaceType InterfaceUpfInfoItem::getInterfaceType() const {
// return m_InterfaceType;
// }
// void InterfaceUpfInfoItem::setInterfaceType(UPInterfaceType const& value) {
// m_InterfaceType = value;
// }
std
::
string
InterfaceUpfInfoItem
::
getInterfaceType
()
const
{
return
m_InterfaceType
;
}
void
InterfaceUpfInfoItem
::
setInterfaceType
(
UPInterfaceType
const
&
value
)
{
void
InterfaceUpfInfoItem
::
setInterfaceType
(
std
::
string
const
&
value
)
{
m_InterfaceType
=
value
;
}
std
::
vector
<
std
::
string
>&
InterfaceUpfInfoItem
::
getIpv4EndpointAddresses
()
{
...
...
src/api-server/model/InterfaceUpfInfoItem.h
View file @
df9f9dd3
...
...
@@ -45,8 +45,10 @@ class InterfaceUpfInfoItem {
/// <summary>
///
/// </summary>
UPInterfaceType
getInterfaceType
()
const
;
void
setInterfaceType
(
UPInterfaceType
const
&
value
);
// UPInterfaceType getInterfaceType() const;
// void setInterfaceType(UPInterfaceType const& value);
std
::
string
getInterfaceType
()
const
;
void
setInterfaceType
(
std
::
string
const
&
value
);
/// <summary>
///
/// </summary>
...
...
@@ -80,7 +82,8 @@ class InterfaceUpfInfoItem {
friend
void
from_json
(
const
nlohmann
::
json
&
j
,
InterfaceUpfInfoItem
&
o
);
protected:
UPInterfaceType
m_InterfaceType
;
// UPInterfaceType m_InterfaceType;
std
::
string
m_InterfaceType
;
std
::
vector
<
std
::
string
>
m_Ipv4EndpointAddresses
;
bool
m_Ipv4EndpointAddressesIsSet
;
...
...
src/common/smf.h
View file @
df9f9dd3
...
...
@@ -317,7 +317,16 @@ typedef struct snssai_upf_info_item_s {
std
::
vector
<
dnn_upf_info_item_t
>
dnn_upf_info_list
;
}
snssai_upf_info_item_t
;
typedef
struct
interface_upf_info_item_s
{
std
::
string
interface_type
;
std
::
vector
<
struct
in_addr
>
ipv4_addresses
;
std
::
vector
<
struct
in6_addr
>
ipv6_addresses
;
std
::
string
endpoint_fqdn
;
std
::
string
network_instance
;
}
interface_upf_info_item_t
;
typedef
struct
upf_info_s
{
std
::
vector
<
interface_upf_info_item_t
>
interface_upf_info_list
;
std
::
vector
<
snssai_upf_info_item_t
>
snssai_upf_info_list
;
}
upf_info_t
;
...
...
src/smf_app/smf_profile.cpp
View file @
df9f9dd3
...
...
@@ -519,6 +519,26 @@ void upf_profile::display() const {
Logger
::
smf_app
().
debug
(
"
\t\t\t
DNN %s"
,
d
.
dnn
.
c_str
());
}
}
if
(
!
upf_info
.
interface_upf_info_list
.
empty
())
{
for
(
auto
s
:
upf_info
.
interface_upf_info_list
)
{
std
::
string
network_instance
=
{};
std
::
string
endpoint_fqdn
=
{};
std
::
vector
<
struct
in_addr
>
ipv4_addresses
=
{};
// std::vector<struct in6_addr> ipv6_addresses = {};
if
(
!
s
.
network_instance
.
empty
())
network_instance
=
s
.
network_instance
;
if
(
!
s
.
endpoint_fqdn
.
empty
())
endpoint_fqdn
=
s
.
endpoint_fqdn
;
Logger
::
smf_app
().
debug
(
"
\t\t
INTERFACE UPF Info List, Interface Type : %s, Network Instance "
"%s, EndpointFqdn: %s"
,
s
.
interface_type
.
c_str
(),
s
.
network_instance
.
c_str
(),
s
.
endpoint_fqdn
.
c_str
());
if
(
s
.
ipv4_addresses
.
size
()
>
0
)
Logger
::
smf_app
().
debug
(
"
\t\t\t
INTERFACE UPF Info List, IPv4 Addr:"
);
for
(
auto
address
:
s
.
ipv4_addresses
)
{
Logger
::
smf_app
().
debug
(
"
\t\t\t\t\t\t
%s"
,
inet_ntoa
(
address
));
}
}
}
}
//------------------------------------------------------------------------------
...
...
@@ -540,7 +560,24 @@ void upf_profile::to_json(nlohmann::json& data) const {
}
data
[
"upfInfo"
][
"sNssaiUpfInfoList"
].
push_back
(
tmp
);
}
if
(
!
upf_info
.
interface_upf_info_list
.
empty
())
{
data
[
"upfInfo"
][
"interfaceUpfInfoList"
]
=
nlohmann
::
json
::
array
();
for
(
auto
s
:
upf_info
.
interface_upf_info_list
)
{
nlohmann
::
json
tmp
=
{};
tmp
[
"interfaceType"
]
=
s
.
interface_type
;
if
(
!
s
.
endpoint_fqdn
.
empty
())
tmp
[
"endpointFqdn"
]
=
s
.
endpoint_fqdn
;
if
(
!
s
.
network_instance
.
empty
())
tmp
[
"networkInstance"
]
=
s
.
network_instance
;
if
(
s
.
ipv4_addresses
.
size
()
>
0
)
{
tmp
[
"ipv4EndpointAddresses"
]
=
nlohmann
::
json
::
array
();
for
(
auto
address
:
s
.
ipv4_addresses
)
{
tmp
[
"ipv4EndpointAddresses"
].
push_back
(
inet_ntoa
(
address
));
}
}
// ToDo for ipv6
data
[
"upfInfo"
][
"interfaceUpfInfoList"
].
push_back
(
tmp
);
}
}
Logger
::
smf_app
().
debug
(
"UPF profile to json:
\n
%s"
,
data
.
dump
().
c_str
());
}
...
...
@@ -576,6 +613,42 @@ void upf_profile::from_json(const nlohmann::json& data) {
upf_info
.
snssai_upf_info_list
.
push_back
(
upf_info_item
);
}
}
if
(
info
.
find
(
"interfaceUpfInfoList"
)
!=
info
.
end
())
{
nlohmann
::
json
interface_upf_info_list
=
data
[
"upfInfo"
][
"interfaceUpfInfoList"
];
for
(
auto
it
:
interface_upf_info_list
)
{
interface_upf_info_item_t
up_interface_info_item
=
{};
if
(
it
.
find
(
"interfaceType"
)
!=
it
.
end
())
up_interface_info_item
.
interface_type
=
it
[
"interfaceType"
].
get
<
std
::
string
>
();
if
(
it
.
find
(
"networkInstance"
)
!=
it
.
end
())
up_interface_info_item
.
network_instance
=
it
[
"networkInstance"
].
get
<
std
::
string
>
();
if
(
it
.
find
(
"endpointFqdn"
)
!=
it
.
end
())
up_interface_info_item
.
endpoint_fqdn
=
it
[
"endpointFqdn"
].
get
<
std
::
string
>
();
if
(
it
.
find
(
"ipv4EndpointAddresses"
)
!=
it
.
end
())
{
nlohmann
::
json
addresses
=
it
[
"ipv4EndpointAddresses"
];
for
(
auto
d
:
addresses
)
{
struct
in_addr
addr4
=
{};
std
::
string
address
=
d
.
get
<
std
::
string
>
();
unsigned
char
buf_in_addr
[
sizeof
(
struct
in_addr
)];
if
(
inet_pton
(
AF_INET
,
util
::
trim
(
address
).
c_str
(),
buf_in_addr
)
==
1
)
{
memcpy
(
&
addr4
,
buf_in_addr
,
sizeof
(
struct
in_addr
));
}
else
{
Logger
::
smf_app
().
warn
(
"Address conversion: Bad value %s"
,
util
::
trim
(
address
).
c_str
());
}
up_interface_info_item
.
ipv4_addresses
.
push_back
(
addr4
);
}
}
// ToDo for ipv6
upf_info
.
interface_upf_info_list
.
push_back
(
up_interface_info_item
);
}
}
}
display
();
...
...
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