X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Ftools%2Fwrk%2Fwrk.py;h=84d17ee7a15a2a5683b24e928928ea614a507830;hb=43e969af97832930a122aca538ef271e714838b5;hp=a891fd6ae9763fdab8f08ad1c39cfaf3fea385f4;hpb=54ad6efd342695d0a7dad5380cc989a8d846f518;p=csit.git diff --git a/resources/tools/wrk/wrk.py b/resources/tools/wrk/wrk.py index a891fd6ae9..84d17ee7a1 100644 --- a/resources/tools/wrk/wrk.py +++ b/resources/tools/wrk/wrk.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 Cisco and/or its affiliates. +# Copyright (c) 2019 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: @@ -24,7 +24,7 @@ from robot.api import logger from resources.libraries.python.ssh import SSH from resources.libraries.python.topology import NodeType from resources.libraries.python.CpuUtils import CpuUtils -from resources.libraries.python.constants import Constants +from resources.libraries.python.Constants import Constants from resources.tools.wrk.wrk_traffic_profile_parser import WrkTrafficProfile from resources.tools.wrk.wrk_errors import WrkError @@ -57,13 +57,13 @@ REGEX_LATENCY_DIST = \ REGEX_NUM = r"(\d*\.*\d*)(\D*)" -def install_wrk(tg_node): - """Install wrk on the TG node. +def check_wrk(tg_node): + """Check if wrk is installed on the TG node. :param tg_node: Traffic generator node. :type tg_node: dict :raises: RuntimeError if the given node is not a TG node or if the - installation fails. + command is not availble. """ if tg_node['type'] != NodeType.TG: @@ -74,33 +74,10 @@ def install_wrk(tg_node): ret, _, _ = ssh.exec_command( "sudo -E " - "sh -c '{0}/resources/tools/wrk/wrk_utils.sh install false'". - format(Constants.REMOTE_FW_DIR), timeout=1800) + "sh -c '{0}/resources/tools/wrk/wrk_utils.sh installed'". + format(Constants.REMOTE_FW_DIR)) if int(ret) != 0: - raise RuntimeError('Installation of wrk on TG node failed.') - - -def destroy_wrk(tg_node): - """Destroy wrk on the TG node. - - :param tg_node: Traffic generator node. - :type tg_node: dict - :raises: RuntimeError if the given node is not a TG node or the removal of - wrk failed. - """ - - if tg_node['type'] != NodeType.TG: - raise RuntimeError('Node type is not a TG.') - - ssh = SSH() - ssh.connect(tg_node) - - ret, _, _ = ssh.exec_command( - "sudo -E " - "sh -c '{0}/resources/tools/wrk/wrk_utils.sh destroy'". - format(Constants.REMOTE_FW_DIR), timeout=1800) - if int(ret) != 0: - raise RuntimeError('Removal of wrk from the TG node failed.') + raise RuntimeError('WRK is not installed on TG node.') def run_wrk(tg_node, profile_name, tg_numa, test_type, warm_up=False):