def vpp_show_errors(node): """Run "show errors" debug CLI command. :param node: Node to run command on. :type node: dict """ PapiSocketExecutor.run_cli_cmd_on_all_sockets(node, u"show errors")
def clear_packet_trace_on_dut(node): """Clear VPP packet trace on dut. :param node: Node where the packet trace will be cleared. :type node: dict """ PapiSocketExecutor.run_cli_cmd_on_all_sockets(node, u"clear trace")
def show_event_logger(node): """Show event logger on the specified topology node. :param node: Topology node. :type node: dict """ PapiSocketExecutor.run_cli_cmd_on_all_sockets(node, u"show event-logger")
def vpp_enable_elog_traces(node): """Enable API/CLI/Barrier traces on the specified topology node. :param node: Topology node. :type node: dict """ PapiSocketExecutor.run_cli_cmd_on_all_sockets( node, u"elog trace api cli barrier")
def vpp_show_hardware(node): """Run "show hardware" debug CLI command. :param node: Node to run command on. :type node: dict """ PapiSocketExecutor.run_cli_cmd_on_all_sockets( node, u"show hardware verbose")
def vpp_clear_errors(node): """Run "clear errors" CLI command. :param node: Node to run command on. :type node: dict """ PapiSocketExecutor.run_cli_cmd_on_all_sockets(node, u"clear errors", log=False)
def vpp_show_memory(node): """Run "show memory" debug CLI command. Currently, every flag is hardcoded, giving the longest output. :param node: Node to run command on. :type node: dict """ PapiSocketExecutor.run_cli_cmd_on_all_sockets( node, u"show memory verbose api-segment stats-segment main-heap")
def vpp_clear_hardware(node): """Run "clear hardware" CLI command. :param node: Node to run command on. :type node: dict :returns: Verified data from PAPI response. :rtype: dict """ PapiSocketExecutor.run_cli_cmd_on_all_sockets(node, u"clear hardware", log=False)
def show_packet_trace_on_all_duts(nodes, maximum=None): """Show VPP packet trace. :param nodes: Nodes from which the packet trace will be displayed. :param maximum: Maximum number of packet traces to be displayed. :type nodes: dict :type maximum: int """ max_opt = f"" if maximum is None else f" max {maximum}" for node in nodes.values(): if node[u"type"] == NodeType.DUT: PapiSocketExecutor.run_cli_cmd_on_all_sockets( node, f"show trace{max_opt}")
def vpp_enable_elog_traces(node): """Enable API/CLI/Barrier traces on the specified topology node. :param node: Topology node. :type node: dict """ try: PapiSocketExecutor.run_cli_cmd_on_all_sockets( node, u"event-logger trace api cli barrier") except AssertionError: # Perhaps an older VPP build is tested. PapiSocketExecutor.run_cli_cmd_on_all_sockets( node, u"elog trace api cli barrier")
def vpp_enable_traces_on_dut(node, fail_on_error=False): """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 """ cmds = [ u"trace add dpdk-input 50", u"trace add vhost-user-input 50", u"trace add memif-input 50", u"trace add avf-input 50" ] for cmd in cmds: try: PapiSocketExecutor.run_cli_cmd_on_all_sockets(node, cmd) except AssertionError: if fail_on_error: raise
def vpp_show_runtime(node, log_zeros=False): """Run "show runtime" CLI command. :param node: Node to run command on. :param log_zeros: Log also items with zero values. :type node: dict :type log_zeros: bool """ args = dict(path=u"^/sys/node") sockets = Topology.get_node_sockets(node, socket_type=SocketType.STATS) if sockets: for socket in sockets.values(): with PapiExecutor(node) as papi_exec: stats = papi_exec.add(u"vpp-stats", **args).\ get_stats(socket=socket)[0] names = stats[u"/sys/node/names"] if not names: return runtime = list() runtime_nz = list() for name in names: runtime.append({u"name": name}) for idx, runtime_item in enumerate(runtime): calls_th = [] for thread in stats[u"/sys/node/calls"]: calls_th.append(thread[idx]) runtime_item[u"calls"] = calls_th vectors_th = [] for thread in stats[u"/sys/node/vectors"]: vectors_th.append(thread[idx]) runtime_item[u"vectors"] = vectors_th suspends_th = [] for thread in stats[u"/sys/node/suspends"]: suspends_th.append(thread[idx]) runtime_item[u"suspends"] = suspends_th clocks_th = [] for thread in stats[u"/sys/node/clocks"]: clocks_th.append(thread[idx]) runtime_item[u"clocks"] = clocks_th if (sum(calls_th) or sum(vectors_th) or sum(suspends_th) or sum(clocks_th)): runtime_nz.append(runtime_item) if log_zeros: logger.info( f"stats runtime ({node[u'host']} - {socket}):\n" f"{pformat(runtime)}") else: logger.info( f"stats runtime ({node[u'host']} - {socket}):\n" f"{pformat(runtime_nz)}") # Run also the CLI command, the above sometimes misses some info. PapiSocketExecutor.run_cli_cmd_on_all_sockets(node, u"show runtime")