Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-NWDAF
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-NWDAF
Commits
b0674ee3
Commit
b0674ee3
authored
Jul 27, 2021
by
yangjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add context
parent
f143657b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
45 deletions
+82
-45
src/nwdaf-app/nwdaf_app.cpp
src/nwdaf-app/nwdaf_app.cpp
+44
-14
src/nwdaf-app/nwdaf_app.hpp
src/nwdaf-app/nwdaf_app.hpp
+6
-12
src/nwdaf-server/impl/NWDAFAnalyticsDocumentApiImpl.cpp
src/nwdaf-server/impl/NWDAFAnalyticsDocumentApiImpl.cpp
+32
-19
No files found.
src/nwdaf-app/nwdaf_app.cpp
View file @
b0674ee3
...
...
@@ -410,10 +410,6 @@ bool nwdaf_app::get_data_from_udsf_database(std::string const& imsi, nf_message&
//------------------------------------------------------------------------------
void
nwdaf_app
::
handler_polling_get_information
()
{
// Logger::nwdaf_app().info("****** TASK_AMF_APP_PERIODIC_GETINFO ******");
set_test_value
();
uint32_t
value
=
get_test_value
();
Logger
::
nwdaf_app
().
info
(
"test_value = %d"
,
value
);
// Get "gNB" data
if
(
nwdaf_cfg
.
gnbIsSet
)
...
...
@@ -444,6 +440,10 @@ void nwdaf_app::handler_polling_get_information() {
to_json
(
j
,
nf_msgs
);
std
::
string
out
=
j
.
dump
();
Logger
::
nwdaf_app
().
info
(
"[%d] nf_msgs: %s"
,
i
,
out
.
c_str
());
//context
set_imsi_2_nf_context
(
udm_msgs
[
i
].
getImsi
(),
nf_msgs
);
}
//
...
...
@@ -463,19 +463,49 @@ void nwdaf_app::handler_polling_get_information() {
}
//------------------------------------------------------------------------------
void
nwdaf_app
::
set_test_value
()
{
std
::
shared_lock
lock
(
m_test_value
);
std
::
shared_ptr
<
nf_message
>
nwdaf_app
::
imsi_2_nf_context
(
const
std
::
string
&
imsi
)
const
{
std
::
shared_lock
lock
(
m_nfcontext
);
test_value
++
;
return
nfcontext
.
at
(
imsi
);
}
if
(
test_value
==
0xFF
)
{
Logger
::
nwdaf_app
().
info
(
"test_value clear"
);
test_value
=
0
;
}
//------------------------------------------------------------------------------
bool
nwdaf_app
::
is_imsi_2_nf_context
(
const
std
::
string
&
imsi
)
const
{
std
::
shared_lock
lock
(
m_nfcontext
);
return
bool
{
nfcontext
.
count
(
imsi
)
>
0
};
}
//------------------------------------------------------------------------------
void
nwdaf_app
::
set_imsi_2_nf_context
(
const
std
::
string
&
imsi
,
const
nf_message
&
msgs
)
{
std
::
unique_lock
<
std
::
shared_mutex
>
lock
(
m_nfcontext
);
std
::
shared_ptr
<
nf_message
>
nc
;
if
(
nfcontext
.
count
(
imsi
)
>
0
)
{
nc
=
nfcontext
.
at
(
imsi
);
}
else
{
nc
=
std
::
shared_ptr
<
nf_message
>
(
new
nf_message
());
}
*
(
nc
.
get
())
=
msgs
;
nfcontext
[
imsi
]
=
nc
;
}
//------------------------------------------------------------------------------
uint32_t
nwdaf_app
::
get_test_value
()
{
std
::
shared_lock
lock
(
m_test_value
);
return
test_value
;
bool
nwdaf_app
::
get_nf_context
(
std
::
vector
<
nf_message
>
&
vec
)
{
std
::
shared_lock
lock
(
m_nfcontext
);
std
::
map
<
std
::
string
,
std
::
shared_ptr
<
nf_message
>>::
reverse_iterator
iter
;
for
(
iter
=
nfcontext
.
rbegin
();
iter
!=
nfcontext
.
rend
();
iter
++
)
{
vec
.
push_back
(
*
(
iter
->
second
.
get
()));
}
return
true
;
}
src/nwdaf-app/nwdaf_app.hpp
View file @
b0674ee3
...
...
@@ -60,13 +60,10 @@ class nwdaf_app {
void
handler_polling_get_information
();
// context management
// std::shared_ptr<ue_ngap_context> ran_ue_id_2_ue_ngap_context( const
// uint32_t& ran_ue_ngap_id) const; bool
// is_ran_ue_id_2_ue_ngap_context(const uint32_t& ran_ue_ngap_id) const;
// void set_ran_ue_ngap_id_2_ue_ngap_context( const uint32_t&
// ran_ue_ngap_id, std::shared_ptr<ue_ngap_context> unc);
void
set_test_value
();
uint32_t
get_test_value
();
std
::
shared_ptr
<
nf_message
>
imsi_2_nf_context
(
const
std
::
string
&
imsi
)
const
;
bool
is_imsi_2_nf_context
(
const
std
::
string
&
imsi
)
const
;
void
set_imsi_2_nf_context
(
const
std
::
string
&
imsi
,
const
nf_message
&
msgs
);
bool
get_nf_context
(
std
::
vector
<
nf_message
>
&
vec
);
void
get_ue_from_gNB
(
gnb_msg
&
value
);
void
get_gain_from_gNB
(
gnb_gain
&
value
);
...
...
@@ -79,11 +76,8 @@ class nwdaf_app {
private:
// context variable
// std::map<uint32_t, std::shared_ptr<ue_ngap_context>>
// ranid2uecontext; // ran ue ngap id
// mutable std::shared_mutex m_ranid2uecontext;
uint32_t
test_value
=
0
;
mutable
std
::
shared_mutex
m_test_value
;
std
::
map
<
std
::
string
,
std
::
shared_ptr
<
nf_message
>>
nfcontext
;
mutable
std
::
shared_mutex
m_nfcontext
;
};
}
// namespace nwdaf_application
...
...
src/nwdaf-server/impl/NWDAFAnalyticsDocumentApiImpl.cpp
View file @
b0674ee3
...
...
@@ -16,6 +16,8 @@
#include "nwdaf_app.hpp"
using
namespace
nwdaf_application
;
using
namespace
nf_msg
;
extern
nwdaf_app
*
nwdaf_app_inst
;
...
...
@@ -37,28 +39,39 @@ void NWDAFAnalyticsDocumentApiImpl::get_nwdaf_analytics(const Pistache::Optional
//Logger::nwdaf_server().info("eventId = %d",eventId.get().getEventId());
if
(
eventId
.
get
().
getEventId
()
==
1
)
{
nwdaf_app_inst
->
set_test_value
();
}
else
if
(
eventId
.
get
().
getEventId
()
==
2
)
{
Logger
::
nwdaf_server
().
info
(
"test_value = %d"
,
nwdaf_app_inst
->
get_test_value
());
std
::
vector
<
nf_message
>
list
;
nwdaf_app_inst
->
get_nf_context
(
list
);
}
bool
is_AnalyticsData
=
true
;
if
(
is_AnalyticsData
)
{
//response.send(Pistache::Http::Code::Ok, "Do some magic\n");
std
::
string
value_str
=
std
::
to_string
(
nwdaf_app_inst
->
get_test_value
());
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
value_str
.
c_str
(),
value_str
.
size
());
}
else
nlohmann
::
json
j
,
tmp_j
;
if
(
list
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++
)
{
response
.
send
(
Pistache
::
Http
::
Code
::
No_Content
,
""
);
Logger
::
nwdaf_server
().
warn
(
"Analytics Data does not exis!"
)
;
to_json
(
tmp_j
,
list
[
i
]
);
j
+=
tmp_j
;
}
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
j
.
dump
());
}
else
{
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"[]"
);
}
// bool is_AnalyticsData = true;
// if(is_AnalyticsData)
// {
// //response.send(Pistache::Http::Code::Ok, "Do some magic\n");
// //std::string value_str = std::to_string(nwdaf_app_inst->get_test_value());
//
// response.send(Pistache::Http::Code::Ok, value_str.c_str(),value_str.size());
// }
// else
// {
// response.send(Pistache::Http::Code::No_Content, "");
// Logger::nwdaf_server().warn("Analytics Data does not exis!");
// }
}
}
...
...
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