Add continue/fail option for enable traces 33/20233/3
authorTibor Frank <tifrank@cisco.com>
Wed, 19 Jun 2019 12:14:10 +0000 (14:14 +0200)
committerTibor Frank <tifrank@cisco.com>
Wed, 19 Jun 2019 15:01:18 +0000 (15:01 +0000)
Change-Id: I675f9664391c9f18f312773812f765f345983cc1
Signed-off-by: Tibor Frank <tifrank@cisco.com>
resources/libraries/python/VPPUtil.py
resources/libraries/robot/performance/performance_utils.robot

index c20912e..c60509f 100644 (file)
@@ -216,26 +216,43 @@ class VPPUtil(object):
             host=node['host'], if_data=if_data))
 
     @staticmethod
             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.
         """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 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
 
     @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.
         """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 nodes: dict
+        :type fail_on_error: bool
         """
         for node in nodes.values():
             if node['type'] == NodeType.DUT:
         """
         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):
 
     @staticmethod
     def vpp_enable_elog_traces_on_dut(node):
index e9eab2c..71e20af 100644 (file)
 | | ... | ${unidirection} | ${tx_port} | ${rx_port}
 | | Run Keyword If | ${dut_stats}==${True} | Clear all counters on all DUTs
 | | Run Keyword If | ${dut_stats}==${True} and ${pkt_trace}==${True}
 | | ... | ${unidirection} | ${tx_port} | ${rx_port}
 | | Run Keyword If | ${dut_stats}==${True} | Clear all counters on all DUTs
 | | Run Keyword If | ${dut_stats}==${True} and ${pkt_trace}==${True}
-| | ... | VPP Enable Traces On All DUTs | ${nodes}
+| | ... | VPP Enable Traces On All DUTs | ${nodes} | fail_on_error=${False}
 | | Run Keyword If | ${dut_stats}==${True}
 | | ... | VPP enable elog traces on all DUTs | ${nodes}
 | | ${results} = | Create List
 | | Run Keyword If | ${dut_stats}==${True}
 | | ... | VPP enable elog traces on all DUTs | ${nodes}
 | | ${results} = | Create List