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
f02027a7
Commit
f02027a7
authored
Jan 11, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fix for NF Deregister
parent
421287b2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
32 deletions
+33
-32
src/api-server/impl/NFInstanceIDDocumentApiImpl.cpp
src/api-server/impl/NFInstanceIDDocumentApiImpl.cpp
+2
-1
src/nrf_app/nrf_app.cpp
src/nrf_app/nrf_app.cpp
+22
-26
src/nrf_app/nrf_app.hpp
src/nrf_app/nrf_app.hpp
+2
-2
src/nrf_app/nrf_event.cpp
src/nrf_app/nrf_event.cpp
+1
-1
src/nrf_app/nrf_event.hpp
src/nrf_app/nrf_event.hpp
+2
-2
src/nrf_app/nrf_event_sig.hpp
src/nrf_app/nrf_event_sig.hpp
+4
-0
No files found.
src/api-server/impl/NFInstanceIDDocumentApiImpl.cpp
View file @
f02027a7
...
...
@@ -143,8 +143,9 @@ void NFInstanceIDDocumentApiImpl::register_nf_instance(
void
NFInstanceIDDocumentApiImpl
::
update_nf_instance
(
const
std
::
string
&
nfInstanceID
,
const
std
::
vector
<
PatchItem
>
&
patchItem
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
Logger
::
nrf_sbi
().
info
(
""
);
Logger
::
nrf_sbi
().
info
(
"
\n
Got a request to update an NF instance, Instance ID: %s"
,
"Got a request to update an NF instance, Instance ID: %s"
,
nfInstanceID
.
c_str
());
int
http_code
=
0
;
...
...
src/nrf_app/nrf_app.cpp
View file @
f02027a7
...
...
@@ -248,8 +248,7 @@ void nrf_app::handle_update_nf_instance(
std
::
chrono
::
system_clock
::
now
().
time_since_epoch
())
.
count
();
Logger
::
nrf_app
().
debug
(
"NF update for Heartbeat, current time %ld"
,
ms
);
Logger
::
nrf_app
().
debug
(
"NF update for Heartbeat, current time %ld"
,
ms
);
// If this happens before the first Heartbeattimer expires -> remove this
// timer
if
(
sn
.
get
()
->
unsubscribe_heartbeat_timeout_nfregistration
())
{
...
...
@@ -357,13 +356,18 @@ void nrf_app::handle_deregister_nf_instance(const std::string &nf_instance_id,
Logger
::
nrf_app
().
info
(
"Handle Deregister an NF Instance (HTTP version %d)"
,
http_version
);
if
(
is_profile_exist
(
nf_instance_id
))
{
std
::
shared_ptr
<
nrf_profile
>
profile
=
{};
profile
=
find_nf_profile
(
nf_instance_id
);
if
(
profile
.
get
()
!=
nullptr
)
{
// TODO: notify NF status changed event
// Notify NF status deregistered event
m_event_sub
.
nf_status_deregistered
(
profile
);
// from nrf_app
if
(
remove_nf_profile
(
nf_instance_id
))
{
Logger
::
nrf_app
().
debug
(
"Removed NF profile with profile ID %s"
,
nf_instance_id
.
c_str
());
http_code
=
HTTP_STATUS_CODE_204_NO_CONTENT
;
// Notify NF status change event
m_event_sub
.
nf_status_deregistered
(
nf_instance_id
);
// from nrf_app
return
;
}
else
{
http_code
=
HTTP_STATUS_CODE_500_INTERNAL_SERVER_ERROR
;
...
...
@@ -940,28 +944,20 @@ void nrf_app::subscribe_nf_status_deregistered() {
}
//------------------------------------------------------------------------------
void
nrf_app
::
handle_nf_status_deregistered
(
const
std
::
string
&
profile_id
)
{
void
nrf_app
::
handle_nf_status_deregistered
(
const
std
::
shared_ptr
<
nrf_profile
>
&
p
)
{
Logger
::
nrf_app
().
info
(
"Handle NF status deregistered event, profile id %s"
,
profile_id
.
c_str
());
std
::
shared_ptr
<
nrf_profile
>
profile
=
{};
Logger
::
nrf_app
().
info
(
"
\t
Find a NF profile with ID %s"
,
profile_id
.
c_str
());
find_nf_profile
(
profile_id
,
profile
);
if
(
profile
.
get
()
!=
nullptr
)
{
std
::
vector
<
std
::
string
>
notification_uris
=
{};
get_subscription_list
(
profile_id
,
NOTIFICATION_TYPE_NF_DEREGISTERED
,
notification_uris
);
// send notifications
if
(
notification_uris
.
size
()
>
0
)
nrf_client_inst
->
notify_subscribed_event
(
profile
,
NOTIFICATION_TYPE_NF_DEREGISTERED
,
notification_uris
);
else
Logger
::
nrf_app
().
debug
(
"
\t
No subscription found"
);
}
else
{
Logger
::
nrf_app
().
error
(
"NF profile not found, profile id %s"
,
profile_id
.
c_str
());
}
p
.
get
()
->
get_nf_instance_id
().
c_str
());
std
::
vector
<
std
::
string
>
notification_uris
=
{};
get_subscription_list
(
p
.
get
()
->
get_nf_instance_id
(),
NOTIFICATION_TYPE_NF_DEREGISTERED
,
notification_uris
);
// send notifications
if
(
notification_uris
.
size
()
>
0
)
nrf_client_inst
->
notify_subscribed_event
(
p
,
NOTIFICATION_TYPE_NF_DEREGISTERED
,
notification_uris
);
else
Logger
::
nrf_app
().
debug
(
"
\t
No subscription found"
);
}
//------------------------------------------------------------------------------
...
...
src/nrf_app/nrf_app.hpp
View file @
f02027a7
...
...
@@ -373,10 +373,10 @@ class nrf_app {
/*
* Handle NF status deregistered event
* @param [const std::s
tring &] profile_id: Profile ID of
the deregistered NF
* @param [const std::s
hared_ptr<nrf_profile> &] profile: pointer to
the deregistered NF
* @return void
*/
void
handle_nf_status_deregistered
(
const
std
::
s
tring
&
profile_id
);
void
handle_nf_status_deregistered
(
const
std
::
s
hared_ptr
<
nrf_profile
>
&
p
);
/*
* Subscribe to the event when a registered NF changes its profile
...
...
src/nrf_app/nrf_event.cpp
View file @
f02027a7
...
...
@@ -78,7 +78,7 @@ bs2::connection nrf_event::subscribe_nf_status_registered(
//------------------------------------------------------------------------------
bs2
::
connection
nrf_event
::
subscribe_nf_status_deregistered
(
const
nf_
status
_sig_t
::
slot_type
&
sig
)
{
const
nf_
deregistered
_sig_t
::
slot_type
&
sig
)
{
return
nf_status_deregistered
.
connect
(
sig
);
}
...
...
src/nrf_app/nrf_event.hpp
View file @
f02027a7
...
...
@@ -95,7 +95,7 @@ class nrf_event {
const
nf_status_sig_t
::
slot_type
&
sig
);
bs2
::
connection
subscribe_nf_status_deregistered
(
const
nf_
status
_sig_t
::
slot_type
&
sig
);
const
nf_
deregistered
_sig_t
::
slot_type
&
sig
);
bs2
::
connection
subscribe_nf_status_profile_changed
(
const
nf_status_sig_t
::
slot_type
&
sig
);
...
...
@@ -104,7 +104,7 @@ class nrf_event {
task_sig_t
task_tick
;
nf_status_change_sig_t
nf_status_change
;
nf_status_sig_t
nf_status_registered
;
nf_
status
_sig_t
nf_status_deregistered
;
nf_
deregistered
_sig_t
nf_status_deregistered
;
nf_status_sig_t
nf_status_profile_changed
;
};
}
// namespace app
...
...
src/nrf_app/nrf_event_sig.hpp
View file @
f02027a7
...
...
@@ -50,6 +50,10 @@ typedef bs2::signal_type<void(const std::string &),
bs2
::
keywords
::
mutex_type
<
bs2
::
dummy_mutex
>>::
type
nf_status_sig_t
;
typedef
bs2
::
signal_type
<
void
(
const
std
::
shared_ptr
<
nrf_profile
>
&
p
),
bs2
::
keywords
::
mutex_type
<
bs2
::
dummy_mutex
>>::
type
nf_deregistered_sig_t
;
typedef
bs2
::
signal_type
<
void
(
const
std
::
shared_ptr
<
nrf_profile
>
&
p
),
bs2
::
keywords
::
mutex_type
<
bs2
::
dummy_mutex
>>::
type
nf_status_change_sig_t
;
...
...
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