Files
openairinterface5g/ci-scripts/tests/iperf-analysis.py
Robert Schmidt 8107939f08 Change OAI license to CSSL v1.0 (and others)
- all RAN code, CI code, configuration files, dockerfiles, in CSSL v1.0
- all deployment code (openshift, charts, ancillary files like shell
  scripts), in MIT
- documentation in CC-BY-4.0
- exceptions might apply and are listed in NOTICE
- there is a new LICENSES folder with all licenses
- CONTRIBUTIONS.md has been updated accordingly

For automated changes based on OAI PL v1.1:

    perl -i~ -0pe 's/\/\*.*Licensed to the OpenAirInterface.*openairinterface.org\n#?/\/*\n * SPDX-License-Identifier: LicenseRef-CSSL-1.0\n/s' **/*.{c,h,cpp}
    perl -i~ -0pe 's/\/\*.*Licensed to the OpenAirInterface.*openairinterface.org\n#?/\/*\n * SPDX-License-Identifier: LicenseRef-CSSL-1.0\n/s' **/*.ts
    perl -i~ -0pe 's/<!--.*Licensed to the OpenAirInterface.*openairinterface.org\n.*-->/<!-- SPDX-License-Identifier: LicenseRef-CSSL-1.0 -->/s' **/*.xml

The rest (cmake, files with missing license, cmake) manually.
2026-03-27 16:36:37 +01:00

92 lines
3.6 KiB
Python

# SPDX-License-Identifier: LicenseRef-CSSL-1.0
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"
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"
target_bitrate = "1"
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, target_bitrate)
self.assertEqual(msg, expected_msg_ok)
self.assertTrue(success)
def test_iperf_analyzeV3UDP_ok2(self):
filename_ok = "tests/log/iperf_udp_test_ok2.log"
msg_filename_ok = "tests/log/iperf_udp_msg_ok2.txt"
target_bitrate = "4.67"
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, 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"
target_bitrate = "1"
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, target_bitrate)
self.assertEqual(msg, expected_msg_nok)
self.assertFalse(success)
def test_iperf_analyzeV3UDP_nok2(self):
filename_nok = "tests/log/iperf_udp_test_nok2.log"
msg_filename_nok = "tests/log/iperf_udp_msg_nok2.txt"
target_bitrate = "80"
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, target_bitrate)
self.assertEqual(msg, expected_msg_nok)
self.assertFalse(success)
def test_iperf_analyzeV3UDP_nok3(self):
filename_nok = "tests/log/iperf_udp_test_nok3.log"
msg_filename_nok = "tests/log/iperf_udp_msg_nok3.txt"
target_bitrate = "4.67"
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, 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"
target_bitrate = "1"
success, msg = cls_oaicitest.Iperf_analyzeV3UDP(filename_notfound, self.iperf_bitrate_threshold, self.iperf_packetloss_threshold, target_bitrate)
self.assertEqual(msg, "Iperf3 UDP: Log file not present")
self.assertFalse(success)
def test_iperf_analyzeV2UDP(self):
filename_ok = "tests/log/iperf_udp_v2_ok.log"
msg_filename_ok = "tests/log/iperf_udp_v2_ok.txt"
target_bitrate = "2.00"
bitrate_thresh = 80
packetloss_thresh = 25
with open(msg_filename_ok, 'r') as file:
expected_msg_ok = file.read().strip()
success, msg = cls_oaicitest.Iperf_analyzeV2UDP(filename_ok, bitrate_thresh, packetloss_thresh, target_bitrate)
self.assertEqual(msg, expected_msg_ok)
self.assertTrue(success)
if __name__ == '__main__':
unittest.main()