def runTest(self): installers.install_iperf3(wan) installers.install_iperf3(self.client) wan.sendline('iperf3 -s -p %s' % self.server_port) wan.expect( '-----------------------------------------------------------') wan.expect( '-----------------------------------------------------------') if self.target_ip == None: self.target_ip = wan.gw board.collect_stats(stats=['mpstat']) self.client.sendline( 'iperf3 %s -c %s -P5 -t %s -i 0 -p %s' % (self.opts, self.target_ip, self.time, self.server_port)) self.client.expect(prompt, timeout=self.time + 10) sender = re.findall('SUM.*Bytes\s*(.*/sec).*sender', self.client.before)[-1] if 'Mbits' in sender: s_rate = float(sender.split()[0]) elif 'Kbits' in sender: s_rate = float(sender.split()[0]) / 1024 elif 'Gbits' in sender: s_rate = float(sender.split()[0]) * 1024 else: raise Exception("Unknown rate in sender results") recv = re.findall('SUM.*Bytes\s*(.*/sec).*receiver', self.client.before)[-1] if 'Mbits' in recv: r_rate = float(recv.split()[0]) elif 'Kbits' in recv: r_rate = float(recv.split()[0]) / 1024 elif 'Gbits' in recv: r_rate = float(recv.split()[0]) * 1024 else: raise Exception("Unknown rate in recv results") self.logged['s_rate'] = s_rate self.logged['r_rate'] = r_rate self.recovery()
def runTest(self): installers.install_iperf3(wan) installers.install_iperf3(lan) wan.sendline('iperf3 -s -p %s' % self.server_port) wan.expect( '-----------------------------------------------------------') wan.expect( '-----------------------------------------------------------') lan.sendline('iperf3 %s -c %s -P5 -t %s -i 0 -p %s' % (self.opts, wan.gw, self.time, self.server_port)) lan.expect(prompt, timeout=self.time + 10) sender = re.findall('SUM.*Bytes\s*(.*/sec).*sender', lan.before)[-1] if 'Mbits' in sender: s_rate = float(sender.split()[0]) elif 'Kbits' in sender: s_rate = float(sender.split()[0]) / 1024 elif 'Gbits' in sender: s_rate = float(sender.split()[0]) * 1024 else: raise Exception("Unknown rate in sender results") recv = re.findall('SUM.*Bytes\s*(.*/sec).*receiver', lan.before)[-1] if 'Mbits' in recv: r_rate = float(recv.split()[0]) elif 'Kbits' in recv: r_rate = float(recv.split()[0]) / 1024 elif 'Gbits' in recv: r_rate = float(recv.split()[0]) * 1024 else: raise Exception("Unknown rate in recv results") self.result_message = "Sender rate = %s MBits/sec, Receiver rate = %s Mbits/sec\n" % ( s_rate, r_rate) self.logged['s_rate'] = s_rate self.logged['r_rate'] = r_rate self.recovery()
def runTest(self): installers.install_iperf3(wan) installers.install_iperf3(lan) wan.sendline('iperf3 -s') wan.expect( '-----------------------------------------------------------') wan.expect( '-----------------------------------------------------------') time = 60 lan.sendline('iperf3 -c 192.168.0.1 -P5 -t %s -i 0' % time) lan.expect(prompt, timeout=time + 5) sender = re.findall('SUM.*Bytes\s*(.*/sec).*sender', lan.before)[-1] if 'Mbits' in sender: s_rate = float(sender.split()[0]) elif 'Kbits' in sender: s_rate = float(sender.split()[0] / 1024) else: raise Exception("Unknown rate in sender results") recv = re.findall('SUM.*Bytes\s*(.*/sec).*receiver', lan.before)[-1] if 'Mbits' in recv: r_rate = float(recv.split()[0]) elif 'Kbits' in recv: r_rate = float(recv.split()[0] / 1024) else: raise Exception("Unknown rate in recv results") self.result_message = "Sender rate = %si MBits/sec, Receiver rate = %s Mbits/sec\n", ( s_rate, r_rate) self.logged['s_rate'] = s_rate self.logged['r_rate'] = r_rate self.recovery()