Before this commit, the Testlib.pktgen packet's destination IP address was
determined by the IP address of the destination port. This did not allow
the user to use pktgen's destination range feature, controlled by the
dst_min and dst_max options.
Make the TestLib.pktgen function more flexible by making it not set the
destination if dst_max and dst_min present.
Signed-off-by: Yotam Gigi <yotamg(a)mellanox.com>
---
recipes/switchdev/TestLib.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/recipes/switchdev/TestLib.py b/recipes/switchdev/TestLib.py
index d4c6749..cabce0b 100644
--- a/recipes/switchdev/TestLib.py
+++ b/recipes/switchdev/TestLib.py
@@ -286,7 +286,9 @@ class TestLib:
if "dst_mac" not in kwargs.keys():
pktgen_option.append("dst_mac %s" % if2.get_hwaddr())
pktgen_option.append("pkt_size %s" % pkt_size)
- pktgen_option.append("dst %s" % if2.get_ip(0))
+ if "dst" not in kwargs.keys() and "dst_min" not in
kwargs.keys() and \
+ "dst_max" not in kwargs.keys():
+ pktgen_option.append("dst %s" % if2.get_ip(0))
for arg, argval in kwargs.iteritems():
if arg == "vlan_id":
pktgen_option.insert(0, "{} {}".format(arg, argval))
--
2.8.4