aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/VPPUtil.py
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2019-06-19 14:14:10 +0200
committerTibor Frank <tifrank@cisco.com>2019-06-19 15:01:18 +0000
commit34b3be9de85e2c2fe5a70b0910e40750f799d64c (patch)
tree04a78abdba0b6f2570c513c4d66ec147e06b8b54 /resources/libraries/python/VPPUtil.py
parentb7b863ad5f1504bc5d82a557c68dc0db39304698 (diff)
Add continue/fail option for enable traces
Change-Id: I675f9664391c9f18f312773812f765f345983cc1 Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources/libraries/python/VPPUtil.py')
-rw-r--r--resources/libraries/python/VPPUtil.py29
1 files changed, 23 insertions, 6 deletions
diff --git a/resources/libraries/python/VPPUtil.py b/resources/libraries/python/VPPUtil.py
index c20912eec5..c60509f018 100644
--- a/resources/libraries/python/VPPUtil.py
+++ b/resources/libraries/python/VPPUtil.py
@@ -216,26 +216,43 @@ class VPPUtil(object):
host=node['host'], if_data=if_data))
@staticmethod
- def vpp_enable_traces_on_dut(node):
+ def vpp_enable_traces_on_dut(node, fail_on_error=True):
"""Enable vpp packet traces on the DUT node.
:param node: DUT node to set up.
+ :param fail_on_error: If True, keyword fails if an error occurs,
+ otherwise passes.
:type node: dict
+ :type fail_on_error: bool
"""
- PapiExecutor.run_cli_cmd(node, "trace add dpdk-input 50")
- PapiExecutor.run_cli_cmd(node, "trace add vhost-user-input 50")
- PapiExecutor.run_cli_cmd(node, "trace add memif-input 50")
+ cmds = [
+ "trace add dpdk-input 50",
+ "trace add vhost-user-input 50",
+ "trace add memif-input 50"
+ ]
+
+ for cmd in cmds:
+ try:
+ PapiExecutor.run_cli_cmd(node, cmd)
+ except AssertionError as err:
+ if fail_on_error:
+ raise
+ else:
+ logger.error(repr(err))
@staticmethod
- def vpp_enable_traces_on_all_duts(nodes):
+ def vpp_enable_traces_on_all_duts(nodes, fail_on_error=True):
"""Enable vpp packet traces on all DUTs in the given topology.
:param nodes: Nodes in the topology.
+ :param fail_on_error: If True, keyword fails if an error occurs,
+ otherwise passes.
:type nodes: dict
+ :type fail_on_error: bool
"""
for node in nodes.values():
if node['type'] == NodeType.DUT:
- VPPUtil.vpp_enable_traces_on_dut(node)
+ VPPUtil.vpp_enable_traces_on_dut(node, fail_on_error)
@staticmethod
def vpp_enable_elog_traces_on_dut(node):