blob: 8b2851baea2339afea8b1bb5d187063a3c4daf47 [file] [log] [blame]
Renato Botelho do Coutoead1e532019-10-31 13:31:07 -05001#!/usr/bin/env python3
Neale Ranns177bbdc2016-11-15 09:46:51 +00002
3import unittest
Neale Ranns177bbdc2016-11-15 09:46:51 +00004
Paul Vinciguerraa7427ec2019-03-10 10:04:23 -07005import scapy.compat
Neale Ranns177bbdc2016-11-15 09:46:51 +00006from scapy.packet import Raw
Klement Sekera9225dee2016-12-12 08:36:58 +01007from scapy.layers.l2 import Ether, Dot1Q, GRE
Neale Ranns177bbdc2016-11-15 09:46:51 +00008from scapy.layers.inet import IP, UDP
Klement Sekera65cc8c02016-12-18 15:49:54 +01009from scapy.layers.inet6 import IPv6
Neale Ranns177bbdc2016-11-15 09:46:51 +000010from scapy.volatile import RandMAC, RandIP
11
Dave Wallace8800f732023-08-31 00:47:44 -040012from framework import VppTestCase
13from asfframework import VppTestRunner, tag_fixme_vpp_workers
Paul Vinciguerra95c0ca42019-03-28 13:07:00 -070014from vpp_sub_interface import L2_VTR_OP, VppDot1QSubint
Neale Ranns5a8844b2019-04-16 07:15:35 +000015from vpp_gre_interface import VppGreInterface
Neale Ranns28287212019-12-16 00:53:11 +000016from vpp_teib import VppTeib
Paul Vinciguerraa279d9c2019-02-28 09:00:09 -080017from vpp_ip import DpoProto
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020018from vpp_ip_route import (
19 VppIpRoute,
20 VppRoutePath,
21 VppIpTable,
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020022 VppMplsLabel,
23)
Neale Ranns533bf082020-10-08 08:10:34 +000024from vpp_mpls_tunnel_interface import VppMPLSTunnelInterface
Klement Sekera9225dee2016-12-12 08:36:58 +010025from util import ppp, ppc
Neale Ranns5a8844b2019-04-16 07:15:35 +000026from vpp_papi import VppEnum
Dmitry Valter34fa0ce2024-03-11 10:38:46 +000027from config import config
John Loa43ccae2018-02-13 17:15:23 -050028
29
Andrew Yourtchenko8dc0d482021-01-29 13:17:19 +000030@tag_fixme_vpp_workers
Dmitry Valter34fa0ce2024-03-11 10:38:46 +000031@unittest.skipIf("gre" in config.excluded_plugins, "Exclude GRE plugin tests")
Jakub Grajciarf03beca2019-05-24 08:25:03 +020032class TestGREInputNodes(VppTestCase):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020033 """GRE Input Nodes Test Case"""
Jakub Grajciarf03beca2019-05-24 08:25:03 +020034
35 def setUp(self):
36 super(TestGREInputNodes, self).setUp()
37
38 # create 3 pg interfaces - set one in a non-default table.
39 self.create_pg_interfaces(range(1))
40
41 for i in self.pg_interfaces:
42 i.admin_up()
43 i.config_ip4()
44
45 def tearDown(self):
46 for i in self.pg_interfaces:
47 i.unconfig_ip4()
48 i.admin_down()
49 super(TestGREInputNodes, self).tearDown()
50
51 def test_gre_input_node(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020052 """GRE gre input nodes not registerd unless configured"""
53 pkt = (
54 Ether(dst=self.pg0.local_mac, src=self.pg0.remote_mac)
55 / IP(src=self.pg0.remote_ip4, dst=self.pg0.local_ip4)
56 / GRE()
57 )
Jakub Grajciarf03beca2019-05-24 08:25:03 +020058
59 self.pg0.add_stream(pkt)
60 self.pg_start()
61 # no tunnel created, gre-input not registered
Neale Rannse22a7042022-08-09 03:03:29 +000062 err = self.statistics.get_counter("/err/ip4-local/unknown_protocol")[0]
Jakub Grajciarf03beca2019-05-24 08:25:03 +020063 self.assertEqual(err, 1)
64 err_count = err
65
66 # create gre tunnel
67 gre_if = VppGreInterface(self, self.pg0.local_ip4, "1.1.1.2")
68 gre_if.add_vpp_config()
69
70 self.pg0.add_stream(pkt)
71 self.pg_start()
72 # tunnel created, gre-input registered
Neale Rannse22a7042022-08-09 03:03:29 +000073 err = self.statistics.get_counter("/err/ip4-local/unknown_protocol")[0]
Jakub Grajciarf03beca2019-05-24 08:25:03 +020074 # expect no new errors
75 self.assertEqual(err, err_count)
76
77
Dmitry Valter34fa0ce2024-03-11 10:38:46 +000078@unittest.skipIf("gre" in config.excluded_plugins, "Exclude GRE plugin tests")
Neale Ranns177bbdc2016-11-15 09:46:51 +000079class TestGRE(VppTestCase):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020080 """GRE Test Case"""
Neale Ranns177bbdc2016-11-15 09:46:51 +000081
82 @classmethod
83 def setUpClass(cls):
84 super(TestGRE, cls).setUpClass()
85
Paul Vinciguerra7f9b7f92019-03-12 19:23:27 -070086 @classmethod
87 def tearDownClass(cls):
88 super(TestGRE, cls).tearDownClass()
89
Neale Ranns177bbdc2016-11-15 09:46:51 +000090 def setUp(self):
91 super(TestGRE, self).setUp()
92
Ciara Loftus7eac9162016-09-30 15:47:03 +010093 # create 3 pg interfaces - set one in a non-default table.
Neale Ranns5f8f6172019-04-18 10:23:56 +000094 self.create_pg_interfaces(range(5))
Neale Ranns15002542017-09-10 04:39:11 -070095
96 self.tbl = VppIpTable(self, 1)
97 self.tbl.add_vpp_config()
Neale Ranns177bbdc2016-11-15 09:46:51 +000098 self.pg1.set_table_ip4(1)
Ciara Loftus7eac9162016-09-30 15:47:03 +010099
Neale Ranns177bbdc2016-11-15 09:46:51 +0000100 for i in self.pg_interfaces:
101 i.admin_up()
Ciara Loftus7eac9162016-09-30 15:47:03 +0100102
103 self.pg0.config_ip4()
104 self.pg0.resolve_arp()
105 self.pg1.config_ip4()
106 self.pg1.resolve_arp()
107 self.pg2.config_ip6()
108 self.pg2.resolve_ndp()
Neale Ranns5f8f6172019-04-18 10:23:56 +0000109 self.pg3.config_ip4()
110 self.pg3.resolve_arp()
111 self.pg4.config_ip4()
112 self.pg4.resolve_arp()
Neale Ranns177bbdc2016-11-15 09:46:51 +0000113
114 def tearDown(self):
Neale Ranns4008ac92017-02-13 23:20:04 -0800115 for i in self.pg_interfaces:
116 i.unconfig_ip4()
117 i.unconfig_ip6()
118 i.admin_down()
Neale Ranns15002542017-09-10 04:39:11 -0700119 self.pg1.set_table_ip4(0)
120 super(TestGRE, self).tearDown()
Neale Ranns177bbdc2016-11-15 09:46:51 +0000121
Neale Rannse5b94dd2019-12-31 05:13:14 +0000122 def create_stream_ip4(self, src_if, src_ip, dst_ip, dscp=0, ecn=0):
Neale Ranns177bbdc2016-11-15 09:46:51 +0000123 pkts = []
Neale Rannse5b94dd2019-12-31 05:13:14 +0000124 tos = (dscp << 2) | ecn
Neale Ranns177bbdc2016-11-15 09:46:51 +0000125 for i in range(0, 257):
Klement Sekeradab231a2016-12-21 08:50:14 +0100126 info = self.create_packet_info(src_if, src_if)
Neale Ranns177bbdc2016-11-15 09:46:51 +0000127 payload = self.info_to_payload(info)
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200128 p = (
129 Ether(dst=src_if.local_mac, src=src_if.remote_mac)
130 / IP(src=src_ip, dst=dst_ip, tos=tos)
131 / UDP(sport=1234, dport=1234)
132 / Raw(payload)
133 )
Neale Ranns177bbdc2016-11-15 09:46:51 +0000134 info.data = p.copy()
135 pkts.append(p)
136 return pkts
137
Neale Rannse5b94dd2019-12-31 05:13:14 +0000138 def create_stream_ip6(self, src_if, src_ip, dst_ip, dscp=0, ecn=0):
Ciara Loftus7eac9162016-09-30 15:47:03 +0100139 pkts = []
Neale Rannse5b94dd2019-12-31 05:13:14 +0000140 tc = (dscp << 2) | ecn
Ciara Loftus7eac9162016-09-30 15:47:03 +0100141 for i in range(0, 257):
142 info = self.create_packet_info(src_if, src_if)
143 payload = self.info_to_payload(info)
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200144 p = (
145 Ether(dst=src_if.local_mac, src=src_if.remote_mac)
146 / IPv6(src=src_ip, dst=dst_ip, tc=tc)
147 / UDP(sport=1234, dport=1234)
148 / Raw(payload)
149 )
Ciara Loftus7eac9162016-09-30 15:47:03 +0100150 info.data = p.copy()
151 pkts.append(p)
152 return pkts
153
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200154 def create_tunnel_stream_4o4(self, src_if, tunnel_src, tunnel_dst, src_ip, dst_ip):
Neale Ranns177bbdc2016-11-15 09:46:51 +0000155 pkts = []
156 for i in range(0, 257):
Klement Sekeradab231a2016-12-21 08:50:14 +0100157 info = self.create_packet_info(src_if, src_if)
Neale Ranns177bbdc2016-11-15 09:46:51 +0000158 payload = self.info_to_payload(info)
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200159 p = (
160 Ether(dst=src_if.local_mac, src=src_if.remote_mac)
161 / IP(src=tunnel_src, dst=tunnel_dst)
162 / GRE()
163 / IP(src=src_ip, dst=dst_ip)
164 / UDP(sport=1234, dport=1234)
165 / Raw(payload)
166 )
Neale Ranns177bbdc2016-11-15 09:46:51 +0000167 info.data = p.copy()
168 pkts.append(p)
169 return pkts
170
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200171 def create_tunnel_stream_6o4(self, src_if, tunnel_src, tunnel_dst, src_ip, dst_ip):
Neale Ranns177bbdc2016-11-15 09:46:51 +0000172 pkts = []
173 for i in range(0, 257):
Klement Sekeradab231a2016-12-21 08:50:14 +0100174 info = self.create_packet_info(src_if, src_if)
Neale Ranns177bbdc2016-11-15 09:46:51 +0000175 payload = self.info_to_payload(info)
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200176 p = (
177 Ether(dst=src_if.local_mac, src=src_if.remote_mac)
178 / IP(src=tunnel_src, dst=tunnel_dst)
179 / GRE()
180 / IPv6(src=src_ip, dst=dst_ip)
181 / UDP(sport=1234, dport=1234)
182 / Raw(payload)
183 )
Neale Ranns177bbdc2016-11-15 09:46:51 +0000184 info.data = p.copy()
185 pkts.append(p)
186 return pkts
187
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200188 def create_tunnel_stream_6o6(self, src_if, tunnel_src, tunnel_dst, src_ip, dst_ip):
Ciara Loftus7eac9162016-09-30 15:47:03 +0100189 pkts = []
190 for i in range(0, 257):
191 info = self.create_packet_info(src_if, src_if)
192 payload = self.info_to_payload(info)
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200193 p = (
194 Ether(dst=src_if.local_mac, src=src_if.remote_mac)
195 / IPv6(src=tunnel_src, dst=tunnel_dst)
196 / GRE()
197 / IPv6(src=src_ip, dst=dst_ip)
198 / UDP(sport=1234, dport=1234)
199 / Raw(payload)
200 )
Ciara Loftus7eac9162016-09-30 15:47:03 +0100201 info.data = p.copy()
202 pkts.append(p)
203 return pkts
204
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200205 def create_tunnel_stream_l2o4(self, src_if, tunnel_src, tunnel_dst):
Neale Ranns177bbdc2016-11-15 09:46:51 +0000206 pkts = []
207 for i in range(0, 257):
Klement Sekeradab231a2016-12-21 08:50:14 +0100208 info = self.create_packet_info(src_if, src_if)
Neale Ranns177bbdc2016-11-15 09:46:51 +0000209 payload = self.info_to_payload(info)
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200210 p = (
211 Ether(dst=src_if.local_mac, src=src_if.remote_mac)
212 / IP(src=tunnel_src, dst=tunnel_dst)
213 / GRE()
214 / Ether(dst=RandMAC("*:*:*:*:*:*"), src=RandMAC("*:*:*:*:*:*"))
215 / IP(src=scapy.compat.raw(RandIP()), dst=scapy.compat.raw(RandIP()))
216 / UDP(sport=1234, dport=1234)
217 / Raw(payload)
218 )
Neale Ranns177bbdc2016-11-15 09:46:51 +0000219 info.data = p.copy()
220 pkts.append(p)
221 return pkts
222
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200223 def create_tunnel_stream_vlano4(self, src_if, tunnel_src, tunnel_dst, vlan):
Neale Ranns177bbdc2016-11-15 09:46:51 +0000224 pkts = []
225 for i in range(0, 257):
Klement Sekeradab231a2016-12-21 08:50:14 +0100226 info = self.create_packet_info(src_if, src_if)
Neale Ranns177bbdc2016-11-15 09:46:51 +0000227 payload = self.info_to_payload(info)
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200228 p = (
229 Ether(dst=src_if.local_mac, src=src_if.remote_mac)
230 / IP(src=tunnel_src, dst=tunnel_dst)
231 / GRE()
232 / Ether(dst=RandMAC("*:*:*:*:*:*"), src=RandMAC("*:*:*:*:*:*"))
233 / Dot1Q(vlan=vlan)
234 / IP(src=scapy.compat.raw(RandIP()), dst=scapy.compat.raw(RandIP()))
235 / UDP(sport=1234, dport=1234)
236 / Raw(payload)
237 )
Neale Ranns177bbdc2016-11-15 09:46:51 +0000238 info.data = p.copy()
239 pkts.append(p)
240 return pkts
241
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200242 def verify_tunneled_4o4(
243 self, src_if, capture, sent, tunnel_src, tunnel_dst, dscp=0, ecn=0
244 ):
Neale Ranns177bbdc2016-11-15 09:46:51 +0000245 self.assertEqual(len(capture), len(sent))
Neale Rannse5b94dd2019-12-31 05:13:14 +0000246 tos = (dscp << 2) | ecn
Neale Ranns177bbdc2016-11-15 09:46:51 +0000247
248 for i in range(len(capture)):
249 try:
250 tx = sent[i]
251 rx = capture[i]
252
253 tx_ip = tx[IP]
254 rx_ip = rx[IP]
255
256 self.assertEqual(rx_ip.src, tunnel_src)
257 self.assertEqual(rx_ip.dst, tunnel_dst)
Neale Rannse5b94dd2019-12-31 05:13:14 +0000258 self.assertEqual(rx_ip.tos, tos)
Aloys Augustincf86740a2020-07-16 11:01:01 +0200259 self.assertEqual(rx_ip.len, len(rx_ip))
Neale Ranns177bbdc2016-11-15 09:46:51 +0000260
261 rx_gre = rx[GRE]
262 rx_ip = rx_gre[IP]
263
264 self.assertEqual(rx_ip.src, tx_ip.src)
265 self.assertEqual(rx_ip.dst, tx_ip.dst)
266 # IP processing post pop has decremented the TTL
267 self.assertEqual(rx_ip.ttl + 1, tx_ip.ttl)
268
269 except:
Klement Sekera9225dee2016-12-12 08:36:58 +0100270 self.logger.error(ppp("Rx:", rx))
271 self.logger.error(ppp("Tx:", tx))
Neale Ranns177bbdc2016-11-15 09:46:51 +0000272 raise
273
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200274 def verify_tunneled_6o6(
275 self, src_if, capture, sent, tunnel_src, tunnel_dst, dscp=0, ecn=0
276 ):
Ciara Loftus7eac9162016-09-30 15:47:03 +0100277 self.assertEqual(len(capture), len(sent))
Neale Rannse5b94dd2019-12-31 05:13:14 +0000278 tc = (dscp << 2) | ecn
Ciara Loftus7eac9162016-09-30 15:47:03 +0100279
280 for i in range(len(capture)):
281 try:
282 tx = sent[i]
283 rx = capture[i]
284
285 tx_ip = tx[IPv6]
286 rx_ip = rx[IPv6]
287
288 self.assertEqual(rx_ip.src, tunnel_src)
289 self.assertEqual(rx_ip.dst, tunnel_dst)
Neale Rannse5b94dd2019-12-31 05:13:14 +0000290 self.assertEqual(rx_ip.tc, tc)
Ciara Loftus7eac9162016-09-30 15:47:03 +0100291
Paul Vinciguerraa7427ec2019-03-10 10:04:23 -0700292 rx_gre = GRE(scapy.compat.raw(rx_ip[IPv6].payload))
Aloys Augustincf86740a2020-07-16 11:01:01 +0200293
294 self.assertEqual(rx_ip.plen, len(rx_gre))
295
Ciara Loftus7eac9162016-09-30 15:47:03 +0100296 rx_ip = rx_gre[IPv6]
297
298 self.assertEqual(rx_ip.src, tx_ip.src)
299 self.assertEqual(rx_ip.dst, tx_ip.dst)
300
301 except:
302 self.logger.error(ppp("Rx:", rx))
303 self.logger.error(ppp("Tx:", tx))
304 raise
305
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200306 def verify_tunneled_4o6(self, src_if, capture, sent, tunnel_src, tunnel_dst):
Neale Ranns2646c802018-09-19 04:55:32 -0700307 self.assertEqual(len(capture), len(sent))
308
309 for i in range(len(capture)):
310 try:
311 tx = sent[i]
312 rx = capture[i]
313
314 rx_ip = rx[IPv6]
315
316 self.assertEqual(rx_ip.src, tunnel_src)
317 self.assertEqual(rx_ip.dst, tunnel_dst)
318
Paul Vinciguerraa7427ec2019-03-10 10:04:23 -0700319 rx_gre = GRE(scapy.compat.raw(rx_ip[IPv6].payload))
Aloys Augustincf86740a2020-07-16 11:01:01 +0200320
321 self.assertEqual(rx_ip.plen, len(rx_gre))
322
Neale Ranns2646c802018-09-19 04:55:32 -0700323 tx_ip = tx[IP]
324 rx_ip = rx_gre[IP]
325
326 self.assertEqual(rx_ip.src, tx_ip.src)
327 self.assertEqual(rx_ip.dst, tx_ip.dst)
328
329 except:
330 self.logger.error(ppp("Rx:", rx))
331 self.logger.error(ppp("Tx:", tx))
332 raise
333
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200334 def verify_tunneled_6o4(self, src_if, capture, sent, tunnel_src, tunnel_dst):
Neale Ranns2646c802018-09-19 04:55:32 -0700335 self.assertEqual(len(capture), len(sent))
336
337 for i in range(len(capture)):
338 try:
339 tx = sent[i]
340 rx = capture[i]
341
342 rx_ip = rx[IP]
343
344 self.assertEqual(rx_ip.src, tunnel_src)
345 self.assertEqual(rx_ip.dst, tunnel_dst)
Aloys Augustincf86740a2020-07-16 11:01:01 +0200346 self.assertEqual(rx_ip.len, len(rx_ip))
Neale Ranns2646c802018-09-19 04:55:32 -0700347
Paul Vinciguerraa7427ec2019-03-10 10:04:23 -0700348 rx_gre = GRE(scapy.compat.raw(rx_ip[IP].payload))
Neale Ranns2646c802018-09-19 04:55:32 -0700349 rx_ip = rx_gre[IPv6]
350 tx_ip = tx[IPv6]
351
352 self.assertEqual(rx_ip.src, tx_ip.src)
353 self.assertEqual(rx_ip.dst, tx_ip.dst)
354
355 except:
356 self.logger.error(ppp("Rx:", rx))
357 self.logger.error(ppp("Tx:", tx))
358 raise
359
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200360 def verify_tunneled_l2o4(self, src_if, capture, sent, tunnel_src, tunnel_dst):
Neale Ranns177bbdc2016-11-15 09:46:51 +0000361 self.assertEqual(len(capture), len(sent))
362
363 for i in range(len(capture)):
364 try:
365 tx = sent[i]
366 rx = capture[i]
367
368 tx_ip = tx[IP]
369 rx_ip = rx[IP]
370
371 self.assertEqual(rx_ip.src, tunnel_src)
372 self.assertEqual(rx_ip.dst, tunnel_dst)
Aloys Augustincf86740a2020-07-16 11:01:01 +0200373 self.assertEqual(rx_ip.len, len(rx_ip))
Neale Ranns177bbdc2016-11-15 09:46:51 +0000374
375 rx_gre = rx[GRE]
376 rx_l2 = rx_gre[Ether]
377 rx_ip = rx_l2[IP]
378 tx_gre = tx[GRE]
379 tx_l2 = tx_gre[Ether]
380 tx_ip = tx_l2[IP]
381
382 self.assertEqual(rx_ip.src, tx_ip.src)
383 self.assertEqual(rx_ip.dst, tx_ip.dst)
384 # bridged, not L3 forwarded, so no TTL decrement
385 self.assertEqual(rx_ip.ttl, tx_ip.ttl)
386
387 except:
Klement Sekera9225dee2016-12-12 08:36:58 +0100388 self.logger.error(ppp("Rx:", rx))
389 self.logger.error(ppp("Tx:", tx))
Neale Ranns177bbdc2016-11-15 09:46:51 +0000390 raise
391
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200392 def verify_tunneled_vlano4(
393 self, src_if, capture, sent, tunnel_src, tunnel_dst, vlan
394 ):
Neale Ranns177bbdc2016-11-15 09:46:51 +0000395 try:
Neale Ranns177bbdc2016-11-15 09:46:51 +0000396 self.assertEqual(len(capture), len(sent))
397 except:
Klement Sekera9225dee2016-12-12 08:36:58 +0100398 ppc("Unexpected packets captured:", capture)
Neale Ranns177bbdc2016-11-15 09:46:51 +0000399 raise
400
401 for i in range(len(capture)):
402 try:
403 tx = sent[i]
404 rx = capture[i]
405
406 tx_ip = tx[IP]
407 rx_ip = rx[IP]
408
409 self.assertEqual(rx_ip.src, tunnel_src)
410 self.assertEqual(rx_ip.dst, tunnel_dst)
411
412 rx_gre = rx[GRE]
413 rx_l2 = rx_gre[Ether]
414 rx_vlan = rx_l2[Dot1Q]
415 rx_ip = rx_l2[IP]
416
417 self.assertEqual(rx_vlan.vlan, vlan)
418
419 tx_gre = tx[GRE]
420 tx_l2 = tx_gre[Ether]
421 tx_ip = tx_l2[IP]
422
423 self.assertEqual(rx_ip.src, tx_ip.src)
424 self.assertEqual(rx_ip.dst, tx_ip.dst)
425 # bridged, not L3 forwarded, so no TTL decrement
426 self.assertEqual(rx_ip.ttl, tx_ip.ttl)
427
428 except:
Klement Sekera9225dee2016-12-12 08:36:58 +0100429 self.logger.error(ppp("Rx:", rx))
430 self.logger.error(ppp("Tx:", tx))
Neale Ranns177bbdc2016-11-15 09:46:51 +0000431 raise
432
433 def verify_decapped_4o4(self, src_if, capture, sent):
Neale Ranns177bbdc2016-11-15 09:46:51 +0000434 self.assertEqual(len(capture), len(sent))
435
436 for i in range(len(capture)):
437 try:
438 tx = sent[i]
439 rx = capture[i]
440
441 tx_ip = tx[IP]
442 rx_ip = rx[IP]
443 tx_gre = tx[GRE]
444 tx_ip = tx_gre[IP]
445
446 self.assertEqual(rx_ip.src, tx_ip.src)
447 self.assertEqual(rx_ip.dst, tx_ip.dst)
448 # IP processing post pop has decremented the TTL
449 self.assertEqual(rx_ip.ttl + 1, tx_ip.ttl)
450
451 except:
Klement Sekera9225dee2016-12-12 08:36:58 +0100452 self.logger.error(ppp("Rx:", rx))
453 self.logger.error(ppp("Tx:", tx))
Neale Ranns177bbdc2016-11-15 09:46:51 +0000454 raise
455
456 def verify_decapped_6o4(self, src_if, capture, sent):
Neale Ranns177bbdc2016-11-15 09:46:51 +0000457 self.assertEqual(len(capture), len(sent))
458
459 for i in range(len(capture)):
460 try:
461 tx = sent[i]
462 rx = capture[i]
463
464 tx_ip = tx[IP]
465 rx_ip = rx[IPv6]
466 tx_gre = tx[GRE]
467 tx_ip = tx_gre[IPv6]
468
469 self.assertEqual(rx_ip.src, tx_ip.src)
470 self.assertEqual(rx_ip.dst, tx_ip.dst)
471 self.assertEqual(rx_ip.hlim + 1, tx_ip.hlim)
472
473 except:
Klement Sekera9225dee2016-12-12 08:36:58 +0100474 self.logger.error(ppp("Rx:", rx))
475 self.logger.error(ppp("Tx:", tx))
Neale Ranns177bbdc2016-11-15 09:46:51 +0000476 raise
477
Neale Ranns4c16d802019-12-17 20:15:03 +0000478 def verify_decapped_6o6(self, src_if, capture, sent):
479 self.assertEqual(len(capture), len(sent))
480
481 for i in range(len(capture)):
482 try:
483 tx = sent[i]
484 rx = capture[i]
485
486 tx_ip = tx[IPv6]
487 rx_ip = rx[IPv6]
488 tx_gre = tx[GRE]
489 tx_ip = tx_gre[IPv6]
490
491 self.assertEqual(rx_ip.src, tx_ip.src)
492 self.assertEqual(rx_ip.dst, tx_ip.dst)
493 self.assertEqual(rx_ip.hlim + 1, tx_ip.hlim)
494
495 except:
496 self.logger.error(ppp("Rx:", rx))
497 self.logger.error(ppp("Tx:", tx))
498 raise
499
Neale Ranns177bbdc2016-11-15 09:46:51 +0000500 def test_gre(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200501 """GRE IPv4 tunnel Tests"""
Neale Ranns177bbdc2016-11-15 09:46:51 +0000502
503 #
504 # Create an L3 GRE tunnel.
505 # - set it admin up
506 # - assign an IP Addres
507 # - Add a route via the tunnel
508 #
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200509 gre_if = VppGreInterface(self, self.pg0.local_ip4, "1.1.1.2")
Neale Ranns177bbdc2016-11-15 09:46:51 +0000510 gre_if.add_vpp_config()
511
512 #
513 # The double create (create the same tunnel twice) should fail,
514 # and we should still be able to use the original
515 #
516 try:
517 gre_if.add_vpp_config()
518 except Exception:
519 pass
520 else:
521 self.fail("Double GRE tunnel add does not fail")
522
523 gre_if.admin_up()
524 gre_if.config_ip4()
525
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200526 route_via_tun = VppIpRoute(
527 self, "4.4.4.4", 32, [VppRoutePath("0.0.0.0", gre_if.sw_if_index)]
528 )
Neale Ranns177bbdc2016-11-15 09:46:51 +0000529
530 route_via_tun.add_vpp_config()
531
532 #
533 # Send a packet stream that is routed into the tunnel
Jim Thompsonf324dec2019-04-08 03:22:21 -0500534 # - they are all dropped since the tunnel's destintation IP
Neale Ranns177bbdc2016-11-15 09:46:51 +0000535 # is unresolved - or resolves via the default route - which
536 # which is a drop.
537 #
538 tx = self.create_stream_ip4(self.pg0, "5.5.5.5", "4.4.4.4")
Neale Ranns177bbdc2016-11-15 09:46:51 +0000539
Neale Ranns55882252018-11-29 08:48:37 +0000540 self.send_and_assert_no_replies(self.pg0, tx)
Neale Ranns177bbdc2016-11-15 09:46:51 +0000541
542 #
543 # Add a route that resolves the tunnel's destination
544 #
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200545 route_tun_dst = VppIpRoute(
546 self,
547 "1.1.1.2",
548 32,
549 [VppRoutePath(self.pg0.remote_ip4, self.pg0.sw_if_index)],
550 )
Neale Ranns177bbdc2016-11-15 09:46:51 +0000551 route_tun_dst.add_vpp_config()
552
553 #
554 # Send a packet stream that is routed into the tunnel
555 # - packets are GRE encapped
556 #
Neale Ranns177bbdc2016-11-15 09:46:51 +0000557 tx = self.create_stream_ip4(self.pg0, "5.5.5.5", "4.4.4.4")
Neale Ranns55882252018-11-29 08:48:37 +0000558 rx = self.send_and_expect(self.pg0, tx, self.pg0)
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200559 self.verify_tunneled_4o4(self.pg0, rx, tx, self.pg0.local_ip4, "1.1.1.2")
Neale Ranns177bbdc2016-11-15 09:46:51 +0000560
561 #
562 # Send tunneled packets that match the created tunnel and
563 # are decapped and forwarded
564 #
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200565 tx = self.create_tunnel_stream_4o4(
566 self.pg0,
567 "1.1.1.2",
568 self.pg0.local_ip4,
569 self.pg0.local_ip4,
570 self.pg0.remote_ip4,
571 )
Neale Ranns55882252018-11-29 08:48:37 +0000572 rx = self.send_and_expect(self.pg0, tx, self.pg0)
Neale Ranns177bbdc2016-11-15 09:46:51 +0000573 self.verify_decapped_4o4(self.pg0, rx, tx)
574
575 #
576 # Send tunneled packets that do not match the tunnel's src
577 #
578 self.vapi.cli("clear trace")
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200579 tx = self.create_tunnel_stream_4o4(
580 self.pg0,
581 "1.1.1.3",
582 self.pg0.local_ip4,
583 self.pg0.local_ip4,
584 self.pg0.remote_ip4,
585 )
Neale Ranns55882252018-11-29 08:48:37 +0000586 self.send_and_assert_no_replies(
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200587 self.pg0, tx, remark="GRE packets forwarded despite no SRC address match"
588 )
Neale Ranns177bbdc2016-11-15 09:46:51 +0000589
590 #
591 # Configure IPv6 on the PG interface so we can route IPv6
592 # packets
593 #
594 self.pg0.config_ip6()
595 self.pg0.resolve_ndp()
596
597 #
598 # Send IPv6 tunnel encapslated packets
599 # - dropped since IPv6 is not enabled on the tunnel
600 #
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200601 tx = self.create_tunnel_stream_6o4(
602 self.pg0,
603 "1.1.1.2",
604 self.pg0.local_ip4,
605 self.pg0.local_ip6,
606 self.pg0.remote_ip6,
607 )
608 self.send_and_assert_no_replies(
609 self.pg0,
610 tx,
611 "IPv6 GRE packets forwarded despite IPv6 not enabled on tunnel",
612 )
Neale Ranns177bbdc2016-11-15 09:46:51 +0000613
614 #
615 # Enable IPv6 on the tunnel
616 #
617 gre_if.config_ip6()
618
619 #
620 # Send IPv6 tunnel encapslated packets
621 # - forwarded since IPv6 is enabled on the tunnel
622 #
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200623 tx = self.create_tunnel_stream_6o4(
624 self.pg0,
625 "1.1.1.2",
626 self.pg0.local_ip4,
627 self.pg0.local_ip6,
628 self.pg0.remote_ip6,
629 )
Neale Ranns55882252018-11-29 08:48:37 +0000630 rx = self.send_and_expect(self.pg0, tx, self.pg0)
Neale Ranns177bbdc2016-11-15 09:46:51 +0000631 self.verify_decapped_6o4(self.pg0, rx, tx)
632
633 #
Neale Ranns2646c802018-09-19 04:55:32 -0700634 # Send v6 packets for v4 encap
635 #
636 route6_via_tun = VppIpRoute(
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200637 self,
638 "2001::1",
639 128,
640 [VppRoutePath("::", gre_if.sw_if_index, proto=DpoProto.DPO_PROTO_IP6)],
641 )
Neale Ranns2646c802018-09-19 04:55:32 -0700642 route6_via_tun.add_vpp_config()
643
644 tx = self.create_stream_ip6(self.pg0, "2001::2", "2001::1")
645 rx = self.send_and_expect(self.pg0, tx, self.pg0)
646
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200647 self.verify_tunneled_6o4(self.pg0, rx, tx, self.pg0.local_ip4, "1.1.1.2")
Neale Ranns2646c802018-09-19 04:55:32 -0700648
649 #
Neale Ranns533bf082020-10-08 08:10:34 +0000650 # add a labelled route through the tunnel
651 #
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200652 label_via_tun = VppIpRoute(
653 self,
654 "5.4.3.2",
655 32,
656 [VppRoutePath("0.0.0.0", gre_if.sw_if_index, labels=[VppMplsLabel(33)])],
657 )
Neale Ranns533bf082020-10-08 08:10:34 +0000658 label_via_tun.add_vpp_config()
659
660 tx = self.create_stream_ip4(self.pg0, "5.5.5.5", "5.4.3.2")
661 rx = self.send_and_expect(self.pg0, tx, self.pg0)
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200662 self.verify_tunneled_4o4(self.pg0, rx, tx, self.pg0.local_ip4, "1.1.1.2")
Neale Ranns533bf082020-10-08 08:10:34 +0000663
664 #
665 # an MPLS tunnel over the GRE tunnel add a route through
666 # the mpls tunnel
667 #
668 mpls_tun = VppMPLSTunnelInterface(
669 self,
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200670 [
671 VppRoutePath(
672 "0.0.0.0",
673 gre_if.sw_if_index,
674 labels=[VppMplsLabel(44), VppMplsLabel(46)],
675 )
676 ],
677 )
Neale Ranns533bf082020-10-08 08:10:34 +0000678 mpls_tun.add_vpp_config()
679 mpls_tun.admin_up()
680
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200681 label_via_mpls = VppIpRoute(
682 self,
683 "5.4.3.1",
684 32,
685 [VppRoutePath("0.0.0.0", mpls_tun.sw_if_index, labels=[VppMplsLabel(33)])],
686 )
Neale Ranns533bf082020-10-08 08:10:34 +0000687 label_via_mpls.add_vpp_config()
688
689 tx = self.create_stream_ip4(self.pg0, "5.5.5.5", "5.4.3.1")
690 rx = self.send_and_expect(self.pg0, tx, self.pg0)
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200691 self.verify_tunneled_4o4(self.pg0, rx, tx, self.pg0.local_ip4, "1.1.1.2")
Neale Ranns533bf082020-10-08 08:10:34 +0000692
693 mpls_tun_l2 = VppMPLSTunnelInterface(
694 self,
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200695 [
696 VppRoutePath(
697 "0.0.0.0",
698 gre_if.sw_if_index,
699 labels=[VppMplsLabel(44), VppMplsLabel(46)],
700 )
701 ],
702 is_l2=1,
703 )
Neale Ranns533bf082020-10-08 08:10:34 +0000704 mpls_tun_l2.add_vpp_config()
705 mpls_tun_l2.admin_up()
706
707 #
Neale Ranns177bbdc2016-11-15 09:46:51 +0000708 # test case cleanup
709 #
710 route_tun_dst.remove_vpp_config()
711 route_via_tun.remove_vpp_config()
Neale Ranns2646c802018-09-19 04:55:32 -0700712 route6_via_tun.remove_vpp_config()
Neale Ranns533bf082020-10-08 08:10:34 +0000713 label_via_mpls.remove_vpp_config()
714 label_via_tun.remove_vpp_config()
715 mpls_tun.remove_vpp_config()
716 mpls_tun_l2.remove_vpp_config()
Neale Ranns177bbdc2016-11-15 09:46:51 +0000717 gre_if.remove_vpp_config()
718
719 self.pg0.unconfig_ip6()
720
Ciara Loftus7eac9162016-09-30 15:47:03 +0100721 def test_gre6(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200722 """GRE IPv6 tunnel Tests"""
Ciara Loftus7eac9162016-09-30 15:47:03 +0100723
Neale Ranns8716e6b2017-12-13 02:47:27 -0800724 self.pg1.config_ip6()
725 self.pg1.resolve_ndp()
726
Ciara Loftus7eac9162016-09-30 15:47:03 +0100727 #
728 # Create an L3 GRE tunnel.
729 # - set it admin up
730 # - assign an IP Address
731 # - Add a route via the tunnel
732 #
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200733 gre_if = VppGreInterface(self, self.pg2.local_ip6, "1002::1")
Ciara Loftus7eac9162016-09-30 15:47:03 +0100734 gre_if.add_vpp_config()
735 gre_if.admin_up()
736 gre_if.config_ip6()
737
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200738 route_via_tun = VppIpRoute(
739 self, "4004::1", 128, [VppRoutePath("0::0", gre_if.sw_if_index)]
740 )
Ciara Loftus7eac9162016-09-30 15:47:03 +0100741
742 route_via_tun.add_vpp_config()
743
744 #
745 # Send a packet stream that is routed into the tunnel
Jim Thompsonf324dec2019-04-08 03:22:21 -0500746 # - they are all dropped since the tunnel's destintation IP
Ciara Loftus7eac9162016-09-30 15:47:03 +0100747 # is unresolved - or resolves via the default route - which
748 # which is a drop.
749 #
750 tx = self.create_stream_ip6(self.pg2, "5005::1", "4004::1")
Neale Ranns55882252018-11-29 08:48:37 +0000751 self.send_and_assert_no_replies(
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200752 self.pg2, tx, "GRE packets forwarded without DIP resolved"
753 )
Ciara Loftus7eac9162016-09-30 15:47:03 +0100754
755 #
756 # Add a route that resolves the tunnel's destination
757 #
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200758 route_tun_dst = VppIpRoute(
759 self,
760 "1002::1",
761 128,
762 [VppRoutePath(self.pg2.remote_ip6, self.pg2.sw_if_index)],
763 )
Ciara Loftus7eac9162016-09-30 15:47:03 +0100764 route_tun_dst.add_vpp_config()
765
766 #
767 # Send a packet stream that is routed into the tunnel
768 # - packets are GRE encapped
769 #
Ciara Loftus7eac9162016-09-30 15:47:03 +0100770 tx = self.create_stream_ip6(self.pg2, "5005::1", "4004::1")
Neale Ranns55882252018-11-29 08:48:37 +0000771 rx = self.send_and_expect(self.pg2, tx, self.pg2)
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200772 self.verify_tunneled_6o6(self.pg2, rx, tx, self.pg2.local_ip6, "1002::1")
Ciara Loftus7eac9162016-09-30 15:47:03 +0100773
774 #
Neale Ranns8716e6b2017-12-13 02:47:27 -0800775 # Test decap. decapped packets go out pg1
776 #
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200777 tx = self.create_tunnel_stream_6o6(
778 self.pg2, "1002::1", self.pg2.local_ip6, "2001::1", self.pg1.remote_ip6
779 )
Neale Ranns55882252018-11-29 08:48:37 +0000780 rx = self.send_and_expect(self.pg2, tx, self.pg1)
Neale Ranns8716e6b2017-12-13 02:47:27 -0800781
782 #
783 # RX'd packet is UDP over IPv6, test the GRE header is gone.
784 #
785 self.assertFalse(rx[0].haslayer(GRE))
786 self.assertEqual(rx[0][IPv6].dst, self.pg1.remote_ip6)
787
788 #
Neale Ranns2646c802018-09-19 04:55:32 -0700789 # Send v4 over v6
790 #
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200791 route4_via_tun = VppIpRoute(
792 self, "1.1.1.1", 32, [VppRoutePath("0.0.0.0", gre_if.sw_if_index)]
793 )
Neale Ranns2646c802018-09-19 04:55:32 -0700794 route4_via_tun.add_vpp_config()
795
796 tx = self.create_stream_ip4(self.pg0, "1.1.1.2", "1.1.1.1")
797 rx = self.send_and_expect(self.pg0, tx, self.pg2)
798
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200799 self.verify_tunneled_4o6(self.pg0, rx, tx, self.pg2.local_ip6, "1002::1")
Neale Ranns2646c802018-09-19 04:55:32 -0700800
801 #
Ciara Loftus7eac9162016-09-30 15:47:03 +0100802 # test case cleanup
803 #
804 route_tun_dst.remove_vpp_config()
805 route_via_tun.remove_vpp_config()
Neale Ranns2646c802018-09-19 04:55:32 -0700806 route4_via_tun.remove_vpp_config()
Ciara Loftus7eac9162016-09-30 15:47:03 +0100807 gre_if.remove_vpp_config()
808
809 self.pg2.unconfig_ip6()
Neale Ranns8716e6b2017-12-13 02:47:27 -0800810 self.pg1.unconfig_ip6()
Ciara Loftus7eac9162016-09-30 15:47:03 +0100811
Neale Ranns177bbdc2016-11-15 09:46:51 +0000812 def test_gre_vrf(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200813 """GRE tunnel VRF Tests"""
Neale Ranns177bbdc2016-11-15 09:46:51 +0000814
Neale Rannse5b94dd2019-12-31 05:13:14 +0000815 e = VppEnum.vl_api_tunnel_encap_decap_flags_t
816
Neale Ranns177bbdc2016-11-15 09:46:51 +0000817 #
818 # Create an L3 GRE tunnel whose destination is in the non-default
819 # table. The underlay is thus non-default - the overlay is still
820 # the default.
821 # - set it admin up
822 # - assign an IP Addres
823 #
Neale Rannse5b94dd2019-12-31 05:13:14 +0000824 gre_if = VppGreInterface(
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200825 self,
826 self.pg1.local_ip4,
Neale Rannse5b94dd2019-12-31 05:13:14 +0000827 "2.2.2.2",
828 outer_table_id=1,
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200829 flags=(
830 e.TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP
831 | e.TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_ECN
832 ),
833 )
Neale Rannse5b94dd2019-12-31 05:13:14 +0000834
Neale Ranns177bbdc2016-11-15 09:46:51 +0000835 gre_if.add_vpp_config()
836 gre_if.admin_up()
837 gre_if.config_ip4()
838
839 #
840 # Add a route via the tunnel - in the overlay
841 #
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200842 route_via_tun = VppIpRoute(
843 self, "9.9.9.9", 32, [VppRoutePath("0.0.0.0", gre_if.sw_if_index)]
844 )
Neale Ranns177bbdc2016-11-15 09:46:51 +0000845 route_via_tun.add_vpp_config()
846
847 #
848 # Add a route that resolves the tunnel's destination - in the
849 # underlay table
850 #
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200851 route_tun_dst = VppIpRoute(
852 self,
853 "2.2.2.2",
854 32,
855 table_id=1,
856 paths=[VppRoutePath(self.pg1.remote_ip4, self.pg1.sw_if_index)],
857 )
Neale Ranns177bbdc2016-11-15 09:46:51 +0000858 route_tun_dst.add_vpp_config()
859
860 #
861 # Send a packet stream that is routed into the tunnel
862 # packets are sent in on pg0 which is in the default table
863 # - packets are GRE encapped
864 #
865 self.vapi.cli("clear trace")
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200866 tx = self.create_stream_ip4(self.pg0, "5.5.5.5", "9.9.9.9", dscp=5, ecn=3)
Neale Ranns55882252018-11-29 08:48:37 +0000867 rx = self.send_and_expect(self.pg0, tx, self.pg1)
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200868 self.verify_tunneled_4o4(
869 self.pg1, rx, tx, self.pg1.local_ip4, "2.2.2.2", dscp=5, ecn=3
870 )
Neale Ranns177bbdc2016-11-15 09:46:51 +0000871
872 #
873 # Send tunneled packets that match the created tunnel and
874 # are decapped and forwarded. This tests the decap lookup
875 # does not happen in the encap table
876 #
877 self.vapi.cli("clear trace")
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200878 tx = self.create_tunnel_stream_4o4(
879 self.pg1,
880 "2.2.2.2",
881 self.pg1.local_ip4,
882 self.pg0.local_ip4,
883 self.pg0.remote_ip4,
884 )
Neale Ranns55882252018-11-29 08:48:37 +0000885 rx = self.send_and_expect(self.pg1, tx, self.pg0)
Neale Ranns177bbdc2016-11-15 09:46:51 +0000886 self.verify_decapped_4o4(self.pg0, rx, tx)
887
888 #
Neale Ranns743ee3e2018-11-29 08:24:38 +0000889 # Send tunneled packets that match the created tunnel
Neale Ranns33ce60d2017-12-14 08:51:32 -0800890 # but arrive on an interface that is not in the tunnel's
Neale Ranns743ee3e2018-11-29 08:24:38 +0000891 # encap VRF, these are dropped.
892 # IP enable the interface so they aren't dropped due to
893 # IP not being enabled.
Neale Ranns33ce60d2017-12-14 08:51:32 -0800894 #
Neale Ranns743ee3e2018-11-29 08:24:38 +0000895 self.pg2.config_ip4()
Neale Ranns33ce60d2017-12-14 08:51:32 -0800896 self.vapi.cli("clear trace")
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200897 tx = self.create_tunnel_stream_4o4(
898 self.pg2,
899 "2.2.2.2",
900 self.pg1.local_ip4,
901 self.pg0.local_ip4,
902 self.pg0.remote_ip4,
903 )
Neale Ranns55882252018-11-29 08:48:37 +0000904 rx = self.send_and_assert_no_replies(
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200905 self.pg2, tx, "GRE decap packets in wrong VRF"
906 )
Neale Ranns33ce60d2017-12-14 08:51:32 -0800907
Neale Ranns743ee3e2018-11-29 08:24:38 +0000908 self.pg2.unconfig_ip4()
909
Neale Ranns33ce60d2017-12-14 08:51:32 -0800910 #
Neale Ranns177bbdc2016-11-15 09:46:51 +0000911 # test case cleanup
912 #
913 route_tun_dst.remove_vpp_config()
914 route_via_tun.remove_vpp_config()
915 gre_if.remove_vpp_config()
916
917 def test_gre_l2(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200918 """GRE tunnel L2 Tests"""
Neale Ranns177bbdc2016-11-15 09:46:51 +0000919
920 #
921 # Add routes to resolve the tunnel destinations
922 #
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200923 route_tun1_dst = VppIpRoute(
924 self,
925 "2.2.2.2",
926 32,
927 [VppRoutePath(self.pg0.remote_ip4, self.pg0.sw_if_index)],
928 )
929 route_tun2_dst = VppIpRoute(
930 self,
931 "2.2.2.3",
932 32,
933 [VppRoutePath(self.pg0.remote_ip4, self.pg0.sw_if_index)],
934 )
Neale Ranns177bbdc2016-11-15 09:46:51 +0000935
936 route_tun1_dst.add_vpp_config()
937 route_tun2_dst.add_vpp_config()
938
939 #
940 # Create 2 L2 GRE tunnels and x-connect them
941 #
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200942 gre_if1 = VppGreInterface(
943 self,
944 self.pg0.local_ip4,
945 "2.2.2.2",
946 type=(VppEnum.vl_api_gre_tunnel_type_t.GRE_API_TUNNEL_TYPE_TEB),
947 )
948 gre_if2 = VppGreInterface(
949 self,
950 self.pg0.local_ip4,
951 "2.2.2.3",
952 type=(VppEnum.vl_api_gre_tunnel_type_t.GRE_API_TUNNEL_TYPE_TEB),
953 )
Neale Ranns177bbdc2016-11-15 09:46:51 +0000954 gre_if1.add_vpp_config()
955 gre_if2.add_vpp_config()
956
957 gre_if1.admin_up()
958 gre_if2.admin_up()
959
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200960 self.vapi.sw_interface_set_l2_xconnect(
961 gre_if1.sw_if_index, gre_if2.sw_if_index, enable=1
962 )
963 self.vapi.sw_interface_set_l2_xconnect(
964 gre_if2.sw_if_index, gre_if1.sw_if_index, enable=1
965 )
Neale Ranns177bbdc2016-11-15 09:46:51 +0000966
967 #
968 # Send in tunnel encapped L2. expect out tunnel encapped L2
969 # in both directions
970 #
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200971 tx = self.create_tunnel_stream_l2o4(self.pg0, "2.2.2.2", self.pg0.local_ip4)
Neale Ranns55882252018-11-29 08:48:37 +0000972 rx = self.send_and_expect(self.pg0, tx, self.pg0)
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200973 self.verify_tunneled_l2o4(self.pg0, rx, tx, self.pg0.local_ip4, "2.2.2.3")
Neale Ranns177bbdc2016-11-15 09:46:51 +0000974
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200975 tx = self.create_tunnel_stream_l2o4(self.pg0, "2.2.2.3", self.pg0.local_ip4)
Neale Ranns55882252018-11-29 08:48:37 +0000976 rx = self.send_and_expect(self.pg0, tx, self.pg0)
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200977 self.verify_tunneled_l2o4(self.pg0, rx, tx, self.pg0.local_ip4, "2.2.2.2")
Neale Ranns177bbdc2016-11-15 09:46:51 +0000978
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200979 self.vapi.sw_interface_set_l2_xconnect(
980 gre_if1.sw_if_index, gre_if2.sw_if_index, enable=0
981 )
982 self.vapi.sw_interface_set_l2_xconnect(
983 gre_if2.sw_if_index, gre_if1.sw_if_index, enable=0
984 )
Neale Ranns177bbdc2016-11-15 09:46:51 +0000985
986 #
987 # Create a VLAN sub-interfaces on the GRE TEB interfaces
988 # then x-connect them
989 #
990 gre_if_11 = VppDot1QSubint(self, gre_if1, 11)
991 gre_if_12 = VppDot1QSubint(self, gre_if2, 12)
992
993 # gre_if_11.add_vpp_config()
994 # gre_if_12.add_vpp_config()
995
996 gre_if_11.admin_up()
997 gre_if_12.admin_up()
998
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200999 self.vapi.sw_interface_set_l2_xconnect(
1000 gre_if_11.sw_if_index, gre_if_12.sw_if_index, enable=1
1001 )
1002 self.vapi.sw_interface_set_l2_xconnect(
1003 gre_if_12.sw_if_index, gre_if_11.sw_if_index, enable=1
1004 )
Neale Ranns177bbdc2016-11-15 09:46:51 +00001005
1006 #
1007 # Configure both to pop thier respective VLAN tags,
1008 # so that during the x-coonect they will subsequently push
1009 #
Ole Troana5b2eec2019-03-11 19:23:25 +01001010 self.vapi.l2_interface_vlan_tag_rewrite(
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001011 sw_if_index=gre_if_12.sw_if_index, vtr_op=L2_VTR_OP.L2_POP_1, push_dot1q=12
1012 )
Ole Troana5b2eec2019-03-11 19:23:25 +01001013 self.vapi.l2_interface_vlan_tag_rewrite(
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001014 sw_if_index=gre_if_11.sw_if_index, vtr_op=L2_VTR_OP.L2_POP_1, push_dot1q=11
1015 )
Neale Ranns177bbdc2016-11-15 09:46:51 +00001016
1017 #
1018 # Send traffic in both directiond - expect the VLAN tags to
1019 # be swapped.
1020 #
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001021 tx = self.create_tunnel_stream_vlano4(
1022 self.pg0, "2.2.2.2", self.pg0.local_ip4, 11
1023 )
Neale Ranns55882252018-11-29 08:48:37 +00001024 rx = self.send_and_expect(self.pg0, tx, self.pg0)
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001025 self.verify_tunneled_vlano4(self.pg0, rx, tx, self.pg0.local_ip4, "2.2.2.3", 12)
Neale Ranns177bbdc2016-11-15 09:46:51 +00001026
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001027 tx = self.create_tunnel_stream_vlano4(
1028 self.pg0, "2.2.2.3", self.pg0.local_ip4, 12
1029 )
Neale Ranns55882252018-11-29 08:48:37 +00001030 rx = self.send_and_expect(self.pg0, tx, self.pg0)
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001031 self.verify_tunneled_vlano4(self.pg0, rx, tx, self.pg0.local_ip4, "2.2.2.2", 11)
Neale Ranns177bbdc2016-11-15 09:46:51 +00001032
1033 #
1034 # Cleanup Test resources
1035 #
1036 gre_if_11.remove_vpp_config()
1037 gre_if_12.remove_vpp_config()
1038 gre_if1.remove_vpp_config()
1039 gre_if2.remove_vpp_config()
1040 route_tun1_dst.add_vpp_config()
1041 route_tun2_dst.add_vpp_config()
1042
Neale Ranns521a8d72018-12-06 13:46:49 +00001043 def test_gre_loop(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001044 """GRE tunnel loop Tests"""
Neale Ranns521a8d72018-12-06 13:46:49 +00001045
1046 #
1047 # Create an L3 GRE tunnel.
1048 # - set it admin up
1049 # - assign an IP Addres
1050 #
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001051 gre_if = VppGreInterface(self, self.pg0.local_ip4, "1.1.1.2")
Neale Ranns521a8d72018-12-06 13:46:49 +00001052 gre_if.add_vpp_config()
1053 gre_if.admin_up()
1054 gre_if.config_ip4()
1055
1056 #
1057 # add a route to the tunnel's destination that points
1058 # through the tunnel, hence forming a loop in the forwarding
1059 # graph
1060 #
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001061 route_dst = VppIpRoute(
1062 self, "1.1.1.2", 32, [VppRoutePath("0.0.0.0", gre_if.sw_if_index)]
1063 )
Neale Ranns521a8d72018-12-06 13:46:49 +00001064 route_dst.add_vpp_config()
1065
1066 #
1067 # packets to the tunnels destination should be dropped
1068 #
1069 tx = self.create_stream_ip4(self.pg0, "1.1.1.1", "1.1.1.2")
1070 self.send_and_assert_no_replies(self.pg2, tx)
1071
1072 self.logger.info(self.vapi.ppcli("sh adj 7"))
1073
1074 #
1075 # break the loop
1076 #
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001077 route_dst.modify([VppRoutePath(self.pg1.remote_ip4, self.pg1.sw_if_index)])
Neale Ranns521a8d72018-12-06 13:46:49 +00001078 route_dst.add_vpp_config()
1079
1080 rx = self.send_and_expect(self.pg0, tx, self.pg1)
1081
1082 #
1083 # a good route throught the tunnel to check it restacked
1084 #
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001085 route_via_tun_2 = VppIpRoute(
1086 self, "2.2.2.2", 32, [VppRoutePath("0.0.0.0", gre_if.sw_if_index)]
1087 )
Neale Ranns521a8d72018-12-06 13:46:49 +00001088 route_via_tun_2.add_vpp_config()
1089
1090 tx = self.create_stream_ip4(self.pg0, "2.2.2.3", "2.2.2.2")
1091 rx = self.send_and_expect(self.pg0, tx, self.pg1)
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001092 self.verify_tunneled_4o4(self.pg1, rx, tx, self.pg0.local_ip4, "1.1.1.2")
Neale Ranns521a8d72018-12-06 13:46:49 +00001093
1094 #
1095 # cleanup
1096 #
1097 route_via_tun_2.remove_vpp_config()
1098 gre_if.remove_vpp_config()
1099
Neale Ranns5f8f6172019-04-18 10:23:56 +00001100 def test_mgre(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001101 """mGRE IPv4 tunnel Tests"""
Neale Ranns5f8f6172019-04-18 10:23:56 +00001102
1103 for itf in self.pg_interfaces[3:]:
1104 #
1105 # one underlay nh for each overlay/tunnel peer
1106 #
1107 itf.generate_remote_hosts(4)
1108 itf.configure_ipv4_neighbors()
1109
1110 #
1111 # Create an L3 GRE tunnel.
1112 # - set it admin up
1113 # - assign an IP Addres
1114 # - Add a route via the tunnel
1115 #
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001116 gre_if = VppGreInterface(
1117 self,
1118 itf.local_ip4,
1119 "0.0.0.0",
1120 mode=(VppEnum.vl_api_tunnel_mode_t.TUNNEL_API_MODE_MP),
1121 )
Neale Ranns5f8f6172019-04-18 10:23:56 +00001122 gre_if.add_vpp_config()
1123 gre_if.admin_up()
1124 gre_if.config_ip4()
1125 gre_if.generate_remote_hosts(4)
1126
Neale Ranns3fd99042019-12-16 00:53:11 +00001127 self.logger.info(self.vapi.cli("sh adj"))
1128 self.logger.info(self.vapi.cli("sh ip fib"))
1129
Neale Ranns5f8f6172019-04-18 10:23:56 +00001130 #
Neale Ranns4c16d802019-12-17 20:15:03 +00001131 # ensure we don't match to the tunnel if the source address
1132 # is all zeros
1133 #
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001134 tx = self.create_tunnel_stream_4o4(
1135 self.pg0,
1136 "0.0.0.0",
1137 itf.local_ip4,
1138 self.pg0.local_ip4,
1139 self.pg0.remote_ip4,
1140 )
Neale Ranns4c16d802019-12-17 20:15:03 +00001141 self.send_and_assert_no_replies(self.pg0, tx)
1142
1143 #
Neale Ranns5f8f6172019-04-18 10:23:56 +00001144 # for-each peer
1145 #
1146 for ii in range(1, 4):
1147 route_addr = "4.4.4.%d" % ii
Neale Rannsbd8e43d2021-03-15 14:42:30 +00001148 tx_e = self.create_stream_ip4(self.pg0, "5.5.5.5", route_addr)
Neale Ranns5f8f6172019-04-18 10:23:56 +00001149
1150 #
1151 # route traffic via the peer
1152 #
1153 route_via_tun = VppIpRoute(
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001154 self,
1155 route_addr,
1156 32,
1157 [VppRoutePath(gre_if._remote_hosts[ii].ip4, gre_if.sw_if_index)],
1158 )
Neale Ranns5f8f6172019-04-18 10:23:56 +00001159 route_via_tun.add_vpp_config()
1160
Neale Rannsbd8e43d2021-03-15 14:42:30 +00001161 # all packets dropped at this point
Neale Rannsbd8e43d2021-03-15 14:42:30 +00001162 rx = self.send_and_assert_no_replies(self.pg0, tx_e)
1163
1164 gre_if.admin_down()
1165 gre_if.admin_up()
Neale Rannsbd8e43d2021-03-15 14:42:30 +00001166 rx = self.send_and_assert_no_replies(self.pg0, tx_e)
1167
Neale Ranns5f8f6172019-04-18 10:23:56 +00001168 #
Neale Ranns28287212019-12-16 00:53:11 +00001169 # Add a TEIB entry resolves the peer
Neale Ranns5f8f6172019-04-18 10:23:56 +00001170 #
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001171 teib = VppTeib(
1172 self,
1173 gre_if,
1174 gre_if._remote_hosts[ii].ip4,
1175 itf._remote_hosts[ii].ip4,
1176 )
Neale Ranns03ce4622020-02-03 10:55:09 +00001177 teib.add_vpp_config()
Neale Ranns5f8f6172019-04-18 10:23:56 +00001178
1179 #
1180 # Send a packet stream that is routed into the tunnel
1181 # - packets are GRE encapped
1182 #
Neale Rannsf2b6b9e2021-04-27 13:54:46 +00001183 rx = self.send_and_expect(self.pg0, tx_e, itf)
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001184 self.verify_tunneled_4o4(
1185 self.pg0, rx, tx_e, itf.local_ip4, itf._remote_hosts[ii].ip4
1186 )
Neale Ranns5f8f6172019-04-18 10:23:56 +00001187
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001188 tx_i = self.create_tunnel_stream_4o4(
1189 self.pg0,
1190 itf._remote_hosts[ii].ip4,
1191 itf.local_ip4,
1192 self.pg0.local_ip4,
1193 self.pg0.remote_ip4,
1194 )
Neale Ranns4c16d802019-12-17 20:15:03 +00001195 rx = self.send_and_expect(self.pg0, tx_i, self.pg0)
1196 self.verify_decapped_4o4(self.pg0, rx, tx_i)
1197
Neale Ranns5f8f6172019-04-18 10:23:56 +00001198 #
Neale Ranns28287212019-12-16 00:53:11 +00001199 # delete and re-add the TEIB
Neale Ranns5f8f6172019-04-18 10:23:56 +00001200 #
Neale Ranns03ce4622020-02-03 10:55:09 +00001201 teib.remove_vpp_config()
Neale Ranns4c16d802019-12-17 20:15:03 +00001202 self.send_and_assert_no_replies(self.pg0, tx_e)
1203 self.send_and_assert_no_replies(self.pg0, tx_i)
Neale Ranns5f8f6172019-04-18 10:23:56 +00001204
Neale Ranns03ce4622020-02-03 10:55:09 +00001205 teib.add_vpp_config()
Neale Ranns4c16d802019-12-17 20:15:03 +00001206 rx = self.send_and_expect(self.pg0, tx_e, itf)
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001207 self.verify_tunneled_4o4(
1208 self.pg0, rx, tx_e, itf.local_ip4, itf._remote_hosts[ii].ip4
1209 )
Neale Ranns4c16d802019-12-17 20:15:03 +00001210 rx = self.send_and_expect(self.pg0, tx_i, self.pg0)
1211 self.verify_decapped_4o4(self.pg0, rx, tx_i)
Neale Ranns5f8f6172019-04-18 10:23:56 +00001212
Neale Rannsbd8e43d2021-03-15 14:42:30 +00001213 #
1214 # bounce the interface state and try packets again
1215 #
1216 gre_if.admin_down()
1217 gre_if.admin_up()
1218 rx = self.send_and_expect(self.pg0, tx_e, itf)
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001219 self.verify_tunneled_4o4(
1220 self.pg0, rx, tx_e, itf.local_ip4, itf._remote_hosts[ii].ip4
1221 )
Neale Rannsbd8e43d2021-03-15 14:42:30 +00001222 rx = self.send_and_expect(self.pg0, tx_i, self.pg0)
1223 self.verify_decapped_4o4(self.pg0, rx, tx_i)
1224
Neale Ranns3fd99042019-12-16 00:53:11 +00001225 gre_if.admin_down()
1226 gre_if.unconfig_ip4()
1227
Neale Rannse11dce22019-12-17 00:14:26 +00001228 def test_mgre6(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001229 """mGRE IPv6 tunnel Tests"""
Neale Rannse11dce22019-12-17 00:14:26 +00001230
Neale Ranns4c16d802019-12-17 20:15:03 +00001231 self.pg0.config_ip6()
1232 self.pg0.resolve_ndp()
Neale Rannse11dce22019-12-17 00:14:26 +00001233
Neale Rannse5b94dd2019-12-31 05:13:14 +00001234 e = VppEnum.vl_api_tunnel_encap_decap_flags_t
1235
Neale Rannse11dce22019-12-17 00:14:26 +00001236 for itf in self.pg_interfaces[3:]:
1237 #
1238 # one underlay nh for each overlay/tunnel peer
1239 #
1240 itf.config_ip6()
1241 itf.generate_remote_hosts(4)
1242 itf.configure_ipv6_neighbors()
1243
1244 #
1245 # Create an L3 GRE tunnel.
1246 # - set it admin up
1247 # - assign an IP Addres
1248 # - Add a route via the tunnel
1249 #
Neale Rannse5b94dd2019-12-31 05:13:14 +00001250 gre_if = VppGreInterface(
1251 self,
1252 itf.local_ip6,
1253 "::",
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001254 mode=(VppEnum.vl_api_tunnel_mode_t.TUNNEL_API_MODE_MP),
1255 flags=e.TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP,
1256 )
Neale Rannse5b94dd2019-12-31 05:13:14 +00001257
Neale Rannse11dce22019-12-17 00:14:26 +00001258 gre_if.add_vpp_config()
1259 gre_if.admin_up()
1260 gre_if.config_ip6()
1261 gre_if.generate_remote_hosts(4)
1262
1263 #
1264 # for-each peer
1265 #
1266 for ii in range(1, 4):
1267 route_addr = "4::%d" % ii
1268
1269 #
Neale Ranns28287212019-12-16 00:53:11 +00001270 # Add a TEIB entry resolves the peer
Neale Ranns14053c92019-12-29 23:55:18 +00001271 #
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001272 teib = VppTeib(
1273 self,
1274 gre_if,
1275 gre_if._remote_hosts[ii].ip6,
1276 itf._remote_hosts[ii].ip6,
1277 )
Neale Ranns03ce4622020-02-03 10:55:09 +00001278 teib.add_vpp_config()
Neale Ranns14053c92019-12-29 23:55:18 +00001279
1280 #
Neale Rannse11dce22019-12-17 00:14:26 +00001281 # route traffic via the peer
1282 #
1283 route_via_tun = VppIpRoute(
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001284 self,
1285 route_addr,
1286 128,
1287 [VppRoutePath(gre_if._remote_hosts[ii].ip6, gre_if.sw_if_index)],
1288 )
Neale Rannse11dce22019-12-17 00:14:26 +00001289 route_via_tun.add_vpp_config()
1290
1291 #
Neale Rannse11dce22019-12-17 00:14:26 +00001292 # Send a packet stream that is routed into the tunnel
1293 # - packets are GRE encapped
1294 #
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001295 tx_e = self.create_stream_ip6(
1296 self.pg0, "5::5", route_addr, dscp=2, ecn=1
1297 )
Neale Ranns4c16d802019-12-17 20:15:03 +00001298 rx = self.send_and_expect(self.pg0, tx_e, itf)
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001299 self.verify_tunneled_6o6(
1300 self.pg0, rx, tx_e, itf.local_ip6, itf._remote_hosts[ii].ip6, dscp=2
1301 )
1302 tx_i = self.create_tunnel_stream_6o6(
1303 self.pg0,
1304 itf._remote_hosts[ii].ip6,
1305 itf.local_ip6,
1306 self.pg0.local_ip6,
1307 self.pg0.remote_ip6,
1308 )
Neale Ranns4c16d802019-12-17 20:15:03 +00001309 rx = self.send_and_expect(self.pg0, tx_i, self.pg0)
1310 self.verify_decapped_6o6(self.pg0, rx, tx_i)
Neale Rannse11dce22019-12-17 00:14:26 +00001311
1312 #
Neale Ranns28287212019-12-16 00:53:11 +00001313 # delete and re-add the TEIB
Neale Rannse11dce22019-12-17 00:14:26 +00001314 #
Neale Ranns03ce4622020-02-03 10:55:09 +00001315 teib.remove_vpp_config()
Neale Ranns4c16d802019-12-17 20:15:03 +00001316 self.send_and_assert_no_replies(self.pg0, tx_e)
Neale Rannse11dce22019-12-17 00:14:26 +00001317
Neale Ranns03ce4622020-02-03 10:55:09 +00001318 teib.add_vpp_config()
Neale Ranns4c16d802019-12-17 20:15:03 +00001319 rx = self.send_and_expect(self.pg0, tx_e, itf)
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001320 self.verify_tunneled_6o6(
1321 self.pg0, rx, tx_e, itf.local_ip6, itf._remote_hosts[ii].ip6, dscp=2
1322 )
Neale Ranns4c16d802019-12-17 20:15:03 +00001323 rx = self.send_and_expect(self.pg0, tx_i, self.pg0)
1324 self.verify_decapped_6o6(self.pg0, rx, tx_i)
1325
Neale Rannse11dce22019-12-17 00:14:26 +00001326 gre_if.admin_down()
1327 gre_if.unconfig_ip4()
1328 itf.unconfig_ip6()
Neale Ranns4c16d802019-12-17 20:15:03 +00001329 self.pg0.unconfig_ip6()
Neale Rannse11dce22019-12-17 00:14:26 +00001330
Neale Ranns177bbdc2016-11-15 09:46:51 +00001331
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001332if __name__ == "__main__":
Neale Ranns177bbdc2016-11-15 09:46:51 +00001333 unittest.main(testRunner=VppTestRunner)