def runTest(self): #for d in [wan, lan]: #d.sendline('apt-get update && apt-get -o Dpkg::Options::="--force-confnew" -y install socat pv') #d.expect(prompt) maxtime = 5 board.get_nf_conntrack_conn_count() for i in range(10000): sz, rate, ip, port = self.startSingleFlow(maxtime=maxtime) print("started UDP to %s:%s sz = %s, rate = %sk" % (ip, port, sz, rate)) time = sz / (rate * 1024) print("time should be ~%s" % time) self.check_and_clean_ips() lan.sendline('fg') lan.expect(prompt, timeout=5) board.get_pp_dev().sendline( 'cat /proc/net/nf_conntrack | grep dst=%s.*dport=%s' % (ip, port)) board.get_pp_dev().expect(prompt) board.get_nf_conntrack_conn_count() self.recover()
def runTest(self): #for d in [wan, lan]: #d.sendline('apt-get update && apt-get -o Dpkg::Options::="--force-confnew" -y install socat pv') #d.expect(prompt) sz, rate, ip, port = self.startSingleFlow() print("started UDP to %s:%s sz = %s, rate = %sk" % (ip, port, sz, rate)) time = sz / ( rate * 1024) print("time should be ~%s" % time) self.check_and_clean_ips() lan.sendline('fg') lan.expect(prompt, timeout=time+10) # TODO: make this a function that's more robust board.get_pp_dev().sendline('cat /proc/net/nf_conntrack | grep dst=%s.*dport=%s' % (ip, port)) board.get_pp_dev().expect(prompt) self.recover()
def runTest(self): pp = board.get_pp_dev() with open(os.path.join(self.config.output_dir, 'iptables.log'), 'w') as ipt_log: for tbl in ['filter', 'nat', 'mangle', 'raw', 'security']: pp.sendline('iptables -n -t %s -L -v; echo DONE' % tbl) pp.expect_exact('echo DONE') pp.expect_exact('DONE') ipt_log.write(pp.before) pp.expect(pp.prompt)
def runTest(self): # TODO: create a get devices function? devs = [] for device in self.config.devices: devs.append(getattr(self.config, device)) devs.append(board.get_pp_dev()) results = [] for d1 in devs: for d2 in devs: if d1 is d2: continue board.touch() print("comparing " + d1.name + " to " + d2.name) try: ip1 = d1.get_interface_ipaddr(d1.iface_dut) ip2 = d2.get_interface_ipaddr(d2.iface_dut) def parse_ping_times(string): r = [ float(i) for i in re.findall('time=([^\s]*) ms', string) ] return sum(r) / len(r) d1.sendline("ping -c20 %s" % ip2) d1.expect_exact("ping -c20 %s" % ip2) d1.expect(d1.prompt) result = parse_ping_times(d1.before) if result is not float('nan'): results.append('latency from %s to %s = %s ms' % (d1.name, d2.name, str(result))) d2.sendline("ping -c20 %s" % ip1) d2.expect_exact("ping -c20 %s" % ip1) d2.expect(d2.prompt) result = parse_ping_times(d2.before) if result is not float('nan'): results.append('latency from %s to %s = %s ms' % (d2.name, d1.name, str(result))) except: print("failed to ping " + d1.name + " to " + d2.name) continue print("Results:") for line in results: print(line)
def runTest(self): pp = board.get_pp_dev() pp.sendline('iptables -Z') pp.expect(pp.prompt)