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 CD052A00C4; Thu, 23 Apr 2020 15:33:02 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BDA4B1D167; Thu, 23 Apr 2020 15:33:02 +0200 (CEST) Received: from mail-il1-f181.google.com (mail-il1-f181.google.com [209.85.166.181]) by dpdk.org (Postfix) with ESMTP id 8AC2E1C23F for ; Thu, 23 Apr 2020 15:33:01 +0200 (CEST) Received: by mail-il1-f181.google.com with SMTP id r2so5521121ilo.6 for ; Thu, 23 Apr 2020 06:33:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; h=mime-version:from:date:message-id:subject:to; bh=U4FKSyS2IjKMxHwiFUl0wjOtWzW3FaJU0xrHXL0P6RE=; b=ChwEgewXK9d8F2MxTzNN2y0QWyI1We6tP+THEGDaOFz3uWNjisnNlNZ+GGLTksq/Et JGGu345GMFxK18Msh2mJDXTQEmA5dhQIoGHqszHClCrVEi9XSIBuJz6H5ig+SoILyKoD 1LpVDjzzx1MlGAmIHPxMM/GXzSwwvfGKeAZDI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=U4FKSyS2IjKMxHwiFUl0wjOtWzW3FaJU0xrHXL0P6RE=; b=XEGlerRnsBo9UWDC61czRpGdOxQemoxTJ/oVhh/ORUDKFytD4HXonnkEEaDNDR3h64 u2B/OycJcET5f71kZ0/vftcHN/rs6bEraCPOQBJAIwkNNzmLaeao9BzgU/RKvcoVZgEV m1qPa7lkGI54jpD+LOiHv45HU6EJPxfaifQAQ47byXdnPwHu7hqJgmLfeWl8M3Rd4r5d sMBO6gy9ZwLicYVh7yno4fwVWsxQpzqyY9gpCcIhD+GDgnKvmAlUSH3OKmLHnKu7n/Z3 K4LsDisrt3WNFn75znY20YSKBtf1s1Zi1yE921z/EDtzy2H7SJyuZgWs1AveCcx+pcYt tLrg== X-Gm-Message-State: AGi0PuYP1JOoQFUe77Cq8xg62o5zzvoWqgMyC2rkQ6p46rWFuj27IaT9 xvt1YK6D6/xiLBCd75uHOW9QHAPs/uEBtA6//HxHLykgRDY= X-Google-Smtp-Source: APiQypJ90x1VUHaS8AgcNUQh8/1tdABDF4te7mPJ7Sj4uaCMXUIf8V7yUrCHY20vLkjrQ97ijO1bQxTlt9bK7qGUyOA= X-Received: by 2002:a05:6e02:cc6:: with SMTP id c6mr3218881ilj.188.1587648780522; Thu, 23 Apr 2020 06:33:00 -0700 (PDT) MIME-Version: 1.0 From: Brandon Lo Date: Thu, 23 Apr 2020 09:32:25 -0400 Message-ID: To: dts@dpdk.org Content-Type: multipart/alternative; boundary="00000000000097706a05a3f549e1" Subject: [dts] [PATCH] Add link status check test 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" --00000000000097706a05a3f549e1 Content-Type: text/plain; charset="UTF-8" This is a simple test meant to check whether or not the link status changes when we set the link down/up. Signed-off-by: Brandon Lo --- test_plans/link_status_test_plan.rst | 48 +++++++++++++++++++++ tests/TestSuite_link_status.py | 63 ++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 test_plans/link_status_test_plan.rst create mode 100644 tests/TestSuite_link_status.py diff --git a/test_plans/link_status_test_plan.rst b/test_plans/link_status_test_plan.rst new file mode 100644 index 0000000..2d92a68 --- /dev/null +++ b/test_plans/link_status_test_plan.rst @@ -0,0 +1,48 @@ +============================================= +Link Status Check +============================================= + +This check will use testpmd to test whether or not a link can be set as +down/up and appear as the set status. + + +Prerequisites +============= + +Compile DPDK and testpmd. Be able to have the testpmd run. + +Test Case: set links as down +========================================== + +Run testpmd in interactive mode :: + + $ ./dpdk-testpmd -- -i + +This can be run with other arguments as well, depending on your setup. + +Run this command in testpmd :: + + testpmd> set link-down port 0 + +Verify the output matches with the port being down :: + + testpmd> show port summary 0 + + +Test Case: set links as up +=========================================== + +Run testpmd in interactive mode :: + + $ ./dpdk-testpmd -- -i + +This can be run with other arguments as well, depending on your setup. + +Run this command in testpmd :: + + testpmd> set link-up port 0 + +Verify the output matches with the port being up :: + + testpmd> show port summary 0 + diff --git a/tests/TestSuite_link_status.py b/tests/TestSuite_link_status.py new file mode 100644 index 0000000..0172000 --- /dev/null +++ b/tests/TestSuite_link_status.py @@ -0,0 +1,63 @@ +""" +DPDK Test suite. +Testing link status in testpmd +""" + +import utils +import time +from test_case import TestCase +from pmd_output import PmdOutput + +class TestLinkStatus(TestCase): + + def set_up_all(self): + """ + Run at the start of each test suite. + """ + self.dut.build_install_dpdk(self.target) + self.pmdout = PmdOutput(self.dut) + self.pmdout.start_testpmd() + self.dut_ports = self.dut.get_ports() + + def set_up(self): + """ + Run before each test case. + Nothing to do. + """ + pass + + def test_link_down(self): + """ + Run set link-down on ports and check if they are down in summary. + """ + for port in self.dut_ports: + self.dut.send_command('set link-down port {}'.format(port)) + time.sleep(5) + self.dut.send_command('show port summary {}'.format(port)) + self.verify('down' in self.dut.session.history[-1]['output'], + 'Link down for port {}'.format(port)) + + def test_link_up(self): + """ + Run set link-up on ports and check if they are up in summary. + """ + for port in self.dut_ports: + self.dut.send_command('set link-up port {}'.format(port)) + time.sleep(5) + self.dut.send_command('show port summary {}'.format(port)) + self.verify('up' in self.dut.session.history[-1]['output'], + 'Link up for port {}'.format(port)) + + def tear_down(self): + """ + Run after each test case. + Nothing to do. + """ + pass + + def tear_down_all(self): + """ + Quit out of testpmd + """ + self.dut.send_expect("quit", "# ", 30) + -- 2.17.1 --00000000000097706a05a3f549e1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
This is a simple test meant to = check whether or not the
link status changes when we set the link down/up.

