From b790150e5465cd567346b3be29bdf8638ed11862 Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Wed, 26 Jun 2024 21:20:06 +0200 Subject: [PATCH] CI: Simplify Iperf_Module() Remove code related to "rfsim4g_enb_fembms" testcase from Iperf_Module() - replaced by Iperf2_Unidir(). Use copyin() for both remote and local commands - no need to check if running on localhost anymore. Create directory for log collection on executor node - used for log collection in pipelines running on localhost. Copy the iperf3 report to the executor machine for log collection. The report needs to be copied to two different directories to ensure proper log collection across all pipelines. Using absolute paths ensures compatibility with both remote and local commands. --- ci-scripts/cls_oaicitest.py | 53 +++++++++++++++---------------------- 1 file changed, 22 insertions(+), 31 deletions(-) diff --git a/ci-scripts/cls_oaicitest.py b/ci-scripts/cls_oaicitest.py index 0ff0f9e223..81bd035733 100644 --- a/ci-scripts/cls_oaicitest.py +++ b/ci-scripts/cls_oaicitest.py @@ -790,10 +790,8 @@ class OaiCiTest(): udpIperf = re.search('-u', iperf_opt) is not None bidirIperf = re.search('--bidir', iperf_opt) is not None client_filename = f'iperf_client_{self.testCase_id}_{ue.getName()}.log' - server_filename = f'iperf_server_{self.testCase_id}_{ue.getName()}.log' ymlPath = CONTAINERS.yamlPath[0].split('/') logPath = f'../cmake_targets/log/{ymlPath[1]}' - if udpIperf: target_bitrate, iperf_opt = Iperf_ComputeModifiedBW(idx, ue_num, self.iperf_profile, self.iperf_args) # note: for UDP testing we don't want to use json report - reports 0 Mbps received bitrate @@ -805,36 +803,29 @@ class OaiCiTest(): # hack: the ADB UEs don't have iperf in $PATH, so we need to hardcode for the moment iperf_ue = '/data/local/tmp/iperf3' if re.search('adb', ue.getName()) else 'iperf3' ue_header = f'UE {ue.getName()} ({ueIP})' - - if svr.getName() == "rfsim4g_enb_fembms": - with cls_cmd.getConnection(ue.getHost()) as cmd_ue, cls_cmd.getConnection(EPC.IPAddress) as cmd_svr: - port = 5002 + idx - cmd_ue.run(f'{ue.getCmdPrefix()} iperf -B {ueIP} -s -u -i1 >> {server_filename} &', timeout=iperf_time*1.5) - cmd_svr.run(f'{svr.getCmdPrefix()} iperf -c {ueIP} -B {svrIP} {iperf_opt} -i1 2>&1 | tee {client_filename}', timeout=iperf_time*2.5) - cmd_ue.run(f'cp {client_filename} {logPath}/{client_filename}') - cmd_ue.run(f'cp {server_filename} {logPath}/{server_filename}') - status, msg = Iperf_analyzeV2UDP(server_filename, self.iperf_bitrate_threshold, self.iperf_packetloss_threshold, target_bitrate) + # create log directory on executor node + with cls_cmd.getConnection('localhost') as local: + local.run(f'mkdir -p {logPath}') + with cls_cmd.getConnection(ue.getHost()) as cmd_ue, cls_cmd.getConnection(EPC.IPAddress) as cmd_svr: + port = 5002 + idx + # note: some core setups start an iperf3 server automatically, indicated in ci_infra by runIperf3Server: False` + t = iperf_time * 2.5 + cmd_ue.run(f'rm /tmp/{client_filename}', reportNonZero=False) + if runIperf3Server: + cmd_svr.run(f'{svr.getCmdPrefix()} nohup timeout -vk3 {t} iperf3 -s -B {svrIP} -p {port} -1 {jsonReport} &', timeout=t) + cmd_ue.run(f'{ue.getCmdPrefix()} timeout -vk3 {t} {iperf_ue} -B {ueIP} -c {svrIP} -p {port} {iperf_opt} {jsonReport} {serverReport} -O 5 >> /tmp/{client_filename}', timeout=t) + localPath = f'{os.getcwd()}' + # note: copy iperf3 log to the directory for log collection, used by pipelines running on executor machine + cmd_ue.copyin(f'/tmp/{client_filename}', f'{localPath}/{logPath}/{client_filename}') + # note: copy iperf3 log to the current directory for log analysis and log collection + cmd_ue.copyin(f'/tmp/{client_filename}', f'{localPath}/{client_filename}') + cmd_ue.run(f'rm /tmp/{client_filename}', reportNonZero=False) + if udpIperf: + status, msg = Iperf_analyzeV3UDP(client_filename, self.iperf_bitrate_threshold, self.iperf_packetloss_threshold, target_bitrate) + elif bidirIperf: + status, msg = Iperf_analyzeV3BIDIRJson(client_filename) else: - with cls_cmd.getConnection(ue.getHost()) as cmd_ue, cls_cmd.getConnection(EPC.IPAddress) as cmd_svr: - port = 5002 + idx - # note: some core setups start an iperf3 server automatically, indicated in ci_infra by runIperf3Server: False` - t = iperf_time * 2.5 - if runIperf3Server: - cmd_svr.run(f'{svr.getCmdPrefix()} nohup timeout -vk3 {t} iperf3 -s -B {svrIP} -p {port} -1 {jsonReport} &', timeout=t) - cmd_ue.run(f'rm /tmp/{client_filename}', reportNonZero=False) - cmd_ue.run(f'{ue.getCmdPrefix()} timeout -vk3 {t} {iperf_ue} -B {ueIP} -c {svrIP} -p {port} {iperf_opt} {jsonReport} {serverReport} -O 5 >> /tmp/{client_filename}', timeout=t) - if svr.getHost() == 'localhost': - cmd_ue.run(f'mkdir -p {logPath}') - cmd_ue.run(f'cp /tmp/{client_filename} {logPath}/{client_filename}') - cmd_ue.run(f'cp /tmp/{client_filename} {client_filename}') - else: - cmd_ue.copyin(f'/tmp/{client_filename}', client_filename) - if udpIperf: - status, msg = Iperf_analyzeV3UDP(client_filename, self.iperf_bitrate_threshold, self.iperf_packetloss_threshold, target_bitrate) - elif bidirIperf: - status, msg = Iperf_analyzeV3BIDIRJson(client_filename) - else: - status, msg = Iperf_analyzeV3TCPJson(client_filename, self.iperf_tcp_rate_target) + status, msg = Iperf_analyzeV3TCPJson(client_filename, self.iperf_tcp_rate_target) logging.info(f'\u001B[1;37;45m iperf result for {ue_header}\u001B[0m') for l in msg.split('\n'):