Once all recipes finish execution, get's interface statistics. This feature allows anaylze test execution and find faults easily.
Signed-off-by: Elad Raz eladr@mellanox.com Signed-off-by: Jiri Pirko jiri@mellanox.com --- lnst/Controller/Machine.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/lnst/Controller/Machine.py b/lnst/Controller/Machine.py index 5363d1c..ebdd17a 100644 --- a/lnst/Controller/Machine.py +++ b/lnst/Controller/Machine.py @@ -256,6 +256,19 @@ class Machine(object):
ordered_ifaces = self.get_ordered_interfaces() try: + #dump statistics + for iface in self._interfaces: + # Getting stats only from real interfaces + if isinstance(iface, UnusedInterface): + continue + stats = iface.link_stats() + logging.debug("%s:%s:%s: RX:\t bytes: %d\t packets: %d\t dropped: %d" % + (iface.get_netns(), iface.get_host(), iface.get_id(), + stats["rx_bytes"], stats["rx_packets"], stats["rx_dropped"])) + logging.debug("%s:%s:%s: TX:\t bytes: %d\t packets: %d\t dropped: %d" % + (iface.get_netns(), iface.get_host(), iface.get_id(), + stats["tx_bytes"], stats["tx_packets"], stats["tx_dropped"])) + self._rpc_call("kill_cmds") for netns in self._namespaces: self._rpc_call_to_netns(netns, "kill_cmds") @@ -656,6 +669,9 @@ class Interface(object): def get_netns(self): return self._netns
+ def get_host(self): + return self._machine.get_id() + def set_peer(self, peer): self._peer = peer