aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2017-07-31 02:56:03 -0700
committerNeale Ranns <nranns@cisco.com>2017-08-01 15:36:26 +0000
commit42e6b097e02b80779213aa5c14a5202ecd5913e5 (patch)
treefd038e9eb863f00ded670ec52127645cd09bac85
parent15ac81c16fba83033090299413a3a2dbb848a0f9 (diff)
Tests for recursive load-balancing with no choices.
Change-Id: I90bb3369576741d03628a818ffa63cc99d6e4c98 Signed-off-by: Neale Ranns <nranns@cisco.com>
-rw-r--r--test/test_ip4.py40
-rw-r--r--test/test_ip6.py33
2 files changed, 68 insertions, 5 deletions
diff --git a/test/test_ip4.py b/test/test_ip4.py
index 2f666f10..7a7098c3 100644
--- a/test/test_ip4.py
+++ b/test/test_ip4.py
@@ -796,6 +796,12 @@ class TestIPLoadBalance(VppTestCase):
rx = oo._get_capture(1)
self.assertNotEqual(0, len(rx))
+ def send_and_expect_one_itf(self, input, pkts, itf):
+ input.add_stream(pkts)
+ self.pg_enable_capture(self.pg_interfaces)
+ self.pg_start()
+ rx = itf.get_capture(len(pkts))
+
def test_ip_load_balance(self):
""" IP Load-Balancing """
@@ -874,11 +880,7 @@ class TestIPLoadBalance(VppTestCase):
self.send_and_expect_load_balancing(self.pg0, src_mpls_pkts,
[self.pg1, self.pg2])
- self.pg0.add_stream(port_ip_pkts)
- self.pg_enable_capture(self.pg_interfaces)
- self.pg_start()
-
- rx = self.pg2.get_capture(len(port_ip_pkts))
+ self.send_and_expect_one_itf(self.pg0, port_ip_pkts, self.pg2)
#
# change the flow hash config back to defaults
@@ -928,6 +930,34 @@ class TestIPLoadBalance(VppTestCase):
[self.pg1, self.pg2,
self.pg3, self.pg4])
+ #
+ # Recursive prefixes
+ # - testing that 2 stages of load-balancing, no choices
+ #
+ port_pkts = []
+
+ for ii in range(257):
+ port_pkts.append((Ether(src=self.pg0.remote_mac,
+ dst=self.pg0.local_mac) /
+ IP(dst="1.1.1.2", src="20.0.0.2") /
+ UDP(sport=1234, dport=1234 + ii) /
+ Raw('\xa5' * 100)))
+
+ route_10_0_0_3 = VppIpRoute(self, "10.0.0.3", 32,
+ [VppRoutePath(self.pg3.remote_ip4,
+ self.pg3.sw_if_index)])
+ route_10_0_0_3.add_vpp_config()
+
+ route_1_1_1_2 = VppIpRoute(self, "1.1.1.2", 32,
+ [VppRoutePath("10.0.0.3", 0xffffffff)])
+ route_1_1_1_2.add_vpp_config()
+
+ #
+ # inject the packet on pg0 - expect load-balancing across all 4 paths
+ #
+ self.vapi.cli("clear trace")
+ self.send_and_expect_one_itf(self.pg0, port_pkts, self.pg3)
+
class TestIPVlan0(VppTestCase):
""" IPv4 VLAN-0 """
diff --git a/test/test_ip6.py b/test/test_ip6.py
index 1432858f..593f6868 100644
--- a/test/test_ip6.py
+++ b/test/test_ip6.py
@@ -1469,6 +1469,39 @@ class TestIP6LoadBalance(VppTestCase):
[self.pg1, self.pg2,
self.pg3, self.pg4])
+ #
+ # Recursive prefixes
+ # - testing that 2 stages of load-balancing no choices
+ #
+ port_pkts = []
+
+ for ii in range(257):
+ port_pkts.append((Ether(src=self.pg0.remote_mac,
+ dst=self.pg0.local_mac) /
+ IPv6(dst="6000::1", src="6000:1::1") /
+ UDP(sport=1234, dport=1234 + ii) /
+ Raw('\xa5' * 100)))
+
+ route_5000_2 = VppIpRoute(self, "5000::2", 128,
+ [VppRoutePath(self.pg3.remote_ip6,
+ self.pg3.sw_if_index,
+ is_ip6=1)],
+ is_ip6=1)
+ route_5000_2.add_vpp_config()
+
+ route_6000_1 = VppIpRoute(self, "6000::1", 128,
+ [VppRoutePath("5000::2",
+ 0xffffffff,
+ is_ip6=1)],
+ is_ip6=1)
+ route_6000_1.add_vpp_config()
+
+ #
+ # inject the packet on pg0 - expect load-balancing across all 4 paths
+ #
+ self.vapi.cli("clear trace")
+ self.send_and_expect_one_itf(self.pg0, port_pkts, self.pg3)
+
if __name__ == '__main__':
unittest.main(testRunner=VppTestRunner)