Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
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
spbro
OpenXG-RAN
Commits
9d92c0e4
Commit
9d92c0e4
authored
Sep 26, 2024
by
Jaroslava Fiedlerova
Committed by
Robert Schmidt
Sep 28, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CI: add unit test for UDP iperf3 analysis function
parent
1ba56770
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
132 additions
and
0 deletions
+132
-0
ci-scripts/tests/README.md
ci-scripts/tests/README.md
+1
-0
ci-scripts/tests/iperf-analysis.py
ci-scripts/tests/iperf-analysis.py
+45
-0
ci-scripts/tests/log/iperf_udp_msg_nok.txt
ci-scripts/tests/log/iperf_udp_msg_nok.txt
+4
-0
ci-scripts/tests/log/iperf_udp_msg_ok.txt
ci-scripts/tests/log/iperf_udp_msg_ok.txt
+4
-0
ci-scripts/tests/log/iperf_udp_test_nok.log
ci-scripts/tests/log/iperf_udp_test_nok.log
+39
-0
ci-scripts/tests/log/iperf_udp_test_ok.log
ci-scripts/tests/log/iperf_udp_test_ok.log
+39
-0
No files found.
ci-scripts/tests/README.md
View file @
9d92c0e4
...
...
@@ -8,5 +8,6 @@ start with
python tests/deployment.py -v
python tests/ping-iperf.py -v
python tests/iperf-analysis.py -v
It will indicate if all tests passed.
ci-scripts/tests/iperf-analysis.py
0 → 100644
View file @
9d92c0e4
import
sys
import
logging
logging
.
basicConfig
(
level
=
logging
.
DEBUG
,
stream
=
sys
.
stdout
,
format
=
"[%(asctime)s] %(levelname)8s: %(message)s"
)
import
os
import
unittest
sys
.
path
.
append
(
'./'
)
# to find OAI imports below
import
cls_oaicitest
class
TestIperfAnalysis
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
iperf_bitrate_threshold
=
"99"
self
.
iperf_packetloss_threshold
=
"0"
self
.
target_bitrate
=
"1"
def
test_iperf_analyzeV3UDP_ok
(
self
):
filename_ok
=
"tests/log/iperf_udp_test_ok.log"
msg_filename_ok
=
"tests/log/iperf_udp_msg_ok.txt"
with
open
(
msg_filename_ok
,
'r'
)
as
file
:
expected_msg_ok
=
file
.
read
().
strip
()
success
,
msg
=
cls_oaicitest
.
Iperf_analyzeV3UDP
(
filename_ok
,
self
.
iperf_bitrate_threshold
,
self
.
iperf_packetloss_threshold
,
self
.
target_bitrate
)
self
.
assertEqual
(
msg
,
expected_msg_ok
)
self
.
assertTrue
(
success
)
def
test_iperf_analyzeV3UDP_nok
(
self
):
filename_nok
=
"tests/log/iperf_udp_test_nok.log"
msg_filename_nok
=
"tests/log/iperf_udp_msg_nok.txt"
with
open
(
msg_filename_nok
,
'r'
)
as
file
:
expected_msg_nok
=
file
.
read
().
strip
()
success
,
msg
=
cls_oaicitest
.
Iperf_analyzeV3UDP
(
filename_nok
,
self
.
iperf_bitrate_threshold
,
self
.
iperf_packetloss_threshold
,
self
.
target_bitrate
)
self
.
assertEqual
(
msg
,
expected_msg_nok
)
self
.
assertFalse
(
success
)
def
test_iperf_analyzeV3UDP_notfound
(
self
):
filename_notfound
=
"tests/log/iperf_udp_test_notfound.log"
success
,
msg
=
cls_oaicitest
.
Iperf_analyzeV3UDP
(
filename_notfound
,
self
.
iperf_bitrate_threshold
,
self
.
iperf_packetloss_threshold
,
self
.
target_bitrate
)
self
.
assertEqual
(
msg
,
"Iperf3 UDP: Log file not present"
)
self
.
assertFalse
(
success
)
if
__name__
==
'__main__'
:
unittest
.
main
()
ci-scripts/tests/log/iperf_udp_msg_nok.txt
0 → 100644
View file @
9d92c0e4
Sender Bitrate : 0.52 Mbps
Receiver Bitrate: 0.52 Mbps (too low! < 99%)
Jitter : 0.026 ms
Packet Loss : 10 % (too high! > 0%)
ci-scripts/tests/log/iperf_udp_msg_ok.txt
0 → 100644
View file @
9d92c0e4
Sender Bitrate : 1.00 Mbps
Receiver Bitrate: 1.00 Mbps (99.60 %)
Jitter : 0.029 ms
Packet Loss : 0 %
ci-scripts/tests/log/iperf_udp_test_nok.log
0 → 100644
View file @
9d92c0e4
Connecting to host 127.0.0.1, port 5002
Reverse mode, remote host 127.0.0.1 is sending
[ 5] local 127.0.0.1 port 49140 connected to 127.0.0.1 port 5002
[ ID] Interval Transfer Bitrate Jitter Lost/Total Datagrams
[ 5] 0.00-1.00 sec 64.0 KBytes 524 Kbits/sec 0.005 ms 0/2 (0%) (omitted)
[ 5] 1.00-2.00 sec 64.0 KBytes 524 Kbits/sec 0.012 ms 0/2 (0%) (omitted)
[ 5] 2.00-3.00 sec 64.0 KBytes 524 Kbits/sec 0.013 ms 0/2 (0%) (omitted)
[ 5] 3.00-4.00 sec 64.0 KBytes 524 Kbits/sec 0.015 ms 0/2 (0%) (omitted)
[ 5] 4.00-5.00 sec 64.0 KBytes 524 Kbits/sec 0.019 ms 0/2 (0%) (omitted)
[ 5] 0.00-1.00 sec 64.0 KBytes 524 Kbits/sec 0.006 ms 0/2 (0%)
[ 5] 1.00-2.00 sec 64.0 KBytes 524 Kbits/sec 0.008 ms 0/2 (0%)
[ 5] 2.00-3.00 sec 64.0 KBytes 524 Kbits/sec 0.015 ms 0/2 (0%)
[ 5] 3.00-4.00 sec 64.0 KBytes 524 Kbits/sec 0.017 ms 0/2 (0%)
[ 5] 4.00-5.00 sec 64.0 KBytes 525 Kbits/sec 0.026 ms 0/2 (0%)
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Jitter Lost/Total Datagrams
[ 5] 0.00-5.00 sec 320 KBytes 524 Kbits/sec 0.000 ms 0/10 (0%) sender
[ 5] 0.00-5.00 sec 320 KBytes 524 Kbits/sec 0.026 ms 0/10 (10%) receiver
Server output:
Accepted connection from 127.0.0.1, port 34697
[ 5] local 127.0.0.1 port 5002 connected to 127.0.0.1 port 49140
[ ID] Interval Transfer Bitrate Total Datagrams
[ 5] 0.00-1.00 sec 64.0 KBytes 524 Kbits/sec 2 (omitted)
[ 5] 1.00-2.00 sec 64.0 KBytes 524 Kbits/sec 2 (omitted)
[ 5] 2.00-3.00 sec 64.0 KBytes 524 Kbits/sec 2 (omitted)
[ 5] 3.00-4.00 sec 64.0 KBytes 524 Kbits/sec 2 (omitted)
[ 5] 4.00-5.00 sec 64.0 KBytes 524 Kbits/sec 2 (omitted)
[ 5] 0.00-1.00 sec 64.0 KBytes 524 Kbits/sec 2
[ 5] 1.00-2.00 sec 64.0 KBytes 524 Kbits/sec 2
[ 5] 2.00-3.00 sec 64.0 KBytes 524 Kbits/sec 2
[ 5] 3.00-4.00 sec 64.0 KBytes 524 Kbits/sec 2
[ 5] 4.00-5.00 sec 64.0 KBytes 524 Kbits/sec 2
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Jitter Lost/Total Datagrams
[ 5] 0.00-5.00 sec 320 KBytes 524 Kbits/sec 0.000 ms 0/10 (10%) sender
iperf Done.
ci-scripts/tests/log/iperf_udp_test_ok.log
0 → 100644
View file @
9d92c0e4
Connecting to host 127.0.0.1, port 5002
Reverse mode, remote host 127.0.0.1 is sending
[ 5] local 127.0.0.1 port 34141 connected to 127.0.0.1 port 5002
[ ID] Interval Transfer Bitrate Jitter Lost/Total Datagrams
[ 5] 0.00-1.00 sec 128 KBytes 1.05 Mbits/sec 0.011 ms 0/4 (0%) (omitted)
[ 5] 1.00-2.00 sec 128 KBytes 1.05 Mbits/sec 0.012 ms 0/4 (0%) (omitted)
[ 5] 2.00-3.00 sec 128 KBytes 1.05 Mbits/sec 0.019 ms 0/4 (0%) (omitted)
[ 5] 3.00-4.00 sec 128 KBytes 1.05 Mbits/sec 0.023 ms 0/4 (0%) (omitted)
[ 5] 4.00-5.00 sec 128 KBytes 1.05 Mbits/sec 0.022 ms 0/4 (0%) (omitted)
[ 5] 0.00-1.00 sec 96.0 KBytes 786 Kbits/sec 0.003 ms 0/3 (0%)
[ 5] 1.00-2.00 sec 128 KBytes 1.05 Mbits/sec 0.011 ms 0/4 (0%)
[ 5] 2.00-3.00 sec 128 KBytes 1.05 Mbits/sec 0.024 ms 0/4 (0%)
[ 5] 3.00-4.00 sec 128 KBytes 1.05 Mbits/sec 0.022 ms 0/4 (0%)
[ 5] 4.00-5.00 sec 128 KBytes 1.05 Mbits/sec 0.029 ms 0/4 (0%)
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Jitter Lost/Total Datagrams
[ 5] 0.00-5.00 sec 608 KBytes 996 Kbits/sec 0.000 ms 0/19 (0%) sender
[ 5] 0.00-5.00 sec 608 KBytes 996 Kbits/sec 0.029 ms 0/19 (0%) receiver
Server output:
Accepted connection from 127.0.0.1, port 53711
[ 5] local 127.0.0.1 port 5002 connected to 127.0.0.1 port 34141
[ ID] Interval Transfer Bitrate Total Datagrams
[ 5] 0.00-1.00 sec 128 KBytes 1.05 Mbits/sec 4 (omitted)
[ 5] 1.00-2.00 sec 128 KBytes 1.05 Mbits/sec 4 (omitted)
[ 5] 2.00-3.00 sec 128 KBytes 1.05 Mbits/sec 4 (omitted)
[ 5] 3.00-4.00 sec 128 KBytes 1.05 Mbits/sec 4 (omitted)
[ 5] 4.00-5.00 sec 128 KBytes 1.05 Mbits/sec 4 (omitted)
[ 5] 0.00-1.00 sec 96.0 KBytes 786 Kbits/sec 3
[ 5] 1.00-2.00 sec 128 KBytes 1.05 Mbits/sec 4
[ 5] 2.00-3.00 sec 128 KBytes 1.05 Mbits/sec 4
[ 5] 3.00-4.00 sec 128 KBytes 1.05 Mbits/sec 4
[ 5] 4.00-5.00 sec 128 KBytes 1.05 Mbits/sec 4
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Jitter Lost/Total Datagrams
[ 5] 0.00-5.00 sec 608 KBytes 996 Kbits/sec 0.000 ms 0/19 (0%) sender
iperf Done.
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