Commit 0da2f27f authored by Robert Schmidt's avatar Robert Schmidt

CI Ping/Iperf: add tests, print without lock, reduce code lines

Add some basic unit tests to verify that Iperf/Ping work. Harmonize the
logging by only print in the "main" iperf/ping function, to avoid that
if we test with multiple UEs, the output intermixes. Also, do one common
mkdir before starting multiple pings/iperfs. Finally, harmonize the
paths so that Iperf and Ping log their files in the same place.
parent 02d5f953
......@@ -405,3 +405,7 @@ l2sim4g_ext_dn:
Host: "%%current_host%%"
NetworkScript: docker exec l2sim4g-trf-gen ip a show dev eth0
CmdPrefix: docker exec l2sim4g-trf-gen
test:
Host: localhost
NetworkScript: echo "inet 127.0.0.1 mtu 1500"
......@@ -128,7 +128,7 @@ class LocalCmd(Cmd):
def copyin(self, src, tgt, recursive=False):
if src[0] != '/' or tgt[0] != '/':
raise Exception('support only absolute file paths!')
raise Exception(f'support only absolute file paths (src {src} tgt {tgt})!')
opt = '-r' if recursive else ''
return self.run(f'cp {opt} {src} {tgt}').returncode == 0
......
This diff is collapsed.
......@@ -7,5 +7,6 @@ There are some unit tests. From the parent directory, i.e., `ci-scripts/`,
start with
python tests/deployment.py -v
python tests/ping-iperf.py -v
It will indicate if all tests passed.
import sys
import logging
logging.basicConfig(
level=logging.DEBUG,
stream=sys.stdout,
format="[%(asctime)s] %(levelname)8s: %(message)s"
)
import os
os.system(f'rm -rf cmake_targets')
os.system(f'mkdir -p cmake_targets/log')
import unittest
sys.path.append('./') # to find OAI imports below
import cls_oai_html
import cls_oaicitest
import cls_containerize
import ran
import epc
class TestPingIperf(unittest.TestCase):
def setUp(self):
self.html = cls_oai_html.HTMLManagement()
self.html.testCaseId = "000000"
self.ci = cls_oaicitest.OaiCiTest()
self.ci.ue_ids = ["test"]
self.ci.nodes = ["localhost"]
self.cont = cls_containerize.Containerize()
self.epc = epc.EPCManagement()
self.epc.IPAddress = "localhost"
self.epc.UserName = None
self.epc.Password = None
self.epc.SourceCodePath = os.getcwd()
self.ran = ran.RANManagement()
def test_ping(self):
self.ci.ping_args = "-c3 127.0.0.1"
self.ci.ping_packetloss_threshold = "0"
# TODO Should need nothing but options and UE(s) to use
self.ci.Ping(self.html, self.ran, self.epc, self.cont)
def test_iperf(self):
# note: needs to be five seconds because Iperf() adds -O 3, so if it is
# too short, the server is terminated before the client loaded
# everything
self.ci.iperf_args = "-u -t 5 -b 1M -R"
self.ci.svr_id = "test"
self.ci.svr_node = "localhost"
self.ci.iperf_packetloss_threshold = "0"
self.ci.iperf_bitrate_threshold = "0"
self.ci.iperf_profile = "balanced"
# TODO Should need nothing but options and UE(s) to use
self.ci.Iperf(self.html, self.ran, self.epc, self.cont)
if __name__ == '__main__':
unittest.main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment