Commit 98ea303b authored by Raphael Defosseux's avatar Raphael Defosseux

style(smf): formatting files

Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@openairinterface.org>
parent fdd0cf3b
......@@ -53,7 +53,6 @@ EventNotification::EventNotification() {
m_MaxWaitTimeIsSet = false;
m_usageReport = {};
m_usageReportIsSet = false;
}
EventNotification::~EventNotification() {}
......@@ -90,7 +89,6 @@ void to_json(nlohmann::json& j, const EventNotification& o) {
if (o.dddStatusIsSet()) j["dddStatus"] = o.m_DddStatus;
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) {
......@@ -485,7 +483,6 @@ void EventNotification::unsetUsageReport() {
m_usageReportIsSet = false;
}
} // namespace model
} // namespace smf_server
} // namespace oai
......@@ -15,7 +15,8 @@
*
* 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:
* UE IP address change - DDDS: Downlink data delivery status - QOS_MON: QoS Monitoring
* UE IP address change - DDDS: Downlink data delivery status - QOS_MON: QoS
* Monitoring
*/
#ifndef SmfEvent_H_
......@@ -30,7 +31,8 @@ namespace model {
/// <summary>
/// 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:
/// UE IP address change - DDDS: Downlink data delivery status - QOS_MON: QoS Monitoring
/// UE IP address change - DDDS: Downlink data delivery status - QOS_MON: QoS
/// Monitoring
/// </summary>
class SmfEvent {
public:
......
......@@ -42,21 +42,14 @@ void UsageReport::validate() {
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.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";
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 :
......@@ -77,20 +70,13 @@ void to_json(nlohmann::json& j, const UsageReport& o) {
}
*/
}
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;
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) {
......@@ -106,14 +92,10 @@ void from_json(const nlohmann::json& j, UsageReport& o) {
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 == "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 {
......
......@@ -15,14 +15,7 @@ namespace smf_server {
namespace model {
// TODO: Redefine in separate files
enum UsageReportTrigger {
PERIO = 1,
VOLTH,
TIMTH,
VOLQU,
TIMQU
};
enum UsageReportTrigger { PERIO = 1, VOLTH, TIMTH, VOLQU, TIMQU };
/// <summary>
///
......
......@@ -4478,24 +4478,19 @@ class pfcp_time_quota_ie : public pfcp_ie {
tlv.set_length(sizeof(time_quota));
}
//--------
pfcp_time_quota_ie()
: pfcp_ie(PFCP_IE_TIME_QUOTA), time_quota(0) {
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){};
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 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));
reinterpret_cast<const char*>(&be_time_quota), sizeof(be_time_quota));
}
//--------
void load_from(std::istream& is) {
......
......@@ -990,11 +990,17 @@ void smf_context::handle_itti_msg(
if (ur.get(seqn))
Logger::smf_app().info("\t\t UR-SEQN -> %ld", seqn.ur_seqn);
if (ur.get(trig))
if (trig.perio) Logger::smf_app().info("\t\t Trigger -> Periodic Reporting");
if (trig.timqu) Logger::smf_app().info("\t\t Trigger -> Time Quota");
if (trig.timth) Logger::smf_app().info("\t\t Trigger -> Time Threshold");
if (trig.volqu) Logger::smf_app().info("\t\t Trigger -> Volume Quota");
if (trig.volth) Logger::smf_app().info("\t\t Trigger -> Volume Threshold");
if (trig.perio)
Logger::smf_app().info(
"\t\t Trigger -> Periodic Reporting");
if (trig.timqu)
Logger::smf_app().info("\t\t Trigger -> Time Quota");
if (trig.timth)
Logger::smf_app().info("\t\t Trigger -> Time Threshold");
if (trig.volqu)
Logger::smf_app().info("\t\t Trigger -> Volume Quota");
if (trig.volth)
Logger::smf_app().info("\t\t Trigger -> Volume Threshold");
if (ur.get(dm))
Logger::smf_app().info("\t\t Duration -> %ld", dm.duration);
Logger::smf_app().info("\t\t NoP Total -> %lld", vm.total_nop);
......@@ -1016,10 +1022,8 @@ void smf_context::handle_itti_msg(
oai::smf_server::model::UsageReport ur_model = {};
if (ur.get(vm)) {
ur_model.setSEndID(req->seid);
if (ur.get(seqn))
ur_model.seturSeqN(seqn.ur_seqn);
if (ur.get(dm))
ur_model.setDuration(dm.duration);
if (ur.get(seqn)) ur_model.seturSeqN(seqn.ur_seqn);
if (ur.get(dm)) ur_model.setDuration(dm.duration);
ur_model.setTotNoP(vm.total_nop);
ur_model.setUlNoP(vm.uplink_nop);
ur_model.setDlNoP(vm.downlink_nop);
......@@ -4089,12 +4093,12 @@ void smf_context::trigger_ue_ip_change(scid_t scid, uint8_t http_version) {
}
//------------------------------------------------------------------------------
void smf_context::handle_qos_monitoring(seid_t seid,
oai::smf_server::model::EventNotification ev_notif_model, uint8_t http_version) {
void smf_context::handle_qos_monitoring(
seid_t seid, oai::smf_server::model::EventNotification ev_notif_model,
uint8_t http_version) {
Logger::smf_app().debug(
"Send request to N11 to trigger QoS Monitoring (Usage Report) Event, "
"SMF Context-related SEID " SEID_FMT ,
"SMF Context-related SEID " SEID_FMT,
seid);
// Get the smf context
......@@ -4153,12 +4157,12 @@ void smf_context::handle_qos_monitoring(seid_t seid,
}
//------------------------------------------------------------------------------
void smf_context::trigger_qos_monitoring(seid_t seid,
oai::smf_server::model::EventNotification ev_notif_model, uint8_t http_version) {
void smf_context::trigger_qos_monitoring(
seid_t seid, oai::smf_server::model::EventNotification ev_notif_model,
uint8_t http_version) {
event_sub.ee_qos_monitoring(seid, ev_notif_model, http_version);
}
//------------------------------------------------------------------------------
void smf_context::handle_flexcn_event(scid_t scid, uint8_t http_version) {
Logger::smf_app().debug(
......@@ -4416,8 +4420,6 @@ void smf_context::handle_pdusesest(scid_t scid, uint8_t http_version) {
uint64_t tv_ntp = time_epoch_ntp + SECONDS_SINCE_FIRST_EPOCH;
ev_notif.set_timestamp(std::to_string(tv_ntp));
// UE IPv4
if (sp->ipv4) {
ev_notif.set_ad_ipv4_addr(conv::toString(sp->ipv4_address));
......@@ -4431,7 +4433,8 @@ void smf_context::handle_pdusesest(scid_t scid, uint8_t http_version) {
// ev_notif.set_ad_ipv6_prefix(conv::toString(sp->ipv4_address));
}
}
ev_notif.set_pdu_session_type(sp->pdu_session_type.toString()); // PDU Session Type
ev_notif.set_pdu_session_type(
sp->pdu_session_type.toString()); // PDU Session Type
ev_notif.set_sst(sp->get_snssai().sst);
ev_notif.set_sd(std::to_string(sp->get_snssai().sd));
ev_notif.set_dnn(sp->get_dnn());
......@@ -4463,8 +4466,6 @@ void smf_context::trigger_pdusesest(scid_t scid, uint8_t http_version) {
//------------------------------------------------------------------------------
//-----------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
......@@ -4494,7 +4495,6 @@ void smf_context::trigger_plmn_change(scid_t scid, uint8_t http_version) {
event_sub.ee_plmn_change(scid, http_version);
}
//------------------------------------------------------------------------------
void smf_context::handle_plmn_change(scid_t scid, uint8_t http_version) {
Logger::smf_app().debug(
......
......@@ -1268,8 +1268,12 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
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_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 handle_flexcn_event(scid_t scid, uint8_t http_version);
......
......@@ -82,7 +82,7 @@ class smf_event {
// download link data status
bs2::connection subscribe_ee_ddds(const ee_ddds_sig_t::slot_type& sig);
bs2::connection subscribe_ee_pdusesest(
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);
......
......@@ -81,8 +81,7 @@ typedef bs2::signal_type<
// 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;
bs2::keywords::mutex_type<bs2::dummy_mutex>>::type ee_qos_monitoring_sig_t;
// Signal for FlexCN event (for Event Exposure)
// SCID, HTTP version
......
......@@ -1185,9 +1185,6 @@ bool event_notification::is_sst_set() const {
return m_sst_is_set;
}
//-----------------------------------------------------------------------------
void event_notification::set_sd(std::string const& value) {
m_sd = value;
......@@ -1204,9 +1201,6 @@ 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;
......
......@@ -632,7 +632,6 @@ class event_notification {
oai::smf_server::model::DddStatus get_ddds() const;
bool is_ddds_is_set() const;
void set_dnn(std::string const& value);
std::string get_dnn() const;
bool is_dnn_set() const;
......
......@@ -523,8 +523,9 @@ void smf_sbi::notify_subscribed_event(
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()){
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();
......
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