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 4C0BF456AC; Thu, 25 Jul 2024 18:24:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 96009433FB; Thu, 25 Jul 2024 18:24:00 +0200 (CEST) Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com [209.85.219.54]) by mails.dpdk.org (Postfix) with ESMTP id 6853A427BA for ; Thu, 25 Jul 2024 18:23:36 +0200 (CEST) Received: by mail-qv1-f54.google.com with SMTP id 6a1803df08f44-6b797a2384cso5801376d6.0 for ; Thu, 25 Jul 2024 09:23:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1721924616; x=1722529416; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=i4Goyi9htgy9zfke8lBz4ZJikg6XBUOvarvUMGNrXfQ=; b=apE2X/CSZia4VqO3btuHAmp3CM9SoAhfUqJndCfDOgcyR/bzORaPYXGyM+X5zSBoe0 8iCjxiE5cfntk+2O+yzRkCBDHSF7wCRz+t1eh3rH3cOiwfZF22Tvc9KNXK/8Jq5JqAQg bxqEUdV2bU78Yc3I2zwm9eBXkgys5mWZmVDsg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721924616; x=1722529416; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=i4Goyi9htgy9zfke8lBz4ZJikg6XBUOvarvUMGNrXfQ=; b=gKw1K+LXsWeFwy+wgcgogINbO2i4MnDnI9iAGEWDNvIKWitip0dh3+wl3j0shNn+ak 4P2UFL2CTEZXVx4LyevROORvYjyxiwIddreYuDMz/h0ASuI0u+Z3QhK9Rap92Tybz5bs 4/kYS0/KnlEn9izOXgDgKFfXj9UR7FLTW67+gMrQ3Km1uEoZseqltF8vNjrDNuQ2jbXn PEte/lQvNDHO999Bo/b3HLv03g1GD1A4duerpaHRpgq4rgbLKwqoyEYhlPMZTw1rJ07s fY40DBe89ZF6gMJgJlXXZyMp9lZWCMJHWQaTmJqaCTxffiSqItIVsTj7SaOrUZgfgJn5 aBoQ== X-Gm-Message-State: AOJu0YxqysFR4RvjjSJVB18Qwg1/vksENmvfye2Mz5KAv4zP5fuyfS+A F7i5pGDb2ZSpP2otYCEXyOpzhF0txnpdws2GOA49IQB0Wkij9Phce0Voxd3iXsA= X-Google-Smtp-Source: AGHT+IEV2J1BEzaRJ1YI0I2NaI1VEY6z0fnbQd/rMOKDSQiNzwnqIGg+9n5VFrSkQq7qrqbTrf21Vw== X-Received: by 2002:a05:6214:1d25:b0:6b7:9afa:238f with SMTP id 6a1803df08f44-6bb3ca0d0e9mr40795936d6.21.1721924615621; Thu, 25 Jul 2024 09:23:35 -0700 (PDT) Received: from dean-laptop.iol.unh.edu ([2606:4100:3880:1271:f9bd:24da:464d:6294]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6bb3f8d8269sm8683196d6.20.2024.07.25.09.23.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jul 2024 09:23:35 -0700 (PDT) From: Dean Marx To: probb@iol.unh.edu, npratte@iol.unh.edu, jspewock@iol.unh.edu, luca.vizzarro@arm.com, yoan.picchi@foss.arm.com, Honnappa.Nagarahalli@arm.com, paul.szczepanek@arm.com, juraj.linkes@pantheon.tech Cc: dev@dpdk.org, Dean Marx Subject: [RFC v1 2/3] dts: VXLAN gpe support test suite Date: Thu, 25 Jul 2024 12:23:24 -0400 Message-ID: <20240725162325.20933-3-dmarx@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240725162325.20933-1-dmarx@iol.unh.edu> References: <20240725162325.20933-1-dmarx@iol.unh.edu> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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/TestSuite_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 tunneling +protocols is enabled. GPE is the Generic Protocol Extension for VXLAN, +which is used for configuring fields in the VXLAN header through GPE tunnels. + +If a GPE tunnel is configured for the corresponding UDP port within a sent 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 VXLAN-GPE streams): + 1. VXLAN-GPE ipv4 packet detect - configures a GPE tunnel on port 4790 + and sends packets with a matching UDP destination port. This packet + should be received by the traffic generator with its VXLAN layer. + Then, remove the GPE tunnel, send the same packet, and verify that + 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 test run. + """ + self.verify( + len(self._port_links) > 1, + "There must be at least two port links to run the scatter test suite", + ) + + def send_vxlan_packet_and_verify(self, udp_dport: int, should_receive_vxlan: bool) -> None: + """Generate a VXLAN GPE packet with the given UDP destination port, send and verify. + + Args: + udp_dport: The destination UDP port to generate in the packet. + should_receive_vxlan: Indicates whether the packet should be + received by the traffic generator with its VXLAN layer. + """ + packet = Ether() / IP() / UDP(dport=udp_dport) / VXLAN(flags=12) / IP() / Raw(load="xxxxx") + received = self.send_packet_and_capture(packet) + print(f"Received packets = {received}") + has_vxlan = any( + "VXLAN" in packet.summary() and "xxxxx" in str(packet.load) for packet in received + ) + 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 tunnel.""" + GPE_port = 4790 + with TestPmdShell(node=self.sut_node) as testpmd: + testpmd.set_forward_mode(SimpleForwardingModes.io) + testpmd.set_verbose(level=1) + testpmd.start() + testpmd.udp_tunnel_port(port_id=0, add=True, udp_port=GPE_port, protocol="vxlan") + self.send_vxlan_packet_and_verify(udp_dport=GPE_port, should_receive_vxlan=True) + testpmd.udp_tunnel_port(port_id=0, add=False, udp_port=GPE_port, protocol="vxlan") + self.send_vxlan_packet_and_verify(udp_dport=GPE_port, should_receive_vxlan=False) -- 2.44.0