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
e86d2677
Commit
e86d2677
authored
Dec 14, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix issue for task tick
parent
74858891
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
66 additions
and
17 deletions
+66
-17
src/nrf_app/nrf_app.cpp
src/nrf_app/nrf_app.cpp
+11
-4
src/nrf_app/nrf_event.cpp
src/nrf_app/nrf_event.cpp
+1
-0
src/nrf_app/nrf_event.hpp
src/nrf_app/nrf_event.hpp
+2
-0
src/nrf_app/nrf_profile.cpp
src/nrf_app/nrf_profile.cpp
+28
-0
src/nrf_app/nrf_profile.hpp
src/nrf_app/nrf_profile.hpp
+23
-13
src/nrf_app/task_manager.cpp
src/nrf_app/task_manager.cpp
+1
-0
No files found.
src/nrf_app/nrf_app.cpp
View file @
e86d2677
...
...
@@ -81,17 +81,17 @@ void nrf_app::handle_register_nf_instance(
std
::
shared_ptr
<
nrf_profile
>
sn
=
{
};
switch
(
type
)
{
case
NF_TYPE_AMF
:
{
sn
=
std
::
make_shared
<
amf_profile
>
();
sn
=
std
::
make_shared
<
amf_profile
>
(
m_event_sub
);
}
break
;
case
NF_TYPE_SMF
:
{
sn
=
std
::
make_shared
<
smf_profile
>
();
sn
=
std
::
make_shared
<
smf_profile
>
(
m_event_sub
);
}
break
;
default:
{
sn
=
std
::
make_shared
<
nrf_profile
>
();
sn
=
std
::
make_shared
<
nrf_profile
>
(
m_event_sub
);
}
}
...
...
@@ -255,6 +255,13 @@ bool nrf_app::add_nf_profile(const std::string &profile_id,
}*/
//Create or update if profile exist
instance_id2nrf_profile
[
profile_id
]
=
p
;
//get current time
uint64_t
ms
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
std
::
chrono
::
system_clock
::
now
().
time_since_epoch
()).
count
();
p
.
get
()
->
subscribe_task_tick
(
ms
);
return
true
;
}
...
...
@@ -381,7 +388,7 @@ void nrf_app::subscribe_task_tick(uint64_t ms) {
Logger
::
nrf_app
().
debug
(
"subscribe_task_tick1: %d"
,
ms
);
m_event_sub
.
subscribe_task_tick
(
boost
::
bind
(
&
nrf_app
::
handle_heartbeart_timeout
,
this
,
_1
),
interval
,
ms
%
20000
/* start at time 0 */
);
ms
%
20000
/* start at time 0 */
);
}
...
...
src/nrf_app/nrf_event.cpp
View file @
e86d2677
...
...
@@ -30,6 +30,7 @@
#include "nrf_event.hpp"
#include "nrf_app.hpp"
#include "nrf_event_sig.hpp"
#include <iostream>
using
namespace
oai
::
nrf
::
app
;
...
...
src/nrf_app/nrf_event.hpp
View file @
e86d2677
...
...
@@ -42,6 +42,7 @@ namespace nrf {
namespace
app
{
class
task_manager
;
//class nrf_profile;
class
nrf_event
{
...
...
@@ -60,6 +61,7 @@ class nrf_event {
// class register/handle event
friend
class
nrf_app
;
friend
class
task_manager
;
friend
class
nrf_profile
;
bs2
::
connection
subscribe_task_tick
(
const
task_sig_t
::
slot_type
&
sig
,
uint64_t
period
,
uint64_t
start
=
0
);
...
...
src/nrf_app/nrf_profile.cpp
View file @
e86d2677
...
...
@@ -448,6 +448,34 @@ void nrf_profile::to_json(nlohmann::json &data) const {
data
[
"json_data"
]
=
json_data
;
}
//------------------------------------------------------------------------------
void
nrf_profile
::
subscribe_task_tick
(
uint64_t
ms
)
{
struct
itimerspec
its
;
its
.
it_value
.
tv_sec
=
10
;
//seconds
its
.
it_value
.
tv_nsec
=
0
;
//100 * 1000 * 1000; //100ms
const
uint64_t
interval
=
its
.
it_value
.
tv_sec
*
1000
+
its
.
it_value
.
tv_nsec
/
1000000
;
// convert sec, nsec to msec
//uint64_t interval =10;
// m_event_sub.subscribe_task_tick(
// boost::bind<void>(&nrf_app::handle_heartbeart_timeout, _1), interval, 0 /* start at time 0 */);
Logger
::
nrf_app
().
debug
(
"subscribe_task_tick2 %d"
,
ms
);
m_event_sub
.
subscribe_task_tick
(
boost
::
bind
(
&
nrf_profile
::
handle_heartbeart_timeout
,
this
,
_1
),
interval
,
ms
%
10000
/* start at time 0 */
);
}
//------------------------------------------------------------------------------
void
nrf_profile
::
handle_heartbeart_timeout
(
uint64_t
ms
)
{
Logger
::
nrf_app
().
info
(
"NRF PROFILE handle_heartbeart_timeout1 %d, PROFILE ID %s"
,
ms
,
nf_instance_id
.
c_str
());
}
//------------------------------------------------------------------------------
void
amf_profile
::
add_amf_info
(
const
amf_info_t
&
info
)
{
amf_info
=
info
;
...
...
src/nrf_app/nrf_profile.hpp
View file @
e86d2677
...
...
@@ -39,6 +39,7 @@
#include <vector>
#include <nlohmann/json.hpp>
#include "nrf.h"
#include "nrf_event.hpp"
namespace
oai
{
namespace
nrf
{
...
...
@@ -49,8 +50,9 @@ using namespace std;
class
nrf_profile
:
public
std
::
enable_shared_from_this
<
nrf_profile
>
{
public:
nrf_profile
()
nrf_profile
(
nrf_event
&
ev
)
:
m_event_sub
(
ev
),
nf_type
(
NF_TYPE_UNKNOWN
),
heartBeat_timer
(
0
),
snssais
(),
...
...
@@ -61,8 +63,9 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
nf_status
=
""
;
json_data
=
{
};
}
nrf_profile
(
const
nf_type_t
type
)
nrf_profile
(
nrf_event
&
ev
,
const
nf_type_t
type
)
:
m_event_sub
(
ev
),
nf_type
(
type
),
heartBeat_timer
(
0
),
snssais
(),
...
...
@@ -74,8 +77,9 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
json_data
=
{
};
}
nrf_profile
(
const
std
::
string
&
id
)
nrf_profile
(
nrf_event
&
ev
,
const
std
::
string
&
id
)
:
m_event_sub
(
ev
),
nf_instance_id
(
id
),
heartBeat_timer
(
0
),
snssais
(),
...
...
@@ -294,7 +298,8 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
* @param [const std::string &] value: new value
* @return true if success, otherwise false
*/
virtual
bool
replace_profile_info
(
const
std
::
string
&
path
,
const
std
::
string
&
value
);
virtual
bool
replace_profile_info
(
const
std
::
string
&
path
,
const
std
::
string
&
value
);
/*
* Add a new value for a member of NF profile
...
...
@@ -302,7 +307,8 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
* @param [const std::string &] value: new value
* @return true if success, otherwise false
*/
virtual
bool
add_profile_info
(
const
std
::
string
&
path
,
const
std
::
string
&
value
);
virtual
bool
add_profile_info
(
const
std
::
string
&
path
,
const
std
::
string
&
value
);
/*
* Remove value of a member of NF profile
...
...
@@ -312,7 +318,11 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
*/
virtual
bool
remove_profile_info
(
const
std
::
string
&
path
);
virtual
void
to_json
(
nlohmann
::
json
&
data
)
const
;
virtual
void
subscribe_task_tick
(
uint64_t
ms
);
virtual
void
handle_heartbeart_timeout
(
uint64_t
ms
);
protected:
nrf_event
&
m_event_sub
;
//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_name
;
...
...
@@ -394,15 +404,15 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
class
amf_profile
:
public
nrf_profile
{
public:
amf_profile
()
amf_profile
(
nrf_event
&
ev
)
:
nrf_profile
(
NF_TYPE_AMF
)
{
nrf_profile
(
ev
,
NF_TYPE_AMF
)
{
amf_info
=
{
};
}
amf_profile
(
const
std
::
string
&
id
)
amf_profile
(
nrf_event
&
ev
,
const
std
::
string
&
id
)
:
nrf_profile
(
id
)
{
nrf_profile
(
ev
,
id
)
{
nf_type
=
NF_TYPE_AMF
;
amf_info
=
{
};
}
...
...
@@ -465,15 +475,15 @@ class amf_profile : public nrf_profile {
class
smf_profile
:
public
nrf_profile
{
public:
smf_profile
()
smf_profile
(
nrf_event
&
ev
)
:
nrf_profile
(
NF_TYPE_SMF
)
{
nrf_profile
(
ev
,
NF_TYPE_SMF
)
{
smf_info
=
{
};
}
smf_profile
(
const
std
::
string
&
id
)
smf_profile
(
nrf_event
&
ev
,
const
std
::
string
&
id
)
:
nrf_profile
(
id
)
{
nrf_profile
(
ev
,
id
)
{
nf_type
=
NF_TYPE_SMF
;
smf_info
=
{
};
}
...
...
src/nrf_app/task_manager.cpp
View file @
e86d2677
...
...
@@ -66,6 +66,7 @@ void task_manager::manage_tasks() {
while
(
1
)
{
event_sub_
.
task_tick
(
t
);
t
++
;
wait_for_cycle
();
}
}
...
...
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