Commit f4e86ad1 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

update NRF subscription

parent 03fad3c2
...@@ -84,7 +84,7 @@ typedef struct subscription_condition_api_s { ...@@ -84,7 +84,7 @@ typedef struct subscription_condition_api_s {
bool operator==(const uint8_t &t) const { return (t == type); } bool operator==(const uint8_t &t) const { return (t == type); }
subscription_condition_api_s &operator=(subscription_condition_api_s s) { subscription_condition_api_s &operator=(subscription_condition_api_s &s) {
// TODO: // TODO:
} }
......
...@@ -78,12 +78,85 @@ typedef struct subscription_condition_s { ...@@ -78,12 +78,85 @@ typedef struct subscription_condition_s {
subscription_condition_s(uint8_t t) : type(t) {} subscription_condition_s(uint8_t t) : type(t) {}
subscription_condition_s(const subscription_condition_s &s) {
type = s.type;
switch (s.type) {
case NF_INSTANCE_ID_COND: {
nf_instance_id = s.nf_instance_id;
} break;
case NF_TYPE_COND: {
nf_type = s.nf_type;
} break;
case SERVICE_NAME_COND: {
service_name = s.service_name;
} break;
case AMF_COND: {
amf_info.amf_set_id = s.amf_info.amf_set_id;
amf_info.amf_region_id = s.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:
}
bool operator==(const struct subscription_condition_s &s) const { bool operator==(const struct subscription_condition_s &s) const {
return (s.type == type); return (s.type == type);
} }
bool operator==(const uint8_t &t) const { return (t == type); } bool operator==(const uint8_t &t) const { return (t == type); }
subscription_condition_s &operator=(const subscription_condition_s &s) {
type = s.type;
switch (s.type) {
case NF_INSTANCE_ID_COND: {
nf_instance_id = s.nf_instance_id;
} break;
case NF_TYPE_COND: {
nf_type = s.nf_type;
} break;
case SERVICE_NAME_COND: {
service_name = s.service_name;
} break;
case AMF_COND: {
amf_info.amf_set_id = s.amf_info.amf_set_id;
amf_info.amf_region_id = s.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:
}
virtual ~subscription_condition_s(){}; virtual ~subscription_condition_s(){};
} subscription_condition_t; } subscription_condition_t;
......
...@@ -282,6 +282,8 @@ bool api_conv::subscription_api_to_nrf_subscription( ...@@ -282,6 +282,8 @@ bool api_conv::subscription_api_to_nrf_subscription(
Logger::nrf_app().debug( Logger::nrf_app().debug(
"Subscription condition type: %s", "Subscription condition type: %s",
subscription_condition_type_e2str[sub_condition.type].c_str()); subscription_condition_type_e2str[sub_condition.type].c_str());
sub.get()->set_sub_condition(sub_condition);
} }
// TODO: // TODO:
return true; return true;
......
...@@ -535,16 +535,6 @@ void nrf_app::subscribe_nf_status(const std::string &sub_id) { ...@@ -535,16 +535,6 @@ void nrf_app::subscribe_nf_status(const std::string &sub_id) {
subscribe_nf_status_profile_changed(); subscribe_nf_status_profile_changed();
} }
/*
//------------------------------------------------------------------------------
void nrf_app::handle_nf_status(const std::string &profile_id) {
Logger::nrf_app().info("Handle NF status, profile id %s",
profile_id.c_str()); std::vector<std::string> notification_uris = {};
get_subscription_list(profile_id, notification_uris);
}
*/
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void nrf_app::subscribe_nf_status_registered() { void nrf_app::subscribe_nf_status_registered() {
Logger::nrf_app().debug("Subscribe to NF status registered"); Logger::nrf_app().debug("Subscribe to NF status registered");
...@@ -599,5 +589,6 @@ void nrf_app::handle_nf_status_profile_changed(const std::string &profile_id) { ...@@ -599,5 +589,6 @@ void nrf_app::handle_nf_status_profile_changed(const std::string &profile_id) {
void nrf_app::get_subscription_list(const std::string &profile_id, void nrf_app::get_subscription_list(const std::string &profile_id,
uint8_t notification_type, uint8_t notification_type,
std::vector<std::string> &uris) { std::vector<std::string> &uris) {
// TODO: // TODO:
} }
...@@ -213,7 +213,6 @@ class nrf_app { ...@@ -213,7 +213,6 @@ class nrf_app {
evsub_id_t generate_ev_subscription_id(); evsub_id_t generate_ev_subscription_id();
void subscribe_nf_status(const std::string &sub_id); void subscribe_nf_status(const std::string &sub_id);
// void handle_nf_status(const std::string &profile_id);
void subscribe_nf_status_registered(); void subscribe_nf_status_registered();
void handle_nf_status_registered(const std::string &profile_id); void handle_nf_status_registered(const std::string &profile_id);
void subscribe_nf_status_deregistered(); void subscribe_nf_status_deregistered();
......
...@@ -48,16 +48,32 @@ std::string nrf_subscription::get_subscription_id() const { ...@@ -48,16 +48,32 @@ std::string nrf_subscription::get_subscription_id() const {
return subscription_id; return subscription_id;
} }
//------------------------------------------------------------------------------
void nrf_subscription::set_notification_uri( void nrf_subscription::set_notification_uri(
const std::string &notification_uri) { const std::string &notification_uri) {
nf_status_notification_uri = notification_uri; nf_status_notification_uri = notification_uri;
} }
//------------------------------------------------------------------------------
void nrf_subscription::get_notification_uri( void nrf_subscription::get_notification_uri(
std::string &notification_uri) const { std::string &notification_uri) const {
notification_uri = nf_status_notification_uri; notification_uri = nf_status_notification_uri;
} }
//------------------------------------------------------------------------------
void nrf_subscription::set_sub_condition(const subscription_condition_t &c) {
sub_condition = 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::display() { void nrf_subscription::display() {
Logger::nrf_app().debug("Subscription ID: %s", subscription_id.c_str()); Logger::nrf_app().debug("Subscription ID: %s", subscription_id.c_str());
...@@ -90,3 +106,6 @@ void nrf_subscription::handle_nf_status_change(const std::shared_ptr<nrf_profile ...@@ -90,3 +106,6 @@ void nrf_subscription::handle_nf_status_change(const std::shared_ptr<nrf_profile
} }
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "nrf_event.hpp" #include "nrf_event.hpp"
#include "nrf_profile.hpp" #include "nrf_profile.hpp"
#include "logger.hpp" #include "logger.hpp"
#include "3gpp_29.510.h"
namespace oai { namespace oai {
namespace nrf { namespace nrf {
...@@ -56,12 +57,16 @@ class nrf_subscription { ...@@ -56,12 +57,16 @@ class nrf_subscription {
void set_notification_uri(const std::string &notification_uri); void set_notification_uri(const std::string &notification_uri);
void get_notification_uri(std::string &notification_uri) const; void get_notification_uri(std::string &notification_uri) const;
void display(); void display();
void set_sub_condition(const subscription_condition_t &c);
void get_sub_condition(subscription_condition_t &c) const;
// subscription_condition_t get_sub_condition() const;
void subscribe_nf_status_change(); void subscribe_nf_status_change();
void handle_nf_status_change(const std::shared_ptr<nrf_profile> &profile); void handle_nf_status_change(const std::shared_ptr<nrf_profile> &profile);
private: private:
std::string nf_status_notification_uri; std::string nf_status_notification_uri;
std::string subscription_id; std::string subscription_id;
subscription_condition_t sub_condition;
nrf_event &m_event_sub; nrf_event &m_event_sub;
bs2::connection ev_connection; bs2::connection ev_connection;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment