From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 38B2B4553B; Mon, 1 Jul 2024 21:52:16 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1CA14402CD; Mon, 1 Jul 2024 21:52:16 +0200 (CEST) Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) by mails.dpdk.org (Postfix) with ESMTP id 4E0E8402A3 for ; Mon, 1 Jul 2024 21:52:15 +0200 (CEST) Received: by mail-pg1-f170.google.com with SMTP id 41be03b00d2f7-656d8b346d2so1909575a12.2 for ; Mon, 01 Jul 2024 12:52:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1719863534; x=1720468334; darn=dpdk.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=VQqIoOy45yW90ziCJHervQZYAMYIhhf7HSOS/RfHbVc=; b=GrrELAEzw3KQswxKBlYy2wZ0wjKJpjZPjHffWAaobyokqjb8mIZukYIYVnr1PbX1r6 zAkQEZsUXvJqxrkBymhf+WilUHklQQraORj0TIZ1+43/r81qXOyPaGFUaXarrG3S6/Fx yCM6GPwsos67sSZc3lPUD2AyB7Gzi7miPaGQU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719863534; x=1720468334; h=content-transfer-encoding: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=VQqIoOy45yW90ziCJHervQZYAMYIhhf7HSOS/RfHbVc=; b=jo50dQ3D2P07heLj6CX5lUXjbiLpd/WyezuVBBwpnTad0WaaDvNVBDHHpXmRnmgkc1 hXd/DBLP1Pe5jQfX241P54k4jT1TcoJT/gUMDwKB2oJyO1Rh5sFU8cuoZIIGAJx7Xf2x KWF33DnjiXWv8nuBXOxvHI/ty+89iGez9FGMFrMGQ7H4mnBoML6ltb4kKAGsnJHfEJIb i/xYXJ7S/84MOEGMScio0tDywiGqhfW4ZciASv9PrGI5n6wmRauX4PyfRaYFuDn08Eab 86eiV59Bxwl/l6abnmbQe91luVPf3NN97h6N+wk676oT1WOPZffQkV6MztJN4AjfmPrW hwYA== X-Forwarded-Encrypted: i=1; AJvYcCV6GAKnGg1u8SAHRb6yrqzDWJ6SpWYdwpEKFNdmZdGRd1HNDn7QREYAIDh/rTlz4PqWwrqrF5Y/d8YM7O0= X-Gm-Message-State: AOJu0YxAONJpw+DVWM1F/3vqEcB2xV5nbs8F+2JjFRRQ0dKer3l5aG0K 6HmtV3gxte4N7h5BnV8MTxVszbDZTfrpd9Yk6kpsGvcuKLtAKduxBIYP0WR0OFgmK7C3avOGWoQ Fi+9tXvmTnSI1STpggsS6fSSIhbmeNcGUJGK8Cw== X-Google-Smtp-Source: AGHT+IFgOYvZg5uNia3Hm6Tx23SIAjmX11kM+5zLkUQUQOQ3Jl5Kw7cNTJruNkORQZl47FQKsMKvbZ6c4fD+dFTXPyQ= X-Received: by 2002:a05:6a20:918c:b0:1bd:28b9:6f88 with SMTP id adf61e73a8af0-1bef60fac19mr6520331637.24.1719863534185; Mon, 01 Jul 2024 12:52:14 -0700 (PDT) MIME-Version: 1.0 References: <20240614150238.26374-1-dmarx@iol.unh.edu> <20240628140010.27425-1-dmarx@iol.unh.edu> <20240628140010.27425-2-dmarx@iol.unh.edu> In-Reply-To: <20240628140010.27425-2-dmarx@iol.unh.edu> From: Jeremy Spewock Date: Mon, 1 Jul 2024 15:52:02 -0400 Message-ID: Subject: Re: [PATCH v8 2/3] dts: VLAN test suite implementation To: Dean Marx Cc: Honnappa.Nagarahalli@arm.com, juraj.linkes@pantheon.tech, probb@iol.unh.edu, paul.szczepanek@arm.com, yoan.picchi@foss.arm.com, bruce.richardson@intel.com, luca.vizzarro@arm.com, dev@dpdk.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Fri, Jun 28, 2024 at 10:00=E2=80=AFAM Dean Marx wrot= e: > > Test suite for verifying VLAN filtering, stripping, and insertion > functionality on Poll Mode Driver. > > Signed-off-by: Dean Marx > --- > + def send_vlan_packet_and_verify(self, should_receive: bool, strip: b= ool, vlan_id: int) -> None: > + """Generate a vlan packet, send and verify a packet with > + the same payload is received on the dut. > + > + Args: > + should_receive: Indicate whether the packet should be succes= sfully received. > + strip: Indicates whether stripping is on or off, and when th= e vlan tag is > + checked for a match. > + vlan_id: Expected vlan ID. > + """ > + packet =3D Ether() / Dot1Q(vlan=3Dvlan_id) / Raw(load=3D"xxxxx") > + received_packets =3D self.send_packet_and_capture(packet) > + test_packet =3D None > + for packet in received_packets: > + if b"xxxxx" in packet.load: > + test_packet =3D packet > + break > + if should_receive: > + self.verify( > + test_packet is not None, "Packet was dropped when it sho= uld have been received" > + ) > + if test_packet is not None: I assume this extra if-statement is added since the linter complains that test_packet could be None here. Obviously it can't be since you just verified it above, so another thing you could do here to make the warning go away if you wanted would be adding an `assert` statement (and preferably also a comment) here so that the linter would understand that it can't be None at this point. The if-statement also works fine, I just figured I would mention the alternative. > + if strip: > + self.verify( > + not test_packet.haslayer(Dot1Q), "Vlan tag was n= ot stripped successfully" > + ) > + else: > + self.verify( > + test_packet.vlan =3D=3D vlan_id, > + "The received tag did not match the expected tag= ", > + ) > + else: > + self.verify( > + test_packet is None, > + "Packet was received when it should have been dropped", > + ) > -- > 2.44.0 >