Revision 4e76439c

View differences:

mininet/net.py
617 617

  
618 618
    # XXX This should be cleaned up
619 619

  
620
    def iperf( self, hosts=None, l4Type='TCP', udpBw='10M' ):
620
    def iperf( self, hosts=None, l4Type='TCP', udpBw='10M', format='M' ):
621 621
        """Run iperf between two hosts.
622 622
           hosts: list of hosts; if None, uses opposite hosts
623 623
           l4Type: string, one of [ TCP, UDP ]
......
640 640
            bwArgs = '-b ' + udpBw + ' '
641 641
        elif l4Type != 'TCP':
642 642
            raise Exception( 'Unexpected l4 type: %s' % l4Type )
643
        if not format == 'M':
644
          iperfArgs += '-f %s ' %format
643 645
        server.sendCmd( iperfArgs + '-s', printPid=True )
644 646
        servout = ''
645 647
        while server.lastPid is None:
mininet/test/test_hifi.py
55 55
        """
56 56
        self.assertGreaterEqual( float(measured),
57 57
                                 float(expected) * tolerance_frac )
58
        self.assertLess( float( measured ),
59
                                    float(expected) + (1-tolerance_frac) * float( expected ) )
58 60

  
59 61
    def testCPULimits( self ):
60 62
        "Verify topology creation with CPU limits set for both schedulers."
......
69 71
        results = mn.runCpuLimitTest( cpu=CPU_FRACTION )
70 72
        mn.stop()
71 73
        for cpu in results:
72
            self.assertWithinTolerance( cpu, CPU_FRACTION, CPU_TOLERANCE )
74
            #divide cpu by 100 to convert from percentage to fraction
75
            self.assertWithinTolerance( cpu/100, CPU_FRACTION, CPU_TOLERANCE )
73 76

  
74 77
    def testLinkBandwidth( self ):
75 78
        "Verify that link bandwidths are accurate within a bound."
76
        BW = 5  # Mbps
79
        BW = .5  # Mbps
77 80
        BW_TOLERANCE = 0.8  # BW fraction below which test should fail
78 81
        # Verify ability to create limited-link topo first;
79 82
        lopts = { 'bw': BW, 'use_htb': True }
80 83
        # Also verify correctness of limit limitng within a bound.
81 84
        mn = Mininet( SingleSwitchOptionsTopo( n=N, lopts=lopts ),
82 85
                      link=TCLink, switch=self.switchClass )
83
        bw_strs = mn.run( mn.iperf )
86
        bw_strs = mn.run( mn.iperf, format='m' )
84 87
        for bw_str in bw_strs:
85 88
            bw = float( bw_str.split(' ')[0] )
86 89
            self.assertWithinTolerance( bw, BW, BW_TOLERANCE )
......
101 104
        self.assertEqual( sent, received )
102 105
        # pylint: enable-msg=W0612
103 106
        for rttval in [rttmin, rttavg, rttmax]:
104
            # Multiply delay by 4 to cover there & back on two links
105
            self.assertWithinTolerance( rttval, DELAY_MS * 4.0,
107
            # Multiply delay by 8 to cover there & back on two links, for both the icmp packets and the arp packets
108
            self.assertWithinTolerance( rttval, DELAY_MS * 8.0, 
106 109
                                        DELAY_TOLERANCE)
107 110

  
111

  
108 112
    def testLinkLoss( self ):
109 113
        "Verify that we see packet drops with a high configured loss rate."
110 114
        LOSS_PERCENT = 99

Also available in: Unified diff