Ole Troan | 46c1c11 | 2018-03-14 20:39:40 +0100 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | """ 6RD RFC5969 functional tests """ |
Ole Troan | 6ee4051 | 2018-02-12 18:14:39 +0100 | [diff] [blame] | 3 | |
| 4 | import unittest |
Ole Troan | 46c1c11 | 2018-03-14 20:39:40 +0100 | [diff] [blame] | 5 | from scapy.layers.inet import IP, UDP, Ether |
Ole Troan | 6ee4051 | 2018-02-12 18:14:39 +0100 | [diff] [blame] | 6 | from scapy.layers.inet6 import IPv6 |
Ole Troan | 6ee4051 | 2018-02-12 18:14:39 +0100 | [diff] [blame] | 7 | from scapy.packet import Raw |
Ole Troan | 46c1c11 | 2018-03-14 20:39:40 +0100 | [diff] [blame] | 8 | from framework import VppTestCase, VppTestRunner |
Neale Ranns | 6150211 | 2018-08-22 00:21:14 -0700 | [diff] [blame] | 9 | from vpp_ip_route import VppIpRoute, VppRoutePath, DpoProto, VppIpTable |
Ole Troan | 46c1c11 | 2018-03-14 20:39:40 +0100 | [diff] [blame] | 10 | from socket import AF_INET, AF_INET6, inet_pton |
Ole Troan | 6ee4051 | 2018-02-12 18:14:39 +0100 | [diff] [blame] | 11 | |
| 12 | """ Test6rd is a subclass of VPPTestCase classes. |
| 13 | |
| 14 | 6RD tests. |
| 15 | |
| 16 | """ |
| 17 | |
| 18 | |
| 19 | class Test6RD(VppTestCase): |
| 20 | """ 6RD Test Case """ |
| 21 | |
| 22 | @classmethod |
| 23 | def setUpClass(cls): |
| 24 | super(Test6RD, cls).setUpClass() |
Neale Ranns | 6150211 | 2018-08-22 00:21:14 -0700 | [diff] [blame] | 25 | cls.create_pg_interfaces(range(4)) |
Ole Troan | 46c1c11 | 2018-03-14 20:39:40 +0100 | [diff] [blame] | 26 | cls.interfaces = list(cls.pg_interfaces) |
Ole Troan | 6ee4051 | 2018-02-12 18:14:39 +0100 | [diff] [blame] | 27 | |
Neale Ranns | 6150211 | 2018-08-22 00:21:14 -0700 | [diff] [blame] | 28 | def setUp(self): |
| 29 | super(Test6RD, self).setUp() |
| 30 | t4 = VppIpTable(self, 10) |
| 31 | t6 = VppIpTable(self, 20, True) |
| 32 | |
| 33 | t4.add_vpp_config() |
| 34 | t6.add_vpp_config() |
| 35 | |
| 36 | for n in range(4): |
| 37 | i = self.pg_interfaces[n] |
Ole Troan | 46c1c11 | 2018-03-14 20:39:40 +0100 | [diff] [blame] | 38 | i.admin_up() |
Neale Ranns | 6150211 | 2018-08-22 00:21:14 -0700 | [diff] [blame] | 39 | if (n > 1): |
| 40 | i.set_table_ip4(10) |
| 41 | i.set_table_ip6(20) |
Ole Troan | 46c1c11 | 2018-03-14 20:39:40 +0100 | [diff] [blame] | 42 | i.config_ip4() |
| 43 | i.config_ip6() |
| 44 | i.disable_ipv6_ra() |
| 45 | i.resolve_arp() |
| 46 | i.resolve_ndp() |
Ole Troan | 6ee4051 | 2018-02-12 18:14:39 +0100 | [diff] [blame] | 47 | |
| 48 | def tearDown(self): |
Neale Ranns | 6150211 | 2018-08-22 00:21:14 -0700 | [diff] [blame] | 49 | for i in self.pg_interfaces: |
| 50 | i.unconfig_ip4() |
| 51 | i.unconfig_ip6() |
| 52 | i.set_table_ip4(0) |
| 53 | i.set_table_ip6(0) |
Ole Troan | 6ee4051 | 2018-02-12 18:14:39 +0100 | [diff] [blame] | 54 | super(Test6RD, self).tearDown() |
Ole Troan | 6ee4051 | 2018-02-12 18:14:39 +0100 | [diff] [blame] | 55 | |
| 56 | def validate_6in4(self, rx, expected): |
| 57 | if IP not in rx: |
| 58 | self.fail() |
| 59 | if IPv6 not in rx: |
| 60 | self.fail() |
| 61 | |
| 62 | self.assertEqual(rx[IP].src, expected[IP].src) |
| 63 | self.assertEqual(rx[IP].dst, expected[IP].dst) |
| 64 | self.assertEqual(rx[IP].proto, expected[IP].proto) |
| 65 | self.assertEqual(rx[IPv6].src, expected[IPv6].src) |
| 66 | self.assertEqual(rx[IPv6].dst, expected[IPv6].dst) |
| 67 | |
| 68 | def validate_4in6(self, rx, expected): |
| 69 | if IPv6 not in rx: |
| 70 | self.fail() |
| 71 | if IP in rx: |
| 72 | self.fail() |
| 73 | |
| 74 | self.assertTrue(rx[IPv6].src == expected[IPv6].src) |
| 75 | self.assertTrue(rx[IPv6].dst == expected[IPv6].dst) |
| 76 | self.assertTrue(rx[IPv6].nh == expected[IPv6].nh) |
| 77 | |
| 78 | def payload(self, len): |
| 79 | return 'x' * len |
| 80 | |
| 81 | def test_6rd_ip6_to_ip4(self): |
| 82 | """ ip6 -> ip4 (encap) 6rd test """ |
| 83 | p_ether = Ether(src=self.pg0.remote_mac, dst=self.pg0.local_mac) |
| 84 | p_ip6 = IPv6(src="1::1", dst="2002:AC10:0202::1", nh='UDP') |
| 85 | |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 86 | rv = self.vapi.ipip_6rd_add_tunnel( |
Ole Troan | 46c1c11 | 2018-03-14 20:39:40 +0100 | [diff] [blame] | 87 | 0, inet_pton(AF_INET6, '2002::'), 16, |
Neale Ranns | 6150211 | 2018-08-22 00:21:14 -0700 | [diff] [blame] | 88 | 0, inet_pton(AF_INET, '0.0.0.0'), 0, |
Ole Troan | 46c1c11 | 2018-03-14 20:39:40 +0100 | [diff] [blame] | 89 | self.pg0.local_ip4n, True) |
Ole Troan | 6ee4051 | 2018-02-12 18:14:39 +0100 | [diff] [blame] | 90 | self.tunnel_index = rv.sw_if_index |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 91 | |
Ole Troan | 6ee4051 | 2018-02-12 18:14:39 +0100 | [diff] [blame] | 92 | self.vapi.cli("show ip6 fib") |
| 93 | p_payload = UDP(sport=1234, dport=1234) |
| 94 | p = (p_ether / p_ip6 / p_payload) |
| 95 | |
| 96 | p_reply = (IP(src=self.pg0.local_ip4, dst=self.pg1.remote_ip4, |
| 97 | proto='ipv6') / p_ip6) |
| 98 | |
| 99 | rx = self.send_and_expect(self.pg0, p*10, self.pg1) |
| 100 | for p in rx: |
| 101 | self.validate_6in4(p, p_reply) |
| 102 | |
| 103 | # MTU tests (default is 1480) |
| 104 | plen = 1481 - 40 - 8 |
| 105 | p_ip6 = IPv6(src="1::1", dst="2002:AC10:0202::1") |
| 106 | p_payload = UDP(sport=1234, dport=1234) / Raw(self.payload(plen)) |
| 107 | p = (p_ether / p_ip6 / p_payload) |
| 108 | |
| 109 | p_reply = (IP(src=self.pg0.local_ip4, dst=self.pg1.remote_ip4, |
| 110 | proto='ipv6') / p_ip6) |
| 111 | |
| 112 | rx = self.send_and_assert_no_replies(self.pg0, p*10) |
Neale Ranns | 6150211 | 2018-08-22 00:21:14 -0700 | [diff] [blame] | 113 | self.vapi.ipip_6rd_del_tunnel(self.tunnel_index) |
| 114 | |
| 115 | def test_6rd_ip6_to_ip4_vrf(self): |
| 116 | """ ip6 -> ip4 (encap) 6rd VRF test """ |
| 117 | p_ether = Ether(src=self.pg2.remote_mac, dst=self.pg2.local_mac) |
| 118 | p_ip6 = IPv6(src="1::1", dst="2002:AC10:0402::1", nh='UDP') |
| 119 | |
| 120 | rv = self.vapi.ipip_6rd_add_tunnel( |
| 121 | 20, inet_pton(AF_INET6, '2002::'), 16, |
| 122 | 10, inet_pton(AF_INET, '0.0.0.0'), 0, |
| 123 | self.pg2.local_ip4n, True) |
| 124 | self.tunnel_index = rv.sw_if_index |
| 125 | |
| 126 | self.vapi.cli("show ip6 fib") |
| 127 | p_payload = UDP(sport=1234, dport=1234) |
| 128 | p = (p_ether / p_ip6 / p_payload) |
| 129 | |
| 130 | p_reply = (IP(src=self.pg2.local_ip4, dst=self.pg3.remote_ip4, |
| 131 | proto='ipv6') / p_ip6) |
| 132 | |
| 133 | rx = self.send_and_expect(self.pg2, p*10, self.pg3) |
| 134 | for p in rx: |
| 135 | self.validate_6in4(p, p_reply) |
| 136 | |
| 137 | # MTU tests (default is 1480) |
| 138 | plen = 1481 - 40 - 8 |
| 139 | p_ip6 = IPv6(src="1::1", dst="2002:AC10:0402::1") |
| 140 | p_payload = UDP(sport=1234, dport=1234) / Raw(self.payload(plen)) |
| 141 | p = (p_ether / p_ip6 / p_payload) |
| 142 | |
| 143 | p_reply = (IP(src=self.pg2.local_ip4, dst=self.pg3.remote_ip4, |
| 144 | proto='ipv6') / p_ip6) |
| 145 | |
| 146 | rx = self.send_and_assert_no_replies(self.pg0, p*10) |
| 147 | self.vapi.ipip_6rd_del_tunnel(self.tunnel_index) |
Ole Troan | 6ee4051 | 2018-02-12 18:14:39 +0100 | [diff] [blame] | 148 | |
| 149 | def test_6rd_ip4_to_ip6(self): |
| 150 | """ ip4 -> ip6 (decap) 6rd test """ |
| 151 | |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 152 | rv = self.vapi.ipip_6rd_add_tunnel( |
Neale Ranns | 6150211 | 2018-08-22 00:21:14 -0700 | [diff] [blame] | 153 | 0, inet_pton(AF_INET6, '2002::'), 16, |
| 154 | 0, inet_pton(AF_INET, '0.0.0.0'), 0, |
| 155 | self.pg0.local_ip4n, True) |
Ole Troan | 6ee4051 | 2018-02-12 18:14:39 +0100 | [diff] [blame] | 156 | self.tunnel_index = rv.sw_if_index |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 157 | rv = self.vapi.ipip_6rd_del_tunnel(rv.sw_if_index) |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 158 | rv = self.vapi.ipip_6rd_add_tunnel( |
Neale Ranns | 6150211 | 2018-08-22 00:21:14 -0700 | [diff] [blame] | 159 | 0, inet_pton(AF_INET6, '2002::'), 16, |
| 160 | 0, inet_pton(AF_INET, '0.0.0.0'), 0, |
| 161 | self.pg0.local_ip4n, True) |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 162 | self.tunnel_index = rv.sw_if_index |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 163 | |
Ole Troan | 6ee4051 | 2018-02-12 18:14:39 +0100 | [diff] [blame] | 164 | p_ip6 = (IPv6(src="2002:AC10:0202::1", dst=self.pg1.remote_ip6) / |
| 165 | UDP(sport=1234, dport=1234)) |
| 166 | |
| 167 | p = (Ether(src=self.pg0.remote_mac, |
| 168 | dst=self.pg0.local_mac) / |
| 169 | IP(src=self.pg1.remote_ip4, dst=self.pg0.local_ip4) / |
| 170 | p_ip6) |
| 171 | |
| 172 | p_reply = p_ip6 |
| 173 | |
| 174 | rx = self.send_and_expect(self.pg0, p*10, self.pg1) |
| 175 | for p in rx: |
| 176 | self.validate_4in6(p, p_reply) |
Neale Ranns | 6150211 | 2018-08-22 00:21:14 -0700 | [diff] [blame] | 177 | self.vapi.ipip_6rd_del_tunnel(self.tunnel_index) |
| 178 | |
| 179 | def test_6rd_ip4_to_ip6_vrf(self): |
| 180 | """ ip4 -> ip6 (decap) 6rd VRF test """ |
| 181 | |
| 182 | rv = self.vapi.ipip_6rd_add_tunnel( |
| 183 | 20, inet_pton(AF_INET6, '2002::'), 16, |
| 184 | 10, inet_pton(AF_INET, '0.0.0.0'), 0, |
| 185 | self.pg2.local_ip4n, True) |
| 186 | self.tunnel_index = rv.sw_if_index |
| 187 | rv = self.vapi.ipip_6rd_del_tunnel(rv.sw_if_index) |
| 188 | rv = self.vapi.ipip_6rd_add_tunnel( |
| 189 | 20, inet_pton(AF_INET6, '2002::'), 16, |
| 190 | 10, inet_pton(AF_INET, '0.0.0.0'), 0, |
| 191 | self.pg2.local_ip4n, True) |
| 192 | self.tunnel_index = rv.sw_if_index |
| 193 | self.vapi.sw_interface_set_table(self.tunnel_index, 1, 20) |
| 194 | |
| 195 | p_ip6 = (IPv6(src="2002:AC10:0402::1", dst=self.pg3.remote_ip6) / |
| 196 | UDP(sport=1234, dport=1234)) |
| 197 | |
| 198 | p = (Ether(src=self.pg2.remote_mac, |
| 199 | dst=self.pg2.local_mac) / |
| 200 | IP(src=self.pg3.remote_ip4, dst=self.pg2.local_ip4) / |
| 201 | p_ip6) |
| 202 | |
| 203 | p_reply = p_ip6 |
| 204 | |
| 205 | rx = self.send_and_expect(self.pg2, p*10, self.pg3) |
| 206 | for p in rx: |
| 207 | self.validate_4in6(p, p_reply) |
| 208 | self.vapi.sw_interface_set_table(self.tunnel_index, 1, 0) |
| 209 | self.vapi.ipip_6rd_del_tunnel(self.tunnel_index) |
Ole Troan | 6ee4051 | 2018-02-12 18:14:39 +0100 | [diff] [blame] | 210 | |
| 211 | def test_6rd_ip4_to_ip6_multiple(self): |
| 212 | """ ip4 -> ip6 (decap) 6rd test """ |
| 213 | |
| 214 | self.tunnel_index = [] |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 215 | rv = self.vapi.ipip_6rd_add_tunnel( |
Neale Ranns | 6150211 | 2018-08-22 00:21:14 -0700 | [diff] [blame] | 216 | 0, inet_pton(AF_INET6, '2002::'), 16, |
| 217 | 0, inet_pton(AF_INET, '0.0.0.0'), 0, |
| 218 | self.pg0.local_ip4n, True) |
Ole Troan | 6ee4051 | 2018-02-12 18:14:39 +0100 | [diff] [blame] | 219 | self.tunnel_index.append(rv.sw_if_index) |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 220 | |
| 221 | rv = self.vapi.ipip_6rd_add_tunnel( |
Neale Ranns | 6150211 | 2018-08-22 00:21:14 -0700 | [diff] [blame] | 222 | 0, inet_pton(AF_INET6, '2003::'), 16, |
| 223 | 0, inet_pton(AF_INET, '0.0.0.0'), 0, |
| 224 | self.pg1.local_ip4n, True) |
Ole Troan | 6ee4051 | 2018-02-12 18:14:39 +0100 | [diff] [blame] | 225 | self.tunnel_index.append(rv.sw_if_index) |
| 226 | |
| 227 | self.vapi.cli("show ip6 fib") |
| 228 | p_ether = Ether(src=self.pg0.remote_mac, dst=self.pg0.local_mac) |
| 229 | p_ip4 = IP(src=self.pg1.remote_ip4, dst=self.pg0.local_ip4) |
| 230 | p_ip6_1 = (IPv6(src="2002:AC10:0202::1", dst=self.pg1.remote_ip6) / |
| 231 | UDP(sport=1234, dport=1234)) |
| 232 | p_ip6_2 = (IPv6(src="2003:AC10:0202::1", dst=self.pg1.remote_ip6) / |
| 233 | UDP(sport=1234, dport=1234)) |
| 234 | |
| 235 | p = (p_ether / p_ip4 / p_ip6_1) |
| 236 | rx = self.send_and_expect(self.pg0, p*10, self.pg1) |
| 237 | for p in rx: |
| 238 | self.validate_4in6(p, p_ip6_1) |
| 239 | |
| 240 | p = (p_ether / p_ip4 / p_ip6_2) |
| 241 | rx = self.send_and_expect(self.pg0, p*10, self.pg1) |
| 242 | for p in rx: |
| 243 | self.validate_4in6(p, p_ip6_2) |
Neale Ranns | 6150211 | 2018-08-22 00:21:14 -0700 | [diff] [blame] | 244 | for i in self.tunnel_index: |
| 245 | self.vapi.ipip_6rd_del_tunnel(i) |
Ole Troan | 6ee4051 | 2018-02-12 18:14:39 +0100 | [diff] [blame] | 246 | |
| 247 | def test_6rd_ip4_to_ip6_suffix(self): |
| 248 | """ ip4 -> ip6 (decap) 6rd test """ |
| 249 | |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 250 | rv = self.vapi.ipip_6rd_add_tunnel( |
Ole Troan | 46c1c11 | 2018-03-14 20:39:40 +0100 | [diff] [blame] | 251 | 0, inet_pton(AF_INET6, '2002::'), 16, |
Neale Ranns | 6150211 | 2018-08-22 00:21:14 -0700 | [diff] [blame] | 252 | 0, inet_pton(AF_INET, '172.0.0.0'), 8, |
Ole Troan | 46c1c11 | 2018-03-14 20:39:40 +0100 | [diff] [blame] | 253 | self.pg0.local_ip4n, True) |
Ole Troan | 6ee4051 | 2018-02-12 18:14:39 +0100 | [diff] [blame] | 254 | |
| 255 | self.tunnel_index = rv.sw_if_index |
| 256 | |
| 257 | self.vapi.cli("show ip6 fib") |
| 258 | p_ether = Ether(src=self.pg0.remote_mac, dst=self.pg0.local_mac) |
| 259 | p_ip4 = IP(src=self.pg1.remote_ip4, dst=self.pg0.local_ip4) |
| 260 | p_ip6 = (IPv6(src="2002:1002:0200::1", dst=self.pg1.remote_ip6) / |
| 261 | UDP(sport=1234, dport=1234)) |
| 262 | |
| 263 | p = (p_ether / p_ip4 / p_ip6) |
| 264 | rx = self.send_and_expect(self.pg0, p*10, self.pg1) |
| 265 | for p in rx: |
| 266 | self.validate_4in6(p, p_ip6) |
Neale Ranns | 6150211 | 2018-08-22 00:21:14 -0700 | [diff] [blame] | 267 | self.vapi.ipip_6rd_del_tunnel(self.tunnel_index) |
Ole Troan | 6ee4051 | 2018-02-12 18:14:39 +0100 | [diff] [blame] | 268 | |
| 269 | def test_6rd_ip4_to_ip6_sec_check(self): |
| 270 | """ ip4 -> ip6 (decap) security check 6rd test """ |
| 271 | |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 272 | rv = self.vapi.ipip_6rd_add_tunnel( |
Neale Ranns | 6150211 | 2018-08-22 00:21:14 -0700 | [diff] [blame] | 273 | 0, inet_pton(AF_INET6, '2002::'), 16, |
| 274 | 0, inet_pton(AF_INET, '0.0.0.0'), 0, |
| 275 | self.pg0.local_ip4n, True) |
Ole Troan | 6ee4051 | 2018-02-12 18:14:39 +0100 | [diff] [blame] | 276 | self.tunnel_index = rv.sw_if_index |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 277 | |
Ole Troan | 6ee4051 | 2018-02-12 18:14:39 +0100 | [diff] [blame] | 278 | self.vapi.cli("show ip6 fib") |
| 279 | p_ip6 = (IPv6(src="2002:AC10:0202::1", dst=self.pg1.remote_ip6) / |
| 280 | UDP(sport=1234, dport=1234)) |
| 281 | p_ip6_fail = (IPv6(src="2002:DEAD:0202::1", dst=self.pg1.remote_ip6) / |
| 282 | UDP(sport=1234, dport=1234)) |
| 283 | |
| 284 | p = (Ether(src=self.pg0.remote_mac, |
| 285 | dst=self.pg0.local_mac) / |
| 286 | IP(src=self.pg1.remote_ip4, dst=self.pg0.local_ip4) / |
| 287 | p_ip6) |
| 288 | |
| 289 | p_reply = p_ip6 |
| 290 | |
| 291 | rx = self.send_and_expect(self.pg0, p*10, self.pg1) |
| 292 | for p in rx: |
| 293 | self.validate_4in6(p, p_reply) |
| 294 | |
| 295 | p = (Ether(src=self.pg0.remote_mac, |
| 296 | dst=self.pg0.local_mac) / |
| 297 | IP(src=self.pg1.remote_ip4, dst=self.pg0.local_ip4) / |
| 298 | p_ip6_fail) |
| 299 | rx = self.send_and_assert_no_replies(self.pg0, p*10) |
Neale Ranns | 6150211 | 2018-08-22 00:21:14 -0700 | [diff] [blame] | 300 | self.vapi.ipip_6rd_del_tunnel(self.tunnel_index) |
Ole Troan | 6ee4051 | 2018-02-12 18:14:39 +0100 | [diff] [blame] | 301 | |
| 302 | def test_6rd_bgp_tunnel(self): |
| 303 | """ 6rd BGP tunnel """ |
| 304 | |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 305 | rv = self.vapi.ipip_6rd_add_tunnel( |
Neale Ranns | 6150211 | 2018-08-22 00:21:14 -0700 | [diff] [blame] | 306 | 0, inet_pton(AF_INET6, '2002::'), 16, |
| 307 | 0, inet_pton(AF_INET, '0.0.0.0'), 0, |
| 308 | self.pg0.local_ip4n, False) |
Ole Troan | 6ee4051 | 2018-02-12 18:14:39 +0100 | [diff] [blame] | 309 | self.tunnel_index = rv.sw_if_index |
| 310 | |
| 311 | default_route = VppIpRoute( |
| 312 | self, "DEAD::", 16, [VppRoutePath("2002:0808:0808::", |
| 313 | self.tunnel_index, |
| 314 | proto=DpoProto.DPO_PROTO_IP6)], |
| 315 | is_ip6=1) |
| 316 | default_route.add_vpp_config() |
| 317 | |
| 318 | ip4_route = VppIpRoute(self, "8.0.0.0", 8, |
| 319 | [VppRoutePath(self.pg1.remote_ip4, 0xFFFFFFFF)]) |
| 320 | ip4_route.add_vpp_config() |
| 321 | |
| 322 | # Via recursive route 6 -> 4 |
| 323 | p = (Ether(src=self.pg0.remote_mac, |
| 324 | dst=self.pg0.local_mac) / |
| 325 | IPv6(src="1::1", dst="DEAD:BEEF::1") / |
| 326 | UDP(sport=1234, dport=1234)) |
| 327 | |
| 328 | p_reply = (IP(src=self.pg0.local_ip4, dst="8.8.8.8", |
| 329 | proto='ipv6') / |
| 330 | IPv6(src='1::1', dst='DEAD:BEEF::1', nh='UDP')) |
| 331 | |
| 332 | rx = self.send_and_expect(self.pg0, p*10, self.pg1) |
| 333 | for p in rx: |
| 334 | self.validate_6in4(p, p_reply) |
| 335 | |
| 336 | # Via recursive route 4 -> 6 (Security check must be disabled) |
| 337 | p_ip6 = (IPv6(src="DEAD:BEEF::1", dst=self.pg1.remote_ip6) / |
| 338 | UDP(sport=1234, dport=1234)) |
| 339 | p = (Ether(src=self.pg0.remote_mac, |
| 340 | dst=self.pg0.local_mac) / |
| 341 | IP(src="8.8.8.8", dst=self.pg0.local_ip4) / |
| 342 | p_ip6) |
| 343 | |
| 344 | p_reply = p_ip6 |
| 345 | |
| 346 | rx = self.send_and_expect(self.pg0, p*10, self.pg1) |
| 347 | for p in rx: |
| 348 | self.validate_4in6(p, p_reply) |
Neale Ranns | 6150211 | 2018-08-22 00:21:14 -0700 | [diff] [blame] | 349 | ip4_route.remove_vpp_config() |
| 350 | default_route.remove_vpp_config() |
| 351 | self.vapi.ipip_6rd_del_tunnel(self.tunnel_index) |
Ole Troan | 6ee4051 | 2018-02-12 18:14:39 +0100 | [diff] [blame] | 352 | |
| 353 | |
| 354 | if __name__ == '__main__': |
| 355 | unittest.main(testRunner=VppTestRunner) |