4 namespace eval excentis {
13 namespace eval ByteBlower {
62 proc FlowOutofsequence { scenarioConfig args } {
64 set outputmode "numbers"
67 foreach { option value } $args {
68 set option [
string tolower $option ]
74 error "ByteBlowerHL FlowOutofsequence error: Invalid argument '$option'"
82 if {$outputmode == "numbers"} {
87 proc x.FlowOutofsequence.ScenarioConfig.Validate { scenarioConfig } {
101 foreach flowConfig $scenarioConfig {
104 set outofsequenceTxCount 0
107 foreach {item value} $flowConfig {
111 set txParamList $value
112 set index [ lsearch $txParamList "-outofsequence" ]
113 if { $index != -1 && [
lindex $txParamList [
expr $index + 1 ] ] == 1 } {
114 incr outofsequenceTxCount
119 # Rx part is validated later
121 default { error "ByteBlowerHL FlowOutofsequence error: Invalid flow paremter '$item'" }
126 if { $txCount == 0} {
127 error "ByteBlowerHL FlowOutofsequence error: flow must have at least one TX part\n flow configuration: '$flowConfig'"
129 if { $txCount > 1 && $outofsequenceTxCount > 0} {
130 error "ByteBlowerHL FlowOutofsequence error: flow with an outofsequence-enabled TX part may have no other TX parts\n flow configuration: '$flowConfig'"
132 if { $outofsequenceTxCount == 0 && $rxCount > 0} {
133 error "ByteBlowerHL FlowOutofsequence error: flow without an outofsequence-enabled TX part may not contain RX parts\n flow configuration: '$flowConfig'"
135 if { $outofsequenceTxCount == 1 && $rxCount == 0} {
136 error "ByteBlowerHL FlowOutofsequence error: flow with an outofsequence-enabled TX part must have at least one outofsequence-enabled RX part\n flow configuration: '$flowConfig'"
140 foreach {item value} $flowConfig {
143 set rxParamList $value
144 set basicOutofsequenceCount 0
145 foreach {option value} $rxParamList {
148 incr basicOutofsequenceCount
149 foreach {seqOption seqValue} $value {
150 # if type option is present, it must be 'basic' (basic is also default value)
151 switch -- $seqOption {
153 if { ! [
string equal $seqValue "" ] && ! [
string equal $seqValue basic ] } {
154 error "ByteBlowerHL FlowOutofsequence error: flow RX part may not contain '$seqValue' type out of sequence detector\n flow configuration: '$flowConfig'"
161 error "ByteBlowerHL FlowOutofsequence error: out of sequence flow RX part may not contain trigger\n flow configuration: '$flowConfig'"
164 error "ByteBlowerHL FlowOutofsequence error: out of sequence flow RX part may not contain capture tool\n flow configuration: '$flowConfig'"
167 error "ByteBlowerHL FlowOutofsequence error: out of sequence flow RX part may not contain latency detector\n flow configuration: '$flowConfig'"
170 # ignore other parameters, not our task to validate them
174 if { $basicOutofsequenceCount == 0 } {
175 error "ByteBlowerHL FlowOutofsequence error: out of sequence flow RX part must contain an out of sequence detector\n flow configuration: '$flowConfig'"
177 if { $basicOutofsequenceCount > 1 } {
178 error "ByteBlowerHL FlowOutofsequence error: out of sequence flow RX part must contain exactly one out of sequence detector\n flow configuration: '$flowConfig'"
186 proc x.FlowOutofsequence.Result.Parse.Numbers { scenarioResult } {
201 set scenarioNumbersResult [ list ]
202 foreach flowResult $scenarioResult {
203 set flowNumbersResult [ list ]
204 foreach {item value} $flowResult {
207 set txCounters $value
208 # Format: 'NrOfFramesSent <value> <FrameOid_1> <value_1> <FrameOid_2> ...'
209 # Required format: '<value>'
210 set txNumbersResult [
lindex $txCounters 1 ]
211 lappend flowNumbersResult "-tx" $txNumbersResult
214 if {$value != "NA"} {
215 set rxCounters $value
216 # Format: 'FramesOutOfSequence <outofsequenceValue> NrOfFrames <value>'
217 # Required format: '<value> <outofsequenceValue>' (note: reverse order!)
218 set rxNumbersResult [ list [
lindex $rxCounters 3] [
lindex $rxCounters 1] ]
219 lappend flowNumbersResult "-rx" $rxNumbersResult
221 lappend flowNumbersResult "-rx" $value
226 lappend scenarioNumbersResult $flowNumbersResult
228 return $scenarioNumbersResult