Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-NRF
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-NRF
Commits
697a66f6
Commit
697a66f6
authored
Aug 29, 2021
by
kharade
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optional filed up_interface from upfinfo
parent
95076b72
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
147 additions
and
6 deletions
+147
-6
src/api-server/model/InterfaceUpfInfoItem.cpp
src/api-server/model/InterfaceUpfInfoItem.cpp
+2
-2
src/api-server/model/InterfaceUpfInfoItem.h
src/api-server/model/InterfaceUpfInfoItem.h
+10
-3
src/common/3gpp_29.510.h
src/common/3gpp_29.510.h
+20
-0
src/common/utils/api_conversions.cpp
src/common/utils/api_conversions.cpp
+81
-1
src/common/utils/api_conversions.hpp
src/common/utils/api_conversions.hpp
+7
-0
src/nrf_app/nrf_profile.cpp
src/nrf_app/nrf_profile.cpp
+27
-0
No files found.
src/api-server/model/InterfaceUpfInfoItem.cpp
View file @
697a66f6
...
...
@@ -63,10 +63,10 @@ void from_json(const nlohmann::json& j, InterfaceUpfInfoItem& o) {
}
}
UPInterfaceType
InterfaceUpfInfoItem
::
getInterfaceType
()
const
{
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 @
697a66f6
...
...
@@ -45,8 +45,14 @@ 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
);
bool
InterfaceTypeIsSet
()
const
;
void
unsetInterfaceType
();
/// <summary>
///
/// </summary>
...
...
@@ -80,7 +86,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/3gpp_29.510.h
View file @
697a66f6
...
...
@@ -30,6 +30,17 @@ enum class nf_status_e { REGISTERED = 0, SUSPENDED = 1, UNDISCOVERABLE = 2 };
static
const
std
::
vector
<
std
::
string
>
nf_status_e2str
=
{
"REGISTERED"
,
"SUSPENDED"
,
"UNDISCOVERABLE"
};
typedef
enum
nf_up_interface_type_s
{
N3
=
0
,
N6
=
1
,
N9
=
2
,
DATA_FORWARDING
=
3
,
TYPE_UNKNOWN
=
4
}
nf_up_interface_type_t
;
static
const
std
::
vector
<
std
::
string
>
up_interface_type_e2str
=
{
"N3"
,
"N6"
,
"N9"
,
"DATA_FORWARDING"
,
"UNKNOWN"
};
typedef
struct
amf_info_s
{
std
::
string
amf_set_id
;
std
::
string
amf_region_id
;
...
...
@@ -61,8 +72,17 @@ 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
<
snssai_upf_info_item_t
>
snssai_upf_info_list
;
std
::
vector
<
interface_upf_info_item_t
>
interface_upf_info_list
;
}
upf_info_t
;
typedef
struct
supi_range_ausf_info_item_s
{
...
...
src/common/utils/api_conversions.cpp
View file @
697a66f6
...
...
@@ -216,10 +216,80 @@ bool api_conv::profile_api_to_nrf_profile(
info
.
snssai_upf_info_list
.
push_back
(
snssai
);
}
if
(
upf_info_api
.
interfaceUpfInfoListIsSet
())
{
for
(
auto
s
:
upf_info_api
.
getInterfaceUpfInfoList
())
{
interface_upf_info_item_t
interface
=
{};
nf_up_interface_type_t
up_interface_type
=
string_to_up_interface_type
(
s
.
getInterfaceType
());
switch
(
up_interface_type
)
{
case
N3
:
{
interface
.
interface_type
=
"N3"
;
}
break
;
case
N6
:
{
interface
.
interface_type
=
"N6"
;
}
break
;
case
N9
:
{
interface
.
interface_type
=
"N9"
;
}
break
;
case
DATA_FORWARDING
:
{
interface
.
interface_type
=
"DATA_FORWARDING"
;
}
break
;
default:
{
interface
.
interface_type
=
"UNKNOWN"
;
}
}
if
(
s
.
endpointFqdnIsSet
())
interface
.
endpoint_fqdn
=
s
.
getEndpointFqdn
();
if
(
s
.
networkInstanceIsSet
())
interface
.
network_instance
=
s
.
getNetworkInstance
();
if
(
s
.
ipv4EndpointAddressesIsSet
())
{
std
::
vector
<
std
::
string
>
ipv4_addr_str
=
s
.
getIpv4EndpointAddresses
();
for
(
auto
address
:
ipv4_addr_str
)
{
struct
in_addr
addr4
=
{};
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
::
nrf_app
().
warn
(
"Address conversion: Bad value %s"
,
util
::
trim
(
address
).
c_str
());
}
Logger
::
nrf_app
().
debug
(
"
\t\t
Endpoint: %s, IPv4 Addr: %s, FQDN: %s, NWI: %s"
,
interface
.
interface_type
.
c_str
(),
address
.
c_str
(),
interface
.
endpoint_fqdn
.
c_str
(),
interface
.
network_instance
.
c_str
());
interface
.
ipv4_addresses
.
push_back
(
addr4
);
}
}
// ToDo for ipv6
// if (s.ipv6EndpointAddressesIsSet()) {
// std::vector<Ipv6Addr> ipv6_addr_str =
// s.getIpv6EndpointAddresses();
// for (auto address : ipv6_addr_str) {
// struct in6_addr addr6 = {};
// unsigned char buf_in_addr[sizeof(struct in6_addr)];
// if (inet_pton(
// AF_INET, util::trim(address).c_str(), buf_in_addr) ==
// 1) {
// memcpy(&addr6, buf_in_addr, sizeof(struct in6_addr));
// } else {
// Logger::nrf_app().warn(
// "Address conversion: Bad value %s",
// util::trim(address).c_str());
// }
// Logger::nrf_app().debug("\tIPv4 Addr: %s", address.c_str());
// interface.ipv6_addresses.push_back(addr6);
// }
// }
info
.
interface_upf_info_list
.
push_back
(
interface
);
}
}
(
std
::
static_pointer_cast
<
upf_profile
>
(
profile
))
.
get
()
->
add_upf_info
(
info
);
}
break
;
case
NF_TYPE_AUSF
:
{
Logger
::
nrf_app
().
debug
(
"
\t
AUSF profile, AUSFF Info"
);
...
...
@@ -443,6 +513,16 @@ nf_type_t api_conv::string_to_nf_type(const std::string& str) {
return
NF_TYPE_UNKNOWN
;
}
//------------------------------------------------------------------------------
nf_up_interface_type_t
api_conv
::
string_to_up_interface_type
(
const
std
::
string
&
str
)
{
if
(
str
.
compare
(
"N3"
)
==
0
)
return
N3
;
if
(
str
.
compare
(
"N6"
)
==
0
)
return
N6
;
if
(
str
.
compare
(
"N9"
)
==
0
)
return
N9
;
if
(
str
.
compare
(
"DATA_FORWARDING"
)
==
0
)
return
DATA_FORWARDING
;
// default
return
TYPE_UNKNOWN
;
}
//------------------------------------------------------------------------------
patch_op_type_t
api_conv
::
string_to_patch_operation
(
const
std
::
string
&
str
)
{
if
(
str
.
compare
(
"add"
)
==
0
)
return
PATCH_OP_ADD
;
...
...
src/common/utils/api_conversions.hpp
View file @
697a66f6
...
...
@@ -69,6 +69,13 @@ bool subscription_api_to_nrf_subscription(
*/
nf_type_t
string_to_nf_type
(
const
std
::
string
&
str
);
/*
* Convert a string to nf type
* @param [const std::string &] str: string input
* @return the corresponding up_interface_type
*/
nf_up_interface_type_t
string_to_up_interface_type
(
const
std
::
string
&
str
);
/*
* Convert a string to Patch operation
* @param [const std::string &] str: string input
...
...
src/nrf_app/nrf_profile.cpp
View file @
697a66f6
...
...
@@ -1001,6 +1001,14 @@ void upf_profile::display() {
"
\t\t
SNSSAI UPF Info List, DNN List: %s"
,
d
.
dnn
.
c_str
());
}
}
if
(
!
upf_info
.
interface_upf_info_list
.
empty
())
{
for
(
auto
s
:
upf_info
.
interface_upf_info_list
)
{
Logger
::
nrf_app
().
debug
(
"
\t\t
Interface UPF Info List, Interface Type : %s, Network Instance "
"%s"
,
s
.
interface_type
.
c_str
(),
s
.
network_instance
.
c_str
());
}
}
}
//------------------------------------------------------------------------------
...
...
@@ -1102,6 +1110,25 @@ 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
.
empty
())
{
tmp
[
"ipv4EndpointAddresses"
]
=
nlohmann
::
json
::
array
();
for
(
auto
address
:
s
.
ipv4_addresses
)
{
nlohmann
::
json
addr
=
inet_ntoa
(
address
);
tmp
[
"ipv4EndpointAddresses"
].
push_back
(
addr
);
}
}
// ToDo for ipv6
data
[
"upfInfo"
][
"interfaceUpfInfoList"
].
push_back
(
tmp
);
}
}
}
//------------------------------------------------------------------------------
...
...
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