Skip to content
This repository was archived by the owner on Jun 27, 2018. It is now read-only.

Commit 037e819

Browse files
committed
fix filter for path_test_0
1 parent 94527f2 commit 037e819

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

pyretic/tests/test_bucket.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,19 @@ def get_tshark_counts(t_outfile, tshark_filter_funs):
9797
return tshark_counts
9898

9999
def tshark_filter_count(t_outfile, filter_fun):
100+
global ints_map
100101
t_out = open(t_outfile, 'r')
101102
pkt_count = 0
102103
byte_count = 0
103104
filter_fun = globals()[filter_fun]
105+
if 'any' not in ints_map:
106+
bytes_fun = get_bytes
107+
else:
108+
bytes_fun = get_bytes_cooked_capture
104109
for line in t_out:
105110
if filter_fun(line.strip()):
106111
pkt_count += 1
107-
byte_count += get_bytes_cooked_capture(line)
112+
byte_count += bytes_fun(line)
108113
return (pkt_count, byte_count)
109114

110115
def ctlr_counts(c_outfile):
@@ -258,7 +263,7 @@ def __get_arp_dstip(line):
258263
return line.split(',')[4]
259264

260265
def __get_interface_id(line):
261-
return line.split(',')[5]
266+
return int(line.split(',')[5])
262267

263268
def get_bytes(l):
264269
return int(__get_frame_len(l))
@@ -337,9 +342,7 @@ def filt_test7(l):
337342

338343
## Path Query test cases
339344
def filt_path_test_0(l):
340-
return (pkt_interface('s1-eth1', l) or
341-
pkt_interface('s1-eth2', l) or
342-
pkt_interface('s1-eth3', l))
345+
return pkt_interface('s2-eth3', l)
343346

344347
### Interfaces map for packet capture ###
345348
def map_any():

0 commit comments

Comments
 (0)