Commit 2562b02d authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Merge branch 'event_exposure' into 'develop'

PDU SESS EST + Qos Monitoring events exposure

See merge request oai/cn5g/oai-cn5g-smf!147
parents f1873ad2 c1d240b1
...@@ -51,6 +51,8 @@ EventNotification::EventNotification() { ...@@ -51,6 +51,8 @@ EventNotification::EventNotification() {
m_DddStatusIsSet = false; m_DddStatusIsSet = false;
m_MaxWaitTime = ""; m_MaxWaitTime = "";
m_MaxWaitTimeIsSet = false; m_MaxWaitTimeIsSet = false;
m_usageReport = {};
m_usageReportIsSet = false;
} }
EventNotification::~EventNotification() {} EventNotification::~EventNotification() {}
...@@ -86,6 +88,7 @@ void to_json(nlohmann::json& j, const EventNotification& o) { ...@@ -86,6 +88,7 @@ void to_json(nlohmann::json& j, const EventNotification& o) {
if (o.pduSeIdIsSet()) j["pduSeId"] = o.m_PduSeId; if (o.pduSeIdIsSet()) j["pduSeId"] = o.m_PduSeId;
if (o.dddStatusIsSet()) j["dddStatus"] = o.m_DddStatus; if (o.dddStatusIsSet()) j["dddStatus"] = o.m_DddStatus;
if (o.maxWaitTimeIsSet()) j["maxWaitTime"] = o.m_MaxWaitTime; if (o.maxWaitTimeIsSet()) j["maxWaitTime"] = o.m_MaxWaitTime;
if (o.usageReportIsSet()) j["Usage Report"] = o.m_usageReport;
} }
void from_json(const nlohmann::json& j, EventNotification& o) { void from_json(const nlohmann::json& j, EventNotification& o) {
...@@ -175,6 +178,10 @@ void from_json(const nlohmann::json& j, EventNotification& o) { ...@@ -175,6 +178,10 @@ void from_json(const nlohmann::json& j, EventNotification& o) {
j.at("maxWaitTime").get_to(o.m_MaxWaitTime); j.at("maxWaitTime").get_to(o.m_MaxWaitTime);
o.m_MaxWaitTimeIsSet = true; o.m_MaxWaitTimeIsSet = true;
} }
if (j.find("Usage Report") != j.end()) {
j.at("Usage Report").get_to(o.m_usageReport);
o.m_usageReportIsSet = true;
}
} }
SmfEvent EventNotification::getEvent() const { SmfEvent EventNotification::getEvent() const {
...@@ -462,6 +469,19 @@ bool EventNotification::maxWaitTimeIsSet() const { ...@@ -462,6 +469,19 @@ bool EventNotification::maxWaitTimeIsSet() const {
void EventNotification::unsetMaxWaitTime() { void EventNotification::unsetMaxWaitTime() {
m_MaxWaitTimeIsSet = false; m_MaxWaitTimeIsSet = false;
} }
UsageReport EventNotification::getUsageReport() const {
return m_usageReport;
}
void EventNotification::setUsageReport(UsageReport const& value) {
m_usageReport = value;
m_usageReportIsSet = true;
}
bool EventNotification::usageReportIsSet() const {
return m_usageReportIsSet;
}
void EventNotification::unsetUsageReport() {
m_usageReportIsSet = false;
}
} // namespace model } // namespace model
} // namespace smf_server } // namespace smf_server
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "PlmnId.h" #include "PlmnId.h"
#include "RouteToLocation.h" #include "RouteToLocation.h"
#include "AccessType.h" #include "AccessType.h"
#include "UsageReport.h"
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
namespace oai { namespace oai {
...@@ -203,6 +204,13 @@ class EventNotification { ...@@ -203,6 +204,13 @@ class EventNotification {
void setMaxWaitTime(std::string const& value); void setMaxWaitTime(std::string const& value);
bool maxWaitTimeIsSet() const; bool maxWaitTimeIsSet() const;
void unsetMaxWaitTime(); void unsetMaxWaitTime();
/// <summary>
///
/// </summary>
UsageReport getUsageReport() const;
void setUsageReport(UsageReport const& value);
bool usageReportIsSet() const;
void unsetUsageReport();
friend void to_json(nlohmann::json& j, const EventNotification& o); friend void to_json(nlohmann::json& j, const EventNotification& o);
friend void from_json(const nlohmann::json& j, EventNotification& o); friend void from_json(const nlohmann::json& j, EventNotification& o);
...@@ -254,6 +262,8 @@ class EventNotification { ...@@ -254,6 +262,8 @@ class EventNotification {
bool m_DddStatusIsSet; bool m_DddStatusIsSet;
std::string m_MaxWaitTime; std::string m_MaxWaitTime;
bool m_MaxWaitTimeIsSet; bool m_MaxWaitTimeIsSet;
UsageReport m_usageReport;
bool m_usageReportIsSet;
}; };
} // namespace model } // namespace model
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
* *
* Possible values are - AC_TY_CH: Access Type Change - UP_PATH_CH: UP Path * Possible values are - AC_TY_CH: Access Type Change - UP_PATH_CH: UP Path
* Change - PDU_SES_REL: PDU Session Release - PLMN_CH: PLMN Change - UE_IP_CH: * Change - PDU_SES_REL: PDU Session Release - PLMN_CH: PLMN Change - UE_IP_CH:
* UE IP address change - DDDS: Downlink data delivery status * UE IP address change - DDDS: Downlink data delivery status - QOS_MON: QoS
* Monitoring
*/ */
#ifndef SmfEvent_H_ #ifndef SmfEvent_H_
...@@ -30,7 +31,8 @@ namespace model { ...@@ -30,7 +31,8 @@ namespace model {
/// <summary> /// <summary>
/// Possible values are - AC_TY_CH: Access Type Change - UP_PATH_CH: UP Path /// Possible values are - AC_TY_CH: Access Type Change - UP_PATH_CH: UP Path
/// Change - PDU_SES_REL: PDU Session Release - PLMN_CH: PLMN Change - UE_IP_CH: /// Change - PDU_SES_REL: PDU Session Release - PLMN_CH: PLMN Change - UE_IP_CH:
/// UE IP address change - DDDS: Downlink data delivery status /// UE IP address change - DDDS: Downlink data delivery status - QOS_MON: QoS
/// Monitoring
/// </summary> /// </summary>
class SmfEvent { class SmfEvent {
public: public:
......
/**
* Nsmf_EventExposure
*
* UsageReport.cpp
*/
#include "UsageReport.h"
// #include <sstream>
namespace oai {
namespace smf_server {
namespace model {
UsageReport::UsageReport() {
m_SEndID = 0;
m_SEndIDIsSet = false;
m_urSeqN = 0;
m_urSeqNIsSet = false;
m_duration = 0;
m_durationIsSet = false;
m_totNoP = 0;
m_totNoPIsSet = false;
m_ulNoP = 0;
m_ulNoPIsSet = false;
m_dlNoP = 0;
m_dlNoPIsSet = false;
m_totVol = 0;
m_totVolIsSet = false;
m_ulVol = 0;
m_ulVolIsSet = false;
m_dlVol = 0;
m_dlVolIsSet = false;
m_urTrig = {};
m_urTrigIsSet = false;
}
UsageReport::~UsageReport() {}
void UsageReport::validate() {
// TODO: implement validation
}
void to_json(nlohmann::json& j, const UsageReport& o) {
j = nlohmann::json();
if (o.SEndIDIsSet()) j["SEID"] = o.m_SEndID;
if (o.urSeqNIsSet()) j["UR-SEQN"] = o.m_urSeqN;
if (o.urTriggerIsSet()) {
if (o.m_urTrig.perio) j["Trigger"] = "Periodic Reporting";
if (o.m_urTrig.volth) j["Trigger"] = "Volume Threshold";
if (o.m_urTrig.timth) j["Trigger"] = "Time Threshold";
if (o.m_urTrig.volqu) j["Trigger"] = "Volume Quota";
if (o.m_urTrig.timqu) j["Trigger"] = "Time Quota";
/*
switch (o.m_urTrig) {
case :
j["Trigger"] = "Periodic Reporting";
break;
case UsageReportTrigger::VOLTH:
j["Trigger"] = "Volume Threshold";
break;
case UsageReportTrigger::TIMTH:
j["Trigger"] = "Time Threshold";
break;
case UsageReportTrigger::VOLQU:
j["Trigger"] = "Volume Quota";
break;
case UsageReportTrigger::TIMQU:
j["Trigger"] = "Time Quota";
break;
}
*/
}
if (o.durationIsSet()) j["Duration"] = o.m_duration;
if (o.totNoPIsSet()) j["NoP"]["Total"] = o.m_totNoP;
if (o.ulNoPIsSet()) j["NoP"]["Uplink"] = o.m_ulNoP;
if (o.dlNoPIsSet()) j["NoP"]["Downlink"] = o.m_dlNoP;
if (o.totVolIsSet()) j["Volume"]["Total"] = o.m_totVol;
if (o.ulVolIsSet()) j["Volume"]["Uplink"] = o.m_ulVol;
if (o.dlVolIsSet()) j["Volume"]["Downlink"] = o.m_dlVol;
}
void from_json(const nlohmann::json& j, UsageReport& o) {
if (j.find("SEID") != j.end()) {
j.at("SEID").get_to(o.m_SEndID);
o.m_SEndIDIsSet = true;
}
if (j.find("UR-SEQN") != j.end()) {
j.at("UR-SEQN").get_to(o.m_urSeqN);
o.m_urSeqNIsSet = true;
}
if (j.find("Trigger") != j.end()) {
o.m_urTrigIsSet = true;
auto s = j.get<std::string>();
s = j.at("Trigger");
if (s == "Periodic Reporting") o.m_urTrig.perio = 1;
if (s == "Volume Threshold") o.m_urTrig.volth = 1;
if (s == "Time Threshold") o.m_urTrig.timth = 1;
if (s == "Volume Quota") o.m_urTrig.volqu = 1;
if (s == "Time Quota")
o.m_urTrig.timqu = 1;
else {
o.m_urTrigIsSet = false;
// TODO: Handle invalid JSON
}
}
if (j.find("Duration") != j.end()) {
j.at("Duration").get_to(o.m_duration);
o.m_durationIsSet = true;
}
if (j.find("NoP") != j.end()) {
if (j.find("Total") != j.end()) {
j.at("Total").get_to(o.m_totNoP);
o.m_totNoPIsSet = true;
}
if (j.find("Uplink") != j.end()) {
j.at("Uplink").get_to(o.m_ulNoP);
o.m_ulNoPIsSet = true;
}
if (j.find("Downlink") != j.end()) {
j.at("Downlink").get_to(o.m_dlNoP);
o.m_dlNoPIsSet = true;
}
}
if (j.find("Volume") != j.end()) {
if (j.find("Total") != j.end()) {
j.at("Total").get_to(o.m_totVol);
o.m_totVolIsSet = true;
}
if (j.find("Uplink") != j.end()) {
j.at("Uplink").get_to(o.m_ulVol);
o.m_ulVolIsSet = true;
}
if (j.find("Downlink") != j.end()) {
j.at("Downlink").get_to(o.m_dlVol);
o.m_dlVolIsSet = true;
}
}
}
int64_t UsageReport::getSEndID() const {
return m_SEndID;
}
void UsageReport::setSEndID(int64_t const& value) {
m_SEndID = value;
m_SEndIDIsSet = true;
}
bool UsageReport::SEndIDIsSet() const {
return m_SEndIDIsSet;
}
void UsageReport::unsetSEndID() {
m_SEndIDIsSet = false;
}
int32_t UsageReport::geturSeqN() const {
return m_urSeqN;
}
void UsageReport::seturSeqN(int32_t const& value) {
m_urSeqN = value;
m_urSeqNIsSet = true;
}
bool UsageReport::urSeqNIsSet() const {
return m_urSeqNIsSet;
}
void UsageReport::unseturSeqN() {
m_urSeqNIsSet = false;
}
int32_t UsageReport::getDuration() const {
return m_duration;
}
void UsageReport::setDuration(int32_t const& value) {
m_duration = value;
m_durationIsSet = true;
}
bool UsageReport::durationIsSet() const {
return m_durationIsSet;
}
void UsageReport::unsetDuration() {
m_durationIsSet = false;
}
int64_t UsageReport::getTotNoP() const {
return m_totNoP;
}
void UsageReport::setTotNoP(int64_t const& value) {
m_totNoP = value;
m_totNoPIsSet = true;
}
bool UsageReport::totNoPIsSet() const {
return m_totNoPIsSet;
}
void UsageReport::unsetTotNoP() {
m_totNoPIsSet = false;
}
int64_t UsageReport::getUlNoP() const {
return m_ulNoP;
}
void UsageReport::setUlNoP(int64_t const& value) {
m_ulNoP = value;
m_ulNoPIsSet = true;
}
bool UsageReport::ulNoPIsSet() const {
return m_ulNoPIsSet;
}
void UsageReport::unsetUlNoP() {
m_ulNoPIsSet = false;
}
int64_t UsageReport::getDlNoP() const {
return m_dlNoP;
}
void UsageReport::setDlNoP(int64_t const& value) {
m_dlNoP = value;
m_dlNoPIsSet = true;
}
bool UsageReport::dlNoPIsSet() const {
return m_dlNoPIsSet;
}
void UsageReport::unsetDlNoP() {
m_dlNoPIsSet = false;
}
int64_t UsageReport::getTotVol() const {
return m_totVol;
}
void UsageReport::setTotVol(int64_t const& value) {
m_totVol = value;
m_totVolIsSet = true;
}
bool UsageReport::totVolIsSet() const {
return m_totVolIsSet;
}
void UsageReport::unsetTotVol() {
m_totVolIsSet = false;
}
int64_t UsageReport::getUlVol() const {
return m_ulVol;
}
void UsageReport::setUlVol(int64_t const& value) {
m_ulVol = value;
m_ulVolIsSet = true;
}
bool UsageReport::ulVolIsSet() const {
return m_ulVolIsSet;
}
void UsageReport::unsetUlVol() {
m_ulVolIsSet = false;
}
int64_t UsageReport::getDlVol() const {
return m_dlVol;
}
void UsageReport::setDlVol(int64_t const& value) {
m_dlVol = value;
m_dlVolIsSet = true;
}
bool UsageReport::dlVolIsSet() const {
return m_dlVolIsSet;
}
void UsageReport::unsetDlVol() {
m_dlVolIsSet = false;
}
pfcp::usage_report_trigger_t UsageReport::getURTrigger() const {
return m_urTrig;
}
void UsageReport::setURTrigger(pfcp::usage_report_trigger_t const& value) {
m_urTrig = value;
m_urTrigIsSet = true;
}
bool UsageReport::urTriggerIsSet() const {
return m_urTrigIsSet;
}
void UsageReport::unsetURTrigger() {
m_urTrigIsSet = false;
}
} // namespace model
} // namespace smf_server
} // namespace oai
/**
* Nsmf_EventExposure
*
* UsageReport.h
*/
#ifndef UsageReport_H_
#define UsageReport_H_
#include "msg_pfcp.hpp"
#include <nlohmann/json.hpp>
namespace oai {
namespace smf_server {
namespace model {
// TODO: Redefine in separate files
enum UsageReportTrigger { PERIO = 1, VOLTH, TIMTH, VOLQU, TIMQU };
/// <summary>
///
/// </summary>
class UsageReport {
public:
UsageReport();
virtual ~UsageReport();
void validate();
/////////////////////////////////////////////
/// UsageReport members
/// <summary>
///
/// </summary>
int64_t getSEndID() const;
void setSEndID(int64_t const& value);
bool SEndIDIsSet() const;
void unsetSEndID();
/// <summary>
///
/// </summary>
int32_t geturSeqN() const;
void seturSeqN(int32_t const& value);
bool urSeqNIsSet() const;
void unseturSeqN();
/// <summary>
///
/// </summary>
int32_t getDuration() const;
void setDuration(int32_t const& value);
bool durationIsSet() const;
void unsetDuration();
/// <summary>
///
/// </summary>
int64_t getTotNoP() const;
void setTotNoP(int64_t const& value);
bool totNoPIsSet() const;
void unsetTotNoP();
/// <summary>
///
/// </summary>
int64_t getUlNoP() const;
void setUlNoP(int64_t const& value);
bool ulNoPIsSet() const;
void unsetUlNoP();
/// <summary>
///
/// </summary>
int64_t getDlNoP() const;
void setDlNoP(int64_t const& value);
bool dlNoPIsSet() const;
void unsetDlNoP();
/// <summary>
///
/// </summary>
int64_t getTotVol() const;
void setTotVol(int64_t const& value);
bool totVolIsSet() const;
void unsetTotVol();
/// <summary>
///
/// </summary>
int64_t getUlVol() const;
void setUlVol(int64_t const& value);
bool ulVolIsSet() const;
void unsetUlVol();
/// <summary>
///
/// </summary>
int64_t getDlVol() const;
void setDlVol(int64_t const& value);
bool dlVolIsSet() const;
void unsetDlVol();
/// <summary>
///
/// </summary>
pfcp::usage_report_trigger_t getURTrigger() const;
void setURTrigger(pfcp::usage_report_trigger_t const& value);
bool urTriggerIsSet() const;
void unsetURTrigger();
friend void to_json(nlohmann::json& j, const UsageReport& o);
friend void from_json(const nlohmann::json& j, UsageReport& o);
protected:
int64_t m_SEndID;
bool m_SEndIDIsSet;
int32_t m_urSeqN;
bool m_urSeqNIsSet;
int32_t m_duration;
bool m_durationIsSet;
int64_t m_totNoP;
bool m_totNoPIsSet;
int64_t m_ulNoP;
bool m_ulNoPIsSet;
int64_t m_dlNoP;
bool m_dlNoPIsSet;
int64_t m_totVol;
bool m_totVolIsSet;
int64_t m_ulVol;
bool m_ulVolIsSet;
int64_t m_dlVol;
bool m_dlVolIsSet;
// UsageReportTrigger m_urTrig;
pfcp::usage_report_trigger_t m_urTrig;
bool m_urTrigIsSet;
};
} // namespace model
} // namespace smf_server
} // namespace oai
#endif /* UsageReport_H_ */
...@@ -31,7 +31,9 @@ typedef enum smf_event_e { ...@@ -31,7 +31,9 @@ typedef enum smf_event_e {
SMF_EVENT_PLMN_CH = 4, SMF_EVENT_PLMN_CH = 4,
SMF_EVENT_UE_IP_CH = 5, SMF_EVENT_UE_IP_CH = 5,
SMF_EVENT_DDDS = 6, SMF_EVENT_DDDS = 6,
SMF_EVENT_FLEXCN = 99 SMF_EVENT_PDUSESEST = 97, // Customized event
SMF_EVENT_QOS_MON = 98, // Customized event
SMF_EVENT_FLEXCN = 99 // Customized event
} smf_event_t; } smf_event_t;
static std::string smf_event_from_enum(smf_event_t e) { static std::string smf_event_from_enum(smf_event_t e) {
...@@ -40,7 +42,9 @@ static std::string smf_event_from_enum(smf_event_t e) { ...@@ -40,7 +42,9 @@ static std::string smf_event_from_enum(smf_event_t e) {
if (e == smf_event_t::SMF_EVENT_PDU_SES_REL) return "PDU_SES_REL"; if (e == smf_event_t::SMF_EVENT_PDU_SES_REL) return "PDU_SES_REL";
if (e == smf_event_t::SMF_EVENT_PLMN_CH) return "PLMN_CH"; if (e == smf_event_t::SMF_EVENT_PLMN_CH) return "PLMN_CH";
if (e == smf_event_t::SMF_EVENT_UE_IP_CH) return "UE_IP_CH"; if (e == smf_event_t::SMF_EVENT_UE_IP_CH) return "UE_IP_CH";
if (e == smf_event_t::SMF_EVENT_QOS_MON) return "QOS_MON";
if (e == smf_event_t::SMF_EVENT_DDDS) return "DDDS"; if (e == smf_event_t::SMF_EVENT_DDDS) return "DDDS";
if (e == smf_event_t::SMF_EVENT_PDUSESEST) return "PDU_SES_EST";
if (e == smf_event_t::SMF_EVENT_FLEXCN) return "FLEXCN"; if (e == smf_event_t::SMF_EVENT_FLEXCN) return "FLEXCN";
return ""; return "";
} }
...@@ -53,6 +57,8 @@ static const std::vector<std::string> smf_event_e2str = { ...@@ -53,6 +57,8 @@ static const std::vector<std::string> smf_event_e2str = {
"PLMN Change", "PLMN Change",
"UE IP address change", "UE IP address change",
"Downlink data delivery status", "Downlink data delivery status",
"PDU Session Establishment",
"QoS Monitoring",
"FlexCN"}; "FlexCN"};
enum class notification_method_e { enum class notification_method_e {
......
...@@ -538,6 +538,10 @@ void xgpp_conv::smf_event_exposure_notification_from_openapi( ...@@ -538,6 +538,10 @@ void xgpp_conv::smf_event_exposure_notification_from_openapi(
event_subscription.smf_event = smf_event_e::SMF_EVENT_UE_IP_CH; event_subscription.smf_event = smf_event_e::SMF_EVENT_UE_IP_CH;
} else if (event_id.compare("DDDS") == 0) { } else if (event_id.compare("DDDS") == 0) {
event_subscription.smf_event = smf_event_e::SMF_EVENT_DDDS; event_subscription.smf_event = smf_event_e::SMF_EVENT_DDDS;
} else if (event_id.compare("PDU_SES_EST") == 0) {
event_subscription.smf_event = smf_event_e::SMF_EVENT_PDUSESEST;
} else if (event_id.compare("QOS_MON") == 0) {
event_subscription.smf_event = smf_event_e::SMF_EVENT_QOS_MON;
} else if (event_id.compare("FLEXCN") == 0) { } else if (event_id.compare("FLEXCN") == 0) {
event_subscription.smf_event = smf_event_e::SMF_EVENT_FLEXCN; event_subscription.smf_event = smf_event_e::SMF_EVENT_FLEXCN;
} else { } else {
......
...@@ -4332,98 +4332,184 @@ class pfcp_time_of_last_packet_ie : public pfcp_ie { ...@@ -4332,98 +4332,184 @@ class pfcp_time_of_last_packet_ie : public pfcp_ie {
// s.set(dropped_dl_traffic_threshold); // s.set(dropped_dl_traffic_threshold);
// } // }
//}; //};
////-------------------------------------
//// IE VOLUME_QUOTA //-------------------------------------
// class pfcp_volume_quota_ie : public pfcp_ie { // IE VOLUME_QUOTA
// public: class pfcp_volume_quota_ie : public pfcp_ie {
// uint8_t todo; public:
// union {
// //-------- struct {
// pfcp_volume_quota_ie(const pfcp::volume_quota_t& b) : uint8_t tovol : 1;
// pfcp_ie(PFCP_IE_VOLUME_QUOTA){ uint8_t ulvol : 1;
// todo = 0; uint8_t dlvol : 1;
// tlv.set_length(1); uint8_t spare : 5;
// } } bf;
// //-------- uint8_t b;
// pfcp_volume_quota_ie() : pfcp_ie(PFCP_IE_VOLUME_QUOTA){ } u1;
// todo = 0; uint64_t total_volume;
// tlv.set_length(1); uint64_t uplink_volume;
// } uint64_t downlink_volume;
// //-------- //--------
// pfcp_volume_quota_ie(const pfcp_tlv& t) : pfcp_ie(t) { explicit pfcp_volume_quota_ie(const pfcp::volume_quota_t& b)
// todo = 0; : pfcp_ie(PFCP_IE_VOLUME_QUOTA) {
// }; tlv.set_length(1);
// //-------- u1.b = 0;
// void to_core_type(pfcp::volume_quota_t& b) { u1.bf.tovol = b.tovol;
// b.todo = todo; u1.bf.ulvol = b.ulvol;
// } u1.bf.dlvol = b.dlvol;
// //-------- if (u1.bf.tovol) {
// void dump_to(std::ostream& os) { total_volume = b.total_volume;
// tlv.dump_to(os); tlv.add_length(sizeof(total_volume));
// os.write(reinterpret_cast<const char*>(&todo), sizeof(todo)); } else {
// } total_volume = 0;
// //-------- }
// void load_from(std::istream& is) { if (u1.bf.ulvol) {
// //tlv.load_from(is); uplink_volume = b.uplink_volume;
// if (tlv.get_length() != 1) { tlv.add_length(sizeof(uplink_volume));
// throw pfcp_tlv_bad_length_exception(tlv.type, tlv.get_length(), } else {
// __FILE__, __LINE__); uplink_volume = 0;
// } }
// is.read(reinterpret_cast<char*>(&todo), sizeof(todo)); if (u1.bf.dlvol) {
// } downlink_volume = b.downlink_volume;
// //-------- tlv.add_length(sizeof(downlink_volume));
// void to_core_type(pfcp_ies_container& s) { } else {
// pfcp::volume_quota_t volume_quota = {}; downlink_volume = 0;
// to_core_type(volume_quota); }
// s.set(volume_quota); }
// } //--------
//}; pfcp_volume_quota_ie() : pfcp_ie(PFCP_IE_VOLUME_QUOTA) {
////------------------------------------- tlv.set_length(1);
//// IE TIME_QUOTA u1.b = 0;
// class pfcp_time_quota_ie : public pfcp_ie { total_volume = 0;
// public: uplink_volume = 0;
// uint8_t todo; downlink_volume = 0;
// }
// //-------- //--------
// pfcp_time_quota_ie(const pfcp::time_quota_t& b) : explicit pfcp_volume_quota_ie(const pfcp_tlv& t) : pfcp_ie(t){};
// pfcp_ie(PFCP_IE_TIME_QUOTA){ //--------
// todo = 0; void to_core_type(pfcp::volume_quota_t& b) {
// tlv.set_length(1); b = {};
// } b.tovol = u1.bf.tovol;
// //-------- b.ulvol = u1.bf.ulvol;
// pfcp_time_quota_ie() : pfcp_ie(PFCP_IE_TIME_QUOTA){ b.dlvol = u1.bf.dlvol;
// todo = 0; if (u1.bf.tovol) {
// tlv.set_length(1); b.total_volume = total_volume;
// } }
// //-------- if (u1.bf.ulvol) {
// pfcp_time_quota_ie(const pfcp_tlv& t) : pfcp_ie(t) { b.uplink_volume = uplink_volume;
// todo = 0; }
// }; if (u1.bf.dlvol) {
// //-------- b.downlink_volume = downlink_volume;
// void to_core_type(pfcp::time_quota_t& b) { }
// b.todo = todo; }
// } //--------
// //-------- void dump_to(std::ostream& os) {
// void dump_to(std::ostream& os) { tlv.set_length(1);
// tlv.dump_to(os); if (u1.bf.tovol) {
// os.write(reinterpret_cast<const char*>(&todo), sizeof(todo)); tlv.add_length(sizeof(total_volume));
// } }
// //-------- if (u1.bf.ulvol) {
// void load_from(std::istream& is) { tlv.add_length(sizeof(uplink_volume));
// //tlv.load_from(is); }
// if (tlv.get_length() != 1) { if (u1.bf.dlvol) {
// throw pfcp_tlv_bad_length_exception(tlv.type, tlv.get_length(), tlv.add_length(sizeof(downlink_volume));
// __FILE__, __LINE__); }
// }
// is.read(reinterpret_cast<char*>(&todo), sizeof(todo)); tlv.dump_to(os);
// } os.write(reinterpret_cast<const char*>(&u1.b), sizeof(u1.b));
// //-------- if (u1.bf.tovol) {
// void to_core_type(pfcp_ies_container& s) { auto be_total_volume = htobe64(total_volume);
// pfcp::time_quota_t time_quota = {}; os.write(
// to_core_type(time_quota); reinterpret_cast<const char*>(&be_total_volume),
// s.set(time_quota); sizeof(be_total_volume));
// } }
//}; if (u1.bf.ulvol) {
auto be_uplink_volume = htobe64(uplink_volume);
os.write(
reinterpret_cast<const char*>(&be_uplink_volume),
sizeof(be_uplink_volume));
}
if (u1.bf.dlvol) {
auto be_downlink_volume = htobe64(downlink_volume);
os.write(
reinterpret_cast<const char*>(&be_downlink_volume),
sizeof(be_downlink_volume));
}
}
//--------
void load_from(std::istream& is) {
// tlv.load_from(is);
if (tlv.get_length() < 1) {
throw pfcp_tlv_bad_length_exception(
tlv.type, tlv.get_length(), __FILE__, __LINE__);
}
if (u1.bf.tovol) {
is.read(reinterpret_cast<char*>(&total_volume), sizeof(total_volume));
total_volume = be64toh(total_volume);
}
if (u1.bf.ulvol) {
is.read(reinterpret_cast<char*>(&uplink_volume), sizeof(uplink_volume));
total_volume = be64toh(uplink_volume);
}
if (u1.bf.dlvol) {
is.read(
reinterpret_cast<char*>(&downlink_volume), sizeof(downlink_volume));
total_volume = be64toh(downlink_volume);
}
}
//--------
void to_core_type(pfcp_ies_container& s) {
pfcp::volume_quota_t v = {};
to_core_type(v);
s.set(v);
}
};
//-------------------------------------
// IE TIME_QUOTA
class pfcp_time_quota_ie : public pfcp_ie {
public:
uint32_t time_quota;
//--------
explicit pfcp_time_quota_ie(const pfcp::time_quota_t& b)
: pfcp_ie(PFCP_IE_TIME_QUOTA) {
time_quota = b.time_quota;
tlv.set_length(sizeof(time_quota));
}
//--------
pfcp_time_quota_ie() : pfcp_ie(PFCP_IE_TIME_QUOTA), time_quota(0) {
tlv.set_length(sizeof(time_quota));
}
//--------
explicit pfcp_time_quota_ie(const pfcp_tlv& t) : pfcp_ie(t), time_quota(0){};
//--------
void to_core_type(pfcp::time_quota_t& b) { b.time_quota = time_quota; }
//--------
void dump_to(std::ostream& os) {
tlv.dump_to(os);
auto be_time_quota = htobe32(time_quota);
os.write(
reinterpret_cast<const char*>(&be_time_quota), sizeof(be_time_quota));
}
//--------
void load_from(std::istream& is) {
// tlv.load_from(is);
if (tlv.get_length() != sizeof(time_quota)) {
throw pfcp_tlv_bad_length_exception(
tlv.type, tlv.get_length(), __FILE__, __LINE__);
}
is.read(reinterpret_cast<char*>(&time_quota), sizeof(time_quota));
time_quota = be32toh(time_quota);
}
//--------
void to_core_type(pfcp_ies_container& s) {
pfcp::time_quota_t v = {};
to_core_type(v);
s.set(v);
}
};
//------------------------------------- //-------------------------------------
// IE START_TIME // IE START_TIME
class pfcp_start_time_ie : public pfcp_ie { class pfcp_start_time_ie : public pfcp_ie {
...@@ -9167,16 +9253,33 @@ class pfcp_create_urr_ie : public pfcp_grouped_ie { ...@@ -9167,16 +9253,33 @@ class pfcp_create_urr_ie : public pfcp_grouped_ie {
new pfcp_reporting_triggers_ie(b.reporting_triggers.second)); new pfcp_reporting_triggers_ie(b.reporting_triggers.second));
add_ie(sie); add_ie(sie);
} }
if (b.urr_id.first && b.measurement_period.first) { if (b.urr_id.first) {
if (b.measurement_period.first) {
std::shared_ptr<pfcp_measurement_period_ie> sie( std::shared_ptr<pfcp_measurement_period_ie> sie(
new pfcp_measurement_period_ie(b.measurement_period.second)); new pfcp_measurement_period_ie(b.measurement_period.second));
add_ie(sie); add_ie(sie);
} }
if (b.urr_id.first && b.volume_threshold.first) { if (b.volume_threshold.first) {
std::shared_ptr<pfcp_volume_threshold_ie> sie( std::shared_ptr<pfcp_volume_threshold_ie> sie(
new pfcp_volume_threshold_ie(b.volume_threshold.second)); new pfcp_volume_threshold_ie(b.volume_threshold.second));
add_ie(sie); add_ie(sie);
} }
if (b.volume_quota.first) {
std::shared_ptr<pfcp_volume_quota_ie> sie(
new pfcp_volume_quota_ie(b.volume_quota.second));
add_ie(sie);
}
if (b.time_threshold.first) {
std::shared_ptr<pfcp_time_threshold_ie> sie(
new pfcp_time_threshold_ie(b.time_threshold.second));
add_ie(sie);
}
if (b.time_quota.first) {
std::shared_ptr<pfcp_time_quota_ie> sie(
new pfcp_time_quota_ie(b.time_quota.second));
add_ie(sie);
}
}
// ToDo: Optional IEs // ToDo: Optional IEs
} }
pfcp_create_urr_ie() : pfcp_grouped_ie(PFCP_IE_CREATE_URR) {} pfcp_create_urr_ie() : pfcp_grouped_ie(PFCP_IE_CREATE_URR) {}
......
This diff is collapsed.
...@@ -692,6 +692,14 @@ class smf_context : public std::enable_shared_from_this<smf_context> { ...@@ -692,6 +692,14 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
ee_ddds_connection = event_sub.subscribe_ee_ddds( ee_ddds_connection = event_sub.subscribe_ee_ddds(
boost::bind(&smf_context::handle_ddds, this, _1, _2)); boost::bind(&smf_context::handle_ddds, this, _1, _2));
// Subscribe to QoS Monitoring Event
ee_qos_monitoring_connection = event_sub.subscribe_ee_qos_monitoring(
boost::bind(&smf_context::handle_qos_monitoring, this, _1, _2, _3));
// Subscribe to PDU SESSION ESTABLISHMENT event
ee_pdusesest = event_sub.subscribe_ee_pdusesest(
boost::bind(&smf_context::handle_pdusesest, this, _1, _2));
// Subscribe to FlexCN event // Subscribe to FlexCN event
ee_flexcn = event_sub.subscribe_ee_flexcn_event( ee_flexcn = event_sub.subscribe_ee_flexcn_event(
boost::bind(&smf_context::handle_flexcn_event, this, _1, _2)); boost::bind(&smf_context::handle_flexcn_event, this, _1, _2));
...@@ -710,7 +718,10 @@ class smf_context : public std::enable_shared_from_this<smf_context> { ...@@ -710,7 +718,10 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
ee_ue_ip_change_connection.disconnect(); ee_ue_ip_change_connection.disconnect();
if (ee_plmn_change_connection.connected()) if (ee_plmn_change_connection.connected())
ee_plmn_change_connection.disconnect(); ee_plmn_change_connection.disconnect();
if (ee_qos_monitoring_connection.connected())
ee_qos_monitoring_connection.disconnect();
if (ee_ddds_connection.connected()) ee_ddds_connection.disconnect(); if (ee_ddds_connection.connected()) ee_ddds_connection.disconnect();
if (ee_pdusesest.connected()) ee_pdusesest.disconnect();
if (ee_flexcn.connected()) ee_flexcn.disconnect(); if (ee_flexcn.connected()) ee_flexcn.disconnect();
} }
...@@ -1254,6 +1265,16 @@ class smf_context : public std::enable_shared_from_this<smf_context> { ...@@ -1254,6 +1265,16 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
void trigger_ddds(scid_t scid, uint8_t http_version); void trigger_ddds(scid_t scid, uint8_t http_version);
void handle_ddds(scid_t scid, uint8_t http_version); void handle_ddds(scid_t scid, uint8_t http_version);
void trigger_pdusesest(scid_t scid, uint8_t http_version);
void handle_pdusesest(scid_t scid, uint8_t http_version);
void trigger_qos_monitoring(
seid_t seid, oai::smf_server::model::EventNotification ev_notif_model,
uint8_t http_version);
void handle_qos_monitoring(
seid_t seid, oai::smf_server::model::EventNotification ev_notif_model,
uint8_t http_version);
void trigger_flexcn_event(scid_t scid, uint8_t http_version); void trigger_flexcn_event(scid_t scid, uint8_t http_version);
void handle_flexcn_event(scid_t scid, uint8_t http_version); void handle_flexcn_event(scid_t scid, uint8_t http_version);
/* /*
...@@ -1386,6 +1407,8 @@ class smf_context : public std::enable_shared_from_this<smf_context> { ...@@ -1386,6 +1407,8 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
bs2::connection ee_ue_ip_change_connection; bs2::connection ee_ue_ip_change_connection;
bs2::connection ee_plmn_change_connection; bs2::connection ee_plmn_change_connection;
bs2::connection ee_ddds_connection; bs2::connection ee_ddds_connection;
bs2::connection ee_pdusesest;
bs2::connection ee_qos_monitoring_connection;
bs2::connection ee_flexcn; bs2::connection ee_flexcn;
}; };
} // namespace smf } // namespace smf
......
...@@ -61,10 +61,23 @@ bs2::connection smf_event::subscribe_ee_plmn_change( ...@@ -61,10 +61,23 @@ bs2::connection smf_event::subscribe_ee_plmn_change(
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bs2::connection smf_event::subscribe_ee_ddds( bs2::connection smf_event::subscribe_ee_ddds(
const ee_ddds_sig_t::slot_type& sig) { const ee_ddds_sig_t::slot_type& sig) {
return ee_ddds.connect(sig); return ee_ddds.connect(sig);
} }
//------------------------------------------------------------------------------
bs2::connection smf_event::subscribe_ee_pdusesest(
const ee_pdusesest_sig_t::slot_type& sig) {
return ee_pdusesest.connect(sig);
}
//------------------------------------------------------------------------------
bs2::connection smf_event::subscribe_ee_qos_monitoring(
const ee_qos_monitoring_sig_t::slot_type& sig) {
return ee_qos_monitoring.connect(sig);
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bs2::connection smf_event::subscribe_ee_flexcn_event( bs2::connection smf_event::subscribe_ee_flexcn_event(
......
...@@ -82,6 +82,11 @@ class smf_event { ...@@ -82,6 +82,11 @@ class smf_event {
// download link data status // download link data status
bs2::connection subscribe_ee_ddds(const ee_ddds_sig_t::slot_type& sig); bs2::connection subscribe_ee_ddds(const ee_ddds_sig_t::slot_type& sig);
bs2::connection subscribe_ee_pdusesest(
const ee_pdusesest_sig_t::slot_type& sig);
bs2::connection subscribe_ee_qos_monitoring(
const ee_qos_monitoring_sig_t::slot_type& sig);
bs2::connection subscribe_ee_flexcn_event( bs2::connection subscribe_ee_flexcn_event(
const ee_flexcn_sig_t::slot_type& sig); const ee_flexcn_sig_t::slot_type& sig);
...@@ -93,6 +98,8 @@ class smf_event { ...@@ -93,6 +98,8 @@ class smf_event {
ee_ue_ip_change_sig_t ee_ue_ip_change; // Signal for UE IP Addr change ee_ue_ip_change_sig_t ee_ue_ip_change; // Signal for UE IP Addr change
ee_plmn_change_sig_t ee_plmn_change; // Signal for UE IP Addr change ee_plmn_change_sig_t ee_plmn_change; // Signal for UE IP Addr change
ee_ddds_sig_t ee_ddds; ee_ddds_sig_t ee_ddds;
ee_pdusesest_sig_t ee_pdusesest; // Signal for pdu session establishment
ee_qos_monitoring_sig_t ee_qos_monitoring; // Signal for QoS Monitoring
ee_flexcn_sig_t ee_flexcn; // Signal for FlexCN Event ee_flexcn_sig_t ee_flexcn; // Signal for FlexCN Event
}; };
} // namespace smf } // namespace smf
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <boost/signals2.hpp> #include <boost/signals2.hpp>
#include <string> #include <string>
#include "3gpp_24.007.h" #include "3gpp_24.007.h"
#include "EventNotification.h"
namespace bs2 = boost::signals2; namespace bs2 = boost::signals2;
...@@ -70,6 +71,18 @@ typedef bs2::signal_type< ...@@ -70,6 +71,18 @@ typedef bs2::signal_type<
void(scid_t, uint8_t), bs2::keywords::mutex_type<bs2::dummy_mutex>>::type void(scid_t, uint8_t), bs2::keywords::mutex_type<bs2::dummy_mutex>>::type
ee_ddds_sig_t; ee_ddds_sig_t;
// Signal for PDU SESSION ESTABLISHMENT
// SCID, HTTP version
typedef bs2::signal_type<
void(scid_t, uint8_t), bs2::keywords::mutex_type<bs2::dummy_mutex>>::type
ee_pdusesest_sig_t;
// Signal for QoS Monitoring Event exposure (Usage Report)
// SEID, Event Notification Model , HTTP version
// TODO: use SCID and access PDU Session ID (need binding SCIDs - PDUSessID)
typedef bs2::signal_type<
void(seid_t, oai::smf_server::model::EventNotification, uint8_t),
bs2::keywords::mutex_type<bs2::dummy_mutex>>::type ee_qos_monitoring_sig_t;
// Signal for FlexCN event (for Event Exposure) // Signal for FlexCN event (for Event Exposure)
// SCID, HTTP version // SCID, HTTP version
typedef bs2::signal_type< typedef bs2::signal_type<
......
...@@ -1152,3 +1152,67 @@ void data_notification_msg::set_profile(const std::shared_ptr<nf_profile>& p) { ...@@ -1152,3 +1152,67 @@ void data_notification_msg::set_profile(const std::shared_ptr<nf_profile>& p) {
void data_notification_msg::get_profile(std::shared_ptr<nf_profile>& p) const { void data_notification_msg::get_profile(std::shared_ptr<nf_profile>& p) const {
p = profile; p = profile;
} }
//-----------------------------------------------------------------------------
void event_notification::set_dnn(std::string const& value) {
m_dnn = value;
m_dnn_is_set = true;
}
//-----------------------------------------------------------------------------
std::string event_notification::get_dnn() const {
return m_dnn;
}
//-----------------------------------------------------------------------------
bool event_notification::is_dnn_set() const {
return m_dnn_is_set;
}
//-----------------------------------------------------------------------------
void event_notification::set_sst(uint8_t const& value) {
m_sst = value;
m_sst_is_set = true;
}
//-----------------------------------------------------------------------------
uint8_t event_notification::get_sst() const {
return m_sst;
}
//-----------------------------------------------------------------------------
bool event_notification::is_sst_set() const {
return m_sst_is_set;
}
//-----------------------------------------------------------------------------
void event_notification::set_sd(std::string const& value) {
m_sd = value;
m_sd_is_set = true;
}
//-----------------------------------------------------------------------------
std::string event_notification::get_sd() const {
return m_sd;
}
//-----------------------------------------------------------------------------
bool event_notification::is_sd_set() const {
return m_sd_is_set;
}
//-----------------------------------------------------------------------------
void event_notification::set_pdu_session_type(std::string const& value) {
m_pdu_session_type = value;
m_pdu_session_type_is_set = true;
}
//-----------------------------------------------------------------------------
std::string event_notification::get_pdu_session_type() const {
return m_pdu_session_type;
}
//-----------------------------------------------------------------------------
bool event_notification::is_pdu_session_type_set() const {
return m_pdu_session_type_is_set;
}
...@@ -632,6 +632,22 @@ class event_notification { ...@@ -632,6 +632,22 @@ class event_notification {
oai::smf_server::model::DddStatus get_ddds() const; oai::smf_server::model::DddStatus get_ddds() const;
bool is_ddds_is_set() const; bool is_ddds_is_set() const;
void set_dnn(std::string const& value);
std::string get_dnn() const;
bool is_dnn_set() const;
void set_sst(uint8_t const& value);
uint8_t get_sst() const;
bool is_sst_set() const;
void set_sd(std::string const& value);
std::string get_sd() const;
bool is_sd_set() const;
void set_pdu_session_type(std::string const& value);
std::string get_pdu_session_type() const;
bool is_pdu_session_type_set() const;
void set_pdu_session_id(const pdu_session_id_t value); void set_pdu_session_id(const pdu_session_id_t value);
pdu_session_id_t get_pdu_session_id() const; pdu_session_id_t get_pdu_session_id() const;
bool is_psi_is_set() const; bool is_psi_is_set() const;
...@@ -668,6 +684,15 @@ class event_notification { ...@@ -668,6 +684,15 @@ class event_notification {
oai::smf_server::model::DddStatus m_DddStatus; oai::smf_server::model::DddStatus m_DddStatus;
bool m_DddStatusIsSet; bool m_DddStatusIsSet;
bool m_dnn_is_set;
std::string m_dnn;
bool m_sst_is_set;
uint8_t m_sst;
bool m_sd_is_set;
std::string m_sd;
bool m_pdu_session_type_is_set;
std::string m_pdu_session_type;
// for an access type change // for an access type change
// AccessType m_AccType; // AccessType m_AccType;
// bool m_AccTypeIsSet; // bool m_AccTypeIsSet;
......
...@@ -320,14 +320,33 @@ int session_create_sm_context_procedure::run( ...@@ -320,14 +320,33 @@ int session_create_sm_context_procedure::run(
pfcp::measurement_method_t measurement_method = {}; pfcp::measurement_method_t measurement_method = {};
pfcp::measurement_period_t measurement_Period = {}; pfcp::measurement_period_t measurement_Period = {};
pfcp::reporting_triggers_t reporting_triggers = {}; pfcp::reporting_triggers_t reporting_triggers = {};
pfcp::volume_threshold_t volume_threshold = {};
pfcp::time_threshold_t time_threshold = {};
// Hardcoded values for the moment // Hardcoded values for the moment
measurement_method.volum = 1; // Volume based usage report measurement_method.volum = 1; // Volume based usage report
measurement_method.durat = 1;
measurement_Period.measurement_period = 10; // Every 10 Sec measurement_Period.measurement_period = 10; // Every 10 Sec
reporting_triggers.perio = 1; // Periodic usage report reporting_triggers.perio = 1; // Periodic usage report
reporting_triggers.volth = 1;
reporting_triggers.timth = 1;
reporting_triggers.volqu = 0;
reporting_triggers.timqu = 0;
volume_threshold.dlvol = 1;
volume_threshold.ulvol = 0;
volume_threshold.tovol = 0;
volume_threshold.downlink_volume = 1000;
time_threshold.time_threshold = 5;
create_urr.set(urr_id); create_urr.set(urr_id);
create_urr.set(measurement_method); create_urr.set(measurement_method);
create_urr.set(measurement_Period); create_urr.set(measurement_Period);
create_urr.set(reporting_triggers); create_urr.set(reporting_triggers);
create_urr.set(time_threshold);
create_urr.set(volume_threshold);
n4_triggered->pfcp_ies.set(create_urr); n4_triggered->pfcp_ies.set(create_urr);
} }
// TODO: list of QoS Enforcement Rule IDs // TODO: list of QoS Enforcement Rule IDs
...@@ -1247,6 +1266,7 @@ void session_update_sm_context_procedure::handle_itti_msg( ...@@ -1247,6 +1266,7 @@ void session_update_sm_context_procedure::handle_itti_msg(
sc.get()->trigger_ue_ip_change(scid, 1); sc.get()->trigger_ue_ip_change(scid, 1);
sc.get()->trigger_plmn_change(scid, 1); sc.get()->trigger_plmn_change(scid, 1);
sc.get()->trigger_ddds(scid, 1); sc.get()->trigger_ddds(scid, 1);
sc.get()->trigger_pdusesest(scid, 1);
sc.get()->trigger_flexcn_event(scid, 1); sc.get()->trigger_flexcn_event(scid, 1);
} break; } break;
......
...@@ -522,6 +522,15 @@ void smf_sbi::notify_subscribed_event( ...@@ -522,6 +522,15 @@ void smf_sbi::notify_subscribed_event(
// event_notif["dddStatus"] = i.get_ddds(); // event_notif["dddStatus"] = i.get_ddds();
event_notif["dddStatus"] = "TRANSMITTED"; event_notif["dddStatus"] = "TRANSMITTED";
} }
if (i.is_dnn_set()) event_notif["dnn"] = i.get_dnn();
if (i.is_pdu_session_type_set())
event_notif["pduSessType"] = i.get_pdu_session_type();
if (i.is_sst_set()) {
nlohmann::json snssai_data = {};
snssai_data["sst"] = i.get_sst();
if (i.is_sd_set()) snssai_data["sd"] = i.get_sd();
event_notif["snssai"] = snssai_data;
}
// customized data // customized data
nlohmann::json customized_data = {}; nlohmann::json customized_data = {};
......
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