5 from framework import VppTestCase, VppTestRunner
6 from vpp_sub_interface import VppSubInterface, VppDot1QSubint, VppDot1ADSubint
7 from vpp_ip_route import VppIpMRoute, VppMRoutePath, VppMFibSignal, \
8 MRouteItfFlags, MRouteEntryFlags, VppIpTable, DpoProto
10 from scapy.packet import Raw
11 from scapy.layers.l2 import Ether
12 from scapy.layers.inet import IP, UDP, getmacbyip, ICMP
13 from scapy.layers.inet6 import IPv6, getmacbyip6
17 # The number of packets sent is set to 91 so that when we replicate more than 3
18 # times, which we do for some entries, we will generate more than 256 packets
19 # to the next node in the VLIB graph. Thus we are testing the code's
20 # correctness handling this over-flow.
21 # It's also an odd number so we hit any single loops.
26 class TestMFIB(VppTestCase):
27 """ MFIB Test Case """
30 super(TestMFIB, self).setUp()
33 """ MFIB Unit Tests """
34 error = self.vapi.cli("test mfib")
37 self.logger.critical(error)
38 self.assertEqual(error.find("Failed"), -1)
41 class TestIPMcast(VppTestCase):
42 """ IP Multicast Test Case """
45 super(TestIPMcast, self).setUp()
47 # create 8 pg interfaces
48 self.create_pg_interfaces(range(9))
51 for i in self.pg_interfaces[:8]:
59 tbl4 = VppIpTable(self, 10)
61 self.pg8.set_table_ip4(10)
64 tbl6 = VppIpTable(self, 10, is_ip6=1)
66 self.pg8.set_table_ip6(10)
70 for i in self.pg_interfaces:
75 self.pg8.set_table_ip4(0)
76 self.pg8.set_table_ip6(0)
77 super(TestIPMcast, self).tearDown()
79 def create_stream_ip4(self, src_if, src_ip, dst_ip, payload_size=0):
81 # default to small packet sizes
82 p = (Ether(dst=src_if.local_mac, src=src_if.remote_mac) /
83 IP(src=src_ip, dst=dst_ip) /
84 UDP(sport=1234, dport=1234))
86 payload_size = 64 - len(p)
87 p = p / Raw('\xa5' * payload_size)
89 for i in range(0, N_PKTS_IN_STREAM):
93 def create_stream_ip6(self, src_if, src_ip, dst_ip):
95 for i in range(0, N_PKTS_IN_STREAM):
96 info = self.create_packet_info(src_if, src_if)
97 payload = self.info_to_payload(info)
98 p = (Ether(dst=src_if.local_mac, src=src_if.remote_mac) /
99 IPv6(src=src_ip, dst=dst_ip) /
100 UDP(sport=1234, dport=1234) /
106 def verify_filter(self, capture, sent):
107 if not len(capture) == len(sent):
108 # filter out any IPv6 RAs from the captur
110 if (p.haslayer(IPv6)):
114 def verify_capture_ip4(self, rx_if, sent):
115 rxd = rx_if.get_capture(len(sent))
118 capture = self.verify_filter(rxd, sent)
120 self.assertEqual(len(capture), len(sent))
122 for i in range(len(capture)):
127 self.assertEqual(eth.type, 0x800)
132 # check the MAC address on the RX'd packet is correctly formed
133 self.assertEqual(eth.dst, getmacbyip(rx_ip.dst))
135 self.assertEqual(rx_ip.src, tx_ip.src)
136 self.assertEqual(rx_ip.dst, tx_ip.dst)
137 # IP processing post pop has decremented the TTL
138 self.assertEqual(rx_ip.ttl + 1, tx_ip.ttl)
143 def verify_capture_ip6(self, rx_if, sent):
144 capture = rx_if.get_capture(len(sent))
146 self.assertEqual(len(capture), len(sent))
148 for i in range(len(capture)):
153 self.assertEqual(eth.type, 0x86DD)
158 # check the MAC address on the RX'd packet is correctly formed
159 self.assertEqual(eth.dst, getmacbyip6(rx_ip.dst))
161 self.assertEqual(rx_ip.src, tx_ip.src)
162 self.assertEqual(rx_ip.dst, tx_ip.dst)
163 # IP processing post pop has decremented the TTL
164 self.assertEqual(rx_ip.hlim + 1, tx_ip.hlim)
166 def test_ip_mcast(self):
167 """ IP Multicast Replication """
170 # a stream that matches the default route. gets dropped.
172 self.vapi.cli("clear trace")
173 tx = self.create_stream_ip4(self.pg0, "1.1.1.1", "232.1.1.1")
174 self.pg0.add_stream(tx)
176 self.pg_enable_capture(self.pg_interfaces)
179 self.pg0.assert_nothing_captured(
180 remark="IP multicast packets forwarded on default route")
184 # one accepting interface, pg0, 7 forwarding interfaces
185 # many forwarding interfaces test the case where the replicare DPO
186 # needs to use extra cache lines for the buckets.
188 route_232_1_1_1 = VppIpMRoute(
192 MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE,
193 [VppMRoutePath(self.pg0.sw_if_index,
194 MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT),
195 VppMRoutePath(self.pg1.sw_if_index,
196 MRouteItfFlags.MFIB_ITF_FLAG_FORWARD),
197 VppMRoutePath(self.pg2.sw_if_index,
198 MRouteItfFlags.MFIB_ITF_FLAG_FORWARD),
199 VppMRoutePath(self.pg3.sw_if_index,
200 MRouteItfFlags.MFIB_ITF_FLAG_FORWARD),
201 VppMRoutePath(self.pg4.sw_if_index,
202 MRouteItfFlags.MFIB_ITF_FLAG_FORWARD),
203 VppMRoutePath(self.pg5.sw_if_index,
204 MRouteItfFlags.MFIB_ITF_FLAG_FORWARD),
205 VppMRoutePath(self.pg6.sw_if_index,
206 MRouteItfFlags.MFIB_ITF_FLAG_FORWARD),
207 VppMRoutePath(self.pg7.sw_if_index,
208 MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)])
209 route_232_1_1_1.add_vpp_config()
213 # one accepting interface, pg0, 2 forwarding interfaces
215 route_1_1_1_1_232_1_1_1 = VppIpMRoute(
219 MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE,
220 [VppMRoutePath(self.pg0.sw_if_index,
221 MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT),
222 VppMRoutePath(self.pg1.sw_if_index,
223 MRouteItfFlags.MFIB_ITF_FLAG_FORWARD),
224 VppMRoutePath(self.pg2.sw_if_index,
225 MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)])
226 route_1_1_1_1_232_1_1_1.add_vpp_config()
230 # one accepting interface, pg0, 1 forwarding interfaces
232 route_232 = VppIpMRoute(
236 MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE,
237 [VppMRoutePath(self.pg0.sw_if_index,
238 MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT),
239 VppMRoutePath(self.pg1.sw_if_index,
240 MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)])
241 route_232.add_vpp_config()
244 # a stream that matches the route for (1.1.1.1,232.1.1.1)
247 self.vapi.cli("clear trace")
248 tx = self.create_stream_ip4(self.pg0, "1.1.1.1", "232.1.1.1")
249 self.pg0.add_stream(tx)
251 self.pg_enable_capture(self.pg_interfaces)
254 # We expect replications on Pg1->7
255 self.verify_capture_ip4(self.pg1, tx)
256 self.verify_capture_ip4(self.pg2, tx)
258 # no replications on Pg0
259 self.pg0.assert_nothing_captured(
260 remark="IP multicast packets forwarded on PG0")
261 self.pg3.assert_nothing_captured(
262 remark="IP multicast packets forwarded on PG3")
265 # a stream that matches the route for (1.1.1.1,232.1.1.1)
268 self.vapi.cli("clear trace")
269 tx = self.create_stream_ip4(self.pg0, "1.1.1.1", "232.1.1.1",
271 self.pg0.add_stream(tx)
273 self.pg_enable_capture(self.pg_interfaces)
276 # We expect replications on Pg1->7
277 self.verify_capture_ip4(self.pg1, tx)
278 self.verify_capture_ip4(self.pg2, tx)
280 # no replications on Pg0
281 self.pg0.assert_nothing_captured(
282 remark="IP multicast packets forwarded on PG0")
283 self.pg3.assert_nothing_captured(
284 remark="IP multicast packets forwarded on PG3")
287 # a stream that matches the route for (*,232.0.0.0/8)
288 # Send packets with the 9th bit set so we test the correct clearing
289 # of that bit in the mac rewrite
291 self.vapi.cli("clear trace")
292 tx = self.create_stream_ip4(self.pg0, "1.1.1.1", "232.255.255.255")
293 self.pg0.add_stream(tx)
295 self.pg_enable_capture(self.pg_interfaces)
298 # We expect replications on Pg1 only
299 self.verify_capture_ip4(self.pg1, tx)
301 # no replications on Pg0, Pg2 not Pg3
302 self.pg0.assert_nothing_captured(
303 remark="IP multicast packets forwarded on PG0")
304 self.pg2.assert_nothing_captured(
305 remark="IP multicast packets forwarded on PG2")
306 self.pg3.assert_nothing_captured(
307 remark="IP multicast packets forwarded on PG3")
310 # a stream that matches the route for (*,232.1.1.1)
312 self.vapi.cli("clear trace")
313 tx = self.create_stream_ip4(self.pg0, "1.1.1.2", "232.1.1.1")
314 self.pg0.add_stream(tx)
316 self.pg_enable_capture(self.pg_interfaces)
319 # We expect replications on Pg1, 2, 3.
320 self.verify_capture_ip4(self.pg1, tx)
321 self.verify_capture_ip4(self.pg2, tx)
322 self.verify_capture_ip4(self.pg3, tx)
323 self.verify_capture_ip4(self.pg4, tx)
324 self.verify_capture_ip4(self.pg5, tx)
325 self.verify_capture_ip4(self.pg6, tx)
326 self.verify_capture_ip4(self.pg7, tx)
328 def test_ip6_mcast(self):
329 """ IPv6 Multicast Replication """
332 # a stream that matches the default route. gets dropped.
334 self.vapi.cli("clear trace")
335 tx = self.create_stream_ip6(self.pg0, "2001::1", "ff01::1")
336 self.pg0.add_stream(tx)
338 self.pg_enable_capture(self.pg_interfaces)
341 self.pg0.assert_nothing_captured(
342 remark="IPv6 multicast packets forwarded on default route")
346 # one accepting interface, pg0, 3 forwarding interfaces
348 route_ff01_1 = VppIpMRoute(
352 MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE,
353 [VppMRoutePath(self.pg0.sw_if_index,
354 MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT,
355 proto=DpoProto.DPO_PROTO_IP6),
356 VppMRoutePath(self.pg1.sw_if_index,
357 MRouteItfFlags.MFIB_ITF_FLAG_FORWARD,
358 proto=DpoProto.DPO_PROTO_IP6),
359 VppMRoutePath(self.pg2.sw_if_index,
360 MRouteItfFlags.MFIB_ITF_FLAG_FORWARD,
361 proto=DpoProto.DPO_PROTO_IP6),
362 VppMRoutePath(self.pg3.sw_if_index,
363 MRouteItfFlags.MFIB_ITF_FLAG_FORWARD,
364 proto=DpoProto.DPO_PROTO_IP6)],
366 route_ff01_1.add_vpp_config()
370 # one accepting interface, pg0, 2 forwarding interfaces
372 route_2001_ff01_1 = VppIpMRoute(
376 MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE,
377 [VppMRoutePath(self.pg0.sw_if_index,
378 MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT,
379 proto=DpoProto.DPO_PROTO_IP6),
380 VppMRoutePath(self.pg1.sw_if_index,
381 MRouteItfFlags.MFIB_ITF_FLAG_FORWARD,
382 proto=DpoProto.DPO_PROTO_IP6),
383 VppMRoutePath(self.pg2.sw_if_index,
384 MRouteItfFlags.MFIB_ITF_FLAG_FORWARD,
385 proto=DpoProto.DPO_PROTO_IP6)],
387 route_2001_ff01_1.add_vpp_config()
391 # one accepting interface, pg0, 1 forwarding interface
393 route_ff01 = VppIpMRoute(
397 MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE,
398 [VppMRoutePath(self.pg0.sw_if_index,
399 MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT,
400 proto=DpoProto.DPO_PROTO_IP6),
401 VppMRoutePath(self.pg1.sw_if_index,
402 MRouteItfFlags.MFIB_ITF_FLAG_FORWARD,
403 proto=DpoProto.DPO_PROTO_IP6)],
405 route_ff01.add_vpp_config()
408 # a stream that matches the route for (*, ff01::/16)
409 # sent on the non-accepting interface
411 self.vapi.cli("clear trace")
412 tx = self.create_stream_ip6(self.pg1, "2002::1", "ff01:2::255")
413 self.send_and_assert_no_replies(self.pg1, tx, "RPF miss")
416 # a stream that matches the route for (*, ff01::/16)
417 # sent on the accepting interface
419 self.vapi.cli("clear trace")
420 tx = self.create_stream_ip6(self.pg0, "2002::1", "ff01:2::255")
421 self.pg0.add_stream(tx)
423 self.pg_enable_capture(self.pg_interfaces)
426 # We expect replications on Pg1
427 self.verify_capture_ip6(self.pg1, tx)
429 # no replications on Pg0, Pg3
430 self.pg0.assert_nothing_captured(
431 remark="IP multicast packets forwarded on PG0")
432 self.pg2.assert_nothing_captured(
433 remark="IP multicast packets forwarded on PG2")
434 self.pg3.assert_nothing_captured(
435 remark="IP multicast packets forwarded on PG3")
438 # Bounce the interface and it should still work
440 self.pg1.admin_down()
441 self.pg0.add_stream(tx)
442 self.pg_enable_capture(self.pg_interfaces)
444 self.pg1.assert_nothing_captured(
445 remark="IP multicast packets forwarded on down PG1")
448 self.pg0.add_stream(tx)
449 self.pg_enable_capture(self.pg_interfaces)
451 self.verify_capture_ip6(self.pg1, tx)
454 # a stream that matches the route for (*,ff01::1)
456 self.vapi.cli("clear trace")
457 tx = self.create_stream_ip6(self.pg0, "2002::2", "ff01::1")
458 self.pg0.add_stream(tx)
460 self.pg_enable_capture(self.pg_interfaces)
463 # We expect replications on Pg1, 2, 3.
464 self.verify_capture_ip6(self.pg1, tx)
465 self.verify_capture_ip6(self.pg2, tx)
466 self.verify_capture_ip6(self.pg3, tx)
468 # no replications on Pg0
469 self.pg0.assert_nothing_captured(
470 remark="IPv6 multicast packets forwarded on PG0")
473 # a stream that matches the route for (2001::1, ff00::1)
475 self.vapi.cli("clear trace")
476 tx = self.create_stream_ip6(self.pg0, "2001::1", "ff01::1")
477 self.pg0.add_stream(tx)
479 self.pg_enable_capture(self.pg_interfaces)
482 # We expect replications on Pg1, 2,
483 self.verify_capture_ip6(self.pg1, tx)
484 self.verify_capture_ip6(self.pg2, tx)
486 # no replications on Pg0, Pg3
487 self.pg0.assert_nothing_captured(
488 remark="IP multicast packets forwarded on PG0")
489 self.pg3.assert_nothing_captured(
490 remark="IP multicast packets forwarded on PG3")
492 def _mcast_connected_send_stream(self, dst_ip):
493 self.vapi.cli("clear trace")
494 tx = self.create_stream_ip4(self.pg0,
497 self.pg0.add_stream(tx)
499 self.pg_enable_capture(self.pg_interfaces)
502 # We expect replications on Pg1.
503 self.verify_capture_ip4(self.pg1, tx)
507 def test_ip_mcast_connected(self):
508 """ IP Multicast Connected Source check """
512 # one accepting interface, pg0, 1 forwarding interfaces
514 route_232_1_1_1 = VppIpMRoute(
518 MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE,
519 [VppMRoutePath(self.pg0.sw_if_index,
520 MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT),
521 VppMRoutePath(self.pg1.sw_if_index,
522 MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)])
524 route_232_1_1_1.add_vpp_config()
525 route_232_1_1_1.update_entry_flags(
526 MRouteEntryFlags.MFIB_ENTRY_FLAG_CONNECTED)
529 # Now the (*,G) is present, send from connected source
531 tx = self._mcast_connected_send_stream("232.1.1.1")
534 # Constrct a representation of the signal we expect on pg0
536 signal_232_1_1_1_itf_0 = VppMFibSignal(self,
538 self.pg0.sw_if_index,
542 # read the only expected signal
544 signals = self.vapi.mfib_signal_dump()
546 self.assertEqual(1, len(signals))
548 signal_232_1_1_1_itf_0.compare(signals[0])
551 # reading the signal allows for the generation of another
552 # so send more packets and expect the next signal
554 tx = self._mcast_connected_send_stream("232.1.1.1")
556 signals = self.vapi.mfib_signal_dump()
557 self.assertEqual(1, len(signals))
558 signal_232_1_1_1_itf_0.compare(signals[0])
561 # A Second entry with connected check
562 # one accepting interface, pg0, 1 forwarding interfaces
564 route_232_1_1_2 = VppIpMRoute(
568 MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE,
569 [VppMRoutePath(self.pg0.sw_if_index,
570 MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT),
571 VppMRoutePath(self.pg1.sw_if_index,
572 MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)])
574 route_232_1_1_2.add_vpp_config()
575 route_232_1_1_2.update_entry_flags(
576 MRouteEntryFlags.MFIB_ENTRY_FLAG_CONNECTED)
579 # Send traffic to both entries. One read should net us two signals
581 signal_232_1_1_2_itf_0 = VppMFibSignal(self,
583 self.pg0.sw_if_index,
585 tx = self._mcast_connected_send_stream("232.1.1.1")
586 tx2 = self._mcast_connected_send_stream("232.1.1.2")
589 # read the only expected signal
591 signals = self.vapi.mfib_signal_dump()
593 self.assertEqual(2, len(signals))
595 signal_232_1_1_1_itf_0.compare(signals[1])
596 signal_232_1_1_2_itf_0.compare(signals[0])
598 route_232_1_1_1.update_entry_flags(
599 MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE)
600 route_232_1_1_2.update_entry_flags(
601 MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE)
603 def test_ip_mcast_signal(self):
604 """ IP Multicast Signal """
608 # one accepting interface, pg0, 1 forwarding interfaces
610 route_232_1_1_1 = VppIpMRoute(
614 MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE,
615 [VppMRoutePath(self.pg0.sw_if_index,
616 MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT),
617 VppMRoutePath(self.pg1.sw_if_index,
618 MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)])
620 route_232_1_1_1.add_vpp_config()
621 route_232_1_1_1.update_entry_flags(
622 MRouteEntryFlags.MFIB_ENTRY_FLAG_SIGNAL)
625 # Now the (*,G) is present, send from connected source
627 tx = self._mcast_connected_send_stream("232.1.1.1")
630 # Constrct a representation of the signal we expect on pg0
632 signal_232_1_1_1_itf_0 = VppMFibSignal(self,
634 self.pg0.sw_if_index,
638 # read the only expected signal
640 signals = self.vapi.mfib_signal_dump()
642 self.assertEqual(1, len(signals))
644 signal_232_1_1_1_itf_0.compare(signals[0])
647 # reading the signal allows for the generation of another
648 # so send more packets and expect the next signal
650 tx = self._mcast_connected_send_stream("232.1.1.1")
652 signals = self.vapi.mfib_signal_dump()
653 self.assertEqual(1, len(signals))
654 signal_232_1_1_1_itf_0.compare(signals[0])
657 # Set the negate-signal on the accepting interval - the signals
660 route_232_1_1_1.update_path_flags(
661 self.pg0.sw_if_index,
662 (MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT |
663 MRouteItfFlags.MFIB_ITF_FLAG_NEGATE_SIGNAL))
665 self.vapi.cli("clear trace")
666 tx = self._mcast_connected_send_stream("232.1.1.1")
668 signals = self.vapi.mfib_signal_dump()
669 self.assertEqual(0, len(signals))
672 # Clear the SIGNAL flag on the entry and the signals should
673 # come back since the interface is still NEGATE-SIGNAL
675 route_232_1_1_1.update_entry_flags(
676 MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE)
678 tx = self._mcast_connected_send_stream("232.1.1.1")
680 signals = self.vapi.mfib_signal_dump()
681 self.assertEqual(1, len(signals))
682 signal_232_1_1_1_itf_0.compare(signals[0])
685 # Lastly remove the NEGATE-SIGNAL from the interface and the
686 # signals should stop
688 route_232_1_1_1.update_path_flags(self.pg0.sw_if_index,
689 MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT)
691 tx = self._mcast_connected_send_stream("232.1.1.1")
692 signals = self.vapi.mfib_signal_dump()
693 self.assertEqual(0, len(signals))
695 def test_ip_mcast_vrf(self):
696 """ IP Multicast Replication in non-default table"""
700 # one accepting interface, pg0, 2 forwarding interfaces
702 route_1_1_1_1_232_1_1_1 = VppIpMRoute(
706 MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE,
707 [VppMRoutePath(self.pg8.sw_if_index,
708 MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT),
709 VppMRoutePath(self.pg1.sw_if_index,
710 MRouteItfFlags.MFIB_ITF_FLAG_FORWARD),
711 VppMRoutePath(self.pg2.sw_if_index,
712 MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)],
714 route_1_1_1_1_232_1_1_1.add_vpp_config()
717 # a stream that matches the route for (1.1.1.1,232.1.1.1)
720 self.vapi.cli("clear trace")
721 tx = self.create_stream_ip4(self.pg8, "1.1.1.1", "232.1.1.1")
722 self.pg8.add_stream(tx)
724 self.pg_enable_capture(self.pg_interfaces)
727 # We expect replications on Pg1 & 2
728 self.verify_capture_ip4(self.pg1, tx)
729 self.verify_capture_ip4(self.pg2, tx)
731 def test_ip6_mcast_vrf(self):
732 """ IPv6 Multicast Replication in non-default table"""
736 # one accepting interface, pg0, 2 forwarding interfaces
738 route_2001_ff01_1 = VppIpMRoute(
742 MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE,
743 [VppMRoutePath(self.pg8.sw_if_index,
744 MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT,
745 proto=DpoProto.DPO_PROTO_IP6),
746 VppMRoutePath(self.pg1.sw_if_index,
747 MRouteItfFlags.MFIB_ITF_FLAG_FORWARD,
748 proto=DpoProto.DPO_PROTO_IP6),
749 VppMRoutePath(self.pg2.sw_if_index,
750 MRouteItfFlags.MFIB_ITF_FLAG_FORWARD,
751 proto=DpoProto.DPO_PROTO_IP6)],
754 route_2001_ff01_1.add_vpp_config()
757 # a stream that matches the route for (2001::1, ff00::1)
759 self.vapi.cli("clear trace")
760 tx = self.create_stream_ip6(self.pg8, "2001::1", "ff01::1")
761 self.pg8.add_stream(tx)
763 self.pg_enable_capture(self.pg_interfaces)
766 # We expect replications on Pg1, 2,
767 self.verify_capture_ip6(self.pg1, tx)
768 self.verify_capture_ip6(self.pg2, tx)
770 def test_bidir(self):
771 """ IP Multicast Bi-directional """
774 # A (*,G). The set of accepting interfaces matching the forwarding
776 route_232_1_1_1 = VppIpMRoute(
780 MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE,
781 [VppMRoutePath(self.pg0.sw_if_index,
782 MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT |
783 MRouteItfFlags.MFIB_ITF_FLAG_FORWARD),
784 VppMRoutePath(self.pg1.sw_if_index,
785 MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT |
786 MRouteItfFlags.MFIB_ITF_FLAG_FORWARD),
787 VppMRoutePath(self.pg2.sw_if_index,
788 MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT |
789 MRouteItfFlags.MFIB_ITF_FLAG_FORWARD),
790 VppMRoutePath(self.pg3.sw_if_index,
791 MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT |
792 MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)])
793 route_232_1_1_1.add_vpp_config()
795 tx = self.create_stream_ip4(self.pg0, "1.1.1.1", "232.1.1.1")
796 self.pg0.add_stream(tx)
798 self.pg_enable_capture(self.pg_interfaces)
801 # We expect replications on Pg1, 2, 3, but not on pg0
802 self.verify_capture_ip4(self.pg1, tx)
803 self.verify_capture_ip4(self.pg2, tx)
804 self.verify_capture_ip4(self.pg3, tx)
805 self.pg0.assert_nothing_captured(
806 remark="IP multicast packets forwarded on PG0")
809 if __name__ == '__main__':
810 unittest.main(testRunner=VppTestRunner)