X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Ftest_ip_mcast.py;h=094942b35facbd3d28a63368b0272f6829c1bf16;hb=180279b912827c30494ec1b90ee4325a15cb337c;hp=957bab5a2af6a0c488993bf8e8dd83032549e6c7;hpb=37be73693a46b05360483778efee3313a71654f5;p=vpp.git diff --git a/test/test_ip_mcast.py b/test/test_ip_mcast.py index 957bab5a2af..094942b35fa 100644 --- a/test/test_ip_mcast.py +++ b/test/test_ip_mcast.py @@ -4,31 +4,15 @@ import unittest from framework import VppTestCase, VppTestRunner from vpp_sub_interface import VppSubInterface, VppDot1QSubint, VppDot1ADSubint -from vpp_ip_route import VppIpMRoute, VppMRoutePath, VppMFibSignal +from vpp_ip_route import VppIpMRoute, VppMRoutePath, VppMFibSignal, \ + MRouteItfFlags, MRouteEntryFlags from scapy.packet import Raw from scapy.layers.l2 import Ether -from scapy.layers.inet import IP, UDP, getmacbyip +from scapy.layers.inet import IP, UDP, getmacbyip, ICMP from scapy.layers.inet6 import IPv6, getmacbyip6 from util import ppp - -class MRouteItfFlags: - MFIB_ITF_FLAG_NONE = 0 - MFIB_ITF_FLAG_NEGATE_SIGNAL = 1 - MFIB_ITF_FLAG_ACCEPT = 2 - MFIB_ITF_FLAG_FORWARD = 4 - MFIB_ITF_FLAG_SIGNAL_PRESENT = 8 - MFIB_ITF_FLAG_INTERNAL_COPY = 16 - - -class MRouteEntryFlags: - MFIB_ENTRY_FLAG_NONE = 0 - MFIB_ENTRY_FLAG_SIGNAL = 1 - MFIB_ENTRY_FLAG_DROP = 2 - MFIB_ENTRY_FLAG_CONNECTED = 4 - MFIB_ENTRY_FLAG_INHERIT_ACCEPT = 8 - # # The number of packets sent is set to 90 so that when we replicate more than 3 # times, which we do for some entries, we will generate more than 256 packets @@ -70,16 +54,17 @@ class TestIPMcast(VppTestCase): i.resolve_arp() i.resolve_ndp() - def create_stream_ip4(self, src_if, src_ip, dst_ip): + def create_stream_ip4(self, src_if, src_ip, dst_ip, payload_size=0): pkts = [] + # default to small packet sizes + p = (Ether(dst=src_if.local_mac, src=src_if.remote_mac) / + IP(src=src_ip, dst=dst_ip) / + UDP(sport=1234, dport=1234)) + if not payload_size: + payload_size = 64 - len(p) + p = p / Raw('\xa5' * payload_size) + for i in range(0, N_PKTS_IN_STREAM): - info = self.create_packet_info(src_if, src_if) - payload = self.info_to_payload(info) - p = (Ether(dst=src_if.local_mac, src=src_if.remote_mac) / - IP(src=src_ip, dst=dst_ip) / - UDP(sport=1234, dport=1234) / - Raw(payload)) - info.data = p.copy() pkts.append(p) return pkts @@ -237,6 +222,7 @@ class TestIPMcast(VppTestCase): # # a stream that matches the route for (1.1.1.1,232.1.1.1) + # small packets # self.vapi.cli("clear trace") tx = self.create_stream_ip4(self.pg0, "1.1.1.1", "232.1.1.1") @@ -254,6 +240,33 @@ class TestIPMcast(VppTestCase): self.verify_capture_ip4(self.pg6, tx) self.verify_capture_ip4(self.pg7, tx) + # no replications on Pg0 + self.pg0.assert_nothing_captured( + remark="IP multicast packets forwarded on PG0") + self.pg3.assert_nothing_captured( + remark="IP multicast packets forwarded on PG3") + + # + # a stream that matches the route for (1.1.1.1,232.1.1.1) + # large packets + # + self.vapi.cli("clear trace") + tx = self.create_stream_ip4(self.pg0, "1.1.1.1", "232.1.1.1", + payload_size=1024) + self.pg0.add_stream(tx) + + self.pg_enable_capture(self.pg_interfaces) + self.pg_start() + + # We expect replications on Pg1->7 + self.verify_capture_ip4(self.pg1, tx) + self.verify_capture_ip4(self.pg2, tx) + self.verify_capture_ip4(self.pg3, tx) + self.verify_capture_ip4(self.pg4, tx) + self.verify_capture_ip4(self.pg5, tx) + self.verify_capture_ip4(self.pg6, tx) + self.verify_capture_ip4(self.pg7, tx) + # no replications on Pg0 self.pg0.assert_nothing_captured( remark="IP multicast packets forwarded on PG0")