Bug 467981 - Network test reported the wrong supported speed
Network test reported the wrong supported speed
Product: Red Hat Hardware Certification Program
Classification: Red Hat
Component: Test Suite (tests) (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Greg Nichols
Lawrence Lim
Depends On:
  Show dependency treegraph
Reported: 2008-10-21 22:20 EDT by QinXie
Modified: 2014-03-25 20:55 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-01-27 17:58:05 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
network.py patch to for network speed (1.02 KB, patch)
2008-11-20 13:39 EST, Greg Nichols
no flags Details | Diff

  None (edit)
Description QinXie 2008-10-21 22:20:48 EDT
In network.py function  getInterfaceSpeed() only read the first line of ethtool's output, so it is impossible to get the correct speed. 

At least, 3 lines need to be modified:
    def getInterfaceSpeed(self):
        # default to 100 Mb/s
        self.interfaceSpeed = 0
        for interfaceString in (self.interface, "p%s" % self.interface):
            ethtoolCommand = "ethtool %s" % interfaceString
            pipe = os.popen(ethtoolCommand)
#            line = pipe.readline()       
            line=pipe.read()                    # use method read() to get the whole output
            if line:
#                pattern = re.compile("Speed: \d+Mb/s")
                pattern = re.compile("(Speed: )(?P<speed>\d+)(Mb/s)")  # use re to match the speed
                match = pattern.search(line)
                if match:
#                    self.interfaceSpeed = string.atoi(match.group())
                    self.interfaceSpeed = string.atoi(match.group("speed"))  # transfer speed to type int
        if self.interfaceSpeed == 0:
            # default it to 100
            self.interfaceSpeed = 100
            return False

        return True
Comment 1 Greg Nichols 2008-11-20 13:39:31 EST
Created attachment 324219 [details]
network.py patch to for network speed

This patch revises the network test to use the HTS Command wrapper to find network speed on a multi-line result from ethtool.
Comment 3 Yan Tian 2009-01-01 23:53:01 EST
Verified network.py patch of Comment #1 was included in hts-5.3-12.
Comment 5 errata-xmlrpc 2009-01-27 17:58:05 EST
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.


Note You need to log in before you can comment on or make changes to this bug.