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 536C9A0350; Mon, 29 Jun 2020 18:01:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 355E21BFC4; Mon, 29 Jun 2020 18:01:36 +0200 (CEST) Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) by dpdk.org (Postfix) with ESMTP id 693181BF73 for ; Mon, 29 Jun 2020 18:01:35 +0200 (CEST) Received: by mail-qk1-f194.google.com with SMTP id b4so15678108qkn.11 for ; Mon, 29 Jun 2020 09:01:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=C2hc6hLIapTe2LO6pOahiz6C8SAy6QcO5OlIY93d9qM=; b=UpBVIW4VDPBpiqWOt9oSqcgTXpJMVzB8zx6MJ9SBDftx9eDwGXdWRN14tS/e0tTttG S2lTf2Dc+b+M7piXORuStywrq5uVxPZt2PDL8HovdCVUSAp4bXojVBp0WMXO+YIaB0CL VR4PbmqAihCo4b2utAD8UNB/pq0UwA0LzpU4s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=C2hc6hLIapTe2LO6pOahiz6C8SAy6QcO5OlIY93d9qM=; b=KjUdf0hHLhO4Aaz54KVVxnj/Mku+mAkqiV+Vra8I6ZK8Ch/76Orhu8u3Hg4YtLPI/n dZrWgAYWUQ+6ejO8IHAKwaJUBivq1VUfu8DjYcMMNMFmaw4odkVke2ZoGl7Rt41v5VXi jkd0c0AJdlIPOm2VlE7I5prDDoKbbuQoW5KqR8dn7antInVq7dYvU0FZwCK9Qd23HYRs 32RjUZQPix9ze8WZvPfG92LBGwP1R2OgVNxtUBjJo4bChwDOB7j9LYLvOEISMsks5/m7 wegUOzVt98+F+LvG/BWNAF7Z6EWjkTZ57mZ18L9qrMSH3uylHSJMlerBEqxdY06k4OXv kjLg== X-Gm-Message-State: AOAM530HBMgT0UlWrvWOVoCfSsB46T8VWJhVODeKRTiezKN4SKJT9H9p y2mzwExwVbiQEUD4fFWsUXlmNNUCNCC52aG6gT8iHLZF2Dg= X-Google-Smtp-Source: ABdhPJybNuY3r8kF8oIE5LRylsx8lTrOKPd6XH7KW6B/Tt37AcC2YcdwnM8W2p5LpCfkaHVVSaYftEXk30ShFssmBbU= X-Received: by 2002:a37:5b46:: with SMTP id p67mr13813829qkb.346.1593446494527; Mon, 29 Jun 2020 09:01:34 -0700 (PDT) MIME-Version: 1.0 References: <20200616212119.37730-1-ohilyard@iol.unh.edu> <20200629155902.41036-1-ohilyard@iol.unh.edu> In-Reply-To: <20200629155902.41036-1-ohilyard@iol.unh.edu> From: Owen Hilyard Date: Mon, 29 Jun 2020 12:00:58 -0400 Message-ID: To: dts@dpdk.org Cc: david.marchand@redhat.com, Thomas Monjalon , ferruh.yigit@intel.com, arybchenko@solarflare.com, shys@mellanox.com, stephen@networkplumber.org, mb@smartsharesystems.com, Lincoln Lavoie Content-Type: multipart/alternative; boundary="00000000000046af1a05a93b2c45" Subject: Re: [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" --00000000000046af1a05a93b2c45 Content-Type: text/plain; charset="UTF-8" My apologies about the formatting, gmail wasn't playing nice with sending the patch as a thread. On Mon, Jun 29, 2020 at 11:59 AM Owen Hilyard wrote: > 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 > > --00000000000046af1a05a93b2c45 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
My apologies about the formatting, gmail wasn't playin= g nice with sending the patch as a thread.=C2=A0

On Mon, Jun 29, 2020 at 11:= 59 AM Owen Hilyard <ohilyard@iol= .unh.edu> wrote:
add a test case which tries to set the mtu to several invalid value= s
add documented for aformentioned test case.

Signed-off-by: Owen Hilyard <ohilyard@iol.unh.edu>
---
=C2=A0test_plans/mtu_update_test_plan.rst |=C2=A0 6 ++++
=C2=A0tests/TestSuite_mtu_update.py=C2=A0 =C2=A0 =C2=A0 =C2=A0| 43 ++++++++= ++++++++++++---------
=C2=A02 files changed, 36 insertions(+), 13 deletions(-)

diff --git a/test_plans/mtu_update_test_plan.rst b/test_plans/mtu_update_te= st_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 ::
=C2=A0 =C2=A0 =C2=A0#######################################################= #####################

=C2=A0Verify that TX-bytes on port 0 and RX-bytes on port 1 are 1500
+
+Test Case: MTU Checks Invalid Values
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+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<= br> index 6e425dc..0547494 100644
--- a/tests/TestSuite_mtu_update.py
+++ b/tests/TestSuite_mtu_update.py
@@ -34,25 +34,14 @@
=C2=A0DPDK Test suite.
=C2=A0MTU Checks example.
=C2=A0"""
-import os
-import subprocess
=C2=A0from time import sleep
-from typing import List, Tuple
+from typing import Tuple

-import utils
=C2=A0from pmd_output import PmdOutput
-from test_case import TestCase
-
-from pktgen_base import TRANSMIT_S_BURST

=C2=A0import utils
-import re
=C2=A0import time
=C2=A0from test_case import TestCase
-from pktgen import TRANSMIT_CONT
-
-from framework.packet import Packet
-from framework.settings import HEADER_SIZE

=C2=A0ETHER_HEADER_LEN =3D 18
=C2=A0IP_HEADER_LEN =3D 20
@@ -112,7 +101,6 @@ class TestMtuUpdate(TestCase):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 f'Ether(dst= =3Ddutmac, src=3D"52:00:00:00:00:00")/IP()/Raw(load=3D"\x50&= quot;*{padding})')
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return out

-
=C2=A0 =C2=A0 =C2=A0def send_packet_of_size_to_tx_port(self, pktsize, recei= ved=3DTrue):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Send 1 packet to portid
@@ -185,6 +173,12 @@ class TestMtuUpdate(TestCase):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0clear up.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self.dut.kill_all()
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 self.pmdout.start_testpmd("Default")=
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 self.exec("port stop all")
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 for port in self.dut_ports:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.exec(f"port config mtu= {port} 1500")
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 self.exec("port start all")
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 self.pmdout.quit()

=C2=A0 =C2=A0 =C2=A0def admin_tester_port(self, local_port, status):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""
@@ -208,6 +202,7 @@ class TestMtuUpdate(TestCase):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0@return: None
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self.admin_tester_port(self.tester.get_lo= cal_port(self.tx_port), f"mtu {mtu:d}")
+
=C2=A0 =C2=A0 =C2=A0#
=C2=A0 =C2=A0 =C2=A0#
=C2=A0 =C2=A0 =C2=A0#
@@ -264,3 +259,25 @@ class TestMtuUpdate(TestCase):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 then being sent packets of size 8999 and= 9000.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self.helper_test_mut_checks(9000)
+
+=C2=A0 =C2=A0 def test_mtu_checks_invalid_values(self):
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Checks that invalid arguments are rejected. +=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 self.pmdout.start_testpmd("Default")=
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 self.exec("port stop all")
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 for port in self.dut_ports:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.exec(f"port config mtu= {port} 1500")
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 for invalid_arg in -1, 2 ** 128,= "strings_should't_work", 1.2, '\0':
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.verify("= Bad arguments" in self.exec(f"port config mtu {port :d} {invalid_= arg}"),
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 f"MTU {invalid_arg} was accepted when it shou= ldn't have been.")
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 mtu: int =3D int(s= elf.pmdout.get_detail_from_port_info("MTU: ", "\d+", po= rt))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 for to_low_arg in range(0, 64):<= br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.verify("= mtu cannot be less than 64" in self.exec(f"port config mtu {port = :d} {to_low_arg}"),
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 f"MTU {to_low_arg} was accepted when it shoul= dn't have been.")
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 # Check 10000, which should bare= ly be to high for most NICS
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.verify("is not in vali= d range" in self.exec(f"port config mtu {port :d} 10000"), +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 f"MTU 10000 was accepted when it shouldn't have been.&q= uot;)
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 self.exec("port start all")
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 self.pmdout.quit()
--
2.25.1

--00000000000046af1a05a93b2c45--