'Verify that link bandwidths are accurate within a bound.'

def testLinkBandwidth(self):

    if (self.switchClass is UserSwitch):
        self.skipTest('UserSwitch    has    very    poor    performance    -    skipping    for    now')
    BW = 5
    BW_TOLERANCE = 0.8
    lopts = {'bw': BW, 'use_htb': True}
    mn = Mininet(SingleSwitchOptionsTopo(n=N, lopts=lopts), link=TCLink, switch=self.switchClass, waitConnected=True)
    bw_strs = mn.run(mn.iperf, fmt='m')
    loptsStr = ',    '.join((('%s:    %s' % (opt, value)) for (opt, value) in lopts.items()))
    msg = ('\nTesting    link    bandwidth    limited    to    %d    Mbps    per    link\niperf    results[    client,    server    ]:    %s\nTopo    =    SingleSwitchTopo,    %s    hosts\nLink    =    TCLink\nlopts    =    %s\nhost    =    default\nswitch    =    %s\n' % (BW, bw_strs, N, loptsStr, self.switchClass))
    (serverRate, _clientRate) = bw_strs
    bw = float(serverRate.split('    ')[0])
    self.assertWithinTolerance(bw, BW, BW_TOLERANCE, msg)
