summaryrefslogtreecommitdiffstats
path: root/test/test_ip4.py
diff options
context:
space:
mode:
authormu.duojiao <mu.duojiao@zte.com.cn>2018-10-11 14:27:30 +0800
committerMarco Varlese <marco.varlese@suse.de>2018-10-15 08:43:25 +0000
commit051984c6a132517de325576a0847cc4bdc9b2897 (patch)
treeee2ab09df730028f6dab535c6336d5261c7e41e1 /test/test_ip4.py
parent6a86ca9627e4064e9689b3890d180cb078ec6726 (diff)
VPP-1448: Fix error when recurse on down the trie.
Change-Id: Idfed8243643780d3f52dfe6e6ec621c440daa6ae Signed-off-by: mu.duojiao <mu.duojiao@zte.com.cn> (cherry picked from commit 59a829533c1345945dc1b6decc3afe29494e85cd)
Diffstat (limited to 'test/test_ip4.py')
-rw-r--r--test/test_ip4.py49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/test_ip4.py b/test/test_ip4.py
index 02a31be830a..e9ec71a2830 100644
--- a/test/test_ip4.py
+++ b/test/test_ip4.py
@@ -1505,5 +1505,54 @@ class TestIPDirectedBroadcast(VppTestCase):
self.pg1.unconfig_ip4()
+class TestIPLPM(VppTestCase):
+ """ IPv4 longest Prefix Match """
+
+ def setUp(self):
+ super(TestIPLPM, self).setUp()
+
+ self.create_pg_interfaces(range(4))
+
+ for i in self.pg_interfaces:
+ i.admin_up()
+ i.config_ip4()
+ i.resolve_arp()
+
+ def tearDown(self):
+ super(TestIPLPM, self).tearDown()
+ for i in self.pg_interfaces:
+ i.admin_down()
+ i.unconfig_ip4()
+
+ def test_ip_lpm(self):
+ """ IP longest Prefix Match """
+
+ s_24 = VppIpRoute(self, "10.1.2.0", 24,
+ [VppRoutePath(self.pg1.remote_ip4,
+ self.pg1.sw_if_index)])
+ s_24.add_vpp_config()
+ s_8 = VppIpRoute(self, "10.0.0.0", 8,
+ [VppRoutePath(self.pg2.remote_ip4,
+ self.pg2.sw_if_index)])
+ s_8.add_vpp_config()
+
+ p_8 = (Ether(src=self.pg0.remote_mac,
+ dst=self.pg0.local_mac) /
+ IP(src="1.1.1.1",
+ dst="10.1.1.1") /
+ UDP(sport=1234, dport=1234) /
+ Raw('\xa5' * 2000))
+ p_24 = (Ether(src=self.pg0.remote_mac,
+ dst=self.pg0.local_mac) /
+ IP(src="1.1.1.1",
+ dst="10.1.2.1") /
+ UDP(sport=1234, dport=1234) /
+ Raw('\xa5' * 2000))
+
+ self.logger.info(self.vapi.cli("sh ip fib mtrie"))
+ rx = self.send_and_expect(self.pg0, p_8 * 65, self.pg2)
+ rx = self.send_and_expect(self.pg0, p_24 * 65, self.pg1)
+
+
if __name__ == '__main__':
unittest.main(testRunner=VppTestRunner)