diff --git a/src/mpValidations.py b/src/mpValidations.py index d54ec4f..d3e0205 100644 --- a/src/mpValidations.py +++ b/src/mpValidations.py @@ -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) diff --git a/src/tests/base/validation.yml b/src/tests/base/validation.yml index 07f8c80..423d9fc 100644 --- a/src/tests/base/validation.yml +++ b/src/tests/base/validation.yml @@ -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"