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
b302f710
Commit
b302f710
authored
Aug 25, 2021
by
Mohammed Ismail
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ausf_profile' into 'develop'
ausf profile added See merge request oai/cn5g/oai-cn5g-nrf!14
parents
e962a573
5fc7b13f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
330 additions
and
7 deletions
+330
-7
src/common/3gpp_23.003.h
src/common/3gpp_23.003.h
+6
-0
src/common/3gpp_29.510.h
src/common/3gpp_29.510.h
+10
-0
src/common/utils/api_conversions.cpp
src/common/utils/api_conversions.cpp
+31
-0
src/nrf_app/nrf_app.cpp
src/nrf_app/nrf_app.cpp
+4
-0
src/nrf_app/nrf_client.cpp
src/nrf_app/nrf_client.cpp
+4
-0
src/nrf_app/nrf_profile.cpp
src/nrf_app/nrf_profile.cpp
+180
-7
src/nrf_app/nrf_profile.hpp
src/nrf_app/nrf_profile.hpp
+95
-0
No files found.
src/common/3gpp_23.003.h
View file @
b302f710
...
...
@@ -148,4 +148,10 @@ typedef struct guami_s {
std
::
string
amf_id
;
}
guami_t
;
typedef
struct
supi_range_s
{
std
::
string
start
;
std
::
string
end
;
std
::
string
pattern
;
}
supi_range_t
;
#endif
src/common/3gpp_29.510.h
View file @
b302f710
...
...
@@ -65,6 +65,16 @@ typedef struct upf_info_s {
std
::
vector
<
snssai_upf_info_item_t
>
snssai_upf_info_list
;
}
upf_info_t
;
typedef
struct
supi_range_ausf_info_item_s
{
supi_range_t
supi_range
;
}
supi_range_ausf_info_item_t
;
typedef
struct
ausf_info_s
{
std
::
string
groupid
;
std
::
vector
<
supi_range_ausf_info_item_t
>
supi_ranges
;
std
::
vector
<
std
::
string
>
routing_indicator
;
}
ausf_info_t
;
enum
subscr_condition_type_e
{
// TODO: use enum class
UNKNOWN_CONDITION
=
0
,
NF_INSTANCE_ID_COND
=
1
,
...
...
src/common/utils/api_conversions.cpp
View file @
b302f710
...
...
@@ -83,6 +83,16 @@ bool api_conv::profile_api_to_nrf_profile(
Logger
::
nrf_app
().
debug
(
"
\t
SNSSAI (SD, SST): %d, %s"
,
sn
.
sST
,
sn
.
sD
.
c_str
());
}
// if (api_profile.plmnListIsSet()){
// std::vector<PlmnId> &plmnid = api_profile.getPlmnList();
// for (auto s : plmnid) {
// plmn_t sn = {};
// sn.mcc = s.getMcc();
// sn.mnc = s.getMnc();
// profile.get()->add_plmn_list(sn);
// Logger::nrf_app().debug(
// "\tPLMN_List (MCC, MNS): %s, %s", sn.mcc.c_str(), sn.mnc.c_str());
// }
if
(
api_profile
.
fqdnIsSet
())
{
profile
.
get
()
->
set_fqdn
(
api_profile
.
getFqdn
());
Logger
::
nrf_app
().
debug
(
"
\t
FQDN: %s"
,
api_profile
.
getFqdn
().
c_str
());
...
...
@@ -206,6 +216,27 @@ bool api_conv::profile_api_to_nrf_profile(
.
get
()
->
add_upf_info
(
info
);
}
break
;
case
NF_TYPE_AUSF
:
{
Logger
::
nrf_app
().
debug
(
"
\t
AUSF profile, AUSFF Info"
);
profile
.
get
()
->
set_nf_type
(
NF_TYPE_AUSF
);
ausf_info_t
info
=
{};
AusfInfo
ausf_info_api
=
api_profile
.
getAusfInfo
();
info
.
groupid
=
ausf_info_api
.
getGroupId
();
for
(
auto
s
:
ausf_info_api
.
getSupiRanges
())
{
supi_range_ausf_info_item_t
supiRange
=
{};
supiRange
.
supi_range
.
start
=
s
.
getStart
();
supiRange
.
supi_range
.
end
=
s
.
getEnd
();
supiRange
.
supi_range
.
pattern
=
s
.
getPattern
();
info
.
supi_ranges
.
push_back
(
supiRange
);
}
for
(
auto
s
:
ausf_info_api
.
getRoutingIndicators
())
{
info
.
routing_indicator
.
push_back
(
s
);
}
(
std
::
static_pointer_cast
<
ausf_profile
>
(
profile
))
.
get
()
->
add_ausf_info
(
info
);
}
break
;
default:
{
}
...
...
src/nrf_app/nrf_app.cpp
View file @
b302f710
...
...
@@ -136,6 +136,10 @@ void nrf_app::handle_register_nf_instance(
sn
=
std
::
make_shared
<
upf_profile
>
(
m_event_sub
);
}
break
;
case
NF_TYPE_AUSF
:
{
sn
=
std
::
make_shared
<
ausf_profile
>
(
m_event_sub
);
}
break
;
default:
{
sn
=
std
::
make_shared
<
nrf_profile
>
(
m_event_sub
);
}
...
...
src/nrf_app/nrf_client.cpp
View file @
b302f710
...
...
@@ -243,6 +243,10 @@ void nrf_client::notify_subscribed_event(
std
::
static_pointer_cast
<
upf_profile
>
(
profile
).
get
()
->
to_json
(
json_profile
);
}
break
;
case
NF_TYPE_AUSF
:
{
std
::
static_pointer_cast
<
ausf_profile
>
(
profile
).
get
()
->
to_json
(
json_profile
);
}
break
;
default:
{
profile
.
get
()
->
to_json
(
json_profile
);
}
...
...
src/nrf_app/nrf_profile.cpp
View file @
b302f710
...
...
@@ -166,6 +166,22 @@ void nrf_profile::set_fqdn(const std::string& fqdN) {
std
::
string
nrf_profile
::
get_fqdn
()
const
{
return
fqdn
;
}
//------------------------------------------------------------------------------
void
nrf_profile
::
set_plmn_list
(
const
std
::
vector
<
plmn_t
>&
s
)
{
plmn_list
=
s
;
}
//------------------------------------------------------------------------------
void
nrf_profile
::
get_plmn_list
(
std
::
vector
<
plmn_t
>&
s
)
const
{
s
=
plmn_list
;
}
//------------------------------------------------------------------------------
void
nrf_profile
::
add_plmn_list
(
const
plmn_t
&
s
)
{
plmn_list
.
push_back
(
s
);
}
//------------------------------------------------------------------------------
void
nrf_profile
::
set_nf_ipv4_addresses
(
const
std
::
vector
<
struct
in_addr
>&
a
)
{
ipv4_addresses
=
a
;
...
...
@@ -226,6 +242,11 @@ void nrf_profile::display() {
Logger
::
nrf_app
().
debug
(
"
\t
Priority: %d"
,
priority
);
Logger
::
nrf_app
().
debug
(
"
\t
Capacity: %d"
,
capacity
);
// SNSSAIs
if
(
!
plmn_list
.
empty
())
{
for
(
auto
s
:
plmn_list
)
{
Logger
::
nrf_app
().
debug
(
"
\t
PLMN List(MCC, MNC): %d, %s"
,
s
.
mcc
,
s
.
mnc
);
}
}
for
(
auto
s
:
snssais
)
{
Logger
::
nrf_app
().
debug
(
"
\t
NNSSAI(SST, SD): %d, %s"
,
s
.
sST
,
s
.
sD
.
c_str
());
}
...
...
@@ -303,6 +324,11 @@ bool nrf_profile::replace_profile_info(
}
// Replace an array
if
(
path
.
compare
(
"plmnList"
)
==
0
)
{
Logger
::
nrf_app
().
info
(
"Does not support this operation for ipv4Addresses"
);
return
false
;
}
if
(
path
.
compare
(
"ipv4Addresses"
)
==
0
)
{
Logger
::
nrf_app
().
info
(
"Does not support this operation for ipv4Addresses"
);
return
false
;
...
...
@@ -430,6 +456,11 @@ bool nrf_profile::add_profile_info(
return
false
;
}
if
(
path
.
compare
(
"plmnList"
)
==
0
)
{
Logger
::
nrf_app
().
info
(
"Does not support this operation for plmnList"
);
return
false
;
}
return
false
;
}
...
...
@@ -510,6 +541,11 @@ bool nrf_profile::remove_profile_info(const std::string& path) {
return
false
;
}
if
(
path
.
find
(
"plmnList"
)
!=
std
::
string
::
npos
)
{
Logger
::
nrf_app
().
info
(
"Does not support this operation for plmnList"
);
return
false
;
}
Logger
::
nrf_app
().
debug
(
"Member (%s) not found!"
,
path
.
c_str
());
return
false
;
}
...
...
@@ -522,17 +558,27 @@ void nrf_profile::to_json(nlohmann::json& data) const {
data
[
"nfStatus"
]
=
nf_status
;
data
[
"heartBeatTimer"
]
=
heartBeat_timer
;
// SNSSAIs
data
[
"sNssais"
]
=
nlohmann
::
json
::
array
();
for
(
auto
s
:
snssais
)
{
nlohmann
::
json
tmp
=
{};
tmp
[
"sst"
]
=
s
.
sST
;
tmp
[
"sd"
]
=
s
.
sD
;
;
data
[
"sNssais"
].
push_back
(
tmp
);
if
(
!
snssais
.
empty
())
{
data
[
"sNssais"
]
=
nlohmann
::
json
::
array
();
for
(
auto
s
:
snssais
)
{
nlohmann
::
json
tmp
=
{};
tmp
[
"sst"
]
=
s
.
sST
;
tmp
[
"sd"
]
=
s
.
sD
;
data
[
"sNssais"
].
push_back
(
tmp
);
}
}
if
(
!
fqdn
.
empty
())
{
data
[
"fqdn"
]
=
fqdn
;
}
if
(
!
plmn_list
.
empty
())
{
data
[
"plmnList"
]
=
nlohmann
::
json
::
array
();
for
(
auto
s
:
plmn_list
)
{
nlohmann
::
json
tmp
=
{};
tmp
[
"mcc"
]
=
s
.
mcc
;
tmp
[
"mnc"
]
=
s
.
mnc
;
data
[
"plmnList"
].
push_back
(
tmp
);
}
}
// ipv4_addresses
data
[
"ipv4Addresses"
]
=
nlohmann
::
json
::
array
();
for
(
auto
address
:
ipv4_addresses
)
{
...
...
@@ -1057,3 +1103,130 @@ void upf_profile::to_json(nlohmann::json& data) const {
data
[
"upfInfo"
][
"sNssaiUpfInfoList"
].
push_back
(
tmp
);
}
}
//------------------------------------------------------------------------------
void
ausf_profile
::
add_ausf_info
(
const
ausf_info_t
&
info
)
{
ausf_info
=
info
;
}
//------------------------------------------------------------------------------
void
ausf_profile
::
get_ausf_info
(
ausf_info_t
&
infos
)
const
{
infos
=
ausf_info
;
}
//------------------------------------------------------------------------------
void
ausf_profile
::
display
()
{
nrf_profile
::
display
();
Logger
::
nrf_app
().
debug
(
"
\t
AUSF Info"
);
Logger
::
nrf_app
().
debug
(
"
\t\t
GroupId: %s"
,
ausf_info
.
groupid
);
for
(
auto
supi
:
ausf_info
.
supi_ranges
)
{
Logger
::
nrf_app
().
debug
(
"
\t\t
SupiRanges: Start - %s, End - %s, Pattern - %s"
,
supi
.
supi_range
.
start
,
supi
.
supi_range
.
end
,
supi
.
supi_range
.
pattern
);
}
for
(
auto
route_ind
:
ausf_info
.
routing_indicator
)
{
Logger
::
nrf_app
().
debug
(
"
\t\t
Routing Indicators: %s"
,
route_ind
);
}
}
//------------------------------------------------------------------------------
bool
ausf_profile
::
add_profile_info
(
const
std
::
string
&
path
,
const
std
::
string
&
value
)
{
bool
result
=
nrf_profile
::
add_profile_info
(
path
,
value
);
if
(
result
)
return
true
;
// add an element to a list of json object
if
(
path
.
compare
(
"ausfInfo"
)
==
0
)
{
Logger
::
nrf_app
().
info
(
"Does not support this operation for ausfInfo"
);
return
false
;
}
if
((
path
.
compare
(
"nfInstanceId"
)
!=
0
)
and
(
path
.
compare
(
"nfInstanceName"
)
!=
0
)
and
(
path
.
compare
(
"nfType"
)
!=
0
)
and
(
path
.
compare
(
"nfStatus"
)
!=
0
)
and
(
path
.
compare
(
"heartBeatTimer"
)
!=
0
)
and
(
path
.
compare
(
"fqdn"
)
!=
0
)
and
(
path
.
compare
(
"plmnList"
)
!=
0
)
and
(
path
.
compare
(
"ipv4Addresses"
)
!=
0
)
and
(
path
.
compare
(
"priority"
)
!=
0
)
and
(
path
.
compare
(
"capacity"
)
!=
0
)
and
(
path
.
compare
(
"priority"
)
!=
0
)
and
(
path
.
compare
(
"nfServices"
)
!=
0
)
and
(
path
.
compare
(
"ausfInfo"
)
!=
0
))
{
Logger
::
nrf_app
().
debug
(
"Add new member: %s"
,
path
.
c_str
());
// add new member
json_data
[
path
]
=
value
;
return
true
;
}
return
false
;
}
//------------------------------------------------------------------------------
bool
ausf_profile
::
replace_profile_info
(
const
std
::
string
&
path
,
const
std
::
string
&
value
)
{
bool
result
=
nrf_profile
::
replace_profile_info
(
path
,
value
);
if
(
result
)
return
true
;
// for AUSF info
if
(
path
.
compare
(
"ausfInfo"
)
==
0
)
{
Logger
::
nrf_app
().
debug
(
"Does not support this operation for ausfInfo"
);
return
false
;
}
if
((
path
.
compare
(
"nfInstanceId"
)
!=
0
)
and
(
path
.
compare
(
"nfInstanceName"
)
!=
0
)
and
(
path
.
compare
(
"nfType"
)
!=
0
)
and
(
path
.
compare
(
"nfStatus"
)
!=
0
)
and
(
path
.
compare
(
"heartBeatTimer"
)
!=
0
)
and
(
path
.
compare
(
"fqdn"
)
!=
0
)
and
(
path
.
compare
(
"plmnList"
)
!=
0
)
and
(
path
.
compare
(
"ipv4Addresses"
)
!=
0
)
and
(
path
.
compare
(
"priority"
)
!=
0
)
and
(
path
.
compare
(
"capacity"
)
!=
0
)
and
(
path
.
compare
(
"priority"
)
!=
0
)
and
(
path
.
compare
(
"nfServices"
)
!=
0
)
and
(
path
.
compare
(
"ausfInfo"
)
!=
0
))
{
Logger
::
nrf_app
().
debug
(
"Member (%s) not found!"
,
path
.
c_str
());
return
false
;
}
return
false
;
}
//------------------------------------------------------------------------------
bool
ausf_profile
::
remove_profile_info
(
const
std
::
string
&
path
)
{
bool
result
=
nrf_profile
::
remove_profile_info
(
path
);
if
(
result
)
return
true
;
// for AUSF info
if
(
path
.
compare
(
"ausfInfo"
)
==
0
)
{
Logger
::
nrf_app
().
debug
(
"Do not support this operation for ausfInfo"
);
return
false
;
}
if
((
path
.
compare
(
"nfInstanceId"
)
!=
0
)
and
(
path
.
compare
(
"nfInstanceName"
)
!=
0
)
and
(
path
.
compare
(
"nfType"
)
!=
0
)
and
(
path
.
compare
(
"nfStatus"
)
!=
0
)
and
(
path
.
compare
(
"heartBeatTimer"
)
!=
0
)
and
(
path
.
compare
(
"fqdn"
)
!=
0
)
and
(
path
.
compare
(
"plmnList"
)
!=
0
)
and
(
path
.
compare
(
"ipv4Addresses"
)
!=
0
)
and
(
path
.
compare
(
"priority"
)
!=
0
)
and
(
path
.
compare
(
"capacity"
)
!=
0
)
and
(
path
.
compare
(
"priority"
)
!=
0
)
and
(
path
.
compare
(
"nfServices"
)
!=
0
)
and
(
path
.
compare
(
"ausfInfo"
)
!=
0
))
{
Logger
::
nrf_app
().
debug
(
"Member (%s) not found!"
,
path
.
c_str
());
return
false
;
}
return
false
;
}
//------------------------------------------------------------------------------
void
ausf_profile
::
to_json
(
nlohmann
::
json
&
data
)
const
{
nrf_profile
::
to_json
(
data
);
// AUSF Info
data
[
"ausfInfo"
][
"groupId"
]
=
ausf_info
.
groupid
;
data
[
"ausfInfo"
][
"supiRanges"
]
=
nlohmann
::
json
::
array
();
data
[
"ausfInfo"
][
"routingIndicators"
]
=
nlohmann
::
json
::
array
();
for
(
auto
supi
:
ausf_info
.
supi_ranges
)
{
nlohmann
::
json
tmp
=
{};
tmp
[
"start"
]
=
supi
.
supi_range
.
start
;
tmp
[
"end"
]
=
supi
.
supi_range
.
end
;
tmp
[
"pattern"
]
=
supi
.
supi_range
.
pattern
;
data
[
"ausfInfo"
][
"supiRanges"
].
push_back
(
tmp
);
}
for
(
auto
route_ind
:
ausf_info
.
routing_indicator
)
{
std
::
string
tmp
=
route_ind
;
data
[
"ausfInfo"
][
"routingIndicators"
].
push_back
(
route_ind
);
}
}
src/nrf_app/nrf_profile.hpp
View file @
b302f710
...
...
@@ -58,6 +58,7 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
heartBeat_timer
(
0
),
snssais
(),
fqdn
(),
plmn_list
(),
ipv4_addresses
(),
ipv6_addresses
(),
priority
(
0
),
...
...
@@ -76,6 +77,7 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
heartBeat_timer
(
0
),
snssais
(),
fqdn
(),
plmn_list
(),
ipv4_addresses
(),
ipv6_addresses
(),
priority
(
0
),
...
...
@@ -95,6 +97,7 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
heartBeat_timer
(
0
),
snssais
(),
fqdn
(),
plmn_list
(),
ipv4_addresses
(),
ipv6_addresses
(),
priority
(
0
),
...
...
@@ -292,6 +295,27 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
*/
void
set_fqdn
(
const
std
::
string
&
fqdn
);
/*
* Set NF instance plmnList
* @param [std::vector<plmn_t> &] s: plmn (mcc, mnc)
* @return void
*/
void
set_plmn_list
(
const
std
::
vector
<
plmn_t
>&
s
);
/*
* Add plmnList
* @param [plmn_t &] s: plmn (mcc, mnc)
* @return void
*/
void
add_plmn_list
(
const
plmn_t
&
s
);
/*
* Get NF instance plmnList
* @param [std::vector<plmn_t> &] s: store plmnList
* @return void:
*/
void
get_plmn_list
(
std
::
vector
<
plmn_t
>&
s
)
const
;
/*
* Set NF instance ipv4_addresses
* @param [std::vector<struct in_addr> &] a: ipv4_addresses
...
...
@@ -474,6 +498,7 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
nf_type_t
nf_type
;
std
::
string
nf_status
;
int32_t
heartBeat_timer
;
std
::
vector
<
plmn_t
>
plmn_list
;
std
::
vector
<
snssai_t
>
snssais
;
std
::
string
fqdn
;
std
::
vector
<
struct
in_addr
>
ipv4_addresses
;
...
...
@@ -752,6 +777,76 @@ class upf_profile : public nrf_profile {
private:
upf_info_t
upf_info
;
};
class
ausf_profile
:
public
nrf_profile
{
public:
ausf_profile
(
nrf_event
&
ev
)
:
nrf_profile
(
ev
,
NF_TYPE_AUSF
)
{
ausf_info
=
{};
}
ausf_profile
(
nrf_event
&
ev
,
const
std
::
string
&
id
)
:
nrf_profile
(
ev
,
id
)
{
nf_type
=
NF_TYPE_AUSF
;
ausf_info
=
{};
}
ausf_profile
(
ausf_profile
&
b
)
=
delete
;
/*
* Add a AUSF info
* @param [const ausf_info_t &] info: AUSF info
* @return void
*/
void
add_ausf_info
(
const
ausf_info_t
&
info
);
/*
* Get list of AUSF infos a AUSF info
* @param [const ausf_info_t &] info: AUSF info
* @return void
*/
void
get_ausf_info
(
ausf_info_t
&
infos
)
const
;
/*
* Print related-information for a AUSF profile
* @param void
* @return void:
*/
void
display
();
/*
* Update a new value for a member of AUSF profile
* @param [const std::string &] path: member name
* @param [const std::string &] value: new value
* @return void
*/
bool
replace_profile_info
(
const
std
::
string
&
path
,
const
std
::
string
&
value
);
/*
* Add a new value for a member of NF profile
* @param [const std::string &] path: member name
* @param [const std::string &] value: new value
* @return true if success, otherwise false
*/
bool
add_profile_info
(
const
std
::
string
&
path
,
const
std
::
string
&
value
);
/*
* Remove value of a member of NF profile
* @param [const std::string &] path: member name
* @param [const std::string &] value: new value
* @return true if success, otherwise false
*/
bool
remove_profile_info
(
const
std
::
string
&
path
);
/*
* Represent NF profile as json object
* @param [nlohmann::json &] data: Json data
* @return void
*/
void
to_json
(
nlohmann
::
json
&
data
)
const
;
private:
ausf_info_t
ausf_info
;
};
}
// namespace app
}
// namespace nrf
}
// namespace oai
...
...
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