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
2575d720
Commit
2575d720
authored
Dec 20, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add deregistered/profile_change events/notif_events
parent
15640015
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
484 additions
and
242 deletions
+484
-242
src/api-server/model/SubscriptionData.cpp
src/api-server/model/SubscriptionData.cpp
+6
-2
src/api-server/model/SubscriptionData.h
src/api-server/model/SubscriptionData.h
+4
-3
src/common/3gpp_23.003.h
src/common/3gpp_23.003.h
+2
-0
src/common/3gpp_29.510.h
src/common/3gpp_29.510.h
+75
-5
src/common/nrf.h
src/common/nrf.h
+3
-21
src/common/utils/api_conversions.cpp
src/common/utils/api_conversions.cpp
+19
-4
src/common/utils/assertions.h
src/common/utils/assertions.h
+96
-0
src/nrf_app/nrf_app.cpp
src/nrf_app/nrf_app.cpp
+42
-15
src/nrf_app/nrf_app.hpp
src/nrf_app/nrf_app.hpp
+45
-47
src/nrf_app/nrf_client.cpp
src/nrf_app/nrf_client.cpp
+36
-8
src/nrf_app/nrf_config.hpp
src/nrf_app/nrf_config.hpp
+20
-34
src/nrf_app/nrf_event.hpp
src/nrf_app/nrf_event.hpp
+22
-21
src/nrf_app/nrf_event_sig.hpp
src/nrf_app/nrf_event_sig.hpp
+3
-4
src/nrf_app/nrf_profile.hpp
src/nrf_app/nrf_profile.hpp
+48
-66
src/nrf_app/nrf_subscription.cpp
src/nrf_app/nrf_subscription.cpp
+42
-5
src/nrf_app/nrf_subscription.hpp
src/nrf_app/nrf_subscription.hpp
+15
-6
yaml/cmd.txt
yaml/cmd.txt
+6
-1
No files found.
src/api-server/model/SubscriptionData.cpp
View file @
2575d720
...
...
@@ -172,11 +172,15 @@ bool SubscriptionData::validityTimeIsSet() const {
void
SubscriptionData
::
unsetValidityTime
()
{
m_ValidityTimeIsSet
=
false
;
}
std
::
vector
<
NotificationEventType
>&
SubscriptionData
::
getReqNotifEvents
()
{
std
::
vector
<
std
::
string
>
SubscriptionData
::
getReqNotifEvents
()
const
{
return
m_ReqNotifEvents
;
}
void
SubscriptionData
::
getReqNotifEvents
(
std
::
vector
<
std
::
string
>
&
value
)
const
{
value
=
m_ReqNotifEvents
;
}
void
SubscriptionData
::
setReqNotifEvents
(
std
::
vector
<
NotificationEventType
>
const
&
value
)
{
std
::
vector
<
std
::
string
>
const
&
value
)
{
m_ReqNotifEvents
=
value
;
m_ReqNotifEventsIsSet
=
true
;
}
...
...
src/api-server/model/SubscriptionData.h
View file @
2575d720
...
...
@@ -210,8 +210,9 @@ class SubscriptionData {
/// <summary>
///
/// </summary>
std
::
vector
<
NotificationEventType
>
&
getReqNotifEvents
();
void
setReqNotifEvents
(
std
::
vector
<
NotificationEventType
>
const
&
value
);
std
::
vector
<
std
::
string
>
getReqNotifEvents
()
const
;
void
getReqNotifEvents
(
std
::
vector
<
std
::
string
>
&
value
)
const
;
void
setReqNotifEvents
(
std
::
vector
<
std
::
string
>
const
&
value
);
bool
reqNotifEventsIsSet
()
const
;
void
unsetReqNotifEvents
();
/// <summary>
...
...
@@ -266,7 +267,7 @@ class SubscriptionData {
std
::
string
m_ValidityTime
;
bool
m_ValidityTimeIsSet
;
std
::
vector
<
NotificationEventType
>
m_ReqNotifEvents
;
std
::
vector
<
std
::
string
>
m_ReqNotifEvents
;
bool
m_ReqNotifEventsIsSet
;
PlmnId
m_PlmnId
;
bool
m_PlmnIdIsSet
;
...
...
src/common/3gpp_23.003.h
View file @
2575d720
...
...
@@ -29,6 +29,8 @@
#define FILE_3GPP_23_003_SEEN
#include <stdint.h>
#include <string>
/*
typedef struct plmn_s {
uint8_t mcc_digit2 :4;
...
...
src/common/3gpp_29.510.h
View file @
2575d720
...
...
@@ -22,15 +22,38 @@
#ifndef FILE_3GPP_29_510_NRF_SEEN
#define FILE_3GPP_29_510_NRF_SEEN
#include <string>
#include "3gpp_23.003.h"
#include <vector>
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_condition_type_e
{
//TODO: use enum class
typedef
struct
amf_info_s
{
std
::
string
amf_set_id
;
std
::
string
amf_region_id
;
std
::
vector
<
guami_t
>
guami_list
;
}
amf_info_t
;
typedef
struct
dnn_smf_info_item_s
{
std
::
string
dnn
;
}
dnn_smf_info_item_t
;
typedef
struct
snssai_smf_info_item_s
{
snssai_t
snssai
;
std
::
vector
<
dnn_smf_info_item_t
>
dnn_smf_info_list
;
}
snssai_smf_info_item_t
;
typedef
struct
smf_info_s
{
std
::
vector
<
snssai_smf_info_item_t
>
snssai_smf_info_list
;
}
smf_info_t
;
enum
subscr_condition_type_e
{
// TODO: use enum class
UNKNOWN_CONDITION
=
0
,
NF_INSTANCE_ID_COND
=
1
,
NF_TYPE_COND
=
2
,
...
...
@@ -161,12 +184,59 @@ typedef struct subscription_condition_s {
virtual
~
subscription_condition_s
(){};
std
::
string
to_string
()
const
{
std
::
string
s
=
{};
s
.
append
(
"Type: "
);
s
.
append
(
subscription_condition_type_e2str
[
type
]);
s
.
append
(
", condition: "
);
switch
(
type
)
{
case
NF_INSTANCE_ID_COND
:
{
s
.
append
(
nf_instance_id
);
}
break
;
case
NF_TYPE_COND
:
{
s
.
append
(
nf_type
);
}
break
;
case
SERVICE_NAME_COND
:
{
s
.
append
(
service_name
);
}
break
;
case
AMF_COND
:
{
s
.
append
(
", AMF_Set_ID: "
);
s
.
append
(
amf_info
.
amf_set_id
);
s
.
append
(
", AMF_Region_ID: "
);
s
.
append
(
amf_info
.
amf_region_id
);
}
break
;
case
GUAMI_LIST_COND
:
{
// TODO:
}
break
;
case
NETWOTK_SLICE_COND
:
{
// TODO:
}
break
;
case
NF_GROUP_COND
:
{
// TODO:
}
break
;
default:
{
// TODO:
}
}
// TODO:
return
s
;
}
}
subscription_condition_t
;
enum
notification_event_type_t
{
NOTIFICATION_TYPE_NF_REGISTERED
=
0
,
NOTIFICATION_TYPE_NF_DEREGISTERED
=
1
,
NOTIFICATION_TYPE_NF_PROFILE_CHANGED
=
2
NOTIFICATION_TYPE_UNKNOWN_EVENT
=
0
,
NOTIFICATION_TYPE_NF_REGISTERED
=
1
,
NOTIFICATION_TYPE_NF_DEREGISTERED
=
2
,
NOTIFICATION_TYPE_NF_PROFILE_CHANGED
=
3
};
static
const
std
::
vector
<
std
::
string
>
notification_event_type_e2str
=
{
"UNKNOWN EVENT"
,
"NF_REGISTERED"
,
"NF_DEREGISTERED"
,
"NF_PROFILE_CHANGED"
};
#endif
src/common/nrf.h
View file @
2575d720
...
...
@@ -21,7 +21,6 @@
#ifndef FILE_NRF_SEEN
#define FILE_NRF_SEEN
#include "3gpp_23.003.h"
#define HEART_BEAT_TIMER 10
...
...
@@ -68,26 +67,6 @@ typedef enum patch_op_type_s {
static
const
std
::
vector
<
std
::
string
>
patch_op_type_e2str
=
{
"ADD"
,
"REMOVE"
,
"REPLACE"
,
"MOVE"
,
"COPY"
,
"TEST"
,
"UNKNOWN"
};
typedef
struct
amf_info_s
{
std
::
string
amf_set_id
;
std
::
string
amf_region_id
;
std
::
vector
<
guami_t
>
guami_list
;
}
amf_info_t
;
typedef
struct
dnn_smf_info_item_s
{
std
::
string
dnn
;
}
dnn_smf_info_item_t
;
typedef
struct
snssai_smf_info_item_s
{
snssai_t
snssai
;
std
::
vector
<
dnn_smf_info_item_t
>
dnn_smf_info_list
;
}
snssai_smf_info_item_t
;
typedef
struct
smf_info_s
{
std
::
vector
<
snssai_smf_info_item_t
>
snssai_smf_info_list
;
}
smf_info_t
;
// Event Subscription IDs)
typedef
uint32_t
evsub_id_t
;
#define EVSUB_ID_FMT "0x%" PRIx32
...
...
@@ -95,4 +74,7 @@ typedef uint32_t evsub_id_t;
#define INVALID_EVSUB_ID ((evsub_id_t)0x00000000)
#define UNASSIGNED_EVSUB_ID ((evsub_id_t)0x00000000)
#define NNRF_NFM_BASE "/nnrf-nfm/"
#define NNRF_NFM_NF_INSTANCE "/nf-instances/"
#endif
src/common/utils/api_conversions.cpp
View file @
2575d720
...
...
@@ -283,13 +283,28 @@ bool api_conv::subscription_api_to_nrf_subscription(
if
(
sub_condition
.
type
!=
UNKNOWN_CONDITION
)
{
sub
.
get
()
->
set_sub_condition
(
sub_condition
);
return
true
;
}
else
{
return
false
;
}
}
// NotificationEventType
if
(
api_sub
.
reqNotifEventsIsSet
())
{
for
(
auto
n
:
api_sub
.
getReqNotifEvents
())
{
if
(
n
.
compare
(
"NF_REGISTERED"
)
==
0
)
{
sub
.
get
()
->
add_notif_event
(
NOTIFICATION_TYPE_NF_REGISTERED
);
Logger
::
nrf_app
().
debug
(
"ReqNotifEvents: %s"
,
n
.
c_str
());
}
else
if
(
n
.
compare
(
"NF_DEREGISTERED"
)
==
0
)
{
sub
.
get
()
->
add_notif_event
(
NOTIFICATION_TYPE_NF_DEREGISTERED
);
Logger
::
nrf_app
().
debug
(
"ReqNotifEvents: %s"
,
n
.
c_str
());
}
else
if
(
n
.
compare
(
"NF_PROFILE_CHANGED"
)
==
0
)
{
sub
.
get
()
->
add_notif_event
(
NOTIFICATION_TYPE_NF_PROFILE_CHANGED
);
}
else
{
sub
.
get
()
->
add_notif_event
(
NOTIFICATION_TYPE_UNKNOWN_EVENT
);
}
//Logger::nrf_app().debug("ReqNotifEvents: %s", n.c_str());
}
}
// TODO:
return
true
;
}
...
...
src/common/utils/assertions.h
0 → 100644
View file @
2575d720
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <inttypes.h>
#include "backtrace.h"
#ifndef ASSERTIONS_H_
#define ASSERTIONS_H_
#define _Assert_Exit_ \
{ \
fprintf(stderr, "\nExiting execution\n"); \
display_backtrace(); \
fflush(stdout); \
fflush(stderr); \
exit(EXIT_FAILURE); \
}
#define _Assert_SegFault_ \
{ \
fprintf(stderr, "\n Will Intentionaly raise SEGFAULT to be catched by GDB!\n"); \
display_backtrace(); \
fflush(stdout); \
fflush(stderr); \
*(int*)0=0; \
exit(EXIT_FAILURE); \
}
#define _Assert_(cOND, aCTION, fORMAT, aRGS...) \
do { \
if (!(cOND)) { \
fprintf(stderr, "\nAssertion ("#cOND") failed!\n" \
"In %s() %s:%d\n" fORMAT, \
__FUNCTION__, __FILE__, __LINE__, ##aRGS); \
aCTION; \
} \
} while(0)
#if DEBUG_IS_ON
#define _ASSERT_FINAL_ _Assert_SegFault_
#else
#define _ASSERT_FINAL_ _Assert_Exit_
#endif
#define AssertFatal(cOND, ...) _Assert_(cOND, _ASSERT_FINAL_ , ##__VA_ARGS__)
#define DevCheck(cOND, vALUE1, vALUE2, vALUE3) \
_Assert_(cOND, _ASSERT_FINAL_, #vALUE1 ": %" PRIdMAX "\n" #vALUE2 ": %" PRIdMAX "\n" #vALUE3 ": %" PRIdMAX "\n\n", \
(intmax_t)vALUE1, (intmax_t)vALUE2, (intmax_t)vALUE3)
#define DevCheck4(cOND, vALUE1, vALUE2, vALUE3, vALUE4) \
_Assert_(cOND, _ASSERT_FINAL_, #vALUE1": %"PRIdMAX"\n"#vALUE2": %"PRIdMAX"\n"#vALUE3": %"PRIdMAX"\n"#vALUE4": %"PRIdMAX"\n\n", \
(intmax_t)vALUE1, (intmax_t)vALUE2, (intmax_t)vALUE3, (intmax_t)vALUE4)
#define DevAssert(cOND) _Assert_(cOND, _ASSERT_FINAL_, "")
#define DevMessage(mESSAGE) _Assert_(0, _ASSERT_FINAL_, #mESSAGE)
#define CHECK_INIT_RETURN(fCT) \
do { \
int fct_ret; \
if ((fct_ret = (fCT)) != 0) { \
fprintf(stderr, "Function "#fCT" has failed\n" \
"returning %d\n", fct_ret); \
fflush(stdout); \
fflush(stderr); \
exit(EXIT_FAILURE); \
} \
} while(0)
#define AssertError(cOND, aCTION, fORMAT, aRGS...) _Assert_(cOND, aCTION, fORMAT, ##aRGS)
#define DevParam(vALUE1, vALUE2, vALUE3) DevCheck(0, vALUE1, vALUE2, vALUE3)
#endif
/* ASSERTIONS_H_ */
src/nrf_app/nrf_app.cpp
View file @
2575d720
...
...
@@ -125,7 +125,6 @@ void nrf_app::handle_register_nf_instance(
// Notify NF status change event
m_event_sub
.
nf_status_registered
(
nf_instance_id
);
// from nrf_app
//m_event_sub.nf_status_change(sn); // from nrf_app
// display the info
sn
.
get
()
->
display
();
...
...
@@ -202,6 +201,7 @@ void nrf_app::handle_update_nf_instance(
default:
{
Logger
::
nrf_app
().
warn
(
"Requested operation is not valid!"
);
op_success
=
false
;
}
}
...
...
@@ -209,6 +209,10 @@ void nrf_app::handle_update_nf_instance(
http_code
=
HTTP_STATUS_CODE_400_BAD_REQUEST
;
problem_details
.
setCause
(
protocol_application_error_e2str
[
MANDATORY_IE_INCORRECT
]);
}
else
{
// update successful,
// Notify NF status change event
m_event_sub
.
nf_status_profile_changed
(
nf_instance_id
);
// from nrf_app
}
}
...
...
@@ -289,6 +293,8 @@ void nrf_app::handle_deregister_nf_instance(const std::string &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
;
...
...
@@ -327,8 +333,8 @@ void nrf_app::handle_create_subscription(
// subscribe to NF status registered
// subscribe_nf_status(evsub_id); // from nrf_app
// subscribe to NF status
change
ss
.
get
()
->
subscribe_nf_status_registered
();
//from subscription
// subscribe to NF status
//
ss.get()->subscribe_nf_status_registered(); //from subscription
// add to the DB
add_subscription
(
evsub_id
,
ss
);
Logger
::
nrf_app
().
debug
(
"Added a subscription to the DB"
);
...
...
@@ -578,8 +584,6 @@ void nrf_app::handle_nf_status_registered(const std::string &profile_id) {
Logger
::
nrf_app
().
error
(
"NF profile not found, profile id %s"
,
profile_id
.
c_str
());
}
// TODO:
}
//------------------------------------------------------------------------------
...
...
@@ -594,10 +598,21 @@ void nrf_app::subscribe_nf_status_deregistered() {
void
nrf_app
::
handle_nf_status_deregistered
(
const
std
::
string
&
profile_id
)
{
Logger
::
nrf_app
().
info
(
"Handle NF status deregistered, profile id %s"
,
profile_id
.
c_str
());
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_DEREGISTERED
,
notification_uris
);
// TODO:
// 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
());
}
}
//------------------------------------------------------------------------------
...
...
@@ -612,12 +627,23 @@ void nrf_app::subscribe_nf_status_profile_changed() {
void
nrf_app
::
handle_nf_status_profile_changed
(
const
std
::
string
&
profile_id
)
{
Logger
::
nrf_app
().
info
(
"Handle NF status profile changed, profile id %s"
,
profile_id
.
c_str
());
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_PROFILE_CHANGED
,
notification_uris
);
// TODO:
// 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
());
}
}
//------------------------------------------------------------------------------
void
nrf_app
::
get_subscription_list
(
const
std
::
string
&
profile_id
,
uint8_t
notification_type
,
std
::
vector
<
std
::
string
>
&
uris
)
{
...
...
@@ -632,11 +658,9 @@ void nrf_app::get_subscription_list(const std::string &profile_id,
}
for
(
auto
s
:
instance_id2nrf_subscription
)
{
// Logger::nrf_app().debug("Subscription id %s", s.first.c_str());
std
::
string
uri
;
s
.
second
.
get
()
->
get_notification_uri
(
uri
);
// Logger::nrf_app().debug("Uri %s", uri.c_str());
subscription_condition_t
condition
=
{};
s
.
second
.
get
()
->
get_sub_condition
(
condition
);
...
...
@@ -700,6 +724,9 @@ void nrf_app::get_subscription_list(const std::string &profile_id,
// TODO:
}
}
//TODO: reqNotifEvents
}
// TODO:
}
src/nrf_app/nrf_app.hpp
View file @
2575d720
...
...
@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
file
*
except in compliance with the License.
*
You may obtain a copy of the
License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
*
file except in compliance with the License. You may obtain a copy of the
*License at
*
* http://www.openairinterface.org/?page_id=698
*
...
...
@@ -32,12 +32,12 @@
#include <string>
#include "NFProfile.h"
#include "nrf_profile.hpp"
#include "nrf_subscription.hpp"
#include "nrf_event.hpp"
#include "PatchItem.h"
#include "ProblemDetails.h"
#include "SubscriptionData.h"
#include "nrf_event.hpp"
#include "nrf_profile.hpp"
#include "nrf_subscription.hpp"
#include "uint_generator.hpp"
namespace
oai
{
...
...
@@ -47,20 +47,18 @@ namespace app {
using
namespace
oai
::
nrf
::
model
;
class
nrf_config
;
class
nrf_app
{
public:
explicit
nrf_app
(
const
std
::
string
&
config_file
,
nrf_event
&
ev
);
nrf_app
(
nrf_app
const
&
)
=
delete
;
void
operator
=
(
nrf_app
const
&
)
=
delete
;
explicit
nrf_app
(
const
std
::
string
&
config_file
,
nrf_event
&
ev
);
nrf_app
(
nrf_app
const
&
)
=
delete
;
void
operator
=
(
nrf_app
const
&
)
=
delete
;
virtual
~
nrf_app
()
{
Logger
::
nrf_app
().
debug
(
"Delete NRF_APP instance..."
);
for
(
auto
i
:
connections
)
{
for
(
auto
i
:
connections
)
{
if
(
i
.
connected
())
i
.
disconnect
();
}
}
/*
* Handle a Register NF Instance request
* @param [const std::string &] nf_instance_id: Instance ID
...
...
@@ -70,8 +68,7 @@ class nrf_app {
* @param [ProblemDetails &] problem_details: Store details of the error
* @return void
*/
void
handle_register_nf_instance
(
const
std
::
string
&
nf_instance_id
,
void
handle_register_nf_instance
(
const
std
::
string
&
nf_instance_id
,
const
NFProfile
&
nf_profile
,
int
&
http_code
,
const
uint8_t
http_version
,
ProblemDetails
&
problem_details
);
...
...
@@ -91,16 +88,16 @@ class nrf_app {
/*
* Handle a Update NF Instance request
* @param [const std::string &] nf_instance_id: Instance ID
* @param [const std::vector<PatchItem> &] patchItem: List of modifications need to be applied
* @param [const std::vector<PatchItem> &] patchItem: List of modifications
* need to be applied
* @param [int &] http_code: HTTP code used to return to the consumer
* @param [const uint8_t] http_version: HTTP version
* @param [ProblemDetails &] problem_details: Store details of the error
* @return void
*/
void
handle_update_nf_instance
(
const
std
::
string
&
nf_instance_id
,
const
std
::
vector
<
PatchItem
>
&
patchItem
,
int
&
http_code
,
const
uint8_t
http_version
,
void
handle_update_nf_instance
(
const
std
::
string
&
nf_instance_id
,
const
std
::
vector
<
PatchItem
>
&
patchItem
,
int
&
http_code
,
const
uint8_t
http_version
,
ProblemDetails
&
problem_details
);
/*
...
...
@@ -112,10 +109,9 @@ class nrf_app {
* @param [ProblemDetails &] problem_details: Store details of the error
* @return void
*/
void
handle_get_nf_instance
(
const
std
::
string
&
nf_instance_id
,
std
::
shared_ptr
<
nrf_profile
>
&
profile
,
int
&
http_code
,
const
uint8_t
http_version
,
void
handle_get_nf_instance
(
const
std
::
string
&
nf_instance_id
,
std
::
shared_ptr
<
nrf_profile
>
&
profile
,
int
&
http_code
,
const
uint8_t
http_version
,
ProblemDetails
&
problem_details
);
/*
...
...
@@ -126,10 +122,8 @@ class nrf_app {
* @param [ProblemDetails &] problem_details: Store details of the error
* @return void
*/
void
handle_deregister_nf_instance
(
const
std
::
string
&
nf_instance_id
,
int
&
http_code
,
const
uint8_t
http_version
,
void
handle_deregister_nf_instance
(
const
std
::
string
&
nf_instance_id
,
int
&
http_code
,
const
uint8_t
http_version
,
ProblemDetails
&
problem_details
);
/*
...
...
@@ -140,8 +134,8 @@ class nrf_app {
* @param [ProblemDetails &] problem_details: Store details of the error
* @return void
*/
void
handle_create_subscription
(
const
SubscriptionData
&
subscription_data
,
std
::
string
&
sub_id
,
int
&
http_code
,
void
handle_create_subscription
(
const
SubscriptionData
&
subscription_data
,
std
::
string
&
sub_id
,
int
&
http_code
,
const
uint8_t
http_version
,
ProblemDetails
&
problem_details
);
...
...
@@ -182,7 +176,8 @@ class nrf_app {
/*
* Find a list of nf profiles with a type
* @param [const nf_type_t &] nf_type: Type of NF profile
* @param [std::vector<std::shared_ptr<nrf_profile>> &] profiles: Store list of corresponding profiles
* @param [std::vector<std::shared_ptr<nrf_profile>> &] profiles: Store list
* of corresponding profiles
* @return shared pointer to the profile if found
*/
void
find_nf_profiles
(
...
...
@@ -213,7 +208,7 @@ class nrf_app {
bool
add_subscription
(
const
std
::
string
&
sub_id
,
const
std
::
shared_ptr
<
nrf_subscription
>
&
s
);
void
subscribe_task_tick
(
uint64_t
ms
);
void
subscribe_task_tick
(
uint64_t
ms
);
void
handle_heartbeart_timeout
(
uint64_t
ms
);
bool
authorize_subscription
(
const
std
::
shared_ptr
<
nrf_subscription
>
&
s
)
const
;
...
...
@@ -228,21 +223,24 @@ class nrf_app {
void
subscribe_nf_status_profile_changed
();
void
handle_nf_status_profile_changed
(
const
std
::
string
&
profile_id
);
void
get_subscription_list
(
const
std
::
string
&
profile_id
,
uint8_t
notification_type
,
std
::
vector
<
std
::
string
>
&
uris
);
void
get_subscription_list
(
const
std
::
string
&
profile_id
,
uint8_t
notification_type
,
std
::
vector
<
std
::
string
>
&
uris
);
private:
std
::
map
<
std
::
string
,
std
::
shared_ptr
<
nrf_profile
>>
instance_id2nrf_profile
;
mutable
std
::
shared_mutex
m_instance_id2nrf_profile
;
std
::
map
<
std
::
string
,
std
::
shared_ptr
<
nrf_subscription
>>
instance_id2nrf_subscription
;
std
::
map
<
std
::
string
,
std
::
shared_ptr
<
nrf_subscription
>>
instance_id2nrf_subscription
;
mutable
std
::
shared_mutex
m_instance_id2nrf_subscription
;
nrf_event
&
m_event_sub
;
nrf_event
&
m_event_sub
;
util
::
uint_generator
<
uint32_t
>
evsub_id_generator
;
std
::
vector
<
bs2
::
connection
>
connections
;
};
}
}
}
}
// namespace app
}
// namespace nrf
}
// namespace oai
#include "nrf_config.hpp"
#endif
/* FILE_SMF_APP_HPP_SEEN */
src/nrf_app/nrf_client.cpp
View file @
2575d720
...
...
@@ -27,15 +27,17 @@
\email: Tien-Thinh.Nguyen@eurecom.fr
*/
#include
<stdexcept>
#include
"nrf_client.hpp"
#include <curl/curl.h>
#include <pistache/http.h>
#include <pistache/mime.h>
#include <nlohmann/json.hpp>
#include <stdexcept>
#include "3gpp_29.500.h"
#include "logger.hpp"
#include "nrf_c
lient
.hpp"
#include "nrf_c
onfig
.hpp"
using
namespace
Pistache
::
Http
;
using
namespace
Pistache
::
Http
::
Mime
;
...
...
@@ -43,6 +45,7 @@ using namespace oai::nrf::app;
using
json
=
nlohmann
::
json
;
extern
nrf_client
*
nrf_client_inst
;
extern
nrf_config
nrf_cfg
;
//------------------------------------------------------------------------------
// To read content of the response from NF
...
...
@@ -109,7 +112,13 @@ void nrf_client::notify_subscribed_event(
// Fill the json part
nlohmann
::
json
json_data
=
{};
json_data
[
"event"
]
=
"NF_REGISTERED"
;
json_data
[
"nfInstanceUri"
]
=
profile
.
get
()
->
get_nf_instance_id
();
std
::
string
instance_uri
=
std
::
string
(
inet_ntoa
(
*
((
struct
in_addr
*
)
&
nrf_cfg
.
sbi
.
addr4
)))
+
":"
+
std
::
to_string
(
nrf_cfg
.
sbi
.
port
)
+
NNRF_NFM_BASE
+
nrf_cfg
.
sbi_api_version
+
NNRF_NFM_NF_INSTANCE
+
profile
.
get
()
->
get_nf_instance_id
();
Logger
::
nrf_app
().
debug
(
"NF instance URI: %s"
,
instance_uri
.
c_str
());
json_data
[
"nfInstanceUri"
]
=
instance_uri
;
std
::
string
body
=
json_data
.
dump
();
// create and add an easy handle to a multi curl request
...
...
@@ -195,21 +204,26 @@ void nrf_client::notify_subscribed_event(
void
nrf_client
::
notify_subscribed_event
(
const
std
::
shared_ptr
<
nrf_profile
>
&
profile
,
const
std
::
string
&
uri
)
{
Logger
::
nrf_app
().
debug
(
"Send notification
for the subscribed event to the subscription"
);
"Send notification
to the subscribed NF (URI %s)"
,
uri
.
c_str
()
);
Logger
::
nrf_app
().
debug
(
"NF URI: %s"
,
uri
.
c_str
());
// Fill the json part
nlohmann
::
json
json_data
=
{};
json_data
[
"event"
]
=
"NF_REGISTERED"
;
json_data
[
"nfInstanceUri"
]
=
profile
.
get
()
->
get_nf_instance_id
();
std
::
string
instance_uri
=
std
::
string
(
inet_ntoa
(
*
((
struct
in_addr
*
)
&
nrf_cfg
.
sbi
.
addr4
)))
+
":"
+
std
::
to_string
(
nrf_cfg
.
sbi
.
port
)
+
NNRF_NFM_BASE
+
nrf_cfg
.
sbi_api_version
+
NNRF_NFM_NF_INSTANCE
+
profile
.
get
()
->
get_nf_instance_id
();
Logger
::
nrf_app
().
debug
(
"NF instance URI: %s"
,
instance_uri
.
c_str
());
json_data
[
"nfInstanceUri"
]
=
instance_uri
;
std
::
string
body
=
json_data
.
dump
();
curl_global_init
(
CURL_GLOBAL_ALL
);
CURL
*
curl
=
curl
=
curl_easy_init
();
struct
curl_slist
*
headers
=
nullptr
;
if
(
curl
)
{
CURLcode
res
=
{};
struct
curl_slist
*
headers
=
nullptr
;
// headers = curl_slist_append(headers, "charsets: utf-8");
headers
=
curl_slist_append
(
headers
,
"content-type: application/json"
);
curl_easy_setopt
(
curl
,
CURLOPT_HTTPHEADER
,
headers
);
...
...
@@ -229,9 +243,23 @@ void nrf_client::notify_subscribed_event(
curl_easy_getinfo
(
curl
,
CURLINFO_RESPONSE_CODE
,
&
httpCode
);
Logger
::
nrf_app
().
debug
(
"Response from NF, Http Code: %d"
,
httpCode
);
// TODO: in case of "307 temporary redirect"
if
(
httpCode
==
HTTP_STATUS_CODE_204_NO_CONTENT
)
{
}
else
{
// get cause from the response
json
response_data
=
{};
try
{
response_data
=
json
::
parse
(
*
httpData
.
get
());
}
catch
(
json
::
exception
&
e
)
{
Logger
::
nrf_app
().
warn
(
"Could not get the cause from the response"
);
}
Logger
::
nrf_app
().
debug
(
"Response from NF, Http Code: %d, problem details %s"
,
httpCode
,
response_data
.
dump
().
c_str
());
}
curl_easy_cleanup
(
curl
);
}
curl_slist_free_all
(
headers
);
curl_global_cleanup
();
}
src/nrf_app/nrf_config.hpp
View file @
2575d720
...
...
@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
file
*
except in compliance with the License.
*
You may obtain a copy of the
License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
*
file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
...
...
@@ -31,9 +31,9 @@
#define FILE_NRF_CONFIG_HPP_SEEN
#include <arpa/inet.h>
#include <libconfig.h++>
#include <netinet/in.h>
#include <sys/socket.h>
#include <libconfig.h++>
#include <mutex>
#include <vector>
...
...
@@ -74,37 +74,23 @@ class nrf_config {
interface_cfg_t
sbi
;
unsigned
int
sbi_http2_port
;
std
::
string
sbi_api_version
;
//Local configuration
//
Local configuration
bool
local_configuration
;
nrf_config
()
:
m_rw_lock
(),
pid_dir
(),
instance
(
0
),
sbi
()
{
nrf_config
()
:
m_rw_lock
(),
pid_dir
(),
instance
(
0
),
sbi
()
{
sbi
.
port
=
80
;
sbi_http2_port
=
8080
;
sbi_api_version
=
"v1"
;
}
;
};
~
nrf_config
();
void
lock
()
{
m_rw_lock
.
lock
();
}
;
void
unlock
()
{
m_rw_lock
.
unlock
();
}
;
void
lock
()
{
m_rw_lock
.
lock
();
};
void
unlock
()
{
m_rw_lock
.
unlock
();
};
int
load
(
const
std
::
string
&
config_file
);
void
display
();
};
}
}
// namespace app
}
// namespace nrf
}
}
// namespace oai
#endif
/* FILE_NRF_CONFIG_HPP_SEEN */
src/nrf_app/nrf_event.hpp
View file @
2575d720
...
...
@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
file
*
except in compliance with the License.
*
You may obtain a copy of the
License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
*
file except in compliance with the License. You may obtain a copy of the
*License at
*
* http://www.openairinterface.org/?page_id=698
*
...
...
@@ -42,18 +42,15 @@ namespace nrf {
namespace
app
{
class
task_manager
;
//class nrf_profile;
//
class nrf_profile;
class
nrf_event
{
public:
nrf_event
()
{
}
;
nrf_event
(
nrf_event
const
&
)
=
delete
;
void
operator
=
(
nrf_event
const
&
)
=
delete
;
nrf_event
(){};
nrf_event
(
nrf_event
const
&
)
=
delete
;
void
operator
=
(
nrf_event
const
&
)
=
delete
;
static
nrf_event
&
get_instance
()
{
static
nrf_event
&
get_instance
()
{
static
nrf_event
instance
;
return
instance
;
}
...
...
@@ -66,24 +63,28 @@ class nrf_event {
bs2
::
connection
subscribe_task_tick
(
const
task_sig_t
::
slot_type
&
sig
,
uint64_t
period
,
uint64_t
start
=
0
);
bs2
::
connection
subscribe_task_tick_extended
(
const
task_sig_t
::
extended_slot_type
&
sig
,
uint64_t
period
,
uint64_t
start
=
0
);
bs2
::
connection
subscribe_task_tick_extended
(
const
task_sig_t
::
extended_slot_type
&
sig
,
uint64_t
period
,
uint64_t
start
=
0
);
bs2
::
connection
subscribe_nf_status_change
(
const
nf_status_change_sig_t
::
slot_type
&
sig
);
bs2
::
connection
subscribe_nf_status_registered
(
const
nf_status_sig_t
::
slot_type
&
sig
);
bs2
::
connection
subscribe_nf_status_deregistered
(
const
nf_status_sig_t
::
slot_type
&
sig
);
bs2
::
connection
subscribe_nf_status_profile_changed
(
const
nf_status_sig_t
::
slot_type
&
sig
);
bs2
::
connection
subscribe_nf_status_change
(
const
nf_status_change_sig_t
::
slot_type
&
sig
);
bs2
::
connection
subscribe_nf_status_registered
(
const
nf_status_sig_t
::
slot_type
&
sig
);
bs2
::
connection
subscribe_nf_status_deregistered
(
const
nf_status_sig_t
::
slot_type
&
sig
);
bs2
::
connection
subscribe_nf_status_profile_changed
(
const
nf_status_sig_t
::
slot_type
&
sig
);
private:
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_status_sig_t
nf_status_profile_changed
;
};
}
}
}
}
// namespace app
}
// namespace nrf
}
// namespace oai
#endif
/* FILE_NRF_EVENT_HPP_SEEN */
src/nrf_app/nrf_event_sig.hpp
View file @
2575d720
...
...
@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
*file except in compliance with the License. You may obtain a copy of the
*License at
*
file except in compliance with the License. You may obtain a copy of the
*
License at
*
* http://www.openairinterface.org/?page_id=698
*
...
...
@@ -34,7 +34,6 @@
namespace
bs2
=
boost
::
signals2
;
namespace
oai
{
namespace
nrf
{
namespace
app
{
...
...
src/nrf_app/nrf_profile.hpp
View file @
2575d720
...
...
@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
file
*
except in compliance with the License.
*
You may obtain a copy of the
License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
*
file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
...
...
@@ -33,15 +33,16 @@
#include <arpa/inet.h>
#include <netinet/in.h>
#include <map>
#include <shared_mutex>
#include <memory>
#include <nlohmann/json.hpp>
#include <shared_mutex>
#include <utility>
#include <vector>
#include <nlohmann/json.hpp>
#include "3gpp_29.510.h"
#include "logger.hpp"
#include "nrf.h"
#include "nrf_event.hpp"
#include "logger.hpp"
namespace
oai
{
namespace
nrf
{
...
...
@@ -50,11 +51,9 @@ namespace app {
using
namespace
std
;
class
nrf_profile
:
public
std
::
enable_shared_from_this
<
nrf_profile
>
{
public:
nrf_profile
(
nrf_event
&
ev
)
:
m_event_sub
(
ev
),
:
m_event_sub
(
ev
),
nf_type
(
NF_TYPE_UNKNOWN
),
heartBeat_timer
(
0
),
snssais
(),
...
...
@@ -63,11 +62,10 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
capacity
(
0
)
{
nf_instance_name
=
""
;
nf_status
=
""
;
json_data
=
{
};
json_data
=
{};
}
nrf_profile
(
nrf_event
&
ev
,
const
nf_type_t
type
)
:
m_event_sub
(
ev
),
:
m_event_sub
(
ev
),
nf_type
(
type
),
heartBeat_timer
(
0
),
snssais
(),
...
...
@@ -76,12 +74,11 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
capacity
(
0
)
{
nf_instance_name
=
""
;
nf_status
=
""
;
json_data
=
{
};
json_data
=
{};
}
nrf_profile
(
nrf_event
&
ev
,
const
std
::
string
&
id
)
:
m_event_sub
(
ev
),
:
m_event_sub
(
ev
),
nf_instance_id
(
id
),
heartBeat_timer
(
0
),
snssais
(),
...
...
@@ -91,7 +88,7 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
nf_type
(
NF_TYPE_UNKNOWN
)
{
nf_instance_name
=
""
;
nf_status
=
""
;
json_data
=
{
};
json_data
=
{};
}
nrf_profile
(
nrf_profile
&
b
)
=
delete
;
...
...
@@ -341,7 +338,7 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
* @param [uint64_t] ms: current time
* @return void
*/
void
subscribe_task_tick
(
uint64_t
ms
);
void
subscribe_task_tick
(
uint64_t
ms
);
/*
* Handle heartbeart timeout event
...
...
@@ -360,7 +357,7 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
protected:
nrf_event
&
m_event_sub
;
bs2
::
connection
task_connection
;
//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_name
;
nf_type_t
nf_type
;
...
...
@@ -370,7 +367,7 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
std
::
vector
<
struct
in_addr
>
ipv4_addresses
;
uint16_t
priority
;
uint16_t
capacity
;
nlohmann
::
json
json_data
;
//store extra json data
nlohmann
::
json
json_data
;
//
store extra json data
/*
std::vector<PlmnId> m_PlmnList;
...
...
@@ -433,32 +430,24 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
bool m_NfServicePersistenceIsSet;
std::vector<NFService> m_NfServices;
bool m_NfServicesIsSet;
std::vector<DefaultNotificationSubscription> m_DefaultNotificationSubscriptions;
bool m_DefaultNotificationSubscriptionsIsSet;
std::vector<DefaultNotificationSubscription>
m_DefaultNotificationSubscriptions; bool
m_DefaultNotificationSubscriptionsIsSet;
*/
};
class
amf_profile
:
public
nrf_profile
{
public:
amf_profile
(
nrf_event
&
ev
)
:
nrf_profile
(
ev
,
NF_TYPE_AMF
)
{
amf_info
=
{
};
}
amf_profile
(
nrf_event
&
ev
)
:
nrf_profile
(
ev
,
NF_TYPE_AMF
)
{
amf_info
=
{};
}
amf_profile
(
nrf_event
&
ev
,
const
std
::
string
&
id
)
:
nrf_profile
(
ev
,
id
)
{
amf_profile
(
nrf_event
&
ev
,
const
std
::
string
&
id
)
:
nrf_profile
(
ev
,
id
)
{
nf_type
=
NF_TYPE_AMF
;
amf_info
=
{
};
amf_info
=
{};
}
amf_profile
(
amf_profile
&
b
)
=
delete
;
~
amf_profile
()
{
}
~
amf_profile
()
{}
/*
* Add an AMF info
* @param [const amf_info_t &] info: AMF info
...
...
@@ -516,19 +505,12 @@ class amf_profile : public nrf_profile {
};
class
smf_profile
:
public
nrf_profile
{
public:
smf_profile
(
nrf_event
&
ev
)
:
nrf_profile
(
ev
,
NF_TYPE_SMF
)
{
smf_info
=
{
};
}
smf_profile
(
nrf_event
&
ev
)
:
nrf_profile
(
ev
,
NF_TYPE_SMF
)
{
smf_info
=
{};
}
smf_profile
(
nrf_event
&
ev
,
const
std
::
string
&
id
)
:
nrf_profile
(
ev
,
id
)
{
smf_profile
(
nrf_event
&
ev
,
const
std
::
string
&
id
)
:
nrf_profile
(
ev
,
id
)
{
nf_type
=
NF_TYPE_SMF
;
smf_info
=
{
};
smf_info
=
{};
}
smf_profile
(
smf_profile
&
b
)
=
delete
;
...
...
@@ -588,8 +570,8 @@ class smf_profile : public nrf_profile {
private:
smf_info_t
smf_info
;
};
}
}
}
}
// namespace app
}
// namespace nrf
}
// namespace oai
#endif
src/nrf_app/nrf_subscription.cpp
View file @
2575d720
...
...
@@ -69,25 +69,62 @@ void nrf_subscription::set_sub_condition(const subscription_condition_t &c) {
void
nrf_subscription
::
get_sub_condition
(
subscription_condition_t
&
c
)
const
{
c
=
sub_condition
;
}
/*
//------------------------------------------------------------------------------
/*
subscription_condition_t nrf_subscription::get_sub_condition() const {
return sub_condition;
}
*/
//------------------------------------------------------------------------------
void
nrf_subscription
::
set_notif_events
(
const
std
::
vector
<
uint8_t
>
&
ev_types
)
{
notif_events
=
ev_types
;
}
//------------------------------------------------------------------------------
void
nrf_subscription
::
add_notif_event
(
const
uint8_t
&
ev_type
)
{
notif_events
.
push_back
(
ev_type
);
}
//------------------------------------------------------------------------------
void
nrf_subscription
::
get_notif_events
(
std
::
vector
<
uint8_t
>
&
ev_types
)
const
{
ev_types
=
notif_events
;
}
//------------------------------------------------------------------------------
std
::
vector
<
uint8_t
>
nrf_subscription
::
get_notif_events
()
const
{
return
notif_events
;
}
//------------------------------------------------------------------------------
void
nrf_subscription
::
display
()
{
Logger
::
nrf_app
().
debug
(
"Subscription ID: %s"
,
subscription_id
.
c_str
());
Logger
::
nrf_app
().
debug
(
"Subscription information"
);
Logger
::
nrf_app
().
debug
(
".............Sub ID: %s"
,
subscription_id
.
c_str
());
Logger
::
nrf_app
().
debug
(
"Notification URI: %s"
,
Logger
::
nrf_app
().
debug
(
"
.............
Notification URI: %s"
,
nf_status_notification_uri
.
c_str
());
Logger
::
nrf_app
().
debug
(
".............Subscription condition: %s"
,
sub_condition
.
to_string
().
c_str
());
std
::
string
notif_events_str
=
{};
for
(
auto
n
:
notif_events
){
notif_events_str
.
append
(
notification_event_type_e2str
[
n
]);
notif_events_str
.
append
(
", "
);
}
Logger
::
nrf_app
().
debug
(
".............Notification Events: %s"
,
notif_events_str
.
c_str
());
}
//------------------------------------------------------------------------------
void
nrf_subscription
::
subscribe_nf_status_registered
()
{
Logger
::
nrf_app
().
debug
(
"Subscribe to NF status change event"
);
ev_connection
=
m_event_sub
.
subscribe_nf_status_change
(
//TODO: To be updated
boost
::
bind
(
&
nrf_subscription
::
handle_nf_status_registered
,
this
,
_1
));
ev_connection
=
m_event_sub
.
subscribe_nf_status_change
(
// TODO: To be updated
boost
::
bind
(
&
nrf_subscription
::
handle_nf_status_registered
,
this
,
_1
));
}
//------------------------------------------------------------------------------
...
...
src/nrf_app/nrf_subscription.hpp
View file @
2575d720
...
...
@@ -30,11 +30,10 @@
#ifndef FILE_NRF_SUBSCRIPTION_HPP_SEEN
#define FILE_NRF_SUBSCRIPTION_HPP_SEEN
#include <string>
#include "3gpp_29.510.h"
#include "logger.hpp"
#include "nrf_event.hpp"
#include "nrf_profile.hpp"
#include "logger.hpp"
#include "3gpp_29.510.h"
namespace
oai
{
namespace
nrf
{
...
...
@@ -43,14 +42,17 @@ using namespace std;
class
nrf_subscription
{
public:
nrf_subscription
(
nrf_event
&
ev
)
:
m_event_sub
(
ev
){
nrf_subscription
(
nrf_event
&
ev
)
:
m_event_sub
(
ev
){
};
nrf_subscription
(
nrf_subscription
const
&
)
=
delete
;
virtual
~
nrf_subscription
()
{
Logger
::
nrf_app
().
debug
(
"Delete NRF Subscription instance..."
);
if
(
ev_connection
.
connected
())
ev_connection
.
disconnect
();
}
void
operator
=
(
nrf_subscription
const
&
)
=
delete
;
void
set_subscription_id
(
const
std
::
string
&
sub_id
);
...
...
@@ -63,12 +65,19 @@ class nrf_subscription {
void
get_sub_condition
(
subscription_condition_t
&
c
)
const
;
// subscription_condition_t get_sub_condition() const;
void
set_notif_events
(
const
std
::
vector
<
uint8_t
>
&
ev_types
);
void
add_notif_event
(
const
uint8_t
&
ev_type
);
void
get_notif_events
(
std
::
vector
<
uint8_t
>
&
ev_types
)
const
;
std
::
vector
<
uint8_t
>
get_notif_events
()
const
;
void
subscribe_nf_status_registered
();
void
handle_nf_status_registered
(
const
std
::
shared_ptr
<
nrf_profile
>
&
profile
);
private:
std
::
string
nf_status_notification_uri
;
std
::
string
subscription_id
;
subscription_condition_t
sub_condition
;
std
::
vector
<
uint8_t
>
notif_events
;
nrf_event
&
m_event_sub
;
bs2
::
connection
ev_connection
;
};
...
...
yaml/cmd.txt
View file @
2575d720
...
...
@@ -5,3 +5,8 @@ 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": {"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"} } }'
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 -H "Content-Type: application/json" "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"}}, "reqNotifEvents":["NF_REGISTERED", "NF_DEREGISTERED"] }'
\ 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