From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A3F9BA0350; Mon, 29 Jun 2020 17:59:10 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 58AC31BFA4; Mon, 29 Jun 2020 17:59:10 +0200 (CEST) Received: from mail-qk1-f196.google.com (mail-qk1-f196.google.com [209.85.222.196]) by dpdk.org (Postfix) with ESMTP id 0BFD71BFA2 for ; Mon, 29 Jun 2020 17:59:09 +0200 (CEST) Received: by mail-qk1-f196.google.com with SMTP id c30so11829236qka.10 for ; Mon, 29 Jun 2020 08:59:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DmfVssxVJPr0Kxjn+BWGiNhO19RV3Z/7pRsoYMI1l4I=; b=BmFmNCrVg0+9sTu30JIN530ANy0MvumppCi2arF+VFS+F2MECHmPxUXYDLM8+x4jyo wQtlYBbv+rSB8+uxuX4o1M5LHhRNBwPXdLG9tHXyTNBvl0DauKPqEcJIO9hhjOKOTUz4 eAdwwkPcLcIOmI1yGCCBYpDZu+hvBVPLOBLlU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DmfVssxVJPr0Kxjn+BWGiNhO19RV3Z/7pRsoYMI1l4I=; b=J/2NML0fGdOjBlg/4R6HFhybP/yDDCqOMKtfLyBSuXPliKdz2XGam7Gd3SPOKEoCzw VDY+2VgIsWOXsoXBFCGrJJsychGOhWPJKHphbb4Gz2ZM/gwLPliDgCbyfhtid2Q0Sa/m PCMdwmxL3e0XzRFAMUkyyW/hFIY+kUXCI29Ehh682vkZ+JuDDgGaLRaqOsIjzLwAMU3U Wl0tIrVa80uYyvWU5C57ib5DIxEEEQykDvNWitcKxr0dOfc58IAWi0hsr3R1V1Xvh+3c QerYCpnGGNxS3Ak2a06eun2ciwAyYvvCCj9HtrWb0RBigg4A2FURKddPIchf1ELhVxoq t+2g== X-Gm-Message-State: AOAM533f9w+3gB3A+FrTCBB8zu2xgQiDU8z/87Sv3vYIvUMaHySzRhTL jzbXMOXQUYTuJL299h/9nYiolxIWVKMjT6DpRUiHo7cFNlMcyf/Tc1ofO4LQGP7GvAadNDofLvQ aTjknJ7yl4utrFPIQYYs/n6Ve+M1tnXc+W1RAPEZnGqQvR1o4RwA0v1s4Xw== X-Google-Smtp-Source: ABdhPJylI7zA/tOpglhNIp0IiirsqkBsDQ/DVwRurd8BSuZFcr+n+gY48qlrpSyuQWqg/hFcrGEQTg== X-Received: by 2002:a37:aa87:: with SMTP id t129mr15780194qke.70.1593446347879; Mon, 29 Jun 2020 08:59:07 -0700 (PDT) Received: from ohilyard-Alienware-m17.iol.unh.edu (c-67-189-134-179.hsd1.nh.comcast.net. [67.189.134.179]) by smtp.gmail.com with ESMTPSA id t48sm56699qtb.50.2020.06.29.08.59.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2020 08:59:07 -0700 (PDT) Received: by ohilyard-Alienware-m17.iol.unh.edu (Postfix, from userid 1000) id 8F6A61014E4; Mon, 29 Jun 2020 11:59:06 -0400 (EDT) From: Owen Hilyard To: dts@dpdk.org Cc: david.marchand@redhat.com, thomas@monjalon.net, ferruh.yigit@intel.com, arybchenko@solarflare.com, shys@mellanox.com, stephen@networkplumber.org, mb@smartsharesystems.com, lylavoie@iol.unh.edu, Owen Hilyard Date: Mon, 29 Jun 2020 11:59:02 -0400 Message-Id: <20200629155902.41036-1-ohilyard@iol.unh.edu> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200616212119.37730-1-ohilyard@iol.unh.edu> References: <20200616212119.37730-1-ohilyard@iol.unh.edu> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dts] [PATCH v2] mtu update: add invalid values test case X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Sender: "dts" add a test case which tries to set the mtu to several invalid values add documented for aformentioned test case. Signed-off-by: Owen Hilyard --- test_plans/mtu_update_test_plan.rst | 6 ++++ tests/TestSuite_mtu_update.py | 43 ++++++++++++++++++++--------- 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/test_plans/mtu_update_test_plan.rst b/test_plans/mtu_update_test_plan.rst index b62ec15..70e5c04 100644 --- a/test_plans/mtu_update_test_plan.rst +++ b/test_plans/mtu_update_test_plan.rst @@ -152,3 +152,9 @@ Send a packet with size 1600 bytes :: ############################################################################ Verify that TX-bytes on port 0 and RX-bytes on port 1 are 1500 + +Test Case: MTU Checks Invalid Values +===================================== +This test case consists of attempting to set the MTU of ports to invalid +values through TestPmd. Values include the range [0, 63], -1, 2 ^ 128, +strings_should't_work, 1.2, a null character and 10000. diff --git a/tests/TestSuite_mtu_update.py b/tests/TestSuite_mtu_update.py index 6e425dc..0547494 100644 --- a/tests/TestSuite_mtu_update.py +++ b/tests/TestSuite_mtu_update.py @@ -34,25 +34,14 @@ DPDK Test suite. MTU Checks example. """ -import os -import subprocess from time import sleep -from typing import List, Tuple +from typing import Tuple -import utils from pmd_output import PmdOutput -from test_case import TestCase - -from pktgen_base import TRANSMIT_S_BURST import utils -import re import time from test_case import TestCase -from pktgen import TRANSMIT_CONT - -from framework.packet import Packet -from framework.settings import HEADER_SIZE ETHER_HEADER_LEN = 18 IP_HEADER_LEN = 20 @@ -112,7 +101,6 @@ class TestMtuUpdate(TestCase): f'Ether(dst=dutmac, src="52:00:00:00:00:00")/IP()/Raw(load="\x50"*{padding})') return out - def send_packet_of_size_to_tx_port(self, pktsize, received=True): """ Send 1 packet to portid @@ -185,6 +173,12 @@ class TestMtuUpdate(TestCase): clear up. """ self.dut.kill_all() + self.pmdout.start_testpmd("Default") + self.exec("port stop all") + for port in self.dut_ports: + self.exec(f"port config mtu {port} 1500") + self.exec("port start all") + self.pmdout.quit() def admin_tester_port(self, local_port, status): """ @@ -208,6 +202,7 @@ class TestMtuUpdate(TestCase): @return: None """ self.admin_tester_port(self.tester.get_local_port(self.tx_port), f"mtu {mtu:d}") + # # # @@ -264,3 +259,25 @@ class TestMtuUpdate(TestCase): then being sent packets of size 8999 and 9000. """ self.helper_test_mut_checks(9000) + + def test_mtu_checks_invalid_values(self): + """ + Checks that invalid arguments are rejected. + """ + self.pmdout.start_testpmd("Default") + self.exec("port stop all") + for port in self.dut_ports: + self.exec(f"port config mtu {port} 1500") + for invalid_arg in -1, 2 ** 128, "strings_should't_work", 1.2, '\0': + self.verify("Bad arguments" in self.exec(f"port config mtu {port :d} {invalid_arg}"), + f"MTU {invalid_arg} was accepted when it shouldn't have been.") + mtu: int = int(self.pmdout.get_detail_from_port_info("MTU: ", "\d+", port)) + for to_low_arg in range(0, 64): + self.verify("mtu cannot be less than 64" in self.exec(f"port config mtu {port :d} {to_low_arg}"), + f"MTU {to_low_arg} was accepted when it shouldn't have been.") + # Check 10000, which should barely be to high for most NICS + self.verify("is not in valid range" in self.exec(f"port config mtu {port :d} 10000"), + f"MTU 10000 was accepted when it shouldn't have been.") + + self.exec("port start all") + self.pmdout.quit() -- 2.25.1