4 namespace eval excentis {
13 namespace eval ByteBlower {
65 proc FlowLatency { scenarioConfig args } {
67 set outputmode "numbers"
70 foreach { option value } $args {
71 set option [
string tolower $option ]
77 error "ByteBlowerHL FlowLatency error: Invalid argument '$option'"
85 if {$outputmode == "numbers"} {
90 proc x.FlowLatency.ScenarioConfig.Validate { scenarioConfig } {
105 foreach flowConfig $scenarioConfig {
111 foreach {item value} $flowConfig {
115 set txParamList $value
116 set index [ lsearch $txParamList "-latency" ]
117 if { $index != -1 && [
lindex $txParamList [
expr $index + 1 ] ] == 1 } {
123 # Rx part is validated later
125 default { error "ByteBlowerHL FlowLatency error: Invalid flow parameter '$item'\n flow configuration: '$flowConfig'" }
130 if { $txCount == 0} {
131 error "ByteBlowerHL FlowLatency error: flow must have at least one TX part\n flow configuration: '$flowConfig'"
133 if { $txCount > 1 && $latencyTxCount > 0} {
134 error "ByteBlowerHL FlowLatency error: flow with a latency-enabled TX part may have no other TX parts\n flow configuration: '$flowConfig'"
136 if { $latencyTxCount == 0 && $rxCount > 0} {
137 error "ByteBlowerHL FlowLatency error: flow without a latency-enabled TX part may not contain RX parts\n flow configuration: '$flowConfig'"
139 if { $latencyTxCount == 1 && $rxCount == 0} {
140 error "ByteBlowerHL FlowLatency error: flow with a latency-enabled TX part must have at least one latency-enabled RX part\n flow configuration: '$flowConfig'"
144 foreach {item value} $flowConfig {
147 set rxParamList $value
148 set basicLatencyCount 0
149 foreach {option value} $rxParamList {
152 incr basicLatencyCount
153 foreach {latOption latValue} $value {
154 # if type option is present, it must be 'basic' (basic is also default value)
155 switch -- $latOption {
157 if { ! [
string equal $latValue "" ] && ! [
string equal $latValue basic ] } {
158 error "ByteBlowerHL FlowLatency error: flow RX part may not contain '$latValue' type latency detector\n flow configuration: '$flowConfig'"
165 error "ByteBlowerHL FlowLatency error: latency flow RX part may not contain trigger\n flow configuration: '$flowConfig'"
168 error "ByteBlowerHL FlowLatency error: latency flow RX part may not contain capture tool\n flow configuration: '$flowConfig'"
171 error "ByteBlowerHL FlowLatency error: latency flow RX part may not contain out of sequence detector\n flow configuration: '$flowConfig'"
174 # ignore other parameters, not our task to validate them
178 if { $basicLatencyCount == 0 } {
179 error "ByteBlowerHL FlowLatency error: latency flow RX part must contain a latency detector\n flow configuration: '$flowConfig'"
181 if { $basicLatencyCount > 1 } {
182 error "ByteBlowerHL FlowLatency error: latency flow RX part must contain exactly one latency detector\n flow configuration: '$flowConfig'"
190 proc x.FlowLatency.Result.Parse.Numbers { scenarioResult } {
204 set scenarioNumbersResult [ list ]
205 foreach flowResult $scenarioResult {
206 set flowNumbersResult [ list ]
207 foreach {item value} $flowResult {
210 set txCounters $value
211 # Format: 'NrOfFramesSent <value> <FrameOid_1> <value_1> <FrameOid_2> ...'
212 # Required format: '<value>'
213 set txNumbersResult [
lindex $txCounters 1 ]
214 lappend flowNumbersResult "-tx" $txNumbersResult
217 if {$value != "NA"} {
218 set rxCounters $value
219 # Format: 'NrOfFrames <value> MinLatency <value> AvgLatency <value>
220 # MaxLatency <value> Jitter <value>'
221 # Required format: '<value> <value> <value> <value> <value>' (same order)
222 set rxNumbersResult [ list [
lindex $rxCounters 1] [
lindex $rxCounters 3] [
lindex $rxCounters 5] [
lindex $rxCounters 7] [
lindex $rxCounters 9] ]
223 lappend flowNumbersResult "-rx" $rxNumbersResult
225 lappend flowNumbersResult "-rx" $value
230 lappend scenarioNumbersResult $flowNumbersResult
232 return $scenarioNumbersResult