-# Copyright (c) 2016 Cisco and/or its affiliates.
+# Copyright (c) 2018 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:
"""Contains methods for setting up DUTs."""
@staticmethod
def start_vpp_service_on_all_duts(nodes):
- """Start up the VPP service on all nodes."""
+ """Start up the VPP service on all nodes.
+
+ :param nodes: Nodes in the topology.
+ :type nodes: dict
+ """
ssh = SSH()
for node in nodes.values():
if node['type'] == NodeType.DUT:
(ret_code, stdout, stderr) = \
ssh.exec_command_sudo('service vpp restart', timeout=120)
if int(ret_code) != 0:
- logger.debug('stdout: {0}'.format(stdout))
- logger.debug('stderr: {0}'.format(stderr))
raise Exception('DUT {0} failed to start VPP service'.
format(node['host']))
ssh.exec_command('sudo -Sn bash {0}/{1}/dut_setup.sh'.
format(Constants.REMOTE_FW_DIR,
Constants.RESOURCES_LIB_SH), timeout=120)
- logger.trace(stdout)
- logger.trace(stderr)
if int(ret_code) != 0:
logger.debug('DUT {0} setup script failed: "{1}"'.
format(node['host'], stdout + stderr))
if int(ret_code) != 0:
raise RuntimeError('Failed to load {0} kernel module on host {1}'.
format(module, node['host']))
+
+ @staticmethod
+ def vpp_enable_traces_on_all_duts(nodes):
+ """Enable vpp packet traces 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:
+ DUTSetup.vpp_enable_traces_on_dut(node)
+
+ @staticmethod
+ def vpp_enable_traces_on_dut(node):
+ """Enable vpp packet traces on the DUT node.
+
+ :param node: DUT node to set up.
+ :type node: dict
+ """
+
+ vat = VatExecutor()
+ vat.execute_script("enable_dpdk_traces.vat", node, json_out=False)
+ vat.execute_script("enable_vhost_user_traces.vat", node, json_out=False)