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