fib: Compiile time option to use 8-8-8-8 stride tries for FIB rather
[vpp.git] / test / test_ip6.py
index 6eabf5a..dd29041 100644 (file)
@@ -735,9 +735,23 @@ class TestIPv6(TestIPv6ND):
                                 "RS sourced from link-local",
                                 dst_ip=ll)
 
+        #
+        # Source an RS from a link local address
+        # Ensure suppress also applies to solicited RS
+        #
+        self.pg0.ip6_ra_config(send_unicast=1, suppress=1)
+        ll = mk_ll_addr(self.pg0.remote_mac)
+        p = (Ether(dst=self.pg0.local_mac, src=self.pg0.remote_mac) /
+             IPv6(dst=self.pg0.local_ip6, src=ll) /
+             ICMPv6ND_RS())
+        pkts = [p]
+        self.send_and_assert_no_replies(self.pg0, pkts,
+                                        "Suppressed RS from link-local")
+
         #
         # Send the RS multicast
         #
+        self.pg0.ip6_ra_config(no=1, suppress=1)  # Reset suppress flag to zero
         self.pg0.ip6_ra_config(send_unicast=1)
         dmac = in6_getnsmac(inet_pton(AF_INET6, "ff02::2"))
         ll = mk_ll_addr(self.pg0.remote_mac)
@@ -757,7 +771,7 @@ class TestIPv6(TestIPv6ND):
         # If we happen to pick up the periodic RA at this point then so be it,
         # it's not an error.
         #
-        self.pg0.ip6_ra_config(send_unicast=1, suppress=1)
+        self.pg0.ip6_ra_config(send_unicast=1, suppress=0)
         p = (Ether(dst=dmac, src=self.pg0.remote_mac) /
              IPv6(dst="ff02::2", src="::") /
              ICMPv6ND_RS())
@@ -3459,5 +3473,129 @@ class TestIPFibSource(VppTestCase):
         self.assertFalse(find_route(self, "2001::1", 128))
 
 
+class TestIPxAF(VppTestCase):
+    """ IP cross AF """
+
+    @classmethod
+    def setUpClass(cls):
+        super(TestIPxAF, cls).setUpClass()
+
+    @classmethod
+    def tearDownClass(cls):
+        super(TestIPxAF, cls).tearDownClass()
+
+    def setUp(self):
+        super(TestIPxAF, self).setUp()
+
+        self.create_pg_interfaces(range(2))
+
+        for i in self.pg_interfaces:
+            i.admin_up()
+            i.config_ip6()
+            i.config_ip4()
+            i.resolve_arp()
+            i.resolve_ndp()
+
+    def tearDown(self):
+        super(TestIPxAF, self).tearDown()
+        for i in self.pg_interfaces:
+            i.admin_down()
+            i.unconfig_ip4()
+            i.unconfig_ip6()
+
+    def test_x_af(self):
+        """ Cross AF routing """
+
+        N_PKTS = 63
+        # a v4 route via a v6 attached next-hop
+        VppIpRoute(
+            self, "1.1.1.1", 32,
+            [VppRoutePath(self.pg1.remote_ip6,
+                          self.pg1.sw_if_index)]).add_vpp_config()
+
+        p = (Ether(src=self.pg0.remote_mac,
+                   dst=self.pg0.local_mac) /
+             IP(src=self.pg0.remote_ip4, dst="1.1.1.1") /
+             UDP(sport=1234, dport=1234) /
+             Raw(b'\xa5' * 100))
+        rxs = self.send_and_expect(self.pg0, p * N_PKTS, self.pg1)
+
+        for rx in rxs:
+            self.assertEqual(rx[IP].dst, "1.1.1.1")
+
+        # a v6 route via a v4 attached next-hop
+        VppIpRoute(
+            self, "2001::1", 128,
+            [VppRoutePath(self.pg1.remote_ip4,
+                          self.pg1.sw_if_index)]).add_vpp_config()
+
+        p = (Ether(src=self.pg0.remote_mac,
+                   dst=self.pg0.local_mac) /
+             IPv6(src=self.pg0.remote_ip6, dst="2001::1") /
+             UDP(sport=1234, dport=1234) /
+             Raw(b'\xa5' * 100))
+        rxs = self.send_and_expect(self.pg0, p * N_PKTS, self.pg1)
+
+        for rx in rxs:
+            self.assertEqual(rx[IPv6].dst, "2001::1")
+
+        # a recursive v4 route via a v6 next-hop (from above)
+        VppIpRoute(
+            self, "2.2.2.2", 32,
+            [VppRoutePath("2001::1",
+                          0xffffffff)]).add_vpp_config()
+
+        p = (Ether(src=self.pg0.remote_mac,
+                   dst=self.pg0.local_mac) /
+             IP(src=self.pg0.remote_ip4, dst="2.2.2.2") /
+             UDP(sport=1234, dport=1234) /
+             Raw(b'\xa5' * 100))
+        rxs = self.send_and_expect(self.pg0, p * N_PKTS, self.pg1)
+
+        # a recursive v4 route via a v6 next-hop
+        VppIpRoute(
+            self, "2.2.2.3", 32,
+            [VppRoutePath(self.pg1.remote_ip6,
+                          0xffffffff)]).add_vpp_config()
+
+        p = (Ether(src=self.pg0.remote_mac,
+                   dst=self.pg0.local_mac) /
+             IP(src=self.pg0.remote_ip4, dst="2.2.2.3") /
+             UDP(sport=1234, dport=1234) /
+             Raw(b'\xa5' * 100))
+        rxs = self.send_and_expect(self.pg0, p * N_PKTS, self.pg1)
+
+        # a recursive v6 route via a v4 next-hop
+        VppIpRoute(
+            self, "3001::1", 128,
+            [VppRoutePath(self.pg1.remote_ip4,
+                          0xffffffff)]).add_vpp_config()
+
+        p = (Ether(src=self.pg0.remote_mac,
+                   dst=self.pg0.local_mac) /
+             IPv6(src=self.pg0.remote_ip6, dst="3001::1") /
+             UDP(sport=1234, dport=1234) /
+             Raw(b'\xa5' * 100))
+        rxs = self.send_and_expect(self.pg0, p * N_PKTS, self.pg1)
+
+        for rx in rxs:
+            self.assertEqual(rx[IPv6].dst, "3001::1")
+
+        VppIpRoute(
+            self, "3001::2", 128,
+            [VppRoutePath("1.1.1.1",
+                          0xffffffff)]).add_vpp_config()
+
+        p = (Ether(src=self.pg0.remote_mac,
+                   dst=self.pg0.local_mac) /
+             IPv6(src=self.pg0.remote_ip6, dst="3001::2") /
+             UDP(sport=1234, dport=1234) /
+             Raw(b'\xa5' * 100))
+        rxs = self.send_and_expect(self.pg0, p * N_PKTS, self.pg1)
+
+        for rx in rxs:
+            self.assertEqual(rx[IPv6].dst, "3001::2")
+
+
 if __name__ == '__main__':
     unittest.main(testRunner=VppTestRunner)