From a201f3d3a5fdb9ccb86d57664cfd1de4bf484d36 Mon Sep 17 00:00:00 2001 From: Peter Mikus Date: Thu, 5 May 2022 13:08:10 +0200 Subject: fix(uti): Add TG type export - This is actually bug not a feature. - AB to be added later - Tested on TREX and iPerf3 Signed-off-by: Peter Mikus Change-Id: Ib6f2d13e3b9401a9fb5759e42a8a310ee11b9d41 --- resources/tools/ab/ABTools.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'resources/tools/ab') diff --git a/resources/tools/ab/ABTools.py b/resources/tools/ab/ABTools.py index cbd1adf21f..54aff19e92 100644 --- a/resources/tools/ab/ABTools.py +++ b/resources/tools/ab/ABTools.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Intel and/or its affiliates. +# Copyright (c) 2022 Intel 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: @@ -78,6 +78,31 @@ class ABTools: message = u"ab not installed on TG node!" exec_cmd_no_error(tg_node, cmd, message=message) + @staticmethod + def get_ab_type(node): + """Log and return the installed traffic generator type. + + :param node: Node from topology file. + :type node: dict + :returns: Traffic generator type string. + :rtype: str + """ + return "AB" + + @staticmethod + def get_ab_version(node): + """Log and return the installed traffic generator version. + + :param node: Node from topology file. + :type node: dict + :returns: Traffic generator version string. + :rtype: str + """ + command = f"ab -V | head -1 | cut -d',' -f2" + message = u"Get AB version failed!" + stdout, _ = exec_cmd_no_error(node, command, message=message) + return stdout.strip() + @staticmethod def run_ab(tg_node, ip_addr, tg_addr, tls_tcp, cipher, files_num, rps_cps, r_total, c_total, port, protocol=u"TLS1.3"): -- cgit 1.2.3-korg