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
b71f828a
Commit
b71f828a
authored
Jan 15, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add UPF profile
parent
9fe96cdf
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
306 additions
and
59 deletions
+306
-59
src/common/3gpp_29.510.h
src/common/3gpp_29.510.h
+33
-18
src/common/utils/api_conversions.cpp
src/common/utils/api_conversions.cpp
+71
-41
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
+8
-0
src/nrf_app/nrf_profile.cpp
src/nrf_app/nrf_profile.cpp
+122
-0
src/nrf_app/nrf_profile.hpp
src/nrf_app/nrf_profile.hpp
+68
-0
No files found.
src/common/3gpp_29.510.h
View file @
b71f828a
...
@@ -50,15 +50,30 @@ typedef struct smf_info_s {
...
@@ -50,15 +50,30 @@ typedef struct smf_info_s {
std
::
vector
<
snssai_smf_info_item_t
>
snssai_smf_info_list
;
std
::
vector
<
snssai_smf_info_item_t
>
snssai_smf_info_list
;
}
smf_info_t
;
}
smf_info_t
;
typedef
struct
dnn_upf_info_item_s
{
std
::
string
dnn
;
// std::vector<std::string> dnai_list
// std::vector<std::string> pdu_session_types
}
dnn_upf_info_item_t
;
typedef
struct
snssai_upf_info_item_s
{
snssai_t
snssai
;
std
::
vector
<
dnn_upf_info_item_t
>
dnn_upf_info_list
;
}
snssai_upf_info_item_t
;
typedef
struct
upf_info_s
{
std
::
vector
<
snssai_upf_info_item_t
>
snssai_upf_info_list
;
}
upf_info_t
;
enum
subscr_condition_type_e
{
// TODO: use enum class
enum
subscr_condition_type_e
{
// TODO: use enum class
UNKNOWN_CONDITION
=
0
,
UNKNOWN_CONDITION
=
0
,
NF_INSTANCE_ID_COND
=
1
,
NF_INSTANCE_ID_COND
=
1
,
NF_TYPE_COND
=
2
,
NF_TYPE_COND
=
2
,
SERVICE_NAME_COND
=
3
,
SERVICE_NAME_COND
=
3
,
AMF_COND
=
4
,
AMF_COND
=
4
,
GUAMI_LIST_COND
=
5
,
GUAMI_LIST_COND
=
5
,
NETWOTK_SLICE_COND
=
6
,
NETWOTK_SLICE_COND
=
6
,
NF_GROUP_COND
=
7
NF_GROUP_COND
=
7
};
};
static
const
std
::
vector
<
std
::
string
>
subscription_condition_type_e2str
=
{
static
const
std
::
vector
<
std
::
string
>
subscription_condition_type_e2str
=
{
...
@@ -99,7 +114,7 @@ typedef struct subscription_condition_s {
...
@@ -99,7 +114,7 @@ typedef struct subscription_condition_s {
subscription_condition_s
(
uint8_t
t
)
:
type
(
t
)
{}
subscription_condition_s
(
uint8_t
t
)
:
type
(
t
)
{}
subscription_condition_s
(
const
subscription_condition_s
&
s
)
subscription_condition_s
(
const
subscription_condition_s
&
s
)
:
subscription_condition_s
()
{
:
subscription_condition_s
()
{
type
=
s
.
type
;
type
=
s
.
type
;
switch
(
s
.
type
)
{
switch
(
s
.
type
)
{
...
@@ -114,7 +129,7 @@ typedef struct subscription_condition_s {
...
@@ -114,7 +129,7 @@ typedef struct subscription_condition_s {
service_name
=
s
.
service_name
;
service_name
=
s
.
service_name
;
}
break
;
}
break
;
case
AMF_COND
:
{
case
AMF_COND
:
{
amf_info
.
amf_set_id
=
s
.
amf_info
.
amf_set_id
;
amf_info
.
amf_set_id
=
s
.
amf_info
.
amf_set_id
;
amf_info
.
amf_region_id
=
s
.
amf_info
.
amf_region_id
;
amf_info
.
amf_region_id
=
s
.
amf_info
.
amf_region_id
;
}
break
;
}
break
;
...
@@ -136,13 +151,13 @@ typedef struct subscription_condition_s {
...
@@ -136,13 +151,13 @@ typedef struct subscription_condition_s {
}
}
// TODO:
// TODO:
}
}
bool
operator
==
(
const
struct
subscription_condition_s
&
s
)
const
{
bool
operator
==
(
const
struct
subscription_condition_s
&
s
)
const
{
return
(
s
.
type
==
type
);
return
(
s
.
type
==
type
);
}
}
bool
operator
==
(
const
uint8_t
&
t
)
const
{
return
(
t
==
type
);
}
bool
operator
==
(
const
uint8_t
&
t
)
const
{
return
(
t
==
type
);
}
subscription_condition_s
&
operator
=
(
const
subscription_condition_s
&
s
)
{
subscription_condition_s
&
operator
=
(
const
subscription_condition_s
&
s
)
{
type
=
s
.
type
;
type
=
s
.
type
;
switch
(
s
.
type
)
{
switch
(
s
.
type
)
{
case
NF_INSTANCE_ID_COND
:
{
case
NF_INSTANCE_ID_COND
:
{
...
@@ -156,7 +171,7 @@ typedef struct subscription_condition_s {
...
@@ -156,7 +171,7 @@ typedef struct subscription_condition_s {
service_name
=
s
.
service_name
;
service_name
=
s
.
service_name
;
}
break
;
}
break
;
case
AMF_COND
:
{
case
AMF_COND
:
{
amf_info
.
amf_set_id
=
s
.
amf_info
.
amf_set_id
;
amf_info
.
amf_set_id
=
s
.
amf_info
.
amf_set_id
;
amf_info
.
amf_region_id
=
s
.
amf_info
.
amf_region_id
;
amf_info
.
amf_region_id
=
s
.
amf_info
.
amf_region_id
;
}
break
;
}
break
;
...
@@ -227,9 +242,9 @@ typedef struct subscription_condition_s {
...
@@ -227,9 +242,9 @@ typedef struct subscription_condition_s {
}
subscription_condition_t
;
}
subscription_condition_t
;
enum
notification_event_type_t
{
enum
notification_event_type_t
{
NOTIFICATION_TYPE_UNKNOWN_EVENT
=
0
,
NOTIFICATION_TYPE_UNKNOWN_EVENT
=
0
,
NOTIFICATION_TYPE_NF_REGISTERED
=
1
,
NOTIFICATION_TYPE_NF_REGISTERED
=
1
,
NOTIFICATION_TYPE_NF_DEREGISTERED
=
2
,
NOTIFICATION_TYPE_NF_DEREGISTERED
=
2
,
NOTIFICATION_TYPE_NF_PROFILE_CHANGED
=
3
NOTIFICATION_TYPE_NF_PROFILE_CHANGED
=
3
};
};
...
@@ -240,9 +255,9 @@ typedef struct nf_service_version_s {
...
@@ -240,9 +255,9 @@ typedef struct nf_service_version_s {
std
::
string
api_version_in_uri
;
// apiVersionInUri
std
::
string
api_version_in_uri
;
// apiVersionInUri
std
::
string
api_full_version
;
// apiFullVersion
std
::
string
api_full_version
;
// apiFullVersion
nf_service_version_s
&
operator
=
(
const
nf_service_version_s
&
s
)
{
nf_service_version_s
&
operator
=
(
const
nf_service_version_s
&
s
)
{
api_version_in_uri
=
s
.
api_version_in_uri
;
api_version_in_uri
=
s
.
api_version_in_uri
;
api_full_version
=
s
.
api_full_version
;
api_full_version
=
s
.
api_full_version
;
}
}
std
::
string
to_string
()
const
{
std
::
string
to_string
()
const
{
...
...
src/common/utils/api_conversions.cpp
View file @
b71f828a
...
@@ -53,22 +53,22 @@ using namespace oai::nrf;
...
@@ -53,22 +53,22 @@ using namespace oai::nrf;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
bool
api_conv
::
profile_api_to_nrf_profile
(
bool
api_conv
::
profile_api_to_nrf_profile
(
const
NFProfile
&
api_profile
,
std
::
shared_ptr
<
nrf_profile
>
&
profile
)
{
const
NFProfile
&
api_profile
,
std
::
shared_ptr
<
nrf_profile
>&
profile
)
{
Logger
::
nrf_app
().
debug
(
Logger
::
nrf_app
().
debug
(
"Convert a json-type profile to a NF profile (profile ID: %s)"
,
"Convert a json-type profile to a NF profile (profile ID: %s)"
,
api_profile
.
getNfInstanceId
().
c_str
());
api_profile
.
getNfInstanceId
().
c_str
());
profile
.
get
()
->
set_nf_instance_id
(
api_profile
.
getNfInstanceId
());
profile
.
get
()
->
set_nf_instance_id
(
api_profile
.
getNfInstanceId
());
profile
.
get
()
->
set_nf_instance_name
(
api_profile
.
getNfInstanceName
());
profile
.
get
()
->
set_nf_instance_name
(
api_profile
.
getNfInstanceName
());
Logger
::
nrf_app
().
debug
(
"
\t
Instance name: %s"
,
Logger
::
nrf_app
().
debug
(
profile
.
get
()
->
get_nf_instance_name
().
c_str
());
"
\t
Instance name: %s"
,
profile
.
get
()
->
get_nf_instance_name
().
c_str
());
profile
.
get
()
->
set_nf_status
(
api_profile
.
getNfStatus
());
profile
.
get
()
->
set_nf_status
(
api_profile
.
getNfStatus
());
Logger
::
nrf_app
().
debug
(
"
\t
Status: %s"
,
Logger
::
nrf_app
().
debug
(
profile
.
get
()
->
get_nf_status
().
c_str
());
"
\t
Status: %s"
,
profile
.
get
()
->
get_nf_status
().
c_str
());
profile
.
get
()
->
set_nf_heartBeat_timer
(
api_profile
.
getHeartBeatTimer
());
profile
.
get
()
->
set_nf_heartBeat_timer
(
api_profile
.
getHeartBeatTimer
());
Logger
::
nrf_app
().
debug
(
"
\t
HeartBeart timer: %d"
,
Logger
::
nrf_app
().
debug
(
profile
.
get
()
->
get_nf_heartBeat_timer
());
"
\t
HeartBeart timer: %d"
,
profile
.
get
()
->
get_nf_heartBeat_timer
());
profile
.
get
()
->
set_nf_priority
(
api_profile
.
getPriority
());
profile
.
get
()
->
set_nf_priority
(
api_profile
.
getPriority
());
Logger
::
nrf_app
().
debug
(
"
\t
Priority: %d"
,
profile
.
get
()
->
get_nf_priority
());
Logger
::
nrf_app
().
debug
(
"
\t
Priority: %d"
,
profile
.
get
()
->
get_nf_priority
());
profile
.
get
()
->
set_nf_capacity
(
api_profile
.
getCapacity
());
profile
.
get
()
->
set_nf_capacity
(
api_profile
.
getCapacity
());
...
@@ -77,11 +77,11 @@ bool api_conv::profile_api_to_nrf_profile(
...
@@ -77,11 +77,11 @@ bool api_conv::profile_api_to_nrf_profile(
std
::
vector
<
Snssai
>
snssai
=
api_profile
.
getSNssais
();
std
::
vector
<
Snssai
>
snssai
=
api_profile
.
getSNssais
();
for
(
auto
s
:
snssai
)
{
for
(
auto
s
:
snssai
)
{
snssai_t
sn
=
{};
snssai_t
sn
=
{};
sn
.
sD
=
s
.
getSd
();
sn
.
sD
=
s
.
getSd
();
sn
.
sST
=
s
.
getSst
();
sn
.
sST
=
s
.
getSst
();
profile
.
get
()
->
add_snssai
(
sn
);
profile
.
get
()
->
add_snssai
(
sn
);
Logger
::
nrf_app
().
debug
(
"
\t
SNSSAI (SD, SST): %d, %s"
,
sn
.
sST
,
Logger
::
nrf_app
().
debug
(
sn
.
sD
.
c_str
());
"
\t
SNSSAI (SD, SST): %d, %s"
,
sn
.
sST
,
sn
.
sD
.
c_str
());
}
}
std
::
vector
<
std
::
string
>
ipv4_addr_str
=
api_profile
.
getIpv4Addresses
();
std
::
vector
<
std
::
string
>
ipv4_addr_str
=
api_profile
.
getIpv4Addresses
();
...
@@ -91,8 +91,8 @@ bool api_conv::profile_api_to_nrf_profile(
...
@@ -91,8 +91,8 @@ bool api_conv::profile_api_to_nrf_profile(
if
(
inet_pton
(
AF_INET
,
util
::
trim
(
address
).
c_str
(),
buf_in_addr
)
==
1
)
{
if
(
inet_pton
(
AF_INET
,
util
::
trim
(
address
).
c_str
(),
buf_in_addr
)
==
1
)
{
memcpy
(
&
addr4
,
buf_in_addr
,
sizeof
(
struct
in_addr
));
memcpy
(
&
addr4
,
buf_in_addr
,
sizeof
(
struct
in_addr
));
}
else
{
}
else
{
Logger
::
nrf_app
().
warn
(
"Address conversion: Bad value %s"
,
Logger
::
nrf_app
().
warn
(
util
::
trim
(
address
).
c_str
());
"Address conversion: Bad value %s"
,
util
::
trim
(
address
).
c_str
());
}
}
Logger
::
nrf_app
().
debug
(
"
\t
IPv4 Addr: %s"
,
address
.
c_str
());
Logger
::
nrf_app
().
debug
(
"
\t
IPv4 Addr: %s"
,
address
.
c_str
());
...
@@ -105,25 +105,26 @@ bool api_conv::profile_api_to_nrf_profile(
...
@@ -105,25 +105,26 @@ bool api_conv::profile_api_to_nrf_profile(
case
NF_TYPE_AMF
:
{
case
NF_TYPE_AMF
:
{
Logger
::
nrf_app
().
debug
(
"
\t
AMF profile, AMF Info"
);
Logger
::
nrf_app
().
debug
(
"
\t
AMF profile, AMF Info"
);
profile
.
get
()
->
set_nf_type
(
NF_TYPE_AMF
);
profile
.
get
()
->
set_nf_type
(
NF_TYPE_AMF
);
amf_info_t
info
=
{};
amf_info_t
info
=
{};
AmfInfo
amf_info_api
=
api_profile
.
getAmfInfo
();
AmfInfo
amf_info_api
=
api_profile
.
getAmfInfo
();
info
.
amf_region_id
=
amf_info_api
.
getAmfRegionId
();
info
.
amf_region_id
=
amf_info_api
.
getAmfRegionId
();
info
.
amf_set_id
=
amf_info_api
.
getAmfSetId
();
info
.
amf_set_id
=
amf_info_api
.
getAmfSetId
();
Logger
::
nrf_app
().
debug
(
"
\t\t
AMF Set ID: %s, AMF Region ID: %s"
,
Logger
::
nrf_app
().
debug
(
info
.
amf_set_id
.
c_str
(),
"
\t\t
AMF Set ID: %s, AMF Region ID: %s"
,
info
.
amf_set_id
.
c_str
(),
info
.
amf_region_id
.
c_str
());
info
.
amf_region_id
.
c_str
());
for
(
auto
g
:
amf_info_api
.
getGuamiList
())
{
for
(
auto
g
:
amf_info_api
.
getGuamiList
())
{
guami_t
guami
=
{};
guami_t
guami
=
{};
guami
.
amf_id
=
g
.
getAmfId
();
guami
.
amf_id
=
g
.
getAmfId
();
guami
.
plmn
.
mcc
=
g
.
getPlmnId
().
getMcc
();
guami
.
plmn
.
mcc
=
g
.
getPlmnId
().
getMcc
();
guami
.
plmn
.
mnc
=
g
.
getPlmnId
().
getMnc
();
guami
.
plmn
.
mnc
=
g
.
getPlmnId
().
getMnc
();
info
.
guami_list
.
push_back
(
guami
);
info
.
guami_list
.
push_back
(
guami
);
Logger
::
nrf_app
().
debug
(
"
\t\t
AMF GUAMI, AMF_ID: %s"
,
Logger
::
nrf_app
().
debug
(
guami
.
amf_id
.
c_str
());
"
\t\t
AMF GUAMI, AMF_ID: %s"
,
guami
.
amf_id
.
c_str
());
Logger
::
nrf_app
().
debug
(
"
\t\t
AMF GUAMI, PLMN (MCC: %s, MNC: %s)"
,
Logger
::
nrf_app
().
debug
(
guami
.
plmn
.
mcc
.
c_str
(),
guami
.
plmn
.
mnc
.
c_str
());
"
\t\t
AMF GUAMI, PLMN (MCC: %s, MNC: %s)"
,
guami
.
plmn
.
mcc
.
c_str
(),
guami
.
plmn
.
mnc
.
c_str
());
}
}
(
std
::
static_pointer_cast
<
amf_profile
>
(
profile
))
(
std
::
static_pointer_cast
<
amf_profile
>
(
profile
))
.
get
()
.
get
()
...
@@ -132,18 +133,19 @@ bool api_conv::profile_api_to_nrf_profile(
...
@@ -132,18 +133,19 @@ bool api_conv::profile_api_to_nrf_profile(
case
NF_TYPE_SMF
:
{
case
NF_TYPE_SMF
:
{
Logger
::
nrf_app
().
debug
(
"
\t
SMF profile, SMF Info"
);
Logger
::
nrf_app
().
debug
(
"
\t
SMF profile, SMF Info"
);
profile
.
get
()
->
set_nf_type
(
NF_TYPE_SMF
);
profile
.
get
()
->
set_nf_type
(
NF_TYPE_SMF
);
smf_info_t
info
=
{};
smf_info_t
info
=
{};
SmfInfo
smf_info_api
=
api_profile
.
getSmfInfo
();
SmfInfo
smf_info_api
=
api_profile
.
getSmfInfo
();
for
(
auto
s
:
smf_info_api
.
getSNssaiSmfInfoList
())
{
for
(
auto
s
:
smf_info_api
.
getSNssaiSmfInfoList
())
{
snssai_smf_info_item_t
snssai
=
{};
snssai_smf_info_item_t
snssai
=
{};
snssai
.
snssai
.
sD
=
s
.
getSNssai
().
getSd
();
snssai
.
snssai
.
sD
=
s
.
getSNssai
().
getSd
();
snssai
.
snssai
.
sST
=
s
.
getSNssai
().
getSst
();
snssai
.
snssai
.
sST
=
s
.
getSNssai
().
getSst
();
Logger
::
nrf_app
().
debug
(
"
\t\t
NSSAI SD: %s, SST: %d"
,
Logger
::
nrf_app
().
debug
(
snssai
.
snssai
.
sD
.
c_str
(),
snssai
.
snssai
.
sST
);
"
\t\t
NSSAI SD: %s, SST: %d"
,
snssai
.
snssai
.
sD
.
c_str
(),
snssai
.
snssai
.
sST
);
for
(
auto
d
:
s
.
getDnnSmfInfoList
())
{
for
(
auto
d
:
s
.
getDnnSmfInfoList
())
{
dnn_smf_info_item_t
dnn
=
{};
dnn_smf_info_item_t
dnn
=
{};
dnn
.
dnn
=
d
.
getDnn
();
dnn
.
dnn
=
d
.
getDnn
();
snssai
.
dnn_smf_info_list
.
push_back
(
dnn
);
snssai
.
dnn_smf_info_list
.
push_back
(
dnn
);
Logger
::
nrf_app
().
debug
(
"
\t\t
DNN: %s"
,
dnn
.
dnn
.
c_str
());
Logger
::
nrf_app
().
debug
(
"
\t\t
DNN: %s"
,
dnn
.
dnn
.
c_str
());
}
}
...
@@ -155,21 +157,49 @@ bool api_conv::profile_api_to_nrf_profile(
...
@@ -155,21 +157,49 @@ bool api_conv::profile_api_to_nrf_profile(
->
add_smf_info
(
info
);
->
add_smf_info
(
info
);
}
break
;
}
break
;
default:
{}
case
NF_TYPE_UPF
:
{
Logger
::
nrf_app
().
debug
(
"
\t
UPF profile, UPF Info"
);
profile
.
get
()
->
set_nf_type
(
NF_TYPE_UPF
);
upf_info_t
info
=
{};
UpfInfo
upf_info_api
=
api_profile
.
getUpfInfo
();
for
(
auto
s
:
upf_info_api
.
getSNssaiUpfInfoList
())
{
snssai_upf_info_item_t
snssai
=
{};
snssai
.
snssai
.
sD
=
s
.
getSNssai
().
getSd
();
snssai
.
snssai
.
sST
=
s
.
getSNssai
().
getSst
();
Logger
::
nrf_app
().
debug
(
"
\t\t
NSSAI SD: %s, SST: %d"
,
snssai
.
snssai
.
sD
.
c_str
(),
snssai
.
snssai
.
sST
);
for
(
auto
d
:
s
.
getDnnUpfInfoList
())
{
dnn_upf_info_item_t
dnn
=
{};
dnn
.
dnn
=
d
.
getDnn
();
snssai
.
dnn_upf_info_list
.
push_back
(
dnn
);
Logger
::
nrf_app
().
debug
(
"
\t\t
DNN: %s"
,
dnn
.
dnn
.
c_str
());
}
info
.
snssai_upf_info_list
.
push_back
(
snssai
);
}
(
std
::
static_pointer_cast
<
upf_profile
>
(
profile
))
.
get
()
->
add_upf_info
(
info
);
}
break
;
default:
{
}
}
}
// nf_services
// nf_services
if
(
api_profile
.
nfServicesIsSet
())
{
if
(
api_profile
.
nfServicesIsSet
())
{
std
::
vector
<
NFService
>
nf_services
=
api_profile
.
getNfServices
();
std
::
vector
<
NFService
>
nf_services
=
api_profile
.
getNfServices
();
for
(
auto
service
:
nf_services
)
{
for
(
auto
service
:
nf_services
)
{
nf_service_t
ns
=
{};
nf_service_t
ns
=
{};
ns
.
service_instance_id
=
service
.
getServiceInstanceId
();
ns
.
service_instance_id
=
service
.
getServiceInstanceId
();
ns
.
service_name
=
service
.
getServiceName
();
ns
.
service_name
=
service
.
getServiceName
();
ns
.
scheme
=
service
.
getScheme
();
ns
.
scheme
=
service
.
getScheme
();
for
(
auto
v
:
service
.
getVersions
())
{
for
(
auto
v
:
service
.
getVersions
())
{
nf_service_version_t
version
=
{};
nf_service_version_t
version
=
{};
version
.
api_full_version
=
v
.
getApiFullVersion
();
version
.
api_full_version
=
v
.
getApiFullVersion
();
version
.
api_version_in_uri
=
v
.
getApiVersionInUri
();
version
.
api_version_in_uri
=
v
.
getApiVersionInUri
();
ns
.
versions
.
push_back
(
version
);
ns
.
versions
.
push_back
(
version
);
}
}
ns
.
nf_service_status
=
service
.
getNfServiceStatus
();
ns
.
nf_service_status
=
service
.
getNfServiceStatus
();
...
@@ -181,7 +211,7 @@ bool api_conv::profile_api_to_nrf_profile(
...
@@ -181,7 +211,7 @@ bool api_conv::profile_api_to_nrf_profile(
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
bool
api_conv
::
subscription_api_to_nrf_subscription
(
bool
api_conv
::
subscription_api_to_nrf_subscription
(
const
SubscriptionData
&
api_sub
,
std
::
shared_ptr
<
nrf_subscription
>
&
sub
)
{
const
SubscriptionData
&
api_sub
,
std
::
shared_ptr
<
nrf_subscription
>&
sub
)
{
Logger
::
nrf_app
().
debug
(
Logger
::
nrf_app
().
debug
(
"Convert a json-type Subscription data a NRF subscription data"
);
"Convert a json-type Subscription data a NRF subscription data"
);
sub
.
get
()
->
set_notification_uri
(
api_sub
.
getNfStatusNotificationUri
());
sub
.
get
()
->
set_notification_uri
(
api_sub
.
getNfStatusNotificationUri
());
...
@@ -330,7 +360,7 @@ bool api_conv::subscription_api_to_nrf_subscription(
...
@@ -330,7 +360,7 @@ bool api_conv::subscription_api_to_nrf_subscription(
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
nf_type_t
api_conv
::
string_to_nf_type
(
const
std
::
string
&
str
)
{
nf_type_t
api_conv
::
string_to_nf_type
(
const
std
::
string
&
str
)
{
if
(
str
.
compare
(
"NRF"
)
==
0
)
return
NF_TYPE_NRF
;
if
(
str
.
compare
(
"NRF"
)
==
0
)
return
NF_TYPE_NRF
;
if
(
str
.
compare
(
"AMF"
)
==
0
)
return
NF_TYPE_AMF
;
if
(
str
.
compare
(
"AMF"
)
==
0
)
return
NF_TYPE_AMF
;
if
(
str
.
compare
(
"SMF"
)
==
0
)
return
NF_TYPE_SMF
;
if
(
str
.
compare
(
"SMF"
)
==
0
)
return
NF_TYPE_SMF
;
...
@@ -356,7 +386,7 @@ nf_type_t api_conv::string_to_nf_type(const std::string &str) {
...
@@ -356,7 +386,7 @@ nf_type_t api_conv::string_to_nf_type(const std::string &str) {
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
patch_op_type_t
api_conv
::
string_to_patch_operation
(
const
std
::
string
&
str
)
{
patch_op_type_t
api_conv
::
string_to_patch_operation
(
const
std
::
string
&
str
)
{
if
(
str
.
compare
(
"add"
)
==
0
)
return
PATCH_OP_ADD
;
if
(
str
.
compare
(
"add"
)
==
0
)
return
PATCH_OP_ADD
;
if
(
str
.
compare
(
"copy"
)
==
0
)
return
PATCH_OP_COPY
;
if
(
str
.
compare
(
"copy"
)
==
0
)
return
PATCH_OP_COPY
;
if
(
str
.
compare
(
"move"
)
==
0
)
return
PATCH_OP_MOVE
;
if
(
str
.
compare
(
"move"
)
==
0
)
return
PATCH_OP_MOVE
;
...
@@ -367,7 +397,7 @@ patch_op_type_t api_conv::string_to_patch_operation(const std::string &str) {
...
@@ -367,7 +397,7 @@ patch_op_type_t api_conv::string_to_patch_operation(const std::string &str) {
return
PATCH_OP_UNKNOWN
;
return
PATCH_OP_UNKNOWN
;
}
}
bool
api_conv
::
validate_uuid
(
const
std
::
string
&
str
)
{
bool
api_conv
::
validate_uuid
(
const
std
::
string
&
str
)
{
// should be verified with Capital letter
// should be verified with Capital letter
static
const
std
::
regex
e
(
static
const
std
::
regex
e
(
"[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}"
);
"[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}"
);
...
...
src/nrf_app/nrf_app.cpp
View file @
b71f828a
...
@@ -129,6 +129,10 @@ void nrf_app::handle_register_nf_instance(
...
@@ -129,6 +129,10 @@ void nrf_app::handle_register_nf_instance(
sn
=
std
::
make_shared
<
smf_profile
>
(
m_event_sub
);
sn
=
std
::
make_shared
<
smf_profile
>
(
m_event_sub
);
}
break
;
}
break
;
case
NF_TYPE_UPF
:
{
sn
=
std
::
make_shared
<
upf_profile
>
(
m_event_sub
);
}
break
;
default:
{
sn
=
std
::
make_shared
<
nrf_profile
>
(
m_event_sub
);
}
default:
{
sn
=
std
::
make_shared
<
nrf_profile
>
(
m_event_sub
);
}
}
}
...
...
src/nrf_app/nrf_client.cpp
View file @
b71f828a
...
@@ -239,6 +239,10 @@ void nrf_client::notify_subscribed_event(
...
@@ -239,6 +239,10 @@ void nrf_client::notify_subscribed_event(
std
::
static_pointer_cast
<
smf_profile
>
(
profile
).
get
()
->
to_json
(
std
::
static_pointer_cast
<
smf_profile
>
(
profile
).
get
()
->
to_json
(
json_profile
);
json_profile
);
}
break
;
}
break
;
case
NF_TYPE_UPF
:
{
std
::
static_pointer_cast
<
upf_profile
>
(
profile
).
get
()
->
to_json
(
json_profile
);
}
break
;
default:
{
profile
.
get
()
->
to_json
(
json_profile
);
}
default:
{
profile
.
get
()
->
to_json
(
json_profile
);
}
}
}
json_data
[
"nfProfile"
]
=
json_profile
;
json_data
[
"nfProfile"
]
=
json_profile
;
...
@@ -296,6 +300,10 @@ void nrf_client::notify_subscribed_event_multi(
...
@@ -296,6 +300,10 @@ void nrf_client::notify_subscribed_event_multi(
std
::
static_pointer_cast
<
smf_profile
>
(
profile
).
get
()
->
to_json
(
std
::
static_pointer_cast
<
smf_profile
>
(
profile
).
get
()
->
to_json
(
json_profile
);
json_profile
);
}
break
;
}
break
;
case
NF_TYPE_UPF
:
{
std
::
static_pointer_cast
<
upf_profile
>
(
profile
).
get
()
->
to_json
(
json_profile
);
}
break
;
default:
{
profile
.
get
()
->
to_json
(
json_profile
);
}
default:
{
profile
.
get
()
->
to_json
(
json_profile
);
}
}
}
json_data
[
"nfProfile"
]
=
json_profile
;
json_data
[
"nfProfile"
]
=
json_profile
;
...
...
src/nrf_app/nrf_profile.cpp
View file @
b71f828a
...
@@ -833,3 +833,125 @@ void smf_profile::to_json(nlohmann::json &data) const {
...
@@ -833,3 +833,125 @@ void smf_profile::to_json(nlohmann::json &data) const {
data
[
"smfInfo"
][
"sNssaiSmfInfoList"
].
push_back
(
tmp
);
data
[
"smfInfo"
][
"sNssaiSmfInfoList"
].
push_back
(
tmp
);
}
}
}
}
//------------------------------------------------------------------------------
void
upf_profile
::
add_upf_info
(
const
upf_info_t
&
info
)
{
upf_info
=
info
;
}
//------------------------------------------------------------------------------
void
upf_profile
::
get_upf_info
(
upf_info_t
&
infos
)
const
{
infos
=
upf_info
;
}
//------------------------------------------------------------------------------
void
upf_profile
::
display
()
{
nrf_profile
::
display
();
Logger
::
nrf_app
().
debug
(
"
\t
UPF Info"
);
for
(
auto
s
:
upf_info
.
snssai_upf_info_list
)
{
Logger
::
nrf_app
().
debug
(
"
\t\t
SNSSAI UPF Info List, SNSSAI (SD: %s, SST: %d)"
,
s
.
snssai
.
sD
.
c_str
(),
s
.
snssai
.
sST
);
for
(
auto
d
:
s
.
dnn_upf_info_list
)
{
Logger
::
nrf_app
().
debug
(
"
\t\t
SNSSAI UPF Info List, DNN List: %s"
,
d
.
dnn
.
c_str
());
}
}
}
//------------------------------------------------------------------------------
bool
upf_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
(
"upfInfo"
)
==
0
)
{
Logger
::
nrf_app
().
info
(
"Does not support this operation for upfInfo"
);
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
(
"sNssais"
)
!=
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
(
"upfInfo"
)
!=
0
))
{
Logger
::
nrf_app
().
debug
(
"Add new member: %s"
,
path
.
c_str
());
// add new member
json_data
[
path
]
=
value
;
return
true
;
}
return
false
;
}
//------------------------------------------------------------------------------
bool
upf_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 UPF info
if
(
path
.
compare
(
"upfInfo"
)
==
0
)
{
Logger
::
nrf_app
().
debug
(
"Does not support this operation for amfInfo"
);
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
(
"sNssais"
)
!=
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
(
"amfInfo"
)
!=
0
))
{
Logger
::
nrf_app
().
debug
(
"Member (%s) not found!"
,
path
.
c_str
());
return
false
;
}
return
false
;
}
//------------------------------------------------------------------------------
bool
upf_profile
::
remove_profile_info
(
const
std
::
string
&
path
)
{
bool
result
=
nrf_profile
::
remove_profile_info
(
path
);
if
(
result
)
return
true
;
// for UPF info
if
(
path
.
compare
(
"upfInfo"
)
==
0
)
{
Logger
::
nrf_app
().
debug
(
"Do not support this operation for upfInfo"
);
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
(
"sNssais"
)
!=
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
(
"upfInfo"
)
!=
0
))
{
Logger
::
nrf_app
().
debug
(
"Member (%s) not found!"
,
path
.
c_str
());
return
false
;
}
return
false
;
}
//------------------------------------------------------------------------------
void
upf_profile
::
to_json
(
nlohmann
::
json
&
data
)
const
{
nrf_profile
::
to_json
(
data
);
// UPF Info
data
[
"upfInfo"
][
"sNssaiSmfInfoList"
]
=
nlohmann
::
json
::
array
();
for
(
auto
snssai
:
upf_info
.
snssai_upf_info_list
)
{
nlohmann
::
json
tmp
=
{};
tmp
[
"sNssai"
][
"sst"
]
=
snssai
.
snssai
.
sST
;
tmp
[
"sNssai"
][
"sd"
]
=
snssai
.
snssai
.
sD
;
tmp
[
"dnnSmfInfoList"
]
=
nlohmann
::
json
::
array
();
for
(
auto
d
:
snssai
.
dnn_upf_info_list
)
{
nlohmann
::
json
tmp_dnn
=
{};
tmp_dnn
[
"dnn"
]
=
d
.
dnn
;
tmp
[
"dnnSmfInfoList"
].
push_back
(
tmp_dnn
);
}
data
[
"upfInfo"
][
"sNssaiSmfInfoList"
].
push_back
(
tmp
);
}
}
src/nrf_app/nrf_profile.hpp
View file @
b71f828a
...
@@ -649,6 +649,74 @@ class smf_profile : public nrf_profile {
...
@@ -649,6 +649,74 @@ class smf_profile : public nrf_profile {
private:
private:
smf_info_t
smf_info
;
smf_info_t
smf_info
;
};
};
class
upf_profile
:
public
nrf_profile
{
public:
upf_profile
(
nrf_event
&
ev
)
:
nrf_profile
(
ev
,
NF_TYPE_UPF
)
{
upf_info
=
{};
}
upf_profile
(
nrf_event
&
ev
,
const
std
::
string
&
id
)
:
nrf_profile
(
ev
,
id
)
{
nf_type
=
NF_TYPE_UPF
;
upf_info
=
{};
}
upf_profile
(
upf_profile
&
b
)
=
delete
;
/*
* Add a UPF info
* @param [const upf_info_t &] info: UPF info
* @return void
*/
void
add_upf_info
(
const
upf_info_t
&
info
);
/*
* Get list of UPF infos a UPF info
* @param [const upf_info_t &] info: UPF info
* @return void
*/
void
get_upf_info
(
upf_info_t
&
infos
)
const
;
/*
* Print related-information for a UPF profile
* @param void
* @return void:
*/
void
display
();
/*
* Update a new value for a member of UPF 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:
upf_info_t
upf_info
;
};
}
// namespace app
}
// namespace app
}
// namespace nrf
}
// namespace nrf
}
// namespace oai
}
// 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