added min_delay_between validation

This commit is contained in:
Raphael Bauduin 2015-05-26 10:12:46 -07:00
parent 552393562c
commit 1e4f7f55bd
2 changed files with 23 additions and 1 deletions

View File

@ -38,6 +38,17 @@ class MinDelayValidation(Validation):
val = trace.first_packet(index)-trace.first_packet(0) val = trace.first_packet(index)-trace.first_packet(0)
return self.compared<=val return self.compared<=val
# individual flow validation (specific)
# gets flow_spec = ( [ index0, index1] , flows) where:
# - index0 is the index of the flow taken as reference for timing
# - index1 is the flow for which we want to validate the timing
# - flows is the array of flows
class MinDelayBetweenValidation(Validation):
def validate(self, flow_spec):
([index0, index1] ,trace) = flow_spec
val = trace.first_packet(index1)-trace.first_packet(index0)
return self.compared<=val
# Base class testing tcptrace results # Base class testing tcptrace results
@ -77,6 +88,7 @@ class NumberOfFlowsTest(TcptraceTest):
return self.trace.number_of_flows return self.trace.number_of_flows
# get_tested_value returns index of the flow to validate, and the list of flows # get_tested_value returns index of the flow to validate, and the list of flows
# index can be a compound value, as in the case of min_delay_between where it is an array of indexes
class FlowsTest(TcptraceTest): class FlowsTest(TcptraceTest):
def get_tested_value(self, yml): def get_tested_value(self, yml):
return (yml["index"],self.trace) return (yml["index"],self.trace)

View File

@ -3,12 +3,22 @@ tcptrace:
validations: validations:
- name: "min_value" - name: "min_value"
target: 2 target: 2
desc: "Open minimum 2 flows"
- name: "max_value" - name: "max_value"
target: 4 target: 4
desc: "Open maximum 4 flows"
- name: "exact_value" - name: "exact_value"
target: 4 target: 4
desc: "Open exactly 4 flows"
- test: "flows" - test: "flows"
validations: validations:
- name: "min_delay" - name: "min_delay"
index: 1 index: 1
target: 2000 target: 2
desc: "Minimum 2 seconds delay between opening of first and second flow"
- name: "min_delay_between"
index:
- 1
- 2
target: 1
desc: "Minimum 1 second delay between opening of second and third flow"