Signed-off-by: Brandon Lo <blo@iol.unh.edu>
---
=C2=A0test_plans/link_status_test_plan.rst | 48 +++++++++++++++++++++
=C2=A0tests/TestSuite_link_status.py=C2=A0 =C2=A0 =C2=A0 =C2=A0| 63 +++++++= +++++++++++++++++++++
=C2=A02 files changed, 111 insertions(+)
=C2=A0create mode 100644 test_plans/link_status_test_plan.rst
=C2=A0create mode 100644 tests/TestSuite_link_status.py

diff --git a/test_plans/link_status_test_plan.rst b/test_plans/link_status_= test_plan.rst
new file mode 100644
index 0000000..2d92a68
--- /dev/null
+++ b/test_plans/link_status_test_plan.rst
@@ -0,0 +1,48 @@
+=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=3D=3D=3D=3D=3D=3D=3D=3D
+Link Status Check
+=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=3D=3D=3D=3D=3D=3D=3D=3D
+
+This check will use testpmd to test whether or not a link can be set as +down/up and appear as the set status.
+
+
+Prerequisites
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+Compile DPDK and testpmd. Be able to have the testpmd run.
+
+Test Case: set links as down
+=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=3D=3D=3D=3D=3D
+
+Run testpmd in interactive mode ::
+
+=C2=A0 $ ./dpdk-testpmd -- -i
+
+This can be run with other arguments as well, depending on your setup.
+
+Run this command in testpmd ::
+
+=C2=A0 testpmd> set link-down port 0
+
+Verify the output matches with the port being down ::
+=C2=A0
+=C2=A0 testpmd> show port summary 0
+
+
+Test Case: set links as up
+=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=3D=3D=3D=3D=3D=3D
+
+Run testpmd in interactive mode ::
+
+=C2=A0 $ ./dpdk-testpmd -- -i
+
+This can be run with other arguments as well, depending on your setup.
+
+Run this command in testpmd ::
+
+=C2=A0 testpmd> set link-up port 0
+
+Verify the output matches with the port being up ::
+=C2=A0
+=C2=A0 testpmd> show port summary 0
+
diff --git a/tests/TestSuite_link_status.py b/tests/TestSuite_link_status.p= y
new file mode 100644
index 0000000..0172000
--- /dev/null
+++ b/tests/TestSuite_link_status.py
@@ -0,0 +1,63 @@
+"""
+DPDK Test suite.
+Testing link status in testpmd
+"""
+
+import utils
+import time
+from test_case import TestCase
+from pmd_output import PmdOutput
+
+class TestLinkStatus(TestCase):
+
+=C2=A0 =C2=A0 def set_up_all(self):
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Run at the start of each test suite.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 self.dut.build_install_dpdk(self.target)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 self.pmdout =3D PmdOutput(self.dut)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 self.pmdout.start_testpmd()
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 self.dut_ports =3D self.dut.get_ports()
+
+=C2=A0 =C2=A0 def set_up(self):
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Run before each test case.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Nothing to do.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 pass
+
+=C2=A0 =C2=A0 def test_link_down(self):
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Run set link-down on ports and check if they a= re down in summary.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
+=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.dut.send_command('set l= ink-down port {}'.format(port))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 time.sleep(5)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.dut.send_command('show = port summary {}'.format(port))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.verify('down' in se= lf.dut.session.history[-1]['output'],
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 '= ;Link down for port {}'.format(port))
+
+=C2=A0 =C2=A0 def test_link_up(self):
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Run set link-up on ports and check if they are= up in summary.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
+=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.dut.send_command('set l= ink-up port {}'.format(port))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 time.sleep(5)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.dut.send_command('show = port summary {}'.format(port))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.verify('up' in self= .dut.session.history[-1]['output'],
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 '= ;Link up for port {}'.format(port))
+
+=C2=A0 =C2=A0 def tear_down(self):
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Run after each test case.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Nothing to do.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 pass
+
+=C2=A0 =C2=A0 def tear_down_all(self):
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Quit out of testpmd
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 self.dut.send_expect("quit", "#= ", 30)
+
--
2.17.1
--00000000000097706a05a3f549e1--