From 3ccfe8cdb3d94182e365f4bfacefbb52fb32cb93 Mon Sep 17 00:00:00 2001 From: Peter Mikus Date: Wed, 30 Oct 2019 14:29:49 +0000 Subject: Framework: Add show log as tear down action + We can see what is happening when debug level is increased + Big caveat of VPP is that it does not allow to configure default global level. Signed-off-by: Peter Mikus Change-Id: I5ea1a618161cdb3170cab022d7451e52271f83c0 --- resources/libraries/python/InterfaceUtil.py | 3 ++ resources/libraries/python/VPPUtil.py | 35 ++++++++++++++-------- .../libraries/robot/shared/test_teardown.robot | 1 + 3 files changed, 26 insertions(+), 13 deletions(-) (limited to 'resources') diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py index d185137940..a15507454a 100644 --- a/resources/libraries/python/InterfaceUtil.py +++ b/resources/libraries/python/InterfaceUtil.py @@ -1199,6 +1199,9 @@ class InterfaceUtil(object): :raises RuntimeError: If it is not possible to create AVF interface on the node. """ + PapiSocketExecutor.run_cli_cmd( + node, 'set logging class avf level debug') + cmd = 'avf_create' args = dict(pci_addr=InterfaceUtil.pci_to_int(vf_pci_addr), enable_elog=0, diff --git a/resources/libraries/python/VPPUtil.py b/resources/libraries/python/VPPUtil.py index 432a589cd3..72b6142306 100644 --- a/resources/libraries/python/VPPUtil.py +++ b/resources/libraries/python/VPPUtil.py @@ -259,10 +259,10 @@ class VPPUtil(object): VPPUtil.vpp_enable_traces_on_dut(node, fail_on_error) @staticmethod - def vpp_enable_elog_traces_on_dut(node): - """Enable API/CLI/Barrier traces on the DUT node. + def vpp_enable_elog_traces(node): + """Enable API/CLI/Barrier traces on the specified topology node. - :param node: DUT node to set up. + :param node: Topology node. :type node: dict """ PapiSocketExecutor.run_cli_cmd(node, "elog trace api cli barrier") @@ -276,13 +276,13 @@ class VPPUtil(object): """ for node in nodes.values(): if node['type'] == NodeType.DUT: - VPPUtil.vpp_enable_elog_traces_on_dut(node) + VPPUtil.vpp_enable_elog_traces(node) @staticmethod - def show_event_logger_on_dut(node): - """Show event logger on the DUT node. + def show_event_logger(node): + """Show event logger on the specified topology node. - :param node: DUT node to show traces on. + :param node: Topology node. :type node: dict """ PapiSocketExecutor.run_cli_cmd(node, "show event-logger") @@ -296,18 +296,27 @@ class VPPUtil(object): """ for node in nodes.values(): if node['type'] == NodeType.DUT: - VPPUtil.show_event_logger_on_dut(node) + VPPUtil.show_event_logger(node) @staticmethod def show_log(node): - """Show log on the specified topology node. + """Show logging on the specified topology node. :param node: Topology node. :type node: dict - :returns: VPP log data. - :rtype: list """ - return PapiSocketExecutor.run_cli_cmd(node, "show log") + PapiSocketExecutor.run_cli_cmd(node, "show logging") + + @staticmethod + def show_log_on_all_duts(nodes): + """Show logging on all DUTs in the given topology. + + :param nodes: Nodes in the topology. + :type nodes: dict + """ + for node in nodes.values(): + if node['type'] == NodeType.DUT: + VPPUtil.show_log(node) @staticmethod def vpp_show_threads(node): @@ -331,6 +340,6 @@ class VPPUtil(object): thread_data.append(item) threads_data.append(thread_data) - logger.info("show threads:\n{threads}".format(threads=threads_data)) + logger.trace("show threads:\n{threads}".format(threads=threads_data)) return threads_data diff --git a/resources/libraries/robot/shared/test_teardown.robot b/resources/libraries/robot/shared/test_teardown.robot index 1cc526211d..0beeff4484 100644 --- a/resources/libraries/robot/shared/test_teardown.robot +++ b/resources/libraries/robot/shared/test_teardown.robot @@ -33,6 +33,7 @@ | | ... | | Remove All Added Ports On All DUTs From Topology | ${nodes} | | Show PAPI History On All DUTs | ${nodes} +| | Show Log On All DUTs | ${nodes} | | Run Keyword If Test Failed | | ... | Get Core Files on All Nodes | ${nodes} | | Run Keyword If Test Failed -- cgit 1.2.3-korg