From: Haiyang Zhao <haiyangx.zhao@intel.com>
To: dts@dpdk.org
Cc: lijuan.tu@intel.com, Haiyang Zhao <haiyangx.zhao@intel.com>
Subject: [dts] [PATCH V2 3/5] nics/net_device: add attribute pkg and get method
Date: Thu, 18 Mar 2021 17:22:13 +0800 [thread overview]
Message-ID: <20210318092215.27270-4-haiyangx.zhao@intel.com> (raw)
In-Reply-To: <20210318092215.27270-1-haiyangx.zhao@intel.com>
add attribute pkg to record nic current package and add the related get method.
Signed-off-by: Haiyang Zhao <haiyangx.zhao@intel.com>
---
nics/net_device.py | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/nics/net_device.py b/nics/net_device.py
index bdc9d37d..6a26d1eb 100644
--- a/nics/net_device.py
+++ b/nics/net_device.py
@@ -71,6 +71,7 @@ class NetDevice(object):
self.intf2_name = None
self.get_interface_name()
self.socket = self.get_nic_socket()
+ self.pkg = {}
def stop(self):
pass
@@ -118,6 +119,27 @@ class NetDevice(object):
"""
return self.crb.get_pci_dev_driver(self.domain_id, self.bus_id, self.devfun_id)
+ def get_nic_pkg(self):
+ """
+ Get the NIC pkg.
+ """
+ out = self.__send_expect('dmesg | grep "DDP package" | tail -1', '# ')
+ if 'could not load' in out:
+ print(RED(out))
+ print(RED('Warning: The loaded DDP package version may not as you expected'))
+ try:
+ pkg_info = out.split('. ')[1].lower()
+ self.pkg['type'] = re.findall(".*package '(.*)'", pkg_info)[0].strip()
+ self.pkg['version'] = re.findall("version(.*)", pkg_info)[0].strip()
+ except:
+ print(RED('Warning: get pkg info failed'))
+ else:
+ pkg_info = out.split(': ')[-1].lower().split('package version')
+ if len(pkg_info) > 1:
+ self.pkg['type'] = pkg_info[0].strip()
+ self.pkg['version'] = pkg_info[1].strip()
+ return self.pkg
+
def get_nic_socket(self):
"""
Get socket id of specified pci device.
@@ -428,7 +450,6 @@ class NetDevice(object):
self.__send_expect("ifconfig %s down" % intf, "# ")
self.__send_expect("ifconfig %s up" % intf, "# ")
-
@nic_has_driver
def disable_ipv6(self):
"""
--
2.17.1
next prev parent reply other threads:[~2021-03-18 9:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-18 9:22 [dts] [PATCH V2 0/5] framework: add a proposal of recognizing pkgs Haiyang Zhao
2021-03-18 9:22 ` [dts] [PATCH V2 1/5] framework/exception: add new exception VerifySkip Haiyang Zhao
2021-03-18 9:22 ` [dts] [PATCH V2 2/5] framework/test_case: handle the VerifySkip exception and add some functions Haiyang Zhao
2021-03-18 9:22 ` Haiyang Zhao [this message]
2021-03-18 9:22 ` [dts] [PATCH V2 4/5] framework/dut: get nic package in dut prerequisites Haiyang Zhao
2021-03-18 9:22 ` [dts] [PATCH V2 5/5] tests: add nic and pkg check for rss_gtpu Haiyang Zhao
2021-03-19 8:49 ` [dts] [PATCH V2 0/5] framework: add a proposal of recognizing pkgs 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=20210318092215.27270-4-haiyangx.zhao@intel.com \
--to=haiyangx.zhao@intel.com \
--cc=dts@dpdk.org \
--cc=lijuan.tu@intel.com \
/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).