'Verify topology creation with CPU limits set for both schedulers.'

def testCPULimits(self):

    CPU_FRACTION = 0.1
    CPU_TOLERANCE = 0.8
    hopts = {'cpu': CPU_FRACTION}
    mn = Mininet(SingleSwitchOptionsTopo(n=N, hopts=hopts), host=CPULimitedHost, switch=self.switchClass, waitConnected=True)
    mn.start()
    results = mn.runCpuLimitTest(cpu=CPU_FRACTION)
    mn.stop()
    hostUsage = '\n'.join((('h%s:    %s' % ((n + 1), results[((n - 1) * 5):((n * 5) - 1)])) for n in range(N)))
    hoptsStr = ',    '.join((('%s:    %s' % (opt, value)) for (opt, value) in hopts.items()))
    msg = ('\nTesting    cpu    limited    to    %d%%    of    cpu    per    host\ncpu    usage    percent    per    host:\n%s\nTopo    =    SingleSwitchTopo,    %s    hosts\nhopts    =    %s\nhost    =    CPULimitedHost\nSwitch    =    %s\n' % ((CPU_FRACTION * 100), hostUsage, N, hoptsStr, self.switchClass))
    for pct in results:
        self.assertWithinTolerance((pct / 100), CPU_FRACTION, CPU_TOLERANCE, msg)
