diff --git a/dsatest/bench/interface.py b/dsatest/bench/interface.py index a112a84..02c783f 100644 --- a/dsatest/bench/interface.py +++ b/dsatest/bench/interface.py @@ -34,8 +34,9 @@ def del_address(self, address): def flush_addresses(self): self.machine.flush_addresses(self.name) - def ping(self, destination, count=None, deadline=None): - self.machine.ping(destination, from_if=self.name, count=count, deadline=deadline) + def ping(self, destination, count=None, deadline=None, size=None): + self.machine.ping(destination, from_if=self.name, count=count, + deadline=deadline, size=size) def arp_get(self, address): return self.machine.arp_get(address, self.name) diff --git a/dsatest/bench/machine.py b/dsatest/bench/machine.py index 1689172..d74c808 100644 --- a/dsatest/bench/machine.py +++ b/dsatest/bench/machine.py @@ -59,7 +59,7 @@ def del_bridge(self, bridge): self.bridges.remove(bridge) bridge.destroy() - def ping(self, destination, count=None, deadline=None, from_if=None): + def ping(self, destination, count=None, deadline=None, from_if=None, size=None): cmd = "ping " if count is not None: cmd += " -c {} ".format(count) @@ -67,6 +67,8 @@ def ping(self, destination, count=None, deadline=None, from_if=None): cmd += " -w {} ".format(deadline) if from_if is not None: cmd += " -I {} ".format(from_if) + if size is not None: + cmd += " -s {} ".format(size) cmd += " {}".format(destination) self.control.exec_and_check(cmd) diff --git a/dsatest/tests/port/ping.py b/dsatest/tests/port/ping.py index d503422..f21dc49 100644 --- a/dsatest/tests/port/ping.py +++ b/dsatest/tests/port/ping.py @@ -47,3 +47,23 @@ def test_port_ping_all(self): for i, link in enumerate(bench.links): addr = self.get_address(i, "target") link.host_if.ping(addr, count=1, deadline=10) + + def test_port_ping_sizes(self): + for i, link in enumerate(bench.links): + addr = get_address(i, "target") + """ + This is a very small size, but the HW should be rounding up + to a 64 bytes packet on the wire. Depending on the host, this + may fail. If it does, you may need to patch your host driver + """ + link.host_if.ping(addr, count=1, deadline=10, size=1) + """ + This would round up the total Ethernet size sans FCS to 60 bytes + and should be the minumum acceptable size + """ + link.host_if.ping(addr, count=1, deadline=10, size=32) + """ + This would result in a total Ethernet size sans FCS of 1500 bytes + and should be accepted by the switch + """ + link.host_if.ping(addr, count=1, deadline=10, size=1472)