Bug 467981 - Network test reported the wrong supported speed
Summary: Network test reported the wrong supported speed
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Hardware Certification Program
Classification: Retired
Component: Test Suite (tests)
Version: 5.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Greg Nichols
QA Contact: Lawrence Lim
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-10-22 02:20 UTC by QinXie
Modified: 2014-03-26 00:55 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2009-01-27 22:58:05 UTC
Embargoed:


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


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2009:0047 0 normal SHIPPED_LIVE hts bug fix update 2009-01-27 22:57:30 UTC

Description QinXie 2008-10-22 02:20:48 UTC
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
            pipe.close()
            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
                    break
        if self.interfaceSpeed == 0:
            # default it to 100
            self.interfaceSpeed = 100
            return False

        sys.stdout.flush()
        return True

Comment 1 Greg Nichols 2008-11-20 18:39:31 UTC
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-02 04:53:01 UTC
Verified network.py patch of Comment #1 was included in hts-5.3-12.

Comment 5 errata-xmlrpc 2009-01-27 22:58:05 UTC
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.

http://rhn.redhat.com/errata/RHBA-2009-0047.html


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