From: Brandon Lo <blo@iol.unh.edu>
To: dts@dpdk.org
Subject: [dts] [PATCH] Add link status check test
Date: Thu, 23 Apr 2020 09:32:25 -0400 [thread overview]
Message-ID: <CAOeXdvYp1Kyu9+WNtnOzk6eqvOj+_SN91O1hh0QWWtQ_w5Mxiw@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 3717 bytes --]
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>
---
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
[-- Attachment #2: Type: text/html, Size: 5078 bytes --]
next reply other threads:[~2020-04-23 13:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-23 13:32 Brandon Lo [this message]
2020-04-24 5:17 ` Tu, Lijuan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAOeXdvYp1Kyu9+WNtnOzk6eqvOj+_SN91O1hh0QWWtQ_w5Mxiw@mail.gmail.com \
--to=blo@iol.unh.edu \
--cc=dts@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).