CI: add unit test for UDP iperf3 analysis function
This commit is contained in:
committed by
Robert Schmidt
parent
1ba5677056
commit
9d92c0e477
@@ -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.
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
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()
|
||||
@@ -0,0 +1,4 @@
|
||||
Sender Bitrate : 0.52 Mbps
|
||||
Receiver Bitrate: 0.52 Mbps (too low! < 99%)
|
||||
Jitter : 0.026 ms
|
||||
Packet Loss : 10 % (too high! > 0%)
|
||||
@@ -0,0 +1,4 @@
|
||||
Sender Bitrate : 1.00 Mbps
|
||||
Receiver Bitrate: 1.00 Mbps (99.60 %)
|
||||
Jitter : 0.029 ms
|
||||
Packet Loss : 0 %
|
||||
@@ -0,0 +1,39 @@
|
||||
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.
|
||||
@@ -0,0 +1,39 @@
|
||||
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.
|
||||
Reference in New Issue
Block a user