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)
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
@ -77,6 +88,7 @@ class NumberOfFlowsTest(TcptraceTest):
return self.trace.number_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):
def get_tested_value(self, yml):
return (yml["index"],self.trace)

View File

@ -3,12 +3,22 @@ tcptrace:
validations:
- name: "min_value"
target: 2
desc: "Open minimum 2 flows"
- name: "max_value"
target: 4
desc: "Open maximum 4 flows"
- name: "exact_value"
target: 4
desc: "Open exactly 4 flows"
- test: "flows"
validations:
- name: "min_delay"
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"