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
e524ce7b
Commit
e524ce7b
authored
Dec 19, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
send notifications to subscribed NF
parent
e4b232e3
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
46 additions
and
20 deletions
+46
-20
src/common/3gpp_29.510.h
src/common/3gpp_29.510.h
+1
-1
src/common/utils/api_conversions.cpp
src/common/utils/api_conversions.cpp
+14
-4
src/nrf_app/nrf_app.cpp
src/nrf_app/nrf_app.cpp
+29
-7
src/nrf_app/nrf_client.cpp
src/nrf_app/nrf_client.cpp
+0
-2
src/oai-nrf/main.cpp
src/oai-nrf/main.cpp
+0
-4
yaml/cmd.txt
yaml/cmd.txt
+2
-2
No files found.
src/common/3gpp_29.510.h
View file @
e524ce7b
...
...
@@ -30,7 +30,7 @@ enum class nf_status_e { REGISTERED = 0, SUSPENDED = 1, UNDISCOVERABLE = 2 };
static
const
std
::
vector
<
std
::
string
>
nf_status_e2str
=
{
"REGISTERED"
,
"SUSPENDED"
,
"UNDISCOVERABLE"
};
enum
subscr
iption_condition_type_e
{
enum
subscr
_condition_type_e
{
//TODO: use enum class
UNKNOWN_CONDITION
=
0
,
NF_INSTANCE_ID_COND
=
1
,
NF_TYPE_COND
=
2
,
...
...
src/common/utils/api_conversions.cpp
View file @
e524ce7b
...
...
@@ -233,8 +233,9 @@ bool api_conv::subscription_api_to_nrf_subscription(
if
(
sub_condition_api
.
find
(
"NfInstanceIdCond"
)
!=
sub_condition_api
.
end
())
{
sub_condition
.
type
=
NF_INSTANCE_ID_COND
;
sub_condition
.
nf_instance_id
=
sub_condition_api
[
"NfInstanceIdCond"
][
"nfInstanceId"
]
.
get
<
std
::
string
>
();
sub_condition
.
nf_instance_id
=
sub_condition_api
[
"NfInstanceIdCond"
][
"nfInstanceId"
]
.
get
<
std
::
string
>
();
Logger
::
nrf_app
().
debug
(
"Subscription condition type: NfInstanceIdCond, nfInstanceId: %s"
,
sub_condition
.
nf_instance_id
.
c_str
());
...
...
@@ -251,7 +252,9 @@ bool api_conv::subscription_api_to_nrf_subscription(
if
(
sub_condition_api
.
find
(
"ServiceNameCond"
)
!=
sub_condition_api
.
end
())
{
sub_condition
.
type
=
SERVICE_NAME_COND
;
sub_condition
.
service_name
=
sub_condition_api
[
"ServiceNameCond"
][
"serviceName"
].
get
<
std
::
string
>
();
sub_condition
.
service_name
=
sub_condition_api
[
"ServiceNameCond"
][
"serviceName"
]
.
get
<
std
::
string
>
();
Logger
::
nrf_app
().
debug
(
"Subscription condition type: ServiceNameCond, serviceName: %s"
,
sub_condition
.
service_name
.
c_str
());
...
...
@@ -278,8 +281,15 @@ bool api_conv::subscription_api_to_nrf_subscription(
"Subscription condition type: %s"
,
subscription_condition_type_e2str
[
sub_condition
.
type
].
c_str
());
sub
.
get
()
->
set_sub_condition
(
sub_condition
);
if
(
sub_condition
.
type
!=
UNKNOWN_CONDITION
)
{
sub
.
get
()
->
set_sub_condition
(
sub_condition
);
return
true
;
}
else
{
return
false
;
}
}
// TODO:
return
true
;
}
...
...
src/nrf_app/nrf_app.cpp
View file @
e524ce7b
...
...
@@ -34,6 +34,7 @@
#include "api_conversions.hpp"
#include "common_defs.h"
#include "logger.hpp"
#include "nrf_client.hpp"
#include "nrf_config.hpp"
using
namespace
oai
::
nrf
::
app
;
...
...
@@ -42,14 +43,24 @@ using namespace std::chrono;
extern
nrf_app
*
nrf_app_inst
;
extern
nrf_config
nrf_cfg
;
nrf_client
*
nrf_client_inst
=
nullptr
;
//------------------------------------------------------------------------------
nrf_app
::
nrf_app
(
const
std
::
string
&
config_file
,
nrf_event
&
ev
)
:
m_event_sub
(
ev
)
{
Logger
::
nrf_app
().
startup
(
"Starting..."
);
Logger
::
nrf_app
().
startup
(
"Started"
);
//subscribe to NF status
try
{
nrf_client_inst
=
new
nrf_client
();
}
catch
(
std
::
exception
&
e
)
{
Logger
::
nrf_app
().
error
(
"Cannot create NRF_APP: %s"
,
e
.
what
());
throw
;
}
// subscribe to NF status
subscribe_nf_status
();
Logger
::
nrf_app
().
startup
(
"Started"
);
}
//------------------------------------------------------------------------------
...
...
@@ -313,7 +324,7 @@ void nrf_app::handle_create_subscription(
ss
.
get
()
->
set_subscription_id
(
evsub_id
);
// subscribe to NF status registered
// subscribe_nf_status(evsub_id); // from nrf_app
// subscribe_nf_status(evsub_id); // from nrf_app
// subscribe to NF status change
// ss.get()->subscribe_nf_status_change(); //from subscription
// add to the DB
...
...
@@ -550,9 +561,21 @@ void nrf_app::subscribe_nf_status_registered() {
void
nrf_app
::
handle_nf_status_registered
(
const
std
::
string
&
profile_id
)
{
Logger
::
nrf_app
().
info
(
"Handle NF status registered, profile id %s"
,
profile_id
.
c_str
());
std
::
vector
<
std
::
string
>
notification_uris
=
{};
get_subscription_list
(
profile_id
,
NOTIFICATION_TYPE_NF_REGISTERED
,
notification_uris
);
std
::
shared_ptr
<
nrf_profile
>
profile
=
{};
find_nf_profile
(
profile_id
,
profile
);
if
(
profile
!=
nullptr
)
{
std
::
vector
<
std
::
string
>
notification_uris
=
{};
get_subscription_list
(
profile_id
,
NOTIFICATION_TYPE_NF_REGISTERED
,
notification_uris
);
// send notifications
nrf_client_inst
->
notify_subscribed_event
(
profile
,
notification_uris
);
}
else
{
Logger
::
nrf_app
().
error
(
"NF profile not found, profile id %s"
,
profile_id
.
c_str
());
}
// TODO:
}
...
...
@@ -672,7 +695,6 @@ void nrf_app::get_subscription_list(const std::string &profile_id,
// TODO:
}
}
}
// TODO:
}
src/nrf_app/nrf_client.cpp
View file @
e524ce7b
...
...
@@ -35,12 +35,10 @@
#include <nlohmann/json.hpp>
#include "logger.hpp"
#include "nrf_client.hpp"
using
namespace
Pistache
::
Http
;
using
namespace
Pistache
::
Http
::
Mime
;
using
namespace
oai
::
nrf
::
app
;
using
json
=
nlohmann
::
json
;
...
...
src/oai-nrf/main.cpp
View file @
e524ce7b
...
...
@@ -37,7 +37,6 @@ using namespace util;
using
namespace
std
;
nrf_app
*
nrf_app_inst
=
nullptr
;
nrf_client
*
nrf_client_inst
=
nullptr
;
nrf_config
nrf_cfg
;
NRFApiServer
*
api_server
=
nullptr
;
...
...
@@ -94,9 +93,6 @@ if ( !Options::parse( argc, argv ) )
// NRF application layer
nrf_app_inst
=
new
nrf_app
(
Options
::
getlibconfigConfig
(),
ev
);
// NRF client
nrf_client_inst
=
new
nrf_client
();
//Task Manager
task_manager
tm
(
ev
);
std
::
thread
task_manager_thread
(
&
task_manager
::
run
,
&
tm
);
...
...
yaml/cmd.txt
View file @
e524ce7b
...
...
@@ -3,5 +3,5 @@ curl -X GET "http://192.168.1.23/nnrf-nfm/v1/nf-instances?nf-type="serviceId1"&
curl -X PATCH -H "Content-Type: application/json" http://192.168.1.23/nnrf-nfm/v1/nf-instances/343a924e-6494-4927-860b-d45692c95c2d -d '[{"op":"replace","path":"/nfInstanceName", "value": "NEW NAME"}]'
curl -X POST http://192.168.1.23/nnrf-nfm/v1/subscriptions -d '{"nfStatusNotificationUri":"http://192.168.1.23/nnrf-nfm/v1/nf-instances/343a924e-6494-4927-860b-d45692c95c2d", "subscrCond": {"
nfType": "AMF"
} }'
curl -X POST http://192.168.1.23/nnrf-nfm/v1/subscriptions -d '{"nfStatusNotificationUri":"http://192.168.1.23/nnrf-nfm/v1/nf-instances/343a924e-6494-4927-860b-d45692c95c2d", "subscrCond": {"NfTypeCond": {"nfType":"AMF"} } }'
curl -X POST http://192.168.1.23/nnrf-nfm/v1/subscriptions -d '{"nfStatusNotificationUri":"http://192.168.1.23/nnrf-nfm/v1/nf-instances/343a924e-6494-4927-860b-d45692c95c2d", "subscrCond": {"
NfInstanceIdCond": {"nfInstanceId":"AMF"}
} }'
\ No newline at end of file
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