test suite reviews and discussions
 help / color / mirror / Atom feed
From: Zhimin Huang <zhiminx.huang@intel.com>
To: dts@dpdk.org
Cc: Zhimin Huang <zhiminx.huang@intel.com>
Subject: [dts] [PATCH V1] framework/crb:add check link status public method
Date: Thu,  6 Jan 2022 03:56:13 +0800	[thread overview]
Message-ID: <20220105195613.15561-1-zhiminx.huang@intel.com> (raw)

when we meet testpmd or app start but link is not up.
we can loop up the interface to ensure link.

Signed-off-by: Zhimin Huang <zhiminx.huang@intel.com>
---
 framework/crb.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/framework/crb.py b/framework/crb.py
index bd4f565d..22af9ad3 100755
--- a/framework/crb.py
+++ b/framework/crb.py
@@ -907,3 +907,17 @@ class Crb(object):
         else:
             self.logger.info("NIC %s may be not find %s" % (intf, flag))
             return False
+
+    def check_interfaces_link(self, intf, timeout=15):
+        """
+        loop to check port link status
+        """
+        for i in range(timeout):
+            out = self.send_expect("ethtool {} | tail -1 ".format(intf), "# ")
+            if 'Link detected: yes' not in out:
+                self.send_expect("ifconfig {} up".format(intf), "# ")
+                time.sleep(1)
+            else:
+                return True
+        self.logger.error("{} link is down".format(intf))
+        return False
-- 
2.17.1


             reply	other threads:[~2022-01-05 11:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-05 19:56 Zhimin Huang [this message]
2022-01-12  5:56 ` 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=20220105195613.15561-1-zhiminx.huang@intel.com \
    --to=zhiminx.huang@intel.com \
    --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).