added comments

This commit is contained in:
Raphael Bauduin 2015-08-03 11:10:28 -07:00
parent 069727fdc8
commit 3fa6fcb19f
3 changed files with 5 additions and 0 deletions

View File

@ -1,5 +1,6 @@
checkers: checkers:
tshark: tshark:
# applies provided filter to tcpdump trace and returns number of packets matching
- test: "filter" - test: "filter"
filter: "tcp.options.mptcp.subtype==5" filter: "tcp.options.mptcp.subtype==5"
validations: validations:

View File

@ -1,5 +1,6 @@
checkers: checkers:
tshark: tshark:
# applies provided filter to tcpdump trace and returns number of packets matching
- test: "filter" - test: "filter"
filter: "tcp.options.mptcp.subtype==5" filter: "tcp.options.mptcp.subtype==5"
validations: validations:

View File

@ -127,10 +127,12 @@ class Tester:
raise Exception("Method not implemented") raise Exception("Method not implemented")
# applies provided filter to Checker's trace, and returns number of lines in output(ie number of packets)
class FilterTest(Tester): class FilterTest(Tester):
def get_tested_value(self, yml): def get_tested_value(self, yml):
if "filter" in self.yml: if "filter" in self.yml:
ret = check_output(["tshark", "-r", self.trace, "-Y", self.yml["filter"]]) ret = check_output(["tshark", "-r", self.trace, "-Y", self.yml["filter"]])
# -1 : substract line of sudo error message printed by tshark
return len(ret.split("\n")) - 1 return len(ret.split("\n")) - 1
else: else:
raise Exception("Test requires a filter.") raise Exception("Test requires a filter.")
@ -171,6 +173,7 @@ class TcptraceChecker(Checker):
self.trace = TcptraceData(destDir+"/client.pcap") self.trace = TcptraceData(destDir+"/client.pcap")
self.test_id = test_id self.test_id = test_id
# Runs tests based on the tcpdump trace itself
class TsharkChecker(Checker): class TsharkChecker(Checker):
def __init__(self, yml, test_id, destDir): def __init__(self, yml, test_id, destDir):
self.yml = yml["tshark"] self.yml = yml["tshark"]