Revision 4e76439c mininet/test/test_hifi.py

View differences:

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