Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-SMF
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-SMF
Commits
0bd3d579
Commit
0bd3d579
authored
Aug 04, 2022
by
ferrerod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor UsageReport API model, log UR trigger
parent
1a3006f7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
424 additions
and
300 deletions
+424
-300
src/api-server/model/EventNotification.cpp
src/api-server/model/EventNotification.cpp
+15
-182
src/api-server/model/EventNotification.h
src/api-server/model/EventNotification.h
+7
-89
src/api-server/model/UsageReport.cpp
src/api-server/model/UsageReport.cpp
+226
-0
src/api-server/model/UsageReport.h
src/api-server/model/UsageReport.h
+143
-0
src/smf_app/smf_context.cpp
src/smf_app/smf_context.cpp
+33
-29
No files found.
src/api-server/model/EventNotification.cpp
View file @
0bd3d579
...
@@ -51,26 +51,9 @@ EventNotification::EventNotification() {
...
@@ -51,26 +51,9 @@ EventNotification::EventNotification() {
m_DddStatusIsSet
=
false
;
m_DddStatusIsSet
=
false
;
m_MaxWaitTime
=
""
;
m_MaxWaitTime
=
""
;
m_MaxWaitTimeIsSet
=
false
;
m_MaxWaitTimeIsSet
=
false
;
m_usageReport
=
{};
m_usageReportIsSet
=
false
;
// QoS Monitoring (Usage Report)
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
;
}
}
EventNotification
::~
EventNotification
()
{}
EventNotification
::~
EventNotification
()
{}
...
@@ -106,17 +89,8 @@ void to_json(nlohmann::json& j, const EventNotification& o) {
...
@@ -106,17 +89,8 @@ 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
;
// QoS Monitoring (Usage Report)
if
(
o
.
SEndIDIsSet
())
j
[
"SEndID"
]
=
o
.
m_SEndID
;
if
(
o
.
urSeqNIsSet
())
j
[
"urSeqN"
]
=
o
.
m_urSeqN
;
if
(
o
.
durationIsSet
())
j
[
"duration"
]
=
o
.
m_duration
;
if
(
o
.
totNoPIsSet
())
j
[
"totNoP"
]
=
o
.
m_totNoP
;
if
(
o
.
ulNoPIsSet
())
j
[
"ulNoP"
]
=
o
.
m_ulNoP
;
if
(
o
.
dlNoPIsSet
())
j
[
"dlNoP"
]
=
o
.
m_dlNoP
;
if
(
o
.
totVolIsSet
())
j
[
"totVol"
]
=
o
.
m_totVol
;
if
(
o
.
ulVolIsSet
())
j
[
"ulVol"
]
=
o
.
m_ulVol
;
if
(
o
.
dlVolIsSet
())
j
[
"dlVol"
]
=
o
.
m_dlVol
;
}
}
void
from_json
(
const
nlohmann
::
json
&
j
,
EventNotification
&
o
)
{
void
from_json
(
const
nlohmann
::
json
&
j
,
EventNotification
&
o
)
{
...
@@ -206,43 +180,9 @@ void from_json(const nlohmann::json& j, EventNotification& o) {
...
@@ -206,43 +180,9 @@ 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
())
{
// Qos Monitoring (Usage Report)
j
.
at
(
"Usage Report"
).
get_to
(
o
.
m_usageReport
);
if
(
j
.
find
(
"SEndID"
)
!=
j
.
end
())
{
o
.
m_usageReportIsSet
=
true
;
j
.
at
(
"SEndID"
).
get_to
(
o
.
m_SEndID
);
o
.
m_SEndIDIsSet
=
true
;
}
if
(
j
.
find
(
"urSeqN"
)
!=
j
.
end
())
{
j
.
at
(
"urSeqN"
).
get_to
(
o
.
m_urSeqN
);
o
.
m_urSeqNIsSet
=
true
;
}
if
(
j
.
find
(
"duration"
)
!=
j
.
end
())
{
j
.
at
(
"duration"
).
get_to
(
o
.
m_duration
);
o
.
m_durationIsSet
=
true
;
}
if
(
j
.
find
(
"totNoP"
)
!=
j
.
end
())
{
j
.
at
(
"totNoP"
).
get_to
(
o
.
m_totNoP
);
o
.
m_totNoPIsSet
=
true
;
}
if
(
j
.
find
(
"ulNoP"
)
!=
j
.
end
())
{
j
.
at
(
"ulNoP"
).
get_to
(
o
.
m_ulNoP
);
o
.
m_ulNoPIsSet
=
true
;
}
if
(
j
.
find
(
"dlNoP"
)
!=
j
.
end
())
{
j
.
at
(
"dlNoP"
).
get_to
(
o
.
m_dlNoP
);
o
.
m_dlNoPIsSet
=
true
;
}
if
(
j
.
find
(
"totVol"
)
!=
j
.
end
())
{
j
.
at
(
"totVol"
).
get_to
(
o
.
m_totVol
);
o
.
m_totVolIsSet
=
true
;
}
if
(
j
.
find
(
"ulVol"
)
!=
j
.
end
())
{
j
.
at
(
"ulVol"
).
get_to
(
o
.
m_ulVol
);
o
.
m_ulVolIsSet
=
true
;
}
if
(
j
.
find
(
"dlVol"
)
!=
j
.
end
())
{
j
.
at
(
"dlVol"
).
get_to
(
o
.
m_dlVol
);
o
.
m_dlVolIsSet
=
true
;
}
}
}
}
...
@@ -531,125 +471,18 @@ bool EventNotification::maxWaitTimeIsSet() const {
...
@@ -531,125 +471,18 @@ bool EventNotification::maxWaitTimeIsSet() const {
void
EventNotification
::
unsetMaxWaitTime
()
{
void
EventNotification
::
unsetMaxWaitTime
()
{
m_MaxWaitTimeIsSet
=
false
;
m_MaxWaitTimeIsSet
=
false
;
}
}
UsageReport
EventNotification
::
getUsageReport
()
const
{
// QoS Monitoring (Usage Report)
return
m_usageReport
;
int64_t
EventNotification
::
getSEndID
()
const
{
return
m_SEndID
;
}
void
EventNotification
::
setSEndID
(
int64_t
const
&
value
)
{
m_SEndID
=
value
;
m_SEndIDIsSet
=
true
;
}
bool
EventNotification
::
SEndIDIsSet
()
const
{
return
m_SEndIDIsSet
;
}
void
EventNotification
::
unsetSEndID
()
{
m_SEndIDIsSet
=
false
;
}
int32_t
EventNotification
::
geturSeqN
()
const
{
return
m_urSeqN
;
}
void
EventNotification
::
seturSeqN
(
int32_t
const
&
value
)
{
m_urSeqN
=
value
;
m_urSeqNIsSet
=
true
;
}
bool
EventNotification
::
urSeqNIsSet
()
const
{
return
m_urSeqNIsSet
;
}
void
EventNotification
::
unseturSeqN
()
{
m_urSeqNIsSet
=
false
;
}
int32_t
EventNotification
::
getDuration
()
const
{
return
m_duration
;
}
void
EventNotification
::
setDuration
(
int32_t
const
&
value
)
{
m_duration
=
value
;
m_durationIsSet
=
true
;
}
bool
EventNotification
::
durationIsSet
()
const
{
return
m_durationIsSet
;
}
void
EventNotification
::
unsetDuration
()
{
m_durationIsSet
=
false
;
}
int64_t
EventNotification
::
getTotNoP
()
const
{
return
m_totNoP
;
}
void
EventNotification
::
setTotNoP
(
int64_t
const
&
value
)
{
m_totNoP
=
value
;
m_totNoPIsSet
=
true
;
}
bool
EventNotification
::
totNoPIsSet
()
const
{
return
m_totNoPIsSet
;
}
void
EventNotification
::
unsetTotNoP
()
{
m_totNoPIsSet
=
false
;
}
int64_t
EventNotification
::
getUlNoP
()
const
{
return
m_ulNoP
;
}
void
EventNotification
::
setUlNoP
(
int64_t
const
&
value
)
{
m_ulNoP
=
value
;
m_ulNoPIsSet
=
true
;
}
bool
EventNotification
::
ulNoPIsSet
()
const
{
return
m_ulNoPIsSet
;
}
void
EventNotification
::
unsetUlNoP
()
{
m_ulNoPIsSet
=
false
;
}
int64_t
EventNotification
::
getDlNoP
()
const
{
return
m_dlNoP
;
}
void
EventNotification
::
setDlNoP
(
int64_t
const
&
value
)
{
m_dlNoP
=
value
;
m_dlNoPIsSet
=
true
;
}
bool
EventNotification
::
dlNoPIsSet
()
const
{
return
m_dlNoPIsSet
;
}
void
EventNotification
::
unsetDlNoP
()
{
m_dlNoPIsSet
=
false
;
}
int64_t
EventNotification
::
getTotVol
()
const
{
return
m_totVol
;
}
void
EventNotification
::
setTotVol
(
int64_t
const
&
value
)
{
m_totVol
=
value
;
m_totVolIsSet
=
true
;
}
bool
EventNotification
::
totVolIsSet
()
const
{
return
m_totVolIsSet
;
}
void
EventNotification
::
unsetTotVol
()
{
m_totVolIsSet
=
false
;
}
int64_t
EventNotification
::
getUlVol
()
const
{
return
m_ulVol
;
}
void
EventNotification
::
setUlVol
(
int64_t
const
&
value
)
{
m_ulVol
=
value
;
m_ulVolIsSet
=
true
;
}
bool
EventNotification
::
ulVolIsSet
()
const
{
return
m_ulVolIsSet
;
}
void
EventNotification
::
unsetUlVol
()
{
m_ulVolIsSet
=
false
;
}
int64_t
EventNotification
::
getDlVol
()
const
{
return
m_dlVol
;
}
}
void
EventNotification
::
set
DlVol
(
int64_
t
const
&
value
)
{
void
EventNotification
::
set
UsageReport
(
UsageRepor
t
const
&
value
)
{
m_
dlVol
=
value
;
m_
usageReport
=
value
;
m_
dlVol
IsSet
=
true
;
m_
usageReport
IsSet
=
true
;
}
}
bool
EventNotification
::
dlVol
IsSet
()
const
{
bool
EventNotification
::
usageReport
IsSet
()
const
{
return
m_
dlVol
IsSet
;
return
m_
usageReport
IsSet
;
}
}
void
EventNotification
::
unset
DlVol
()
{
void
EventNotification
::
unset
UsageReport
()
{
m_
dlVol
IsSet
=
false
;
m_
usageReport
IsSet
=
false
;
}
}
...
...
src/api-server/model/EventNotification.h
View file @
0bd3d579
...
@@ -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,78 +204,13 @@ class EventNotification {
...
@@ -203,78 +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>
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>
///
///
/// </summary>
/// </summary>
int64_t
getUlNoP
()
const
;
UsageReport
getUsageReport
()
const
;
void
setUlNoP
(
int64_t
const
&
value
);
void
setUsageReport
(
UsageReport
const
&
value
);
bool
ulNoPIsSet
()
const
;
bool
usageReportIsSet
()
const
;
void
unsetUlNoP
();
void
unsetUsageReport
();
/// <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
();
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
);
...
@@ -326,26 +262,8 @@ class EventNotification {
...
@@ -326,26 +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
;
// QoS Monitoring (Usage Report)
bool
m_usageReportIsSet
;
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
;
};
};
}
// namespace model
}
// namespace model
...
...
src/api-server/model/UsageReport.cpp
0 → 100644
View file @
0bd3d579
/**
* Nsmf_EventExposure
*
* UsageReport.cpp
*/
#include "UsageReport.h"
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
;
}
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
.
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
(
"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
;
}
}
// namespace model
}
// namespace smf_server
}
// namespace oai
src/api-server/model/UsageReport.h
0 → 100644
View file @
0bd3d579
/**
* 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
{
/// <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
();
friend
void
to_json
(
nlohmann
::
json
&
j
,
const
UsageReport
&
o
);
friend
void
from_json
(
const
nlohmann
::
json
&
j
,
UsageReport
&
o
);
protected:
pfcp
::
usage_report_within_pfcp_session_deletion_response
m_URSessDel
;
bool
m_URSessDelIsSet
;
pfcp
::
usage_report_within_pfcp_session_modification_response
m_URSessMod
;
bool
m_URSessModIsSet
;
pfcp
::
usage_report_within_pfcp_session_report_request
m_URRequest
;
bool
m_URRequestIsSet
;
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
;
// pfcp::usage_report_trigger_t m_urTrig;
// bool m_urTrigIsSet;
// pfcp::usage_report_within_pfcp_session_modification_response m_urSessMod;
// bool m_urSessModIsSet;
};
}
// namespace model
}
// namespace smf_server
}
// namespace oai
#endif
/* UsageReport_H_ */
src/smf_app/smf_context.cpp
View file @
0bd3d579
...
@@ -982,11 +982,32 @@ void smf_context::handle_itti_msg(
...
@@ -982,11 +982,32 @@ void smf_context::handle_itti_msg(
pfcp
::
volume_measurement_t
vm
;
pfcp
::
volume_measurement_t
vm
;
pfcp
::
duration_measurement_t
dm
;
pfcp
::
duration_measurement_t
dm
;
pfcp
::
ur_seqn_t
seqn
;
pfcp
::
ur_seqn_t
seqn
;
pfcp
::
usage_report_trigger_t
trig
;
if
(
ur
.
get
(
vm
))
{
if
(
ur
.
get
(
vm
))
{
Logger
::
smf_app
().
info
(
"
\t\t
SEID -> %lld"
,
req
->
seid
);
Logger
::
smf_app
().
info
(
"
\t\t
SEID -> %lld"
,
req
->
seid
);
if
(
ur
.
get
(
seqn
))
if
(
ur
.
get
(
seqn
))
Logger
::
smf_app
().
info
(
"
\t\t
UR-SEQN -> %ld"
,
seqn
.
ur_seqn
);
Logger
::
smf_app
().
info
(
"
\t\t
UR-SEQN -> %ld"
,
seqn
.
ur_seqn
);
if
(
ur
.
get
(
trig
))
if
(
trig
.
droth
)
Logger
::
smf_app
().
info
(
"
\t\t
Trigger -> Dropped DL Traffic Threshold"
);
if
(
trig
.
envcl
)
Logger
::
smf_app
().
info
(
"
\t\t
Trigger -> Envelope Closure"
);
if
(
trig
.
evequ
)
Logger
::
smf_app
().
info
(
"
\t\t
Trigger -> Event Quota"
);
if
(
trig
.
eveth
)
Logger
::
smf_app
().
info
(
"
\t\t
Trigger -> Event Threshold"
);
if
(
trig
.
immer
)
Logger
::
smf_app
().
info
(
"
\t\t
Trigger -> Immediate Report"
);
if
(
trig
.
liusa
)
Logger
::
smf_app
().
info
(
"
\t\t
Trigger -> Linked Usage Reporting"
);
if
(
trig
.
macar
)
Logger
::
smf_app
().
info
(
"
\t\t
Trigger -> MAC Addresses Reporting"
);
if
(
trig
.
monit
)
Logger
::
smf_app
().
info
(
"
\t\t
Trigger -> Monitoring Time"
);
if
(
trig
.
perio
)
Logger
::
smf_app
().
info
(
"
\t\t
Trigger -> Periodic Reporting"
);
if
(
trig
.
quhti
)
Logger
::
smf_app
().
info
(
"
\t\t
Trigger -> Quota Holding Time"
);
if
(
trig
.
start
)
Logger
::
smf_app
().
info
(
"
\t\t
Trigger -> Start of Traffic"
);
if
(
trig
.
stop
)
Logger
::
smf_app
().
info
(
"
\t\t
Trigger -> Stop of Traffic"
);
if
(
trig
.
tebur
)
Logger
::
smf_app
().
info
(
"
\t\t
Trigger -> Termination by UP Function Report"
);
if
(
trig
.
termr
)
Logger
::
smf_app
().
info
(
"
\t\t
Trigger -> Termination Report"
);
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
))
if
(
ur
.
get
(
dm
))
Logger
::
smf_app
().
info
(
"
\t\t
Duration -> %ld"
,
dm
.
duration
);
Logger
::
smf_app
().
info
(
"
\t\t
Duration -> %ld"
,
dm
.
duration
);
Logger
::
smf_app
().
info
(
"
\t\t
NoP Total -> %lld"
,
vm
.
total_nop
);
Logger
::
smf_app
().
info
(
"
\t\t
NoP Total -> %lld"
,
vm
.
total_nop
);
...
@@ -1005,19 +1026,21 @@ void smf_context::handle_itti_msg(
...
@@ -1005,19 +1026,21 @@ void smf_context::handle_itti_msg(
std
::
shared_ptr
<
smf_context
>
pc
=
{};
std
::
shared_ptr
<
smf_context
>
pc
=
{};
if
(
smf_app_inst
->
seid_2_smf_context
(
req
->
seid
,
pc
))
{
if
(
smf_app_inst
->
seid_2_smf_context
(
req
->
seid
,
pc
))
{
oai
::
smf_server
::
model
::
EventNotification
ev_notif
=
{};
oai
::
smf_server
::
model
::
EventNotification
ev_notif
=
{};
oai
::
smf_server
::
model
::
UsageReport
ur_model
=
{};
if
(
ur
.
get
(
vm
))
{
if
(
ur
.
get
(
vm
))
{
ev_notif
.
setSEndID
(
req
->
seid
);
ur_model
.
setSEndID
(
req
->
seid
);
if
(
ur
.
get
(
seqn
))
if
(
ur
.
get
(
seqn
))
ev_notif
.
seturSeqN
(
seqn
.
ur_seqn
);
ur_model
.
seturSeqN
(
seqn
.
ur_seqn
);
if
(
ur
.
get
(
dm
))
if
(
ur
.
get
(
dm
))
ev_notif
.
setDuration
(
dm
.
duration
);
ur_model
.
setDuration
(
dm
.
duration
);
ev_notif
.
setTotNoP
(
vm
.
total_nop
);
ur_model
.
setTotNoP
(
vm
.
total_nop
);
ev_notif
.
setUlNoP
(
vm
.
uplink_nop
);
ur_model
.
setUlNoP
(
vm
.
uplink_nop
);
ev_notif
.
setDlNoP
(
vm
.
downlink_nop
);
ur_model
.
setDlNoP
(
vm
.
downlink_nop
);
ev_notif
.
setTotVol
(
vm
.
total_volume
);
ur_model
.
setTotVol
(
vm
.
total_volume
);
ev_notif
.
setUlVol
(
vm
.
uplink_volume
);
ur_model
.
setUlVol
(
vm
.
uplink_volume
);
ev_notif
.
setDlVol
(
vm
.
downlink_volume
);
ur_model
.
setDlVol
(
vm
.
downlink_volume
);
}
}
ev_notif
.
setUsageReport
(
ur_model
);
pc
.
get
()
->
trigger_qos_monitoring
(
req
->
seid
,
ev_notif
,
1
);
pc
.
get
()
->
trigger_qos_monitoring
(
req
->
seid
,
ev_notif
,
1
);
}
else
{
}
else
{
Logger
::
smf_app
().
debug
(
Logger
::
smf_app
().
debug
(
...
@@ -4109,8 +4132,6 @@ void smf_context::handle_qos_monitoring(seid_t seid,
...
@@ -4109,8 +4132,6 @@ void smf_context::handle_qos_monitoring(seid_t seid,
TASK_SMF_APP
,
TASK_SMF_SBI
);
TASK_SMF_APP
,
TASK_SMF_SBI
);
for
(
auto
i
:
subscriptions
)
{
for
(
auto
i
:
subscriptions
)
{
// TODO (?): Add check for repeated notifications
event_notification
ev_notif
=
{};
event_notification
ev_notif
=
{};
ev_notif
.
set_supi
(
supi64
);
ev_notif
.
set_supi
(
supi64
);
ev_notif
.
set_smf_event
(
smf_event_t
::
SMF_EVENT_QOS_MON
);
ev_notif
.
set_smf_event
(
smf_event_t
::
SMF_EVENT_QOS_MON
);
...
@@ -4123,24 +4144,7 @@ void smf_context::handle_qos_monitoring(seid_t seid,
...
@@ -4123,24 +4144,7 @@ void smf_context::handle_qos_monitoring(seid_t seid,
// Custom json for Usage Report
// Custom json for Usage Report
nlohmann
::
json
cj
=
{};
nlohmann
::
json
cj
=
{};
to_json
(
cj
,
ev_notif_model
);
cj
[
"SEID"
]
=
std
::
to_string
(
seid
);
if
(
ev_notif_model
.
urSeqNIsSet
())
cj
[
"UR-SEQN"
]
=
std
::
to_string
(
ev_notif_model
.
geturSeqN
());
if
(
ev_notif_model
.
durationIsSet
())
cj
[
"Duration"
]
=
std
::
to_string
(
ev_notif_model
.
getDuration
());
if
(
ev_notif_model
.
totNoPIsSet
())
cj
[
"NoP"
][
"Total"
]
=
std
::
to_string
(
ev_notif_model
.
getTotNoP
());
if
(
ev_notif_model
.
ulNoPIsSet
())
cj
[
"NoP"
][
"Uplink"
]
=
std
::
to_string
(
ev_notif_model
.
getUlNoP
());
if
(
ev_notif_model
.
dlNoPIsSet
())
cj
[
"NoP"
][
"Downlink"
]
=
std
::
to_string
(
ev_notif_model
.
getDlNoP
());
if
(
ev_notif_model
.
totVolIsSet
())
cj
[
"Volume"
][
"Total"
]
=
std
::
to_string
(
ev_notif_model
.
getTotVol
());
if
(
ev_notif_model
.
ulVolIsSet
())
cj
[
"Volume"
][
"Uplink"
]
=
std
::
to_string
(
ev_notif_model
.
getUlVol
());
if
(
ev_notif_model
.
dlVolIsSet
())
cj
[
"Volume"
][
"Downlink"
]
=
std
::
to_string
(
ev_notif_model
.
getDlVol
());
ev_notif
.
set_custom_info
(
cj
);
ev_notif
.
set_custom_info
(
cj
);
itti_msg
->
event_notifs
.
push_back
(
ev_notif
);
itti_msg
->
event_notifs
.
push_back
(
ev_notif
);
...
...
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