From e969ddb8973888bb0728550b5db3daf1cc708e5a Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 23 Sep 2024 14:41:17 +0200 Subject: [PATCH] IdleSleep(): no need for class members --- ci-scripts/cls_oaicitest.py | 10 +++++----- ci-scripts/main.py | 8 ++------ 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/ci-scripts/cls_oaicitest.py b/ci-scripts/cls_oaicitest.py index 8364f9a7fa..141605084f 100644 --- a/ci-scripts/cls_oaicitest.py +++ b/ci-scripts/cls_oaicitest.py @@ -239,6 +239,11 @@ def Custom_Command(HTML, node, command, command_fail): HTML.CreateHtmlTestRowQueue(command, status, message) return status == 'OK' or status == 'Warning' +def IdleSleep(HTML, idle_sleep_time): + time.sleep(idle_sleep_time) + HTML.CreateHtmlTestRow(f"{idle_sleep_time} sec", 'OK', CONST.ALL_PROCESSES_OK) + return True + #----------------------------------------------------------- # OaiCiTest Class Definition #----------------------------------------------------------- @@ -263,7 +268,6 @@ class OaiCiTest(): self.iperf_profile = '' self.iperf_options = '' self.iperf_tcp_rate_target = '' - self.idle_sleep_time = 0 self.finalStatus = False self.UEIPAddress = '' self.UEUserName = '' @@ -915,10 +919,6 @@ class OaiCiTest(): CONTAINERS.UndeployGenObject(HTML,RAN,self) RAN.prematureExit=True - def IdleSleep(self,HTML): - time.sleep(self.idle_sleep_time) - HTML.CreateHtmlTestRow(str(self.idle_sleep_time) + ' sec', 'OK', CONST.ALL_PROCESSES_OK) - def LogCollectBuild(self,RAN): # Some pipelines are using "none" IP / Credentials # In that case, just forget about it diff --git a/ci-scripts/main.py b/ci-scripts/main.py index a36005cec6..0fdf0f2f07 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -298,12 +298,8 @@ def ExecuteActionWithParam(action): CiTestObj.Iperf2_Unidir(HTML,RAN,EPC,CONTAINERS) elif action == 'IdleSleep': - string_field = test.findtext('idle_sleep_time_in_sec') - if (string_field is None): - CiTestObj.idle_sleep_time = 5 - else: - CiTestObj.idle_sleep_time = int(string_field) - CiTestObj.IdleSleep(HTML) + st = test.findtext('idle_sleep_time_in_sec') or "5" + cls_oaicitest.IdleSleep(HTML, int(st)) elif action == 'Build_PhySim': ldpc.buildargs = test.findtext('physim_build_args')