From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <dev-bounces@dpdk.org> Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 73FB445681; Mon, 22 Jul 2024 15:08:48 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5F904402AC; Mon, 22 Jul 2024 15:08:48 +0200 (CEST) Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) by mails.dpdk.org (Postfix) with ESMTP id 52744400D7 for <dev@dpdk.org>; Mon, 22 Jul 2024 15:08:46 +0200 (CEST) Received: by mail-pg1-f182.google.com with SMTP id 41be03b00d2f7-7a18ba4143bso639265a12.2 for <dev@dpdk.org>; Mon, 22 Jul 2024 06:08:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1721653725; x=1722258525; darn=dpdk.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=01RE9AhQdOTuoEjb7KTIXC7WwPVxuh3l+iwKscEHqWk=; b=MuHNwUqAbEa3O0JbicK+IGSVcooPjJDmiXe0Syo/bWAPZ9Cxt86qovxhVBng7y5sTH bpiOuA58kUcKr9q1ITzeHsJubFg/o9L5CAjPTYZZAPr2IQRjbqvCR//UVe6rUzSkFIq0 MlVVRYphyOms7uG0NoVV3pvV+38jfLSTpRJrk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721653725; x=1722258525; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=01RE9AhQdOTuoEjb7KTIXC7WwPVxuh3l+iwKscEHqWk=; b=WqrcCqCY31vyBYKyCjtne3iUnzmakPD8OuJkDHIlnG9pZ/dvtyQkliEDuachiEatsU lp8+b+2KpoXViR4efN8D+J3ZluEr8na8xwkfmeXWweEK7pHRRcfCGcsbPrz7hI+fkI/1 xZh7O4+ETvn7jvXO52vP2rt1xid6Log/Op1TY/QhI0qpHjKBb7DtV2cFnvAYuImQsIeB 8DMaSchh99ub2pY4n/+48i4KuqJq03rkAI14Gu5q/HPLskW6jCmZUxgr9pQ/mcSdHu2a JOUDyYOQ5p2Ytkl+Q+BnLKDbTD+DJjW5yGDU0BD5fR25auBL8Z2hL9rGMD/+zSoUSApl BxCA== X-Forwarded-Encrypted: i=1; AJvYcCVPoEtD/svh9FQOYy0mAhUsI3zpdwLH7Iia9qNyUitL+suQVvmE9dWLmX1JMkBWi6oZoRZ4jhLGAJ9Qrr0= X-Gm-Message-State: AOJu0YztU+pbd30ny6SSNr12M6+igeW76wdxabCKkKEtuKq5MKD+JbOb rNmBMbKhIG57FdRg3c1UeSEuxKVTJBPMIY7lNGcHk2sM69terOvQZPpZ3/kyspARJJppOg2j2Wm e1r92h1R4I1L3ttLT0/GiyLP2cRsna0grTEmNGQ== X-Google-Smtp-Source: AGHT+IFJtG1Fwcvzej4BajOm1QOjfjw7hEPgSH6QD/aEU26114RYrjYtzn0K0ADycWshM738Fs8g5xvr+QP/yeht5Q8= X-Received: by 2002:a05:6a20:7486:b0:1c0:f648:8574 with SMTP id adf61e73a8af0-1c4285ef476mr4514212637.29.1721653725161; Mon, 22 Jul 2024 06:08:45 -0700 (PDT) MIME-Version: 1.0 References: <20240718190509.4203-1-npratte@iol.unh.edu> <20240718194028.2849-1-npratte@iol.unh.edu> In-Reply-To: <20240718194028.2849-1-npratte@iol.unh.edu> From: Dean Marx <dmarx@iol.unh.edu> Date: Mon, 22 Jul 2024 09:08:28 -0400 Message-ID: <CABD7UXMTYAzc+NX+g3MxKwcMQXK8fgeDArMnyVOU5rb2Xw7avA@mail.gmail.com> Subject: Re: [PATCH v3 3/3] dts: mac filter test suite refactored for new dts To: Nicholas Pratte <npratte@iol.unh.edu> Cc: probb@iol.unh.edu, paul.szczepanek@arm.com, luca.vizzarro@arm.com, jspewock@iol.unh.edu, Honnappa.Nagarahalli@arm.com, yoan.picchi@foss.arm.com, juraj.linkes@pantheon.tech, dev@dpdk.org Content-Type: multipart/alternative; boundary="000000000000b700d9061dd5be9b" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions <dev.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org --000000000000b700d9061dd5be9b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > > <snip> +This test suite ensures proper and expected behavior of Allowlist filterin= g > via mac > +addresses on devices bound to the Poll Mode Driver. If a packet received > on a device > +contains a mac address not contained with its mac address pool, the > packet should > +be dropped. Alternatively, if a packet is received that contains a > destination mac > +within the devices address pool, the packet should be accepted and > forwarded. This > +behavior should remain consistent across all packets, namely those > containing dot1q > +tags or otherwise. > This is pretty minor but you might want to change "with its mac address pool" to "within", just to stay consistent with the wording in the rest of the suite > <snip> > + received_packets =3D [ > + packets > + for packets in self.send_packet_and_capture(packet, > adjust_addresses=3DFalse) > + if hasattr(packets, "load") and "X" * 22 in str(packets.load= ) > + ] > Also Jeremy said he mentioned Juraj's opinion on using Jeremy's method of turning off adjust addresses, if you end up doing that just make it depend on this patch: patch-1142113 ("add send_packets to test suites and rework packet addressing") Reviewed-by: Dean Marx <dmarx@iol.unh.edu> On Thu, Jul 18, 2024 at 3:40=E2=80=AFPM Nicholas Pratte <npratte@iol.unh.ed= u> wrote: > The mac address filter test suite, whose test cases are based on old > DTS's test cases, has been refactored to interface with the new DTS > framework. > > In porting over this test suite into the new framework, some > adjustments were made, namely in the EAL and TestPMD parameter provided > before executing the application. While the original test plan was > referenced, by and large, only for the individual test cases, I'll leave > the parameters the original test plan was asking for below for the sake > of discussion: > > --burst=3D1 --rxpt=3D0 --rxht=3D0 --rxwt=3D0 --txpt=3D36 --txht=3D0 --txw= t=3D0 > --txfreet=3D32 --rxfreet=3D64 --mbcache=3D250 --portmask=3D0x3 > > Bugzilla ID: 1454 > Signed-off-by: Nicholas Pratte <npratte@iol.unh.edu> > > --- > v2: > * Refactored the address pool capacity tests to use all available > octets in the mac address. > * Change the payload to 'X' characters instead of 'P' characters. > --- > dts/framework/config/conf_yaml_schema.json | 3 +- > dts/tests/TestSuite_mac_filter.py | 223 +++++++++++++++++++++ > 2 files changed, 225 insertions(+), 1 deletion(-) > create mode 100644 dts/tests/TestSuite_mac_filter.py > > diff --git a/dts/framework/config/conf_yaml_schema.json > b/dts/framework/config/conf_yaml_schema.json > index f02a310bb5..ad1f3757f7 100644 > --- a/dts/framework/config/conf_yaml_schema.json > +++ b/dts/framework/config/conf_yaml_schema.json > @@ -187,7 +187,8 @@ > "enum": [ > "hello_world", > "os_udp", > - "pmd_buffer_scatter" > + "pmd_buffer_scatter", > + "mac_filter" > ] > }, > "test_target": { > diff --git a/dts/tests/TestSuite_mac_filter.py > b/dts/tests/TestSuite_mac_filter.py > new file mode 100644 > index 0000000000..53a3331224 > --- /dev/null > +++ b/dts/tests/TestSuite_mac_filter.py > @@ -0,0 +1,223 @@ > +# SPDX-License-Identifier: BSD-3-Clause > +# Copyright(c) 2023-2024 University of New Hampshire > +"""Mac address filtering test suite. > + > +This test suite ensures proper and expected behavior of Allowlist > filtering via mac > +addresses on devices bound to the Poll Mode Driver. If a packet received > on a device > +contains a mac address not contained with its mac address pool, the > packet should > +be dropped. Alternatively, if a packet is received that contains a > destination mac > +within the devices address pool, the packet should be accepted and > forwarded. This > +behavior should remain consistent across all packets, namely those > containing dot1q > +tags or otherwise. > + > +The following test suite assesses behaviors based on the aforementioned > logic. > +Additionally, testing is done within the PMD itself to ensure that the > mac address > +allow list is behaving as expected. > +""" > + > +from time import sleep > + > +from scapy.layers.inet import IP # type: ignore[import-untyped] > +from scapy.layers.l2 import Dot1Q, Ether # type: ignore[import-untyped] > +from scapy.packet import Raw # type: ignore[import-untyped] > + > +from framework.exception import InteractiveCommandExecutionError > +from framework.remote_session.testpmd_shell import TestPmdShell > +from framework.test_suite import TestSuite > + > + > +class TestMacFilter(TestSuite): > + """Mac address allowlist filtering test suite. > + > + Configure mac address filtering on a given port, and test the port's > filtering behavior > + using both a given port's hardware address as well as dummy > addresses. If a port accepts > + a packet that is not contained within its mac address allowlist, the= n > a given test case > + fails. Alternatively, if a port drops a packet that is designated > within its mac address > + allowlist, a given test case will fail. > + > + Moreover, a given port should demonstrate proper behavior when bound > to the Poll Mode > + Driver. A port should not have a mac address allowlist that exceeds > its designated size. > + A port's default hardware address should not be removed from its > address pool, and invalid > + addresses should not be included in the allowlist. If a port abides > by the above rules, the > + test case passes. > + """ > + > + def send_packet_and_verify( > + self, > + mac_address: str, > + add_vlan: bool =3D False, > + should_receive: bool =3D True, > + ) -> None: > + """Generate, send, and verify a packet based on specified > parameters. > + > + Test cases within this suite utilize this method to create, send= , > and verify > + packets based on criteria relating to the packet's destination > mac address, > + vlan tag, and whether or not the packet should be received or > not. Packets > + are verified using an inserted payload. Assuming the test case > expects to > + receive a specified packet, if the list of received packets > contains this > + payload within any of its packets, the test case passes. > Alternatively, if > + the designed packet should not be received, and the packet > payload is not, > + received, then the test case fails. Each call with this method > sends exactly > + one packet. > + > + Args: > + mac_address: The destination mac address of the packet being > sent. > + add_vlan: If :data:'True', add a vlan tag to the packet bein= g > sent. The > + vlan tag will be :data:'2' if the packet should be > received and > + :data:'1' if the packet should not be received but > requires a vlan tag. > + should_receive: If :data:'True', assert whether or not the > sent packet > + has been received. If :data:'False', assert that the sen= d > packet was not > + received. :data:'True' by default > + """ > + if add_vlan: > + packet =3D Ether() / Dot1Q(vlan=3D2 if should_receive else 1= ) / > IP() / Raw(load=3D"X" * 22) > + else: > + packet =3D Ether() / IP() / Raw(load=3D"X" * 22) > + packet.dst =3D mac_address > + received_packets =3D [ > + packets > + for packets in self.send_packet_and_capture(packet, > adjust_addresses=3DFalse) > + if hasattr(packets, "load") and "X" * 22 in str(packets.load= ) > + ] > + if should_receive: > + self.verify(len(received_packets) =3D=3D 1, "Expected packet= not > received") > + else: > + self.verify(len(received_packets) =3D=3D 0, "Expected packet > received") > + > + def test_add_remove_mac_addresses(self) -> None: > + """Assess basic mac addressing filtering functionalities. > + > + This test case validates for proper behavior of mac address > filtering with both > + a port's default, burned-in mac address, as well as additional > mac addresses > + added to the PMD. Packets should either be received or not > received depending on > + the properties applied to the PMD at any given time. > + > + Test: > + Start TestPMD with promiscuous mode. > + Send a packet with the port's default mac address. (Should > receive) > + Send a packet with fake mac address. (Should not receive) > + Add fake mac address to the PMD's address pool. > + Send a packet with the fake mac address to the PMD. (Should > receive) > + Remove the fake mac address from the PMD's address pool. > + Sent a packet with the fake mac address to the PMD. (Should > not receive) > + """ > + testpmd =3D TestPmdShell(self.sut_node) > + testpmd.set_promisc(0, on=3DFalse) > + testpmd.start() > + mac_address =3D self._sut_port_ingress.mac_address > + > + # Send a packet with NIC default mac address > + self.send_packet_and_verify(mac_address=3Dmac_address, > should_receive=3DTrue) > + # Send a packet with different mac address > + fake_address =3D "00:00:00:00:00:01" > + self.send_packet_and_verify(mac_address=3Dfake_address, > should_receive=3DFalse) > + > + # Add mac address to pool and rerun tests > + testpmd.set_mac_addr(0, mac_address=3Dfake_address, add=3DTrue) > + self.send_packet_and_verify(mac_address=3Dfake_address, > should_receive=3DTrue) > + testpmd.set_mac_addr(0, mac_address=3Dfake_address, add=3DFalse) > + self.send_packet_and_verify(mac_address=3Dfake_address, > should_receive=3DFalse) > + testpmd.close() > + sleep(6) > + > + def test_invalid_address(self) -> None: > + """Assess the behavior of a NIC mac address pool while bound to > the PMD. > + > + An assessment of a NIC's behavior when mounted to a PMD as it > relates to mac addresses > + and address pooling. Devices should not be able to use invalid > mac addresses, remove their > + built-in hardware address, or exceed their address pools. > + > + Test: > + Start TestPMD. > + Attempt to add an invalid mac address. (Should fail) > + Attempt to remove the device's hardware address with no > additional addresses in the > + address pool. (Should fail) > + Add a fake mac address to the pool twice in succession. > (Should not create any errors) > + Attempt to remove the device's hardware address with other > addresses in the address > + pool. (Should fail) > + Determine the device's mac address pool size, and fill the > pool with fake addresses. > + Attempt to add another fake mac address, overloading the > address pool. (Should fail) > + """ > + testpmd =3D TestPmdShell(self.sut_node) > + testpmd.start() > + mac_address =3D self._sut_port_ingress.mac_address > + try: > + testpmd.set_mac_addr(0, "00:00:00:00:00:00", add=3DTrue) > + self.verify(False, "Invalid mac address added.") > + except InteractiveCommandExecutionError: > + pass > + try: > + testpmd.set_mac_addr(0, mac_address, add=3DFalse) > + self.verify(False, "Default mac address removed.") > + except InteractiveCommandExecutionError: > + pass > + # Should be no errors adding this twice > + testpmd.set_mac_addr(0, "1" + mac_address[1:], add=3DTrue) > + testpmd.set_mac_addr(0, "1" + mac_address[1:], add=3DTrue) > + # Double check to see if default mac address can be removed > + try: > + testpmd.set_mac_addr(0, mac_address, add=3DFalse) > + self.verify(False, "Default mac address removed.") > + except InteractiveCommandExecutionError: > + pass > + > + for i in range(testpmd.show_port_info(0).max_mac_addresses_num - > 1): > + # A0 fake address based on the index 'i'. > + fake_address =3D str(hex(i)[2:].zfill(12)) > + # Insert ':' characters every two indexes to create a fake > mac address. > + fake_address =3D ":".join(fake_address[x : x + 2] for x in > range(0, len(fake_address), 2)) > + testpmd.set_mac_addr(0, fake_address, add=3DTrue, verify=3DF= alse) > + try: > + testpmd.set_mac_addr(0, "F" + mac_address[1:], add=3DTrue) > + self.verify(False, "Mac address limit exceeded.") > + except InteractiveCommandExecutionError: > + pass > + testpmd.close() > + sleep(6) > + > + def test_multicast_filter(self) -> None: > + """Assess basic multicast address filtering functionalities. > + > + Ensure that multicast filtering performs as intended when a give= n > device is bound > + to the PMD, with and without dot1q vlan tagging. > + > + Test: > + Start TestPMD with promiscuous mode. > + Add a fake multicast address to the PMD's multicast address > pool. > + Send a packet with the fake multicast address to the PMD. > (Should receive) > + Set vlan filtering on the PMD, and add vlan ID to the PMD. > + Send a packet with the fake multicast address and vlan ID to > the PMD. (Should receive) > + Send a packet with the fake multicast address and a differen= t > vlan ID to the PMD. > + (Should not receive) > + Remove the vlan tag from the PMD, and turn vlan filtering of= f > on the PMD. > + Send a packet with the fake multicast address and no vlan ta= g > to the PMD. > + (Should receive) > + Remove the fake multicast address from the PMDs multicast > address filter. > + Send a packet with the fake multicast address to the PMD. > (Should not receive) > + """ > + testpmd =3D TestPmdShell(self.sut_node) > + testpmd.start() > + testpmd.set_promisc(0, on=3DFalse) > + multicast_address =3D "01:00:5E:00:00:00" > + vlan_id =3D 2 > + > + testpmd.set_multicast_mac_addr(0, multi_addr=3Dmulticast_address= , > add=3DTrue) > + self.send_packet_and_verify(multicast_address, > should_receive=3DTrue) > + > + # Test vlan filtering on multicast addressing. > + # Verify vlan functionality for debugging purposes. > + testpmd.vlan_filter_set_on(port=3D0) > + testpmd.rx_vlan_add(vlan_id, 0) > + self.send_packet_and_verify(multicast_address, > should_receive=3DTrue, add_vlan=3DTrue) > + self.send_packet_and_verify(multicast_address, > should_receive=3DFalse, add_vlan=3DTrue) > + > + # Remove vlan tag and filtering and run basic multicast addr tes= t. > + testpmd.rx_vlan_rm(vlan_id, 0) > + testpmd.vlan_filter_set_off(port=3D0) > + self.send_packet_and_verify(multicast_address, > should_receive=3DTrue) > + > + # Remove multicast filter and verify the packet was not received= . > + testpmd.set_multicast_mac_addr(0, multicast_address, add=3DFalse= ) > + self.send_packet_and_verify(multicast_address, > should_receive=3DFalse) > + testpmd.close() > + sleep(6) > -- > 2.44.0 > > --000000000000b700d9061dd5be9b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px = 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><snip= >=C2=A0</blockquote><blockquote class=3D"gmail_quote" style=3D"margin:0p= x 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><s= pan class=3D"gmail-im" style=3D"color:rgb(80,0,80)">+This test suite ensure= s proper and expected behavior of Allowlist=C2=A0<span class=3D"gmail-il">f= iltering</span>=C2=A0via=C2=A0<span class=3D"gmail-il">mac</span><br>+addre= sses on devices bound to the Poll Mode Driver. If a packet received on a de= vice<br>+contains a=C2=A0<span class=3D"gmail-il">mac</span>=C2=A0address n= ot contained with its=C2=A0<span class=3D"gmail-il">mac</span>=C2=A0address= pool, the packet should<br>+be dropped. Alternatively, if a packet is rece= ived that contains a destination=C2=A0<span class=3D"gmail-il">mac</span><b= r>+within the devices address pool, the packet should be accepted and forwa= rded. This<br>+behavior should remain consistent across all packets, namely= those containing dot1q<br>+tags or otherwise.<br></span></blockquote><div>= <br></div><div>This is pretty minor but you might want to change "with= its=C2=A0<span class=3D"gmail-il">mac</span>=C2=A0address pool" to &q= uot;within", just</div><div>to stay consistent with the wording in the= rest of the suite</div><div>=C2=A0</div><blockquote class=3D"gmail_quote" = style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);pa= dding-left:1ex"><snip><span class=3D"gmail-im" style=3D"color:rgb(80,= 0,80)"><br>+=C2=A0 =C2=A0 =C2=A0 =C2=A0 received_packets =3D [<br>+=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 packets<br>+=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 for packets in self.send_packet_and_capture(packet, adjust_ad= dresses=3DFalse)<br>+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if hasattr(p= ackets, "load") and "X" * 22 in str(packets.load)<br>+= =C2=A0 =C2=A0 =C2=A0 =C2=A0 ]<br></span></blockquote><div><br></div><div>Al= so Jeremy said he mentioned Juraj's opinion on using Jeremy's metho= d of turning off</div><div>adjust addresses, if you end up doing that just = make it depend on this patch:</div><div>patch-1142113 ("add send_packe= ts to test suites and rework<br>packet addressing")<br></div><div>=C2= =A0</div><div>Reviewed-by: Dean Marx <<a href=3D"mailto:dmarx@iol.unh.ed= u" target=3D"_blank">dmarx@iol.unh.edu</a>></div></div><br><div class=3D= "gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Thu, Jul 18, 2024 at= 3:40=E2=80=AFPM Nicholas Pratte <<a href=3D"mailto:npratte@iol.unh.edu"= >npratte@iol.unh.edu</a>> wrote:<br></div><blockquote class=3D"gmail_quo= te" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204= );padding-left:1ex">The mac address filter test suite, whose test cases are= based on old<br> DTS's test cases, has been refactored to interface with the new DTS<br> framework.<br> <br> In porting over this test suite into the new framework, some<br> adjustments were made, namely in the EAL and TestPMD parameter provided<br> before executing the application. While the original test plan was<br> referenced, by and large, only for the individual test cases, I'll leav= e<br> the parameters the original test plan was asking for below for the sake<br> of discussion:<br> <br> --burst=3D1 --rxpt=3D0 --rxht=3D0 --rxwt=3D0 --txpt=3D36 --txht=3D0 --txwt= =3D0<br> --txfreet=3D32 --rxfreet=3D64 --mbcache=3D250 --portmask=3D0x3<br> <br> Bugzilla ID: 1454<br> Signed-off-by: Nicholas Pratte <<a href=3D"mailto:npratte@iol.unh.edu" t= arget=3D"_blank">npratte@iol.unh.edu</a>><br> <br> ---<br> v2:<br> =C2=A0* Refactored the address pool capacity tests to use all available<br> =C2=A0 =C2=A0octets in the mac address.<br> =C2=A0* Change the payload to 'X' characters instead of 'P'= characters.<br> ---<br> =C2=A0dts/framework/config/conf_yaml_schema.json |=C2=A0 =C2=A03 +-<br> =C2=A0dts/tests/TestSuite_mac_filter.py=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |= 223 +++++++++++++++++++++<br> =C2=A02 files changed, 225 insertions(+), 1 deletion(-)<br> =C2=A0create mode 100644 dts/tests/TestSuite_mac_filter.py<br> <br> diff --git a/dts/framework/config/conf_yaml_schema.json b/dts/framework/con= fig/conf_yaml_schema.json<br> index f02a310bb5..ad1f3757f7 100644<br> --- a/dts/framework/config/conf_yaml_schema.json<br> +++ b/dts/framework/config/conf_yaml_schema.json<br> @@ -187,7 +187,8 @@<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0"enum": [<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"hello_world",<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"os_udp",<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 "pmd_buffer_scatter"<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 "pmd_buffer_scatter",<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 "mac_filter"<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0]<br> =C2=A0 =C2=A0 =C2=A0},<br> =C2=A0 =C2=A0 =C2=A0"test_target": {<br> diff --git a/dts/tests/TestSuite_mac_filter.py b/dts/tests/TestSuite_mac_fi= lter.py<br> new file mode 100644<br> index 0000000000..53a3331224<br> --- /dev/null<br> +++ b/dts/tests/TestSuite_mac_filter.py<br> @@ -0,0 +1,223 @@<br> +# SPDX-License-Identifier: BSD-3-Clause<br> +# Copyright(c) 2023-2024 University of New Hampshire<br> +"""Mac address filtering test suite.<br> +<br> +This test suite ensures proper and expected behavior of Allowlist filterin= g via mac<br> +addresses on devices bound to the Poll Mode Driver. If a packet received o= n a device<br> +contains a mac address not contained with its mac address pool, the packet= should<br> +be dropped. Alternatively, if a packet is received that contains a destina= tion mac<br> +within the devices address pool, the packet should be accepted and forward= ed. This<br> +behavior should remain consistent across all packets, namely those contain= ing dot1q<br> +tags or otherwise.<br> +<br> +The following test suite assesses behaviors based on the aforementioned lo= gic.<br> +Additionally, testing is done within the PMD itself to ensure that the mac= address<br> +allow list is behaving as expected.<br> +"""<br> +<br> +from time import sleep<br> +<br> +from scapy.layers.inet import IP=C2=A0 # type: ignore[import-untyped]<br> +from scapy.layers.l2 import Dot1Q, Ether=C2=A0 # type: ignore[import-untyp= ed]<br> +from scapy.packet import Raw=C2=A0 # type: ignore[import-untyped]<br> +<br> +from framework.exception import InteractiveCommandExecutionError<br> +from framework.remote_session.testpmd_shell import TestPmdShell<br> +from framework.test_suite import TestSuite<br> +<br> +<br> +class TestMacFilter(TestSuite):<br> +=C2=A0 =C2=A0 """Mac address allowlist filtering test suite= .<br> +<br> +=C2=A0 =C2=A0 Configure mac address filtering on a given port, and test th= e port's filtering behavior<br> +=C2=A0 =C2=A0 using both a given port's hardware address as well as du= mmy addresses. If a port accepts<br> +=C2=A0 =C2=A0 a packet that is not contained within its mac address allowl= ist, then a given test case<br> +=C2=A0 =C2=A0 fails. Alternatively, if a port drops a packet that is desig= nated within its mac address<br> +=C2=A0 =C2=A0 allowlist, a given test case will fail.<br> +<br> +=C2=A0 =C2=A0 Moreover, a given port should demonstrate proper behavior wh= en bound to the Poll Mode<br> +=C2=A0 =C2=A0 Driver. A port should not have a mac address allowlist that = exceeds its designated size.<br> +=C2=A0 =C2=A0 A port's default hardware address should not be removed = from its address pool, and invalid<br> +=C2=A0 =C2=A0 addresses should not be included in the allowlist. If a port= abides by the above rules, the<br> +=C2=A0 =C2=A0 test case passes.<br> +=C2=A0 =C2=A0 """<br> +<br> +=C2=A0 =C2=A0 def send_packet_and_verify(<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 self,<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 mac_address: str,<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 add_vlan: bool =3D False,<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 should_receive: bool =3D True,<br> +=C2=A0 =C2=A0 ) -> None:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Generate, send, and verify a= packet based on specified parameters.<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 Test cases within this suite utilize this meth= od to create, send, and verify<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 packets based on criteria relating to the pack= et's destination mac address,<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 vlan tag, and whether or not the packet should= be received or not. Packets<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 are verified using an inserted payload. Assumi= ng the test case expects to<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 receive a specified packet, if the list of rec= eived packets contains this<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 payload within any of its packets, the test ca= se passes. Alternatively, if<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 the designed packet should not be received, an= d the packet payload is not,<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 received, then the test case fails. Each call = with this method sends exactly<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 one packet.<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 Args:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 mac_address: The destination mac= address of the packet being sent.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 add_vlan: If :data:'True'= ;, add a vlan tag to the packet being sent. The<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 vlan tag will be := data:'2' if the packet should be received and<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 :data:'1' = if the packet should not be received but requires a vlan tag.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 should_receive: If :data:'Tr= ue', assert whether or not the sent packet<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 has been received.= If :data:'False', assert that the send packet was not<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 received. :data:&#= 39;True' by default<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 """<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 if add_vlan:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 packet =3D Ether() / Dot1Q(vlan= =3D2 if should_receive else 1) / IP() / Raw(load=3D"X" * 22)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 else:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 packet =3D Ether() / IP() / Raw(= load=3D"X" * 22)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 packet.dst =3D mac_address<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 received_packets =3D [<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 packets<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 for packets in self.send_packet_= and_capture(packet, adjust_addresses=3DFalse)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if hasattr(packets, "load&q= uot;) and "X" * 22 in str(packets.load)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 ]<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 if should_receive:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.verify(len(received_packets= ) =3D=3D 1, "Expected packet not received")<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 else:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.verify(len(received_packets= ) =3D=3D 0, "Expected packet received")<br> +<br> +=C2=A0 =C2=A0 def test_add_remove_mac_addresses(self) -> None:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Assess basic mac addressing = filtering functionalities.<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 This test case validates for proper behavior o= f mac address filtering with both<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 a port's default, burned-in mac address, a= s well as additional mac addresses<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 added to the PMD. Packets should either be rec= eived or not received depending on<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 the properties applied to the PMD at any given= time.<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 Test:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Start TestPMD with promiscuous m= ode.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Send a packet with the port'= s default mac address. (Should receive)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Send a packet with fake mac addr= ess. (Should not receive)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Add fake mac address to the PMD&= #39;s address pool.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Send a packet with the fake mac = address to the PMD. (Should receive)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Remove the fake mac address from= the PMD's address pool.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Sent a packet with the fake mac = address to the PMD. (Should not receive)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 """<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 testpmd =3D TestPmdShell(self.sut_node)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 testpmd.set_promisc(0, on=3DFalse)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 testpmd.start()<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 mac_address =3D self._sut_port_ingress.mac_add= ress<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 # Send a packet with NIC default mac address<b= r> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 self.send_packet_and_verify(mac_address=3Dmac_= address, should_receive=3DTrue)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 # Send a packet with different mac address<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 fake_address =3D "00:00:00:00:00:01"= <br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 self.send_packet_and_verify(mac_address=3Dfake= _address, should_receive=3DFalse)<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 # Add mac address to pool and rerun tests<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 testpmd.set_mac_addr(0, mac_address=3Dfake_add= ress, add=3DTrue)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 self.send_packet_and_verify(mac_address=3Dfake= _address, should_receive=3DTrue)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 testpmd.set_mac_addr(0, mac_address=3Dfake_add= ress, add=3DFalse)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 self.send_packet_and_verify(mac_address=3Dfake= _address, should_receive=3DFalse)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 testpmd.close()<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 sleep(6)<br> +<br> +=C2=A0 =C2=A0 def test_invalid_address(self) -> None:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Assess the behavior of a NIC= mac address pool while bound to the PMD.<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 An assessment of a NIC's behavior when mou= nted to a PMD as it relates to mac addresses<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 and address pooling. Devices should not be abl= e to use invalid mac addresses, remove their<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 built-in hardware address, or exceed their add= ress pools.<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 Test:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Start TestPMD.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Attempt to add an invalid mac ad= dress. (Should fail)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Attempt to remove the device'= ;s hardware address with no additional addresses in the<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 address pool. (Sho= uld fail)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Add a fake mac address to the po= ol twice in succession. (Should not create any errors)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Attempt to remove the device'= ;s hardware address with other addresses in the address<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pool. (Should fail= )<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Determine the device's mac a= ddress pool size, and fill the pool with fake addresses.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Attempt to add another fake mac = address, overloading the address pool. (Should fail)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 """<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 testpmd =3D TestPmdShell(self.sut_node)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 testpmd.start()<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 mac_address =3D self._sut_port_ingress.mac_add= ress<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 try:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 testpmd.set_mac_addr(0, "00= :00:00:00:00:00", add=3DTrue)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.verify(False, "Invalid= mac address added.")<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 except InteractiveCommandExecutionError:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pass<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 try:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 testpmd.set_mac_addr(0, mac_addr= ess, add=3DFalse)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.verify(False, "Default= mac address removed.")<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 except InteractiveCommandExecutionError:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pass<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 # Should be no errors adding this twice<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 testpmd.set_mac_addr(0, "1" + mac_ad= dress[1:], add=3DTrue)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 testpmd.set_mac_addr(0, "1" + mac_ad= dress[1:], add=3DTrue)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 # Double check to see if default mac address c= an be removed<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 try:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 testpmd.set_mac_addr(0, mac_addr= ess, add=3DFalse)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.verify(False, "Default= mac address removed.")<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 except InteractiveCommandExecutionError:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pass<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 for i in range(testpmd.show_port_info(0).max_m= ac_addresses_num - 1):<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 # A0 fake address based on the i= ndex 'i'.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 fake_address =3D str(hex(i)[2:].= zfill(12))<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 # Insert ':' characters = every two indexes to create a fake mac address.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 fake_address =3D ":".j= oin(fake_address[x : x + 2] for x in range(0, len(fake_address), 2))<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 testpmd.set_mac_addr(0, fake_add= ress, add=3DTrue, verify=3DFalse)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 try:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 testpmd.set_mac_addr(0, "F&= quot; + mac_address[1:], add=3DTrue)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.verify(False, "Mac add= ress limit exceeded.")<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 except InteractiveCommandExecutionError:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pass<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 testpmd.close()<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 sleep(6)<br> +<br> +=C2=A0 =C2=A0 def test_multicast_filter(self) -> None:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Assess basic multicast addre= ss filtering functionalities.<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 Ensure that multicast filtering performs as in= tended when a given device is bound<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 to the PMD, with and without dot1q vlan taggin= g.<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 Test:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Start TestPMD with promiscuous m= ode.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Add a fake multicast address to = the PMD's multicast address pool.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Send a packet with the fake mult= icast address to the PMD. (Should receive)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Set vlan filtering on the PMD, a= nd add vlan ID to the PMD.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Send a packet with the fake mult= icast address and vlan ID to the PMD. (Should receive)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Send a packet with the fake mult= icast address and a different vlan ID to the PMD.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (Should not receiv= e)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Remove the vlan tag from the PMD= , and turn vlan filtering off on the PMD.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Send a packet with the fake mult= icast address and no vlan tag to the PMD.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (Should receive)<b= r> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Remove the fake multicast addres= s from the PMDs multicast address filter.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Send a packet with the fake mult= icast address to the PMD. (Should not receive)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 """<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 testpmd =3D TestPmdShell(self.sut_node)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 testpmd.start()<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 testpmd.set_promisc(0, on=3DFalse)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 multicast_address =3D "01:00:5E:00:00:00&= quot;<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 vlan_id =3D 2<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 testpmd.set_multicast_mac_addr(0, multi_addr= =3Dmulticast_address, add=3DTrue)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 self.send_packet_and_verify(multicast_address,= should_receive=3DTrue)<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 # Test vlan filtering on multicast addressing.= <br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 # Verify vlan functionality for debugging purp= oses.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 testpmd.vlan_filter_set_on(port=3D0)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 testpmd.rx_vlan_add(vlan_id, 0)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 self.send_packet_and_verify(multicast_address,= should_receive=3DTrue, add_vlan=3DTrue)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 self.send_packet_and_verify(multicast_address,= should_receive=3DFalse, add_vlan=3DTrue)<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 # Remove vlan tag and filtering and run basic = multicast addr test.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 testpmd.rx_vlan_rm(vlan_id, 0)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 testpmd.vlan_filter_set_off(port=3D0)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 self.send_packet_and_verify(multicast_address,= should_receive=3DTrue)<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 # Remove multicast filter and verify the packe= t was not received.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 testpmd.set_multicast_mac_addr(0, multicast_ad= dress, add=3DFalse)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 self.send_packet_and_verify(multicast_address,= should_receive=3DFalse)<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 testpmd.close()<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 sleep(6)<br> -- <br> 2.44.0<br> <br> </blockquote></div> --000000000000b700d9061dd5be9b--