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

Merge branch 'event_exposure' into 'develop'

Events exposure

See merge request oai/cn5g/oai-cn5g-amf!137
parents cd5e1a41 9743bbc4
......@@ -44,3 +44,13 @@ bs2::connection amf_event::subscribe_ue_connectivity_state(
const ue_connectivity_state_sig_t::slot_type& sig) {
return ue_connectivity_state.connect(sig);
}
bs2::connection amf_event::subscribe_ue_loss_of_connectivity(
const ue_loss_of_connectivity_sig_t::slot_type& sig) {
return ue_loss_of_connectivity.connect(sig);
}
//------------------------------------------------------------------------------
bs2::connection amf_event::subscribe_ue_communication_failure(
const ue_communication_failure_sig_t::slot_type& sig) {
return ue_communication_failure.connect(sig);
}
......@@ -82,7 +82,22 @@ class amf_event {
bs2::connection subscribe_ue_connectivity_state(
const ue_connectivity_state_sig_t::slot_type& sig);
private:
/*
* Subscribe to UE Loss of Connectivity Notification signal
* @param [const ue_loss_of_connectivity_sig_t::slot_type&] sig: slot_type*/
bs2::connection subscribe_ue_loss_of_connectivity(
const ue_loss_of_connectivity_sig_t::slot_type& sig);
/*
* Subscribe to UE Communication Failure Notification signal
* @param [const ue_communication_failure_sig_t::slot_type&] sig: slot_type
* parameter
* @return boost::signals2::connection: the connection between the signal and
* the slot
*/
bs2::connection subscribe_ue_communication_failure(
const ue_communication_failure_sig_t::slot_type& sig);
ue_location_report_sig_t ue_location_report; // Signal for UE Location Report
ue_reachability_status_sig_t
ue_reachability_status; // Signal for UE Reachability Report
......@@ -90,5 +105,9 @@ class amf_event {
ue_registration_state; // Signal for UE Registration State Report
ue_connectivity_state_sig_t
ue_connectivity_state; // Signal for UE Connectivity State Report
ue_loss_of_connectivity_sig_t
ue_loss_of_connectivity; // Signal for UE Loss of Connectivity
ue_communication_failure_sig_t
ue_communication_failure; // Signal for UE Communication Failure Report
};
} // namespace amf_application
......@@ -26,6 +26,7 @@
#include <string>
#include "UserLocation.h"
#include "CommunicationFailure.h"
namespace bs2 = boost::signals2;
......@@ -62,9 +63,24 @@ typedef bs2::signal_type<
bs2::keywords::mutex_type<bs2::dummy_mutex>>::type
ue_connectivity_state_sig_t;
// Signal for Loss of Connectivity
// SUPI, status, HTTP version,
// RAN UE NGAP ID, AMF UE NGAP ID
typedef bs2::signal_type<
void(std::string, uint8_t, uint8_t, uint32_t, long),
bs2::keywords::mutex_type<bs2::dummy_mutex>>::type
ue_loss_of_connectivity_sig_t;
// TODO: Communication-Failure-Report
// Signal for Communication Failure Report
// SUPI, Communication Failure codes, HTTP version
typedef bs2::signal_type<
void(std::string, oai::amf::model::CommunicationFailure, uint8_t),
bs2::keywords::mutex_type<bs2::dummy_mutex>>::type
ue_communication_failure_sig_t;
// TODO: UEs-In-Area-Report
// TODO: Loss-of-Connectivity
} // namespace amf_application
#endif
This diff is collapsed.
......@@ -806,6 +806,40 @@ class amf_n1 {
void handle_ue_connectivity_state_change(
std::string supi, uint8_t status, uint8_t http_version);
/*
* Handle the UE Loss of Connectivity Change event to trigger the notification
* to the subscribed NFs
* @param [std::string] supi: SUPI
* @param [uint8_t] status: UE Loss of Connectivity status
* @param [uint8_t] http_version: HTTP version (for the notification)
* @param [uint32_t] ran_ue_ngap_id: RAN UE NGAP ID
* @param [long] amf_ue_ngap_id: AMF UE NGAP ID
* @return void
*/
void handle_ue_loss_of_connectivity_change(
std::string supi, uint8_t status, uint8_t http_version,
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id);
/*
* Handle the UE Communication Failure event to trigger the notification to the
* subscribed NFs
* @param [std::string] supi: SUPI
* @param [oai::amf::model::CommunicationFailure] comm_failure: Communication Failure reason
* @param [uint8_t] http_version: HTTP version (for the notification)
* @return void
*/
void handle_ue_communication_failure_change(
std::string supi, oai::amf::model::CommunicationFailure, uint8_t http_version);
// for Event Handling
amf_event event_sub;
bs2::connection ee_ue_location_report_connection;
bs2::connection ee_ue_reachability_status_connection;
bs2::connection ee_ue_registration_state_connection;
bs2::connection ee_ue_connectivity_state_connection;
bs2::connection ee_ue_loss_of_connectivity_connection;
bs2::connection ee_ue_communication_failure_connection;
private:
/*
* Handle UE-initiated Deregistration Request message
......@@ -967,13 +1001,6 @@ class amf_n1 {
static uint8_t no_random_delta;
random_state_t random_state;
database_t* db_desc;
// for Event Handling
amf_event event_sub;
bs2::connection ee_ue_location_report_connection;
bs2::connection ee_ue_reachability_status_connection;
bs2::connection ee_ue_registration_state_connection;
bs2::connection ee_ue_connectivity_state_connection;
};
} // namespace amf_application
......
......@@ -1335,7 +1335,7 @@ void amf_n2::handle_itti_message(itti_ue_context_release_command& itti_msg) {
ueCtxRelCmd->setCauseRadioNetwork(
(e_Ngap_CauseRadioNetwork) itti_msg.cause.getValue());
}
uint8_t buffer[BUFFER_SIZE_256];
int encoded_size = ueCtxRelCmd->encode2Buffer(buffer, BUFFER_SIZE_256);
......@@ -1343,6 +1343,84 @@ void amf_n2::handle_itti_message(itti_ue_context_release_command& itti_msg) {
sctp_s_38412.sctp_send_msg(
gc.get()->sctp_assoc_id, unc.get()->sctp_stream_send, &b);
return;
/*
* Send ITTI to N11 SBI, notify CommunicationFailure Report, RAN Cause
*/
std::shared_ptr<nas_context> nc = {};
if (amf_n1_inst->is_amf_ue_id_2_nas_context(itti_msg.amf_ue_ngap_id))
nc = amf_n1_inst->amf_ue_id_2_nas_context(itti_msg.amf_ue_ngap_id);
else {
Logger::amf_n2().warn(
"Could not notify RAN caused CommunicationFailure."
"No existing nas_context with amf_ue_ngap_id(" AMF_UE_NGAP_ID_FMT
")",
itti_msg.amf_ue_ngap_id);
return;
}
string supi = "imsi-" + nc.get()->imsi;
Logger::amf_n2().debug(
"Send request to SBI to trigger UE Communication Failure Report (SUPI "
"%s )",
supi.c_str());
std::vector<std::shared_ptr<amf_subscription>> subscriptions = {};
amf_app_inst->get_ee_subscriptions(
amf_event_type_t::COMMUNICATION_FAILURE_REPORT, subscriptions);
if (subscriptions.size() > 0) {
// Send request to SBI to trigger the notification to the subscribed event
Logger::amf_n1().debug(
"Send ITTI msg to AMF SBI to trigger the event notification");
std::shared_ptr<itti_sbi_notify_subscribed_event> itti_msg_ev =
std::make_shared<itti_sbi_notify_subscribed_event>(
TASK_AMF_N2, TASK_AMF_SBI);
itti_msg_ev->http_version = 1;
for (auto i : subscriptions) {
// Avoid repeated notifications
// TODO: use the anyUE field from the subscription request
if (i.get()->supi_is_set && std::strcmp(i.get()->supi.c_str(), supi.c_str())) continue;
event_notification ev_notif = {};
ev_notif.set_notify_correlation_id(i.get()->notify_correlation_id);
ev_notif.set_notify_uri(i.get()->notify_uri); // Direct subscription
// ev_notif.set_subs_change_notify_correlation_id(i.get()->notify_uri);
oai::amf::model::AmfEventReport event_report = {};
oai::amf::model::AmfEventType amf_event_type = {};
amf_event_type.set_value("COMMUNICATION_FAILURE_REPORT");
event_report.setType(amf_event_type);
oai::amf::model::AmfEventState amf_event_state = {};
amf_event_state.setActive(true);
event_report.setState(amf_event_state);
oai::amf::model::CommunicationFailure comm_failure = {};
NgApCause ngap_cause = {};
ngap_cause.setGroup(itti_msg.cause.getChoiceOfCause());
ngap_cause.setValue(itti_msg.cause.getValue());
comm_failure.setRanReleaseCode(ngap_cause);
event_report.setCommFailure(comm_failure);
event_report.setSupi(supi);
ev_notif.add_report(event_report);
itti_msg_ev->event_notifs.push_back(ev_notif);
}
int ret = itti_inst->send_msg(itti_msg_ev);
if (0 != ret) {
Logger::amf_n2().error(
"Could not send ITTI message %s to task TASK_AMF_SBI",
itti_msg_ev->get_msg_name());
}
}
}
//------------------------------------------------------------------------------
......@@ -2282,6 +2360,12 @@ void amf_n2::remove_ue_context_with_ran_ue_ngap_id(
if (nc.get()->is_stacs_available) {
stacs.update_5gmm_state(nc.get()->imsi, "5GMM-DEREGISTERED");
}
// Trigger UE Loss of Connectivity Status Notify
Logger::amf_n1().debug(
"Signal the UE Loss of Connectivity Event notification for SUPI %s",
supi.c_str());
amf_n1_inst->event_sub.ue_loss_of_connectivity(supi, DEREGISTERED, 1, ran_ue_ngap_id, unc.get()->amf_ue_ngap_id);
amf_n1_inst->remove_imsi_2_nas_context(supi);
// TODO: remove_guti_2_nas_context(guti);
......@@ -2358,6 +2442,11 @@ void amf_n2::remove_ue_context_with_amf_ue_ngap_id(
if (nc.get()->is_stacs_available) {
stacs.update_5gmm_state(nc.get()->imsi, "5GMM-DEREGISTERED");
}
// Trigger UE Loss of Connectivity Status Notify
Logger::amf_n1().debug(
"Signal the UE Loss of Connectivity Event notification for SUPI %s",
supi.c_str());
amf_n1_inst->event_sub.ue_loss_of_connectivity(supi, DEREGISTERED, 1, nc.get()->ran_ue_ngap_id, amf_ue_ngap_id);
amf_n1_inst->remove_imsi_2_nas_context(supi);
// TODO: remove_guti_2_nas_context(guti);
......
......@@ -571,9 +571,30 @@ void amf_sbi::handle_itti_message(itti_sbi_notify_subscribed_event& itti_msg) {
if (r.supiIsSet()) {
report["supi"] = r.getSupi();
}
if (r.locationIsSet()) {
report["location"] = r.getLocation(); // get eutraLocation, nrLocation, n3gaLocation?
}
if (r.rmInfoListIsSet()) {
report["rmInfoList"] = r.getRmInfoList();
}
if (r.cmInfoListIsSet()) {
report["cmInfoList"] = r.getCmInfoList();
}
if (r.reachabilityIsSet()) {
report["reachability"] = r.getReachability().get_value();
}
if (r.lossOfConnectReasonIsSet()) {
report["lossOfConnectReason"] = r.getLossOfConnectReason().get_value();
}
if (r.ranUeNgapIdIsSet()) {
report["ranUeNgapId"] = r.getRanUeNgapId();
}
if (r.amfUeNgapIdIsSet()) {
report["amfUeNgapId"] = r.getAmfUeNgapId();
}
if (r.commFailureIsSet()) {
report["commFailure"] = r.getCommFailure();
}
// Timestamp
std::time_t time_epoch_ntp = std::time(nullptr);
......
......@@ -55,6 +55,18 @@ typedef enum { CM_IDLE = 0, CM_CONNECTED } cm_state_t;
static const std::vector<std::string> cm_state_e2str = {
"CM_IDLE", "CM_CONNECTED"};
typedef enum {
DEREGISTERED = 0,
MAX_DETECTION_TIME_EXPIRED,
PURGED
} loss_of_connectivity_status_t;
static const std::vector<std::string> loss_of_connectivity_status_e2str = {
"DEREGISTERED",
"MAX_DETECTION_TIME_EXPIRED",
"PURGED"
};
class nas_context {
public:
nas_context();
......
......@@ -41,6 +41,9 @@ AmfEventReport::AmfEventReport() {
m_CmInfoListIsSet = false;
m_ReachabilityIsSet = false;
m_CommFailureIsSet = false;
m_LossOfConnectReasonIsSet = false;
m_RanUeNgapIdIsSet = false;
m_AmfUeNgapIdIsSet = false;
m_NumberOfUes = 0;
m_NumberOfUesIsSet = false;
m_r_5gsUserStateListIsSet = false;
......@@ -256,6 +259,18 @@ bool AmfEventReport::operator==(const AmfEventReport& rhs) const {
(commFailureIsSet() && rhs.commFailureIsSet() &&
getCommFailure() == rhs.getCommFailure())) &&
((!lossOfConnectReasonIsSet() && !rhs.lossOfConnectReasonIsSet()) ||
(lossOfConnectReasonIsSet() && rhs.lossOfConnectReasonIsSet() &&
getLossOfConnectReason() == rhs.getLossOfConnectReason())) &&
((!ranUeNgapIdIsSet() && !rhs.ranUeNgapIdIsSet()) ||
(ranUeNgapIdIsSet() && rhs.ranUeNgapIdIsSet() &&
getRanUeNgapId() == rhs.getRanUeNgapId())) &&
((!amfUeNgapIdIsSet() && !rhs.amfUeNgapIdIsSet()) ||
(amfUeNgapIdIsSet() && rhs.amfUeNgapIdIsSet() &&
getAmfUeNgapId() == rhs.getAmfUeNgapId())) &&
((!numberOfUesIsSet() && !rhs.numberOfUesIsSet()) ||
(numberOfUesIsSet() && rhs.numberOfUesIsSet() &&
getNumberOfUes() == rhs.getNumberOfUes())) &&
......@@ -293,6 +308,9 @@ void to_json(nlohmann::json& j, const AmfEventReport& o) {
j["cmInfoList"] = o.m_CmInfoList;
if (o.reachabilityIsSet()) j["reachability"] = o.m_Reachability;
if (o.commFailureIsSet()) j["commFailure"] = o.m_CommFailure;
if (o.lossOfConnectReasonIsSet()) j["lossOfConnectReason"] = o.m_LossOfConnectReason;
if (o.ranUeNgapIdIsSet()) j["ranUeNgapId"] = o.m_RanUeNgapId;
if (o.amfUeNgapIdIsSet()) j["amfUeNgapId"] = o.m_AmfUeNgapId;
if (o.numberOfUesIsSet()) j["numberOfUes"] = o.m_NumberOfUes;
if (o.r5gsUserStateListIsSet() || !o.m_r_5gsUserStateList.empty())
j["5gsUserStateList"] = o.m_r_5gsUserStateList;
......@@ -358,6 +376,18 @@ void from_json(const nlohmann::json& j, AmfEventReport& o) {
j.at("commFailure").get_to(o.m_CommFailure);
o.m_CommFailureIsSet = true;
}
if (j.find("lossOfConnectReason") != j.end()) {
j.at("lossOfConnectReason").get_to(o.m_LossOfConnectReason);
o.m_LossOfConnectReasonIsSet = true;
}
if (j.find("ranUeNgapId") != j.end()) {
j.at("ranUeNgapId").get_to(o.m_RanUeNgapId);
o.m_RanUeNgapIdIsSet = true;
}
if (j.find("amfUeNgapId") != j.end()) {
j.at("amfUeNgapId").get_to(o.m_AmfUeNgapId);
o.m_AmfUeNgapIdIsSet = true;
}
if (j.find("numberOfUes") != j.end()) {
j.at("numberOfUes").get_to(o.m_NumberOfUes);
o.m_NumberOfUesIsSet = true;
......@@ -568,6 +598,45 @@ bool AmfEventReport::commFailureIsSet() const {
void AmfEventReport::unsetCommFailure() {
m_CommFailureIsSet = false;
}
LossOfConnectivityReason AmfEventReport::getLossOfConnectReason() const {
return m_LossOfConnectReason;
}
void AmfEventReport::setLossOfConnectReason(LossOfConnectivityReason const& value) {
m_LossOfConnectReason = value;
m_LossOfConnectReasonIsSet = true;
}
bool AmfEventReport::lossOfConnectReasonIsSet() const {
return m_LossOfConnectReasonIsSet;
}
void AmfEventReport::unsetLossOfConnectReason() {
m_LossOfConnectReasonIsSet = false;
}
uint32_t AmfEventReport::getRanUeNgapId() const {
return m_RanUeNgapId;
}
void AmfEventReport::setRanUeNgapId(uint32_t const value) {
m_RanUeNgapId = value;
m_RanUeNgapIdIsSet = true;
}
bool AmfEventReport::ranUeNgapIdIsSet() const {
return m_RanUeNgapIdIsSet;
}
void AmfEventReport::unsetRanUeNgapId() {
m_RanUeNgapIdIsSet = false;
}
long AmfEventReport::getAmfUeNgapId() const {
return m_AmfUeNgapId;
}
void AmfEventReport::setAmfUeNgapId(long const value) {
m_AmfUeNgapId = value;
m_AmfUeNgapIdIsSet = true;
}
bool AmfEventReport::amfUeNgapIdIsSet() const {
return m_AmfUeNgapIdIsSet;
}
void AmfEventReport::unsetAmfUeNgapId() {
m_AmfUeNgapIdIsSet = false;
}
int32_t AmfEventReport::getNumberOfUes() const {
return m_NumberOfUes;
}
......
......@@ -31,6 +31,7 @@
#include "AmfEventType.h"
#include "CmInfo.h"
#include "CommunicationFailure.h"
#include "LossOfConnectivityReason.h"
#include <nlohmann/json.hpp>
namespace oai::amf::model {
......@@ -175,6 +176,27 @@ class AmfEventReport {
bool commFailureIsSet() const;
void unsetCommFailure();
/// <summary>
///
/// </summary>
LossOfConnectivityReason getLossOfConnectReason() const;
void setLossOfConnectReason(LossOfConnectivityReason const& value);
bool lossOfConnectReasonIsSet() const;
void unsetLossOfConnectReason();
/// <summary>
///
/// </summary>
uint32_t getRanUeNgapId() const;
void setRanUeNgapId(uint32_t const value);
bool ranUeNgapIdIsSet() const;
void unsetRanUeNgapId();
/// <summary>
///
/// </summary>
long getAmfUeNgapId() const;
void setAmfUeNgapId(long const value);
bool amfUeNgapIdIsSet() const;
void unsetAmfUeNgapId();
/// <summary>
///
/// </summary>
int32_t getNumberOfUes() const;
......@@ -230,6 +252,12 @@ class AmfEventReport {
bool m_ReachabilityIsSet;
CommunicationFailure m_CommFailure;
bool m_CommFailureIsSet;
LossOfConnectivityReason m_LossOfConnectReason;
bool m_LossOfConnectReasonIsSet;
uint32_t m_RanUeNgapId;
bool m_RanUeNgapIdIsSet;
long m_AmfUeNgapId;
bool m_AmfUeNgapIdIsSet;
int32_t m_NumberOfUes;
bool m_NumberOfUesIsSet;
std::vector<_5GsUserStateInfo> m_r_5gsUserStateList;
......
/**
* Namf_EventExposure
* AMF Event Exposure Service © 2022, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.7
*
* NOTE: This class is auto generated by OpenAPI-Generator 6.0.1.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "LossOfConnectivityReason.h"
#include "Helpers.h"
#include <sstream>
namespace oai::amf::model {
LossOfConnectivityReason::LossOfConnectivityReason() {}
void LossOfConnectivityReason::validate() const {
std::stringstream msg;
if (!validate(msg)) {
throw oai::amf::helpers::ValidationException(msg.str());
}
}
bool LossOfConnectivityReason::validate(std::stringstream& msg) const {
return validate(msg, "");
}
bool LossOfConnectivityReason::validate(
std::stringstream& msg, const std::string& pathPrefix) const {
bool success = true;
const std::string _pathPrefix =
pathPrefix.empty() ? "LossOfConnectivityReason" : pathPrefix;
return success;
}
bool LossOfConnectivityReason::operator==(const LossOfConnectivityReason& rhs) const {
return true; // TODO
;
}
bool LossOfConnectivityReason::operator!=(const LossOfConnectivityReason& rhs) const {
return !(*this == rhs);
}
void LossOfConnectivityReason::set_value(std::string value) {
this->value = value;
}
void LossOfConnectivityReason::get_value(std::string& value) const {
value = this->value;
}
std::string LossOfConnectivityReason::get_value() const {
return value;
}
void to_json(nlohmann::json& j, const LossOfConnectivityReason& o) {
j = o.get_value();
}
void from_json(const nlohmann::json& j, LossOfConnectivityReason& o) {
o.set_value(j.get<std::string>());
}
} // namespace oai::amf::model
/**
* Namf_EventExposure
* AMF Event Exposure Service © 2022, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.7
*
* NOTE: This class is auto generated by OpenAPI-Generator 6.0.1.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* LossOfConnectivityReason.h
*
*
*/
#ifndef LossOfConnectivityReason_H_
#define LossOfConnectivityReason_H_
#include "LossOfConnectivityReason_anyOf.h"
#include <nlohmann/json.hpp>
namespace oai::amf::model {
/// <summary>
///
/// </summary>
class LossOfConnectivityReason {
public:
LossOfConnectivityReason();
virtual ~LossOfConnectivityReason() = default;
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on
/// failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes
/// an error message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
bool operator==(const LossOfConnectivityReason& rhs) const;
bool operator!=(const LossOfConnectivityReason& rhs) const;
/////////////////////////////////////////////
/// LossOfConnectivityReason members
void set_value(std::string value);
void get_value(std::string& value) const;
std::string get_value() const;
friend void to_json(nlohmann::json& j, const LossOfConnectivityReason& o);
friend void from_json(const nlohmann::json& j, LossOfConnectivityReason& o);
protected:
std::string value;
// Helper overload for validate. Used when one model stores another model and
// calls it's validate.
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
};
} // namespace oai::amf::model
#endif /* LossOfConnectivityReason_H_ */
/**
* Namf_EventExposure
* AMF Event Exposure Service © 2022, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.7
*
* NOTE: This class is auto generated by OpenAPI-Generator 6.0.1.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "LossOfConnectivityReason_anyOf.h"
#include "Helpers.h"
#include <stdexcept>
#include <sstream>
namespace oai::amf::model {
LossOfConnectivityReason_anyOf::LossOfConnectivityReason_anyOf() {}
void LossOfConnectivityReason_anyOf::validate() const {
std::stringstream msg;
if (!validate(msg)) {
throw oai::amf::helpers::ValidationException(msg.str());
}
}
bool LossOfConnectivityReason_anyOf::validate(std::stringstream& msg) const {
return validate(msg, "");
}
bool LossOfConnectivityReason_anyOf::validate(
std::stringstream& msg, const std::string& pathPrefix) const {
bool success = true;
const std::string _pathPrefix =
pathPrefix.empty() ? "LossOfConnectivityReason_anyOf" : pathPrefix;
if (m_value == LossOfConnectivityReason_anyOf::eLossOfConnectivityReason_anyOf::
INVALID_VALUE_OPENAPI_GENERATED) {
success = false;
msg << _pathPrefix << ": has no value;";
}
return success;
}
bool LossOfConnectivityReason_anyOf::operator==(const LossOfConnectivityReason_anyOf& rhs) const {
return getValue() == rhs.getValue();
}
bool LossOfConnectivityReason_anyOf::operator!=(const LossOfConnectivityReason_anyOf& rhs) const {
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const LossOfConnectivityReason_anyOf& o) {
j = nlohmann::json();
switch (o.getValue()) {
case LossOfConnectivityReason_anyOf::eLossOfConnectivityReason_anyOf::
INVALID_VALUE_OPENAPI_GENERATED:
j = "INVALID_VALUE_OPENAPI_GENERATED";
break;
case LossOfConnectivityReason_anyOf::eLossOfConnectivityReason_anyOf::DEREGISTERED:
j = "DEREGISTERED";
break;
case LossOfConnectivityReason_anyOf::eLossOfConnectivityReason_anyOf::MAX_DETECTION_TIME_EXPIRED:
j = "MAX_DETECTION_TIME_EXPIRED";
break;
case LossOfConnectivityReason_anyOf::eLossOfConnectivityReason_anyOf::PURGED:
j = "PURGED";
break;
}
}
void from_json(const nlohmann::json& j, LossOfConnectivityReason_anyOf& o) {
auto s = j.get<std::string>();
if (s == "DEREGISTERED") {
o.setValue(LossOfConnectivityReason_anyOf::eLossOfConnectivityReason_anyOf::DEREGISTERED);
} else if (s == "MAX_DETECTION_TIME_EXPIRED") {
o.setValue(LossOfConnectivityReason_anyOf::eLossOfConnectivityReason_anyOf::MAX_DETECTION_TIME_EXPIRED);
} else if (s == "PURGED") {
o.setValue(LossOfConnectivityReason_anyOf::eLossOfConnectivityReason_anyOf::PURGED);
} else {
std::stringstream ss;
ss << "Unexpected value " << s << " in json"
<< " cannot be converted to enum of type"
<< " LossOfConnectivityReason_anyOf::eLossOfConnectivityReason_anyOf";
throw std::invalid_argument(ss.str());
}
}
LossOfConnectivityReason_anyOf::eLossOfConnectivityReason_anyOf LossOfConnectivityReason_anyOf::getValue()
const {
return m_value;
}
void LossOfConnectivityReason_anyOf::setValue(
LossOfConnectivityReason_anyOf::eLossOfConnectivityReason_anyOf value) {
m_value = value;
}
} // namespace oai::amf::model
/**
* Namf_EventExposure
* AMF Event Exposure Service © 2022, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.7
*
* NOTE: This class is auto generated by OpenAPI-Generator 6.0.1.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* LossOfConnectivityReason_anyOf.h
*
*
*/
#ifndef LossOfConnectivityReason_anyOf_H_
#define LossOfConnectivityReason_anyOf_H_
#include <nlohmann/json.hpp>
namespace oai::amf::model {
/// <summary>
///
/// </summary>
class LossOfConnectivityReason_anyOf {
public:
LossOfConnectivityReason_anyOf();
virtual ~LossOfConnectivityReason_anyOf() = default;
enum class eLossOfConnectivityReason_anyOf {
// To have a valid default value.
// Avoiding nameclashes with user defined
// enum values
INVALID_VALUE_OPENAPI_GENERATED = 0,
DEREGISTERED,
MAX_DETECTION_TIME_EXPIRED,
PURGED
};
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on
/// failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes
/// an error message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
bool operator==(const LossOfConnectivityReason_anyOf& rhs) const;
bool operator!=(const LossOfConnectivityReason_anyOf& rhs) const;
/////////////////////////////////////////////
/// LossOfConnectivityReason_anyOf members
LossOfConnectivityReason_anyOf::eLossOfConnectivityReason_anyOf getValue() const;
void setValue(LossOfConnectivityReason_anyOf::eLossOfConnectivityReason_anyOf value);
friend void to_json(nlohmann::json& j, const LossOfConnectivityReason_anyOf& o);
friend void from_json(const nlohmann::json& j, LossOfConnectivityReason_anyOf& o);
protected:
LossOfConnectivityReason_anyOf::eLossOfConnectivityReason_anyOf m_value = LossOfConnectivityReason_anyOf::
eLossOfConnectivityReason_anyOf::INVALID_VALUE_OPENAPI_GENERATED;
// Helper overload for validate. Used when one model stores another model and
// calls it's validate.
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
};
} // namespace oai::amf::model
#endif /* LossOfConnectivityReason_anyOf_H_ */
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