summaryrefslogtreecommitdiffstats
path: root/test/test_ip6.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_ip6.py')
-rw-r--r--test/test_ip6.py133
1 files changed, 133 insertions, 0 deletions
diff --git a/test/test_ip6.py b/test/test_ip6.py
index 1e846a66c5a..87509f3f8e1 100644
--- a/test/test_ip6.py
+++ b/test/test_ip6.py
@@ -4087,5 +4087,138 @@ class TestIPv6Punt(VppTestCase):
self.assertEqual(str(punts[2].punt.nh), "::")
+class TestIP6InterfaceRx(VppTestCase):
+ """IPv6 Interface Receive"""
+
+ @classmethod
+ def setUpClass(cls):
+ super(TestIP6InterfaceRx, cls).setUpClass()
+
+ @classmethod
+ def tearDownClass(cls):
+ super(TestIP6InterfaceRx, cls).tearDownClass()
+
+ def setUp(self):
+ super(TestIP6InterfaceRx, self).setUp()
+
+ self.create_pg_interfaces(range(3))
+
+ table_id = 0
+
+ for i in self.pg_interfaces:
+ i.admin_up()
+
+ if table_id != 0:
+ table = VppIpTable(self, table_id, is_ip6=1)
+ table.add_vpp_config()
+
+ i.set_table_ip6(table_id)
+ i.config_ip6()
+ i.resolve_ndp()
+ table_id += 1
+
+ def tearDown(self):
+ for i in self.pg_interfaces:
+ i.unconfig_ip6()
+ i.admin_down()
+ i.set_table_ip6(0)
+
+ super(TestIP6InterfaceRx, self).tearDown()
+
+ def test_interface_rx(self):
+ """IPv6 Interface Receive"""
+
+ #
+ # add a route in the default table to receive ...
+ #
+ route_to_dst = VppIpRoute(
+ self,
+ "1::",
+ 122,
+ [
+ VppRoutePath(
+ "::",
+ self.pg1.sw_if_index,
+ type=FibPathType.FIB_PATH_TYPE_INTERFACE_RX,
+ )
+ ],
+ )
+ route_to_dst.add_vpp_config()
+
+ #
+ # packets to these destination are dropped, since they'll
+ # hit the respective default routes in table 1
+ #
+ p_dst = (
+ Ether(src=self.pg0.remote_mac, dst=self.pg0.local_mac)
+ / IPv6(src="5::5", dst="1::1")
+ / inet6.TCP(sport=1234, dport=1234)
+ / Raw(b"\xa5" * 100)
+ )
+ pkts_dst = p_dst * 10
+
+ self.send_and_assert_no_replies(self.pg0, pkts_dst, "IP in table 1")
+
+ #
+ # add a route in the dst table to forward via pg1
+ #
+ route_in_dst = VppIpRoute(
+ self,
+ "1::1",
+ 128,
+ [VppRoutePath(self.pg1.remote_ip6, self.pg1.sw_if_index)],
+ table_id=1,
+ )
+ route_in_dst.add_vpp_config()
+
+ self.send_and_expect(self.pg0, pkts_dst, self.pg1)
+
+ #
+ # add a route in the default table to receive ...
+ #
+ route_to_dst = VppIpRoute(
+ self,
+ "1::",
+ 122,
+ [
+ VppRoutePath(
+ "::",
+ self.pg2.sw_if_index,
+ type=FibPathType.FIB_PATH_TYPE_INTERFACE_RX,
+ )
+ ],
+ table_id=1,
+ )
+ route_to_dst.add_vpp_config()
+
+ #
+ # packets to these destination are dropped, since they'll
+ # hit the respective default routes in table 2
+ #
+ p_dst = (
+ Ether(src=self.pg0.remote_mac, dst=self.pg0.local_mac)
+ / IPv6(src="6::6", dst="1::2")
+ / inet6.TCP(sport=1234, dport=1234)
+ / Raw(b"\xa5" * 100)
+ )
+ pkts_dst = p_dst * 10
+
+ self.send_and_assert_no_replies(self.pg0, pkts_dst, "IP in table 2")
+
+ #
+ # add a route in the table 2 to forward via pg2
+ #
+ route_in_dst = VppIpRoute(
+ self,
+ "1::2",
+ 128,
+ [VppRoutePath(self.pg2.remote_ip6, self.pg2.sw_if_index)],
+ table_id=2,
+ )
+ route_in_dst.add_vpp_config()
+
+ self.send_and_expect(self.pg0, pkts_dst, self.pg2)
+
+
if __name__ == "__main__":
unittest.main(testRunner=VppTestRunner)