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
11678473
Commit
11678473
authored
Mar 29, 2022
by
kharade
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nf profile update for PCF
parent
d50abc66
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
289 additions
and
17 deletions
+289
-17
src/common/3gpp_29.510.h
src/common/3gpp_29.510.h
+8
-0
src/common/utils/api_conversions.cpp
src/common/utils/api_conversions.cpp
+48
-1
src/nrf_app/nrf_app.cpp
src/nrf_app/nrf_app.cpp
+4
-0
src/nrf_app/nrf_jwt.cpp
src/nrf_app/nrf_jwt.cpp
+20
-16
src/nrf_app/nrf_profile.cpp
src/nrf_app/nrf_profile.cpp
+142
-0
src/nrf_app/nrf_profile.hpp
src/nrf_app/nrf_profile.hpp
+67
-0
No files found.
src/common/3gpp_29.510.h
View file @
11678473
...
...
@@ -140,6 +140,14 @@ typedef struct udr_info_s {
std
::
vector
<
std
::
string
>
data_set_id
;
}
udr_info_t
;
typedef
struct
pcf_info_s
{
std
::
string
groupid
;
std
::
vector
<
std
::
string
>
dnn_list
;
std
::
vector
<
supi_range_info_item_t
>
supi_ranges
;
std
::
vector
<
identity_range_info_item_t
>
gpsi_ranges
;
// ToDo: rxDiamHost, rxDiamRealm, v2xSupportInd.
}
pcf_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 @
11678473
...
...
@@ -392,6 +392,8 @@ bool api_conv::profile_api_to_nrf_profile(
profile
.
get
()
->
set_nf_type
(
NF_TYPE_UDR
);
udr_info_t
info
=
{};
UdrInfo
udr_info_api
=
api_profile
.
getUdrInfo
();
info
.
groupid
=
udr_info_api
.
getGroupId
();
Logger
::
nrf_app
().
debug
(
"
\t\t
GroupId - %s"
,
info
.
groupid
.
c_str
());
if
(
udr_info_api
.
supiRangesIsSet
())
{
for
(
auto
s
:
udr_info_api
.
getSupiRanges
())
{
supi_range_info_item_t
supiRange
=
{};
...
...
@@ -443,6 +445,51 @@ bool api_conv::profile_api_to_nrf_profile(
.
get
()
->
add_udr_info
(
info
);
}
break
;
case
NF_TYPE_PCF
:
{
Logger
::
nrf_app
().
debug
(
"
\t
PCF profile, PCF Info"
);
profile
.
get
()
->
set_nf_type
(
NF_TYPE_PCF
);
pcf_info_t
info
=
{};
PcfInfo
pcf_info_api
=
api_profile
.
getPcfInfo
();
info
.
groupid
=
pcf_info_api
.
getGroupId
();
Logger
::
nrf_app
().
debug
(
"
\t\t
GroupId - %s"
,
info
.
groupid
.
c_str
());
if
(
pcf_info_api
.
dnnListIsSet
())
{
for
(
auto
s
:
pcf_info_api
.
getDnnList
())
{
Logger
::
nrf_app
().
debug
(
"
\t\t
DNN - %s"
,
s
.
c_str
());
info
.
dnn_list
.
push_back
(
s
);
}
}
if
(
pcf_info_api
.
supiRangesIsSet
())
{
for
(
auto
s
:
pcf_info_api
.
getSupiRanges
())
{
supi_range_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
);
Logger
::
nrf_app
().
debug
(
"
\t\t
SupiRanges: Start - %s, End - %s, Pattern - %s"
,
supiRange
.
supi_range
.
start
.
c_str
(),
supiRange
.
supi_range
.
end
.
c_str
(),
supiRange
.
supi_range
.
pattern
.
c_str
());
}
}
if
(
pcf_info_api
.
gpsiRangesIsSet
())
{
for
(
auto
s
:
pcf_info_api
.
getGpsiRanges
())
{
identity_range_info_item_t
gpsiRange
=
{};
gpsiRange
.
identity_range
.
start
=
s
.
getStart
();
gpsiRange
.
identity_range
.
end
=
s
.
getEnd
();
gpsiRange
.
identity_range
.
pattern
=
s
.
getPattern
();
info
.
gpsi_ranges
.
push_back
(
gpsiRange
);
Logger
::
nrf_app
().
debug
(
"
\t\t
GpsiRanges: Start - %s, End - %s, Pattern - %s"
,
gpsiRange
.
identity_range
.
start
.
c_str
(),
gpsiRange
.
identity_range
.
end
.
c_str
(),
gpsiRange
.
identity_range
.
pattern
.
c_str
());
}
}
(
std
::
static_pointer_cast
<
pcf_profile
>
(
profile
))
.
get
()
->
add_pcf_info
(
info
);
}
break
;
default:
{
}
}
...
...
@@ -636,7 +683,7 @@ nf_type_t api_conv::string_to_nf_type(const std::string& str) {
if
(
str
.
compare
(
"SMF"
)
==
0
)
return
NF_TYPE_SMF
;
if
(
str
.
compare
(
"AUSF"
)
==
0
)
return
NF_TYPE_AUSF
;
if
(
str
.
compare
(
"NEF"
)
==
0
)
return
NF_TYPE_NEF
;
if
(
str
.
compare
(
"PC
P
"
)
==
0
)
return
NF_TYPE_PCF
;
if
(
str
.
compare
(
"PC
F
"
)
==
0
)
return
NF_TYPE_PCF
;
if
(
str
.
compare
(
"SMSF"
)
==
0
)
return
NF_TYPE_SMSF
;
if
(
str
.
compare
(
"NSSF"
)
==
0
)
return
NF_TYPE_NSSF
;
if
(
str
.
compare
(
"UDR"
)
==
0
)
return
NF_TYPE_UDR
;
...
...
src/nrf_app/nrf_app.cpp
View file @
11678473
...
...
@@ -148,6 +148,10 @@ void nrf_app::handle_register_nf_instance(
sn
=
std
::
make_shared
<
udr_profile
>
(
m_event_sub
);
}
break
;
case
NF_TYPE_PCF
:
{
sn
=
std
::
make_shared
<
pcf_profile
>
(
m_event_sub
);
}
break
;
default:
{
sn
=
std
::
make_shared
<
nrf_profile
>
(
m_event_sub
);
}
...
...
src/nrf_app/nrf_jwt.cpp
View file @
11678473
...
...
@@ -44,13 +44,15 @@ bool nrf_jwt::generate_signature(
get_secret_key
(
scope
,
nf_type
,
target_nf_type
,
key
);
// Create JWT object
// TODO
jwt
::
jwt_object
obj
{
jwt
::
params
::
algorithm
(
"HS256"
),
jwt
::
params
::
payload
({{
"iss"
,
nrf_instance_id
},
{
"sub"
,
nf_consumer_id
},
{
"aud"
,
target_nf_type
},
{
"scope"
,
scope
},
{
"exp"
,
"1000"
}}),
// in second
jwt
::
params
::
secret
(
key
)};
jwt
::
jwt_object
obj
{
jwt
::
params
::
algorithm
(
"HS256"
),
jwt
::
params
::
payload
(
{{
"iss"
,
nrf_instance_id
},
{
"sub"
,
nf_consumer_id
},
{
"aud"
,
target_nf_type
},
{
"scope"
,
scope
},
{
"exp"
,
"1000"
}}),
// in second
jwt
::
params
::
secret
(
key
)};
// Get the encoded string/assertion
signature
=
obj
.
signature
();
...
...
@@ -66,13 +68,15 @@ bool nrf_jwt::generate_signature(
get_secret_key
(
scope
,
target_nf_instance_Id
,
key
);
// Create JWT object
// TODO
jwt
::
jwt_object
obj
{
jwt
::
params
::
algorithm
(
"HS256"
),
jwt
::
params
::
payload
({{
"iss"
,
nrf_instance_id
},
{
"sub"
,
nf_consumer_id
},
{
"aud"
,
target_nf_instance_Id
},
{
"scope"
,
scope
},
{
"exp"
,
"1000"
}}),
// in second
jwt
::
params
::
secret
(
key
)};
jwt
::
jwt_object
obj
{
jwt
::
params
::
algorithm
(
"HS256"
),
jwt
::
params
::
payload
(
{{
"iss"
,
nrf_instance_id
},
{
"sub"
,
nf_consumer_id
},
{
"aud"
,
target_nf_instance_Id
},
{
"scope"
,
scope
},
{
"exp"
,
"1000"
}}),
// in second
jwt
::
params
::
secret
(
key
)};
// Get the encoded string/assertion
signature
=
obj
.
signature
();
...
...
@@ -103,8 +107,8 @@ void nrf_jwt::test_jwt() {
auto
key
=
"secret"
;
// Secret to use for the algorithm
// Create JWT object
jwt
::
jwt_object
obj
{
algorithm
(
"HS256"
),
payload
({{
"some"
,
"payload"
}}),
secret
(
key
)};
jwt
::
jwt_object
obj
{
algorithm
(
"HS256"
),
payload
({{
"some"
,
"payload"
}}),
secret
(
key
)};
// Get the encoded string/assertion
auto
enc_str
=
obj
.
signature
();
...
...
src/nrf_app/nrf_profile.cpp
View file @
11678473
...
...
@@ -1599,3 +1599,145 @@ void udr_profile::to_json(nlohmann::json& data) const {
data
[
"udrInfo"
][
"routingIndicators"
].
push_back
(
data_set_id
);
}
}
//------------------------------------------------------------------------------
void
pcf_profile
::
add_pcf_info
(
const
pcf_info_t
&
info
)
{
pcf_info
=
info
;
}
//------------------------------------------------------------------------------
void
pcf_profile
::
get_pcf_info
(
pcf_info_t
&
infos
)
const
{
infos
=
pcf_info
;
}
//------------------------------------------------------------------------------
void
pcf_profile
::
display
()
{
nrf_profile
::
display
();
Logger
::
nrf_app
().
debug
(
"
\t
UDR Info"
);
Logger
::
nrf_app
().
debug
(
"
\t\t
GroupId: %s"
,
pcf_info
.
groupid
.
c_str
());
for
(
auto
dnn
:
pcf_info
.
dnn_list
)
{
Logger
::
nrf_app
().
debug
(
"
\t\t
DNN: %s"
,
dnn
.
c_str
());
}
for
(
auto
supi
:
pcf_info
.
supi_ranges
)
{
Logger
::
nrf_app
().
debug
(
"
\t\t
SupiRanges: Start - %s, End - %s, Pattern - %s"
,
supi
.
supi_range
.
start
.
c_str
(),
supi
.
supi_range
.
end
.
c_str
(),
supi
.
supi_range
.
pattern
.
c_str
());
}
for
(
auto
gpsiRange
:
pcf_info
.
gpsi_ranges
)
{
Logger
::
nrf_app
().
debug
(
"
\t\t
GpsiRanges: Start - %s, End - %s, Pattern - %s"
,
gpsiRange
.
identity_range
.
start
.
c_str
(),
gpsiRange
.
identity_range
.
end
.
c_str
(),
gpsiRange
.
identity_range
.
pattern
.
c_str
());
}
}
//------------------------------------------------------------------------------
bool
pcf_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
(
"pcfInfo"
)
==
0
)
{
Logger
::
nrf_app
().
info
(
"Does not support this operation for pcfInfo"
);
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
(
"pcfInfo"
)
!=
0
))
{
Logger
::
nrf_app
().
debug
(
"Add new member: %s"
,
path
.
c_str
());
// add new member
json_data
[
path
]
=
value
;
return
true
;
}
return
false
;
}
//------------------------------------------------------------------------------
bool
pcf_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 UDMAUSF info
if
(
path
.
compare
(
"pcfInfo"
)
==
0
)
{
Logger
::
nrf_app
().
debug
(
"Does not support this operation for pcfInfo"
);
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
(
"pcfInfo"
)
!=
0
))
{
Logger
::
nrf_app
().
debug
(
"Member (%s) not found!"
,
path
.
c_str
());
return
false
;
}
return
false
;
}
//------------------------------------------------------------------------------
bool
pcf_profile
::
remove_profile_info
(
const
std
::
string
&
path
)
{
bool
result
=
nrf_profile
::
remove_profile_info
(
path
);
if
(
result
)
return
true
;
// for UDM info
if
(
path
.
compare
(
"pcfInfo"
)
==
0
)
{
Logger
::
nrf_app
().
debug
(
"Do not support this operation for pcfInfo"
);
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
(
"pcfInfo"
)
!=
0
))
{
Logger
::
nrf_app
().
debug
(
"Member (%s) not found!"
,
path
.
c_str
());
return
false
;
}
return
false
;
}
//------------------------------------------------------------------------------
void
pcf_profile
::
to_json
(
nlohmann
::
json
&
data
)
const
{
nrf_profile
::
to_json
(
data
);
// UDR Info
data
[
"pcfInfo"
][
"groupId"
]
=
pcf_info
.
groupid
;
data
[
"pcfInfo"
][
"dnnList"
]
=
nlohmann
::
json
::
array
();
data
[
"pcfInfo"
][
"supiRanges"
]
=
nlohmann
::
json
::
array
();
data
[
"pcfInfo"
][
"gpsiRanges"
]
=
nlohmann
::
json
::
array
();
for
(
auto
supi
:
pcf_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
[
"pcfInfo"
][
"supiRanges"
].
push_back
(
tmp
);
}
for
(
auto
gpsi
:
pcf_info
.
gpsi_ranges
)
{
nlohmann
::
json
tmp
=
{};
tmp
[
"start"
]
=
gpsi
.
identity_range
.
start
;
tmp
[
"end"
]
=
gpsi
.
identity_range
.
end
;
tmp
[
"pattern"
]
=
gpsi
.
identity_range
.
pattern
;
data
[
"pcfInfo"
][
"gpsiRanges"
].
push_back
(
tmp
);
}
for
(
auto
dnn
:
pcf_info
.
dnn_list
)
{
data
[
"pcfInfo"
][
"dnnList"
].
push_back
(
dnn
);
}
}
\ No newline at end of file
src/nrf_app/nrf_profile.hpp
View file @
11678473
...
...
@@ -981,6 +981,73 @@ class udr_profile : public nrf_profile {
udr_info_t
udr_info
;
};
class
pcf_profile
:
public
nrf_profile
{
public:
pcf_profile
(
nrf_event
&
ev
)
:
nrf_profile
(
ev
,
NF_TYPE_PCF
)
{
pcf_info
=
{};
}
pcf_profile
(
nrf_event
&
ev
,
const
std
::
string
&
id
)
:
nrf_profile
(
ev
,
id
)
{
nf_type
=
NF_TYPE_PCF
;
pcf_info
=
{};
}
pcf_profile
(
pcf_profile
&
b
)
=
delete
;
/*
* Add a PCF info
* @param [const pcf_info_t &] info: PCF info
* @return void
*/
void
add_pcf_info
(
const
pcf_info_t
&
info
);
/*
* Get list of PCF infos a PCF info
* @param [const pcf_info_t &] info: pcf info
* @return void
*/
void
get_pcf_info
(
pcf_info_t
&
infos
)
const
;
/*
* Print related-information for a PCF profile
* @param void
* @return void:
*/
void
display
();
/*
* Update a new value for a member of PCF 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 PCF 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 PCF 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 PCF profile as json object
* @param [nlohmann::json &] data: Json data
* @return void
*/
void
to_json
(
nlohmann
::
json
&
data
)
const
;
private:
pcf_info_t
pcf_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