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
19ba2a63
Commit
19ba2a63
authored
Sep 23, 2022
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Send notification only including active NF profiles to the subscribed NFs
parent
7ae2ec1f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
10 deletions
+27
-10
src/nrf_app/nrf_profile.cpp
src/nrf_app/nrf_profile.cpp
+16
-6
src/nrf_app/nrf_profile.hpp
src/nrf_app/nrf_profile.hpp
+11
-4
No files found.
src/nrf_app/nrf_profile.cpp
View file @
19ba2a63
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
#include "nrf_profile.hpp"
#include "nrf_profile.hpp"
#include <unistd.h>
#include <unistd.h>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/split.hpp>
...
@@ -84,22 +85,31 @@ nf_type_t nrf_profile::get_nf_type() const {
...
@@ -84,22 +85,31 @@ nf_type_t nrf_profile::get_nf_type() const {
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
nrf_profile
::
set_nf_status
(
const
std
::
string
&
status
)
{
void
nrf_profile
::
set_nf_status
(
const
std
::
string
&
status
)
{
Logger
::
nrf_app
().
debug
(
"Set NF status to %s"
,
status
.
c_str
());
Logger
::
nrf_app
().
debug
(
"Set NF status to %s"
,
status
.
c_str
());
std
::
unique_lock
lock
(
heartbeart
_mutex
);
std
::
unique_lock
lock
(
nf_profile
_mutex
);
nf_status
=
status
;
nf_status
=
status
;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
nrf_profile
::
get_nf_status
(
std
::
string
&
status
)
const
{
void
nrf_profile
::
get_nf_status
(
std
::
string
&
status
)
const
{
std
::
shared_lock
lock
(
heartbeart
_mutex
);
std
::
shared_lock
lock
(
nf_profile
_mutex
);
status
=
nf_status
;
status
=
nf_status
;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
std
::
string
nrf_profile
::
get_nf_status
()
const
{
std
::
string
nrf_profile
::
get_nf_status
()
const
{
std
::
shared_lock
lock
(
heartbeart
_mutex
);
std
::
shared_lock
lock
(
nf_profile
_mutex
);
return
nf_status
;
return
nf_status
;
}
}
//------------------------------------------------------------------------------
bool
nrf_profile
::
is_nf_active
()
const
{
std
::
shared_lock
lock
(
nf_profile_mutex
);
if
(
boost
::
iequals
(
nf_status
,
"REGISTERED"
))
{
return
true
;
}
return
false
;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
nrf_profile
::
set_nf_heartBeat_timer
(
const
int32_t
&
timer
)
{
void
nrf_profile
::
set_nf_heartBeat_timer
(
const
int32_t
&
timer
)
{
heartBeat_timer
=
timer
;
heartBeat_timer
=
timer
;
...
@@ -755,19 +765,19 @@ void nrf_profile::handle_heartbeart_timeout_nfupdate(uint64_t ms) {
...
@@ -755,19 +765,19 @@ void nrf_profile::handle_heartbeart_timeout_nfupdate(uint64_t ms) {
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
nrf_profile
::
set_status_updated
(
bool
status
)
{
void
nrf_profile
::
set_status_updated
(
bool
status
)
{
std
::
unique_lock
lock
(
heartbeart
_mutex
);
std
::
unique_lock
lock
(
nf_profile
_mutex
);
is_updated
=
status
;
is_updated
=
status
;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
nrf_profile
::
get_status_updated
(
bool
&
status
)
{
void
nrf_profile
::
get_status_updated
(
bool
&
status
)
{
std
::
shared_lock
lock
(
heartbeart
_mutex
);
std
::
shared_lock
lock
(
nf_profile
_mutex
);
status
=
is_updated
;
status
=
is_updated
;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
bool
nrf_profile
::
get_status_updated
()
{
bool
nrf_profile
::
get_status_updated
()
{
std
::
shared_lock
lock
(
heartbeart
_mutex
);
std
::
shared_lock
lock
(
nf_profile
_mutex
);
return
is_updated
;
return
is_updated
;
}
}
...
...
src/nrf_app/nrf_profile.hpp
View file @
19ba2a63
...
@@ -64,7 +64,7 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
...
@@ -64,7 +64,7 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
priority
(
0
),
priority
(
0
),
capacity
(
0
),
capacity
(
0
),
nf_services
(),
nf_services
(),
heartbeart
_mutex
()
{
nf_profile
_mutex
()
{
nf_instance_name
=
""
;
nf_instance_name
=
""
;
nf_status
=
""
;
nf_status
=
""
;
json_data
=
{};
json_data
=
{};
...
@@ -84,7 +84,7 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
...
@@ -84,7 +84,7 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
priority
(
0
),
priority
(
0
),
capacity
(
0
),
capacity
(
0
),
nf_services
(),
nf_services
(),
heartbeart
_mutex
()
{
nf_profile
_mutex
()
{
nf_instance_name
=
""
;
nf_instance_name
=
""
;
nf_status
=
""
;
nf_status
=
""
;
json_data
=
{};
json_data
=
{};
...
@@ -105,7 +105,7 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
...
@@ -105,7 +105,7 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
capacity
(
0
),
capacity
(
0
),
nf_services
(),
nf_services
(),
nf_type
(
NF_TYPE_UNKNOWN
),
nf_type
(
NF_TYPE_UNKNOWN
),
heartbeart
_mutex
()
{
nf_profile
_mutex
()
{
nf_instance_name
=
""
;
nf_instance_name
=
""
;
nf_status
=
""
;
nf_status
=
""
;
json_data
=
{};
json_data
=
{};
...
@@ -184,6 +184,13 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
...
@@ -184,6 +184,13 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
*/
*/
std
::
string
get_nf_status
()
const
;
std
::
string
get_nf_status
()
const
;
/*
* Verify NF status
* @param
* @return true if NF status is REGISTERED, otherwise return false
*/
bool
is_nf_active
()
const
;
/*
/*
* Get NF type
* Get NF type
* @param
* @param
...
@@ -519,7 +526,7 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
...
@@ -519,7 +526,7 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
// (after NF Registration)
// (after NF Registration)
bool
first_update
;
bool
first_update
;
bool
is_updated
;
bool
is_updated
;
mutable
std
::
shared_mutex
heartbeart
_mutex
;
mutable
std
::
shared_mutex
nf_profile
_mutex
;
// From NFProfile (Section 6.1.6.2.2@3GPP TS 29.510 V16.0.0 (2019-06))
// From NFProfile (Section 6.1.6.2.2@3GPP TS 29.510 V16.0.0 (2019-06))
std
::
string
nf_instance_id
;
std
::
string
nf_instance_id
;
...
...
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