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 2ACAF456BF; Fri, 26 Jul 2024 22:18:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 16FDE42DDE; Fri, 26 Jul 2024 22:18:34 +0200 (CEST) Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by mails.dpdk.org (Postfix) with ESMTP id C936F42DD6 for ; Fri, 26 Jul 2024 22:18:32 +0200 (CEST) Received: by mail-pj1-f41.google.com with SMTP id 98e67ed59e1d1-2cb566d528aso1054344a91.1 for ; Fri, 26 Jul 2024 13:18:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1722025112; x=1722629912; 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=4LLGB2xQbLMIAk0HcaB1Gb14S1g0+R7M8pvppRGMvXc=; b=b4KzzNvqAbDChM3uw+1Tk93EIfm+vchfuqqtUxBuiUZWpKYtNDPAnf7T+ECI6qG95K zoiEp3XsvsawQgqrbjKGe0nj6NwHFfC47bViuanzEirmN6UrhHywTxWHjbF6ZpxhxPQs vWsuFtilQ6LbvIXdu0Qtcgg17KP67LtObeEFA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722025112; x=1722629912; 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=4LLGB2xQbLMIAk0HcaB1Gb14S1g0+R7M8pvppRGMvXc=; b=pbbzVTnj7kuhMO/38ym64kV5MxC7znTTq7eUgz5I8gXPZvfeDxV4npW8tUmjXswumb ZugSz2u09QgRMCrcuSQ5uutGd0Wy7NISpRcDtmuzq4X/25DmEypMS7UXgOXVo4wXp5Jj GjC1NpGfpL6fQmsZm+ndBJlV4secMmBw0YSriwldu8P3a34SWAL/olOo07S45BMn7YDR QD0rcsIK/ninQaombk7ogN7JwoghOaUXFx/hgNlSbb0eHfZE5c/cCDfKv43cfSa2Iv12 Ep655COP1osPxl6vhubDSWKg8PHVqC1/yOQ5wifhOqWNwR/7qKN9gnWMsmL5R5Kh9mRI No0g== X-Forwarded-Encrypted: i=1; AJvYcCU/Ik5e/kpSpHvTUjo1655RXzxSi21q3HI1gTrTS07RplOCpyqbx5pEDGlGf229Z5RzS9poLB47QcXE6tI= X-Gm-Message-State: AOJu0Ywaz46qQssxKreN/6MzPQpuSNJx8CGwDNw7xDOtHsrZZ94VbBq4 tqgTpyrMqtW2XI/sNni3NT5Oj8i7gYK9yo5qURolxfINVpzOkWdboiSjlNm2KeVlITSDtp7Fsw9 gNsNXWalN3sDMzfYz1Dgj71zpFs5FnHjw9e3Vug== X-Google-Smtp-Source: AGHT+IHhqh8KhH12zztbj2iJ8v8M/TeQ5zB5WnElO8bLkeBaX/dvVtHVxAh0iKcqWJYhCxPABDVW4+RajvroLK2YO+o= X-Received: by 2002:a17:90b:384d:b0:2c9:7f3d:6aea with SMTP id 98e67ed59e1d1-2cf7e5f4b7cmr719542a91.32.1722025111737; Fri, 26 Jul 2024 13:18:31 -0700 (PDT) MIME-Version: 1.0 References: <20240725162325.20933-1-dmarx@iol.unh.edu> <20240725162325.20933-3-dmarx@iol.unh.edu> In-Reply-To: <20240725162325.20933-3-dmarx@iol.unh.edu> From: Jeremy Spewock Date: Fri, 26 Jul 2024 16:18:20 -0400 Message-ID: Subject: Re: [RFC v1 2/3] dts: VXLAN gpe support test suite To: Dean Marx Cc: probb@iol.unh.edu, npratte@iol.unh.edu, luca.vizzarro@arm.com, yoan.picchi@foss.arm.com, Honnappa.Nagarahalli@arm.com, paul.szczepanek@arm.com, juraj.linkes@pantheon.tech, 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 This all makes sense to me and looks good to me, I just had one suggestion about verification below. On Thu, Jul 25, 2024 at 12:23=E2=80=AFPM Dean Marx wrot= e: > > Test suite for verifying vxlan gpe support on NIC, as well as expected > behavior while sending vxlan packets through tunnel > > Signed-off-by: Dean Marx > --- > dts/tests/TestSuite_vxlan_gpe_support.py | 77 ++++++++++++++++++++++++ > 1 file changed, 77 insertions(+) > create mode 100644 dts/tests/TestSuite_vxlan_gpe_support.py > > diff --git a/dts/tests/TestSuite_vxlan_gpe_support.py b/dts/tests/TestSui= te_vxlan_gpe_support.py > new file mode 100644 > index 0000000000..981f878a4c > --- /dev/null > +++ b/dts/tests/TestSuite_vxlan_gpe_support.py > @@ -0,0 +1,77 @@ > +# SPDX-License-Identifier: BSD-3-Clause > +# Copyright(c) 2024 University of New Hampshire > + > +"""VXLAN-GPE support test suite. > + > +This suite verifies virtual extensible local area network packets > +are only received in the same state when a UDP tunnel port for VXLAN tun= neling > +protocols is enabled. GPE is the Generic Protocol Extension for VXLAN, > +which is used for configuring fields in the VXLAN header through GPE tun= nels. > + > +If a GPE tunnel is configured for the corresponding UDP port within a se= nt packet, > +that packet should be received with its VXLAN layer. If there is no GPE = tunnel, > +the packet should be received without its VXLAN layer. > + > +""" > + > +from scapy.layers.inet import IP, UDP # type: ignore[import-untyped] > +from scapy.layers.l2 import Ether # type: ignore[import-untyped] > +from scapy.layers.vxlan import VXLAN # type: ignore[import-untyped] > +from scapy.packet import Raw # type: ignore[import-untyped] > + > +from framework.params.testpmd import SimpleForwardingModes > +from framework.remote_session.testpmd_shell import TestPmdShell > +from framework.test_suite import TestSuite > + > + > +class TestVxlanGpeSupport(TestSuite): > + """DPDK VXLAN-GPE test suite. > + > + This suite consists of one test case (Port 4790 is designated for VX= LAN-GPE streams): > + 1. VXLAN-GPE ipv4 packet detect - configures a GPE tunnel on port 47= 90 > + and sends packets with a matching UDP destination port. This pac= ket > + should be received by the traffic generator with its VXLAN layer= . > + Then, remove the GPE tunnel, send the same packet, and verify th= at > + the packet is received without its VXLAN layer. > + """ > + > + def set_up_suite(self) -> None: > + """Set up the test suite. > + > + Setup: > + Verify that we have at least 2 port links in the current tes= t run. > + """ > + self.verify( > + len(self._port_links) > 1, > + "There must be at least two port links to run the scatter te= st suite", > + ) > + > + def send_vxlan_packet_and_verify(self, udp_dport: int, should_receiv= e_vxlan: bool) -> None: > + """Generate a VXLAN GPE packet with the given UDP destination po= rt, send and verify. > + > + Args: > + udp_dport: The destination UDP port to generate in the packe= t. > + should_receive_vxlan: Indicates whether the packet should be > + received by the traffic generator with its VXLAN layer. > + """ > + packet =3D Ether() / IP() / UDP(dport=3Dudp_dport) / VXLAN(flags= =3D12) / IP() / Raw(load=3D"xxxxx") > + received =3D self.send_packet_and_capture(packet) > + print(f"Received packets =3D {received}") > + has_vxlan =3D any( > + "VXLAN" in packet.summary() and "xxxxx" in str(packet.load) = for packet in received Scapy actually allows for checking if a layer exists in a packet using the real types in a few different ways. You could use packet.haslayer(VXLAN), or you could do basically the same as what you have without the string comparison if you do `VXLAN in packet`. This might end up being a little shorter and it saves you from having to deal with the string provided from the packet summary. > + ) > + self.verify( > + not (has_vxlan ^ should_receive_vxlan), "Expected packet did= not match received packet." > + ) > + > + def test_gpe_tunneling(self) -> None: > + """Verifies expected behavior of VXLAN packets through a GPE tun= nel.""" > + GPE_port =3D 4790 > + with TestPmdShell(node=3Dself.sut_node) as testpmd: > + testpmd.set_forward_mode(SimpleForwardingModes.io) > + testpmd.set_verbose(level=3D1) > + testpmd.start() > + testpmd.udp_tunnel_port(port_id=3D0, add=3DTrue, udp_port=3D= GPE_port, protocol=3D"vxlan") > + self.send_vxlan_packet_and_verify(udp_dport=3DGPE_port, shou= ld_receive_vxlan=3DTrue) > + testpmd.udp_tunnel_port(port_id=3D0, add=3DFalse, udp_port= =3DGPE_port, protocol=3D"vxlan") > + self.send_vxlan_packet_and_verify(udp_dport=3DGPE_port, shou= ld_receive_vxlan=3DFalse) > -- > 2.44.0 >