aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python
diff options
context:
space:
mode:
Diffstat (limited to 'resources/libraries/python')
-rw-r--r--resources/libraries/python/HoststackUtil.py11
-rw-r--r--resources/libraries/python/model/parse.py14
2 files changed, 16 insertions, 9 deletions
diff --git a/resources/libraries/python/HoststackUtil.py b/resources/libraries/python/HoststackUtil.py
index 3ada07b2a4..cb3970ff0c 100644
--- a/resources/libraries/python/HoststackUtil.py
+++ b/resources/libraries/python/HoststackUtil.py
@@ -285,7 +285,7 @@ class HoststackUtil():
# NGINX used `worker_cpu_affinity` in configuration file
taskset_cmd = u"" if program_name == u"nginx" else \
f"taskset --cpu-list {core_list}"
- cmd = f"nohup {shell_cmd} \'{env_vars}{taskset_cmd} " \
+ cmd = f"nohup {taskset_cmd} {shell_cmd} \'{env_vars} " \
f"{program_path}{program_name} {args} >/tmp/{program_name}_" \
f"stdout.log 2>/tmp/{program_name}_stderr.log &\'"
try:
@@ -322,6 +322,15 @@ class HoststackUtil():
exec_cmd_no_error(node, cmd, message=errmsg, sudo=True)
@staticmethod
+ def sleep_for_hoststack_test_duration(sleep_time):
+ """Wait for the HostStack test program process to complete.
+
+ :param sleep_time: waiting stecific time.
+ """
+ logger.info(f"Sleeping for {sleep_time} seconds")
+ sleep(sleep_time + 1)
+
+ @staticmethod
def hoststack_test_program_finished(node, program_pid, program,
other_node, other_program):
"""Wait for the specified HostStack test program process to complete.
diff --git a/resources/libraries/python/model/parse.py b/resources/libraries/python/model/parse.py
index 6f4505262e..1e0aebfe18 100644
--- a/resources/libraries/python/model/parse.py
+++ b/resources/libraries/python/model/parse.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2025 Cisco and/or its affiliates.
+# Copyright (c) 2024 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -93,21 +93,19 @@ def parse(dirpath: str, fake_value: float = 1.0) -> Dict[str, List[float]]:
result_object = data["result"]
result_type = result_object["type"]
if result_type == "mrr":
- result_list = result_object["receive_rate"]["rate"]["values"]
+ results[name] = result_object["receive_rate"]["rate"]["values"]
elif result_type == "ndrpdr":
- result_list = [result_object["pdr"]["lower"]["rate"]["value"]]
+ results[name] = [result_object["pdr"]["lower"]["rate"]["value"]]
elif result_type == "soak":
- result_list = [
+ results[name] = [
result_object["critical_rate"]["lower"]["rate"]["value"]
]
elif result_type == "reconf":
- result_list = [result_object["loss"]["time"]["value"]]
+ results[name] = [result_object["loss"]["time"]["value"]]
elif result_type == "hoststack":
- result_list = [result_object["bandwidth"]["value"]]
+ results[name] = [result_object["bandwidth"]["value"]]
else:
raise RuntimeError(f"Unknown result type: {result_type}")
- # Negative values from csit/issues/3983 need to be ignored.
- results[name] = [float(val) for val in result_list if val >= 0]
results = {test_id: results[test_id] for test_id in sorted(results)}
with open(resultpath, "wt", encoding="utf8") as file_out:
json.dump(results, file_out, indent=1, separators=(", ", ": "))