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 0D4F645492; Tue, 18 Jun 2024 17:21:43 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 071D540DD8; Tue, 18 Jun 2024 17:21:43 +0200 (CEST) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) by mails.dpdk.org (Postfix) with ESMTP id A8BDD402B4 for ; Tue, 18 Jun 2024 17:21:41 +0200 (CEST) Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-3629c517da9so457195f8f.2 for ; Tue, 18 Jun 2024 08:21:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1718724101; x=1719328901; 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=5oJ72mJUnLW4cRsThHNGROXo5tWx9+d4Ws4LiSV2cyo=; b=g7UKWNN77WuLXZjVbXjUc0Wvz1U5hQYXYzqDU/E1Ta/xaPYwkgKmS9PrfLrwEtWqS9 9Z6PRCkl7ShiyH+d/AvUFwtt+lCMCCzKFj3KrHnRT0Wb/Rdf3OqdS4wF+T+0ZO6OhHZ3 K/SIR6tYT2aZcyEWI0+cupRviW42gxjyNrBdA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718724101; x=1719328901; 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=5oJ72mJUnLW4cRsThHNGROXo5tWx9+d4Ws4LiSV2cyo=; b=vHUC2dvlLDGRnOAK7txjnRxETgI25HscTqbOzUQfoboJxF88+yqigX+DlyHISG+EcG TNglHufVBHpUkHyAo0olvYKsAjfCt2JYJ3usP6/YQPiWCbOxh4IifYnd1GMY6RjENtWZ f8tuJNzXtfAJQNrIkkB9qhLtP7h9bgY1vDomI+vR+MlhogZMGry0jjGN+LNdjtxsaBD5 UD6DpE/2r6Atuoq59ejI1LIAXC8HlTi9boDrpaUadAw0yY6Wchm/CMe91BGJl8rHIf/0 J0eMrJ5JWtBcHfWCZxmvyTJtXEyIUe+HNukvS9B+/WkHJe5Y0QIFTmME0LtgCiA91wbE W7Zg== X-Gm-Message-State: AOJu0Yx031iO8M2xara8ZyXA53SwrDOdZNnY4HGP8sT5C1qwYvoBjOue HAo+CehxaPBj2+eX3ym10HdcJQ8Iw8sKzoOlkMlMNgHDy+/QsvXAMB7Ql/3/Vwo= X-Google-Smtp-Source: AGHT+IG7MpIuGwkAbusVPphFQ3WZk4JUWh0Ojjagw5JxamzNibeFq/kuSwDIUSRsr/rkqYIDA5dVXw== X-Received: by 2002:adf:e784:0:b0:354:f218:9661 with SMTP id ffacd0b85a97d-3607a7435c1mr11206115f8f.14.1718724101236; Tue, 18 Jun 2024 08:21:41 -0700 (PDT) Received: from dean-laptop.iol.unh.edu ([2606:4100:3880:1210:52ef:3eaf:5f1e:6f6a]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3607509c9absm14348420f8f.46.2024.06.18.08.21.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jun 2024 08:21:40 -0700 (PDT) From: Dean Marx To: Honnappa.Nagarahalli@arm.com, juraj.linkes@pantheon.tech, probb@iol.unh.edu, paul.szczepanek@arm.com, yoan.picchi@foss.arm.com, jspewock@iol.unh.edu, bruce.richardson@intel.com, luca.vizzarro@arm.com Cc: dev@dpdk.org, Dean Marx Subject: [PATCH v4 1/3] dts: refactored VLAN test suite Date: Tue, 18 Jun 2024 11:20:51 -0400 Message-ID: <20240618152053.30723-1-dmarx@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240614150238.26374-1-dmarx@iol.unh.edu> References: <20240614150238.26374-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 Tweaked logic on sending and verifying packets for more concise code, added verbose and promisc function calls from pmd shell module. Signed-off-by: Dean Marx --- dts/tests/TestSuite_vlan.py | 59 +++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 32 deletions(-) diff --git a/dts/tests/TestSuite_vlan.py b/dts/tests/TestSuite_vlan.py index 8b6827ec4b..b9b2a98588 100644 --- a/dts/tests/TestSuite_vlan.py +++ b/dts/tests/TestSuite_vlan.py @@ -48,29 +48,26 @@ def send_vlan_packet_and_verify( strip: indicates whether stripping is on or off, and when the vlan tag is checked for a match """ - data = "P" * 10 - packet = Ether() / Dot1Q(vlan=vlan_id) / Raw(load=data) + packet = Ether() / Dot1Q(vlan=vlan_id) / Raw(load='xxxxx') received_packets = self.send_packet_and_capture(packet) - received_packets = [ - packets - for packets in received_packets - if hasattr(packets, "load") and data in str((packets.load)) - ] + test_packet = None + for packet in received_packets: + if packet.haslayer(Raw) and packet[Raw].load == b'xxxxx': + test_packet = packet + break if should_receive: self.verify( - len(received_packets) == 1, "Packet was dropped when it should have been received" + test_packet is not None, "Packet was dropped when it should have been received" ) - received = received_packets[0] if strip: - self.verify(Dot1Q not in received, "Vlan tag was not stripped successfully") + self.verify(Dot1Q not in test_packet, "Vlan tag was not stripped successfully") else: - if len(received_packets) == 1: self.verify( - received.vlan == vlan_id, "The received tag did not match the expected tag" + test_packet.vlan == vlan_id, "The received tag did not match the expected tag" ) else: self.verify( - not len(received_packets) == 1, + test_packet is None, "Packet was received when it should have been dropped", ) @@ -81,20 +78,18 @@ def send_packet_and_verify_insertion(self, expected_id: int = -1) -> None: expected_id: the vlan id that is being inserted through tx_offload configuration should_receive: indicate whether the packet should be successfully received """ - data = "P" * 10 - packet = Ether() / Raw(load=data) + packet = Ether() / Raw(load='xxxxx') received_packets = self.send_packet_and_capture(packet) - received_packets = [ - packets - for packets in received_packets - if hasattr(packets, "load") and data in str((packets.load)) - ] + test_packet = None + for packet in received_packets: + if packet.haslayer(Raw) and packet[Raw].load == b'xxxxx': + test_packet = packet + break self.verify( - len(received_packets) == 1, "Packet was dropped when it should have been received" + test_packet is not None, "Packet was dropped when it should have been received" ) - received = received_packets[0] - self.verify(Dot1Q in received, "The received packet did not have a vlan tag") - self.verify(received.vlan == expected_id, "The received tag did not match the expected tag") + self.verify(Dot1Q in test_packet, "The received packet did not have a vlan tag") + self.verify(test_packet.vlan == expected_id, "The received tag did not match the expected tag") def test_vlan_receipt_no_stripping(self) -> None: """Ensure vlan packet is dropped when receipts are enabled and header stripping is disabled. @@ -104,8 +99,8 @@ def test_vlan_receipt_no_stripping(self) -> None: """ testpmd = self.sut_node.create_interactive_shell(TestPmdShell, privileged=True) testpmd.set_forward_mode(TestPmdForwardingModes.mac) - testpmd.send_command("set verbose 1", "testpmd>") - testpmd.send_command("set promisc 0 off", "testpmd>") + testpmd.set_verbose(1) + testpmd.set_promisc(0, False) testpmd.vlan_filter_set_on(0) testpmd.rx_vlan_add(1, 0) testpmd.start() @@ -122,8 +117,8 @@ def test_vlan_receipt_stripping(self) -> None: """ testpmd = self.sut_node.create_interactive_shell(TestPmdShell, privileged=True) testpmd.set_forward_mode(TestPmdForwardingModes.mac) - testpmd.send_command("set verbose 1", "testpmd>") - testpmd.send_command("set promisc 0 off", "testpmd>") + testpmd.set_verbose(1) + testpmd.set_promisc(0, False) testpmd.vlan_filter_set_on(0) testpmd.rx_vlan_add(1, 0) testpmd.vlan_strip_set_on(0) @@ -140,8 +135,8 @@ def test_vlan_no_receipt(self) -> None: """ testpmd = self.sut_node.create_interactive_shell(TestPmdShell, privileged=True) testpmd.set_forward_mode(TestPmdForwardingModes.mac) - testpmd.send_command("set verbose 1", "testpmd>") - testpmd.send_command("set promisc 0 off", "testpmd>") + testpmd.set_verbose(1) + testpmd.set_promisc(0, False) testpmd.vlan_filter_set_on(0) testpmd.rx_vlan_add(1, 0) testpmd.start() @@ -158,8 +153,8 @@ def test_vlan_header_insertion(self) -> None: """ testpmd = self.sut_node.create_interactive_shell(TestPmdShell, privileged=True) testpmd.set_forward_mode(TestPmdForwardingModes.mac) - testpmd.send_command("set verbose 1", "testpmd>") - testpmd.send_command("set promisc 0 off", "testpmd>") + testpmd.set_verbose(1) + testpmd.set_promisc(0, False) testpmd.port_stop_all() testpmd.tx_vlan_set(1, 51) testpmd.port_start_all() -- 2.44.0