Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
X
xlte
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
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
Joanne Hugé
xlte
Commits
89f29e90
Commit
89f29e90
authored
3 weeks ago
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kpi: Calc.aggregate: Add basic test
As marked as TODO in
bf96c767
add basic test for Calc.aggregate .
parent
43250935
master
xlog-password
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
3 deletions
+52
-3
kpi.py
kpi.py
+0
-1
kpi_test.py
kpi_test.py
+52
-2
No files found.
kpi.py
View file @
89f29e90
...
...
@@ -699,7 +699,6 @@ def eutran_ip_throughput(calc): # -> IPThp[QCI][dl,ul]
# aggregate aggregates values of all Measurements in covered time interval.
# TODO tests
@
func
(
Calc
)
def
aggregate
(
calc
):
# -> ΣMeasurement
Σ
=
Σ
Measurement
()
...
...
This diff is collapsed.
Click to expand it.
kpi_test.py
View file @
89f29e90
# -*- coding: utf-8 -*-
# Copyright (C) 2022-202
3
Nexedi SA and Contributors.
# Copyright (C) 2022-202
4
Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com>
#
# This program is free software: you can Use, Study, Modify and Redistribute
...
...
@@ -20,7 +20,8 @@
from
__future__
import
print_function
,
division
,
absolute_import
from
xlte.kpi
import
Calc
,
MeasurementLog
,
Measurement
,
Interval
,
NA
,
isNA
,
Σ
qci
,
Σ
cause
,
nqci
from
xlte.kpi
import
Calc
,
MeasurementLog
,
Measurement
,
Σ
Measurement
,
Interval
,
\
NA
,
isNA
,
Σ
qci
,
Σ
cause
,
nqci
import
numpy
as
np
from
pytest
import
raises
...
...
@@ -496,6 +497,55 @@ def test_Calc_eutran_ip_throughput():
assert
thp
[
qci
][
'ul'
]
==
I
(
0
)
# verify Calc.aggregate .
def
test_Calc_aggregate
():
mlog
=
MeasurementLog
()
m1
=
Measurement
()
m1
[
'X.Tstart'
]
=
1
m1
[
'X.δT'
]
=
2
m1
[
'S1SIG.ConnEstabAtt'
]
=
12
# Tcc
m1
[
'ERAB.SessionTimeUE'
]
=
1.2
# Ttime
m2
=
Measurement
()
m2
[
'X.Tstart'
]
=
5
# NOTE [3,5) is NA hole
m2
[
'X.δT'
]
=
3
m2
[
'S1SIG.ConnEstabAtt'
]
=
11
m2
[
'ERAB.SessionTimeUE'
]
=
0.7
mlog
.
append
(
m1
)
mlog
.
append
(
m2
)
calc
=
Calc
(
mlog
,
0
,
10
)
assert
calc
.
τ
_lo
==
0
assert
calc
.
τ
_hi
==
10
M
=
calc
.
aggregate
()
assert
isinstance
(
M
,
Σ
Measurement
)
assert
M
[
'X.Tstart'
]
==
0
assert
M
[
'X.δT'
]
==
10
assert
M
[
'S1SIG.ConnEstabAtt'
][
'value'
]
==
12
+
11
assert
M
[
'S1SIG.ConnEstabAtt'
][
'τ_na'
]
==
5
# [0,1) [3,5) [8,10)
assert
M
[
'ERAB.SessionTimeUE'
][
'value'
]
==
1.2
+
0.7
assert
M
[
'ERAB.SessionTimeUE'
][
'τ_na'
]
==
5
# assert that everything else is NA with τ_na == 10
def
_
(
name
):
f
=
M
[
name
]
if
f
.
shape
!=
():
return
# don't check X.QCI - rely on aliases
assert
isNA
(
f
[
'value'
])
assert
f
[
'τ_na'
]
==
10
for
name
in
M
.
dtype
.
names
:
if
name
not
in
(
'X.Tstart'
,
'X.δT'
,
'S1SIG.ConnEstabAtt'
,
'ERAB.SessionTimeUE'
):
_
(
name
)
# verify Σqci.
def
test_
Σ
qci
():
m
=
Measurement
()
...
...
This diff is collapsed.
Click to expand it.
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