4 namespace eval excentis {
13 namespace eval ByteBlower {
36 package require excentis_basic
38 set ::ByteBlowerExecuteScenarioResult ""
39 set ::ByteBlowerExecuteScenarioDone 0
40 set ::ByteBlowerExecuteScenarioWait 1
45 proc x.GetDevicesToStart { txPorts rxPorts } {
46 set portsToStart [ list ]
47 set wepsToStart [ list ]
48 foreach txPort $txPorts {
49 switch -- [ $txPort Get _ClassName ] {
51 if { [ lsearch $portsToStart $txPort ] == -1 } {
52 lappend portsToStart $txPort
56 if { [ lsearch $wepsToStart $txPort ] == -1 } {
57 lappend wepsToStart $txPort
64 foreach rxPort $rxPorts {
65 switch -- [ $rxPort Get _ClassName ] {
67 if { [ lsearch $wepsToStart $rxPort ] == -1 } {
68 lappend wepsToStart $rxPort
74 return [ list $portsToStart $wepsToStart ]
81 proc x.StartWirelessEndpoints { wirelessEndpoints } {
82 foreach wirelessEndpoint $wirelessEndpoints {
84 $wirelessEndpoint Lock 1
87 $wirelessEndpoint Result.Clear
90 set bb [ ByteBlower Instance.Get ]
91 eval $bb WirelessEndpoints.Prepare.Async $wirelessEndpoints
92 eval $bb WirelessEndpoints.Prepare $wirelessEndpoints
94 eval $bb WirelessEndpoints.StartAndWait $wirelessEndpoints
98 proc x.StopWirelessEndpoints { wirelessEndpoints } {
102 proc x.WaitForWirelessEndpoints { wirelessEndpoints } {
104 set check_interval 1000
106 foreach endpoint $wirelessEndpoints {
107 set ::wep_hb($endpoint) [ $endpoint Heartbeat.Timestamp.Last.Get ]
108 set hb_interval [
expr int(double([$endpoint Heartbeat.Interval.Get ]) / 1000000) ]
109 if { ${hb_interval} < $check_interval} {
110 set check_interval $hb_interval
114 set check_interval [
expr $check_interval / 2 ]
117 set ::hb_check_after 0
118 after $check_interval "set ::hb_check_after 1"
119 vwait ::hb_check_after
120 unset ::hb_check_after
123 foreach endpoint $wirelessEndpoints {
124 set cur_heartbeat [ $endpoint Heartbeat.Timestamp.Last.Get ]
125 if { $cur_heartbeat > $::wep_hb($endpoint)} {
129 if { $nrOk == [
llength $wirelessEndpoints ]} {
172 proc ExecuteScenario { scenarioConfig args } {
173 set scenarioResultList [ list ]
180 set scoutingTimetowait 1000
183 for {
set walker 0} { $walker < [
llength $args ]} {
incr walker} {
184 set arg [
lindex $args $walker ]
191 set timetowait [
lindex $args $walker ]
193 -scoutingfinaltimetowait {
195 set scoutingTimetowait [
lindex $args $walker ]
204 set txPorts [
lindex $temp 0 ]
205 set rxPorts [
lindex $temp 1 ]
206 set duration [
lindex $temp 2 ]
207 set scenarioObjectList [
lindex $temp 3 ]
208 set scenarioPrepareObjectList [
lindex $temp 4 ]
211 x.ExecuteScenario.PrepareNetwork $scenarioPrepareObjectList $scoutingTimetowait
223 switch -exact -- [
catch {
227 foreach flowObjectList $scenarioObjectList {
228 foreach {item value} $flowObjectList {
229 if { [
string equal $item "-rx" ] && ![
string equal $value "NA" ] } {
230 # If the rx side has a capture active, start is.
231 # If it has another trigger, reset it.
232 set description [ $value Description.Get ]
233 if { [ regexp {capture} $description ] } {
248 # Select byteblower ports to start, select wireless endpoints to start
250 x.StartWirelessEndpoints $wepsToStart
253 # Start traffic on tx ports
254 eval ByteBlower Ports.Start $portsToStart
255 # Calculate the duration
256 set duration [
expr int(ceil($duration)) ]
257 # Recalculate duration ( duration - sum (all inital times to wait) )
259 if { $::ByteBlowerExecuteScenarioWait } {
260 # Wait for traffic to stop
261 after $duration set stop 1
266 #-- STOP SCENARIO + GET RESULTS
268 eval ByteBlower Ports.Stop $portsToStart
271 # -- Wait for timetowait
273 if { $timetowait != 0 } {
275 after $timetowait set stop 1
279 x.StopWirelessEndpoints $wepsToStart
280 x.WaitForWirelessEndpoints $wepsToStart
285 set command [ list ::excentis::ByteBlower::x.ExecuteScenario.Finished [ list $txPorts] [ list $scenarioObjectList ] [ list $extended ] ]
286 eval after $duration $command
292 # --- Cleanup all created objects (using 'catching' version)
293 x.ExecuteScenario.Error $scenarioObjectList $dummy
301 #-- CLEANUP + RETURN RESULTS
303 x.ExecuteScenario.Cleanup $scenarioObjectList
304 return $scenarioResultList
356 proc ExecuteScenarioRT { scenarioConfig args } {
357 set scenarioResultList [ list ]
364 set scoutingTimetowait 1000
365 set updateinterval 1000
369 for {
set walker 0} { $walker < [
llength $args ]} {
incr walker} {
370 set arg [
lindex $args $walker ]
377 set timetowait [
lindex $args $walker ]
379 -scoutingfinaltimetowait {
381 set scoutingTimetowait [
lindex $args $walker ]
385 set updateinterval [
lindex $args $walker ]
390 set callbackMethod [
lindex $args $walker ]
395 if {$callback == 0} {
398 set callbackMethod "DefaultCallback"
405 set txPorts [
lindex $temp 0 ]
406 set rxPorts [
lindex $temp 1 ]
407 set duration [
lindex $temp 2 ]
408 set scenarioObjectList [
lindex $temp 3 ]
409 set scenarioPrepareObjectList [
lindex $temp 4 ]
412 x.ExecuteScenario.PrepareNetwork $scenarioPrepareObjectList $scoutingTimetowait
428 foreach flowObjectList $scenarioObjectList {
429 foreach {item value} $flowObjectList {
430 if { [ string equal $item "-rx" ] && ![ string equal $value "NA" ] } {
431 # If the rx side has a capture active, start it.
432 # If it has another trigger, reset it.
433 set description [ $value Description.Get ]
434 if { [ regexp {capture} $description ] } {
449 # Select byteblower ports to start, select wireless endpoints to start
451 foreach { portsToStart wepsToStart } [ x.GetDevicesToStart $txPorts $rxPorts ] { break; }
452 x.StartWirelessEndpoints $wepsToStart
455 # Start traffic on tx ports
456 eval ByteBlower Ports.Start $portsToStart
457 # Calculate the duration
458 set duration [expr int(ceil($duration)) + $timetowait ]
459 # Wait for traffic to stop
460 after $duration "set ::stop 1"
462 while { $::stop != 1 } {
464 after $updateinterval set poll 1
467 # We just want a result of one flow, so we don't kill any ByteBlower server.
469 set timestamp [ x.ExecuteScenario.Timestamp.Next.Get $scenarioObjectList $timestamp $updateinterval ]
470 set scenarioTempResultList [ x.ExecuteScenario.InterRunResults.Get $scenarioObjectList $txPorts $extended $timestamp ]
473 if {$callback == 1} {
474 eval $callbackMethod {$scenarioTempResultList}
480 #-- STOP SCENARIO + GET RESULTS
482 eval ByteBlower Ports.Stop $portsToStart
484 x.StopWirelessEndpoints $wepsToStart
485 x.WaitForWirelessEndpoints $wepsToStart
486 set scenarioResultList [ x.ExecuteScenario.Results.Get $scenarioObjectList $extended ]
497 return $scenarioResultList
506 proc DefaultCallback { scenarioResultList } {
508 foreach flowResultList $scenarioResultList {
509 set txResult [
lindex [
lindex $flowResultList 1 ] 1 ]
510 set rxResult [
lindex [
lindex $flowResultList 3 ] 1 ]
511 puts "[
clock format [
clock seconds] -format {%Y-%m-%d %H:%M:%S}]\t$flowid\t$txResult\t$rxResult"
516 proc x.ExecuteScenario.PrepareNetwork { scenarioPrepareObjectList scoutingTimetowait } {
532 foreach flowPrepareObjectList $scenarioPrepareObjectList {
533 foreach { item value } $flowPrepareObjectList {
534 if { [ string equal $item "-scouting_tx" ]} {
535 foreach { scoutingStream scoutingDuration } $value { break}
538 set scoutingDuration [
expr int(ceil($scoutingDuration)) ]
541 $scoutingStream Start
543 set ::scouting_stop 0
544 after $scoutingDuration { set ::scouting_stop 1 }
545 vwait ::scouting_stop
546 unset ::scouting_stop
550 catch { unset scoutingStream } dummy
551 catch { unset scoutingDuration } dummy
553 set doTimetowait $scoutingTimetowait
555 error "ByteBlowerHL error: Unsupported scenario prepare item '$item'"
563 if { $doTimetowait != 0} {
564 set ::scouting_stop 0
565 after $doTimetowait { set ::scouting_stop 1 }
566 vwait ::scouting_stop
567 unset ::scouting_stop
572 proc x.ExecuteScenario.Finished { txPorts scenarioObjectList extended } {
591 incr ::ByteBlowerExecuteScenarioDone
592 puts "TxPorts: $txPorts"
593 puts "ObjectList: $scenarioObjectList"
594 puts "Extended: $extended"
595 eval ByteBlower Ports.Stop $txPorts
600 proc x.ExecuteScenario.GetWirelessEndpoints { scenarioObjectList } {
601 set wirelessEndpoints [ list ]
603 foreach flow $scenarioObjectList {
604 foreach { key value } $flow {
608 if { [ TOOP Info -isobject $value ] } {
609 switch -- [ $value Get _ClassName ] {
611 "Rx.Trigger.Basic.Mobile" -
612 "Rx.Latency.Basic.Mobile" {
613 set parent [ $value Parent.Get ]
614 if { [ $parent Info -implements "WirelessEndpoint" ] } {
615 if { [ lsearch wirelessEndpoints $parent ] == -1 } {
616 lappend wirelessEndpoints $parent
627 return $wirelessEndpoints
630 proc x.ExecuteScenario.ScenarioConfig.Parse { scenarioConfig extended } {
662 set ::excentis::basic::rxPcapFileNames [ list ]
663 set scenarioObjectList [ list ]
665 set scenarioPrepareObjectList [ list ]
668 foreach flowConfig $scenarioConfig {
669 set flowObjectList [ list ]
670 set flowPrepareObjectList [ list ]
671 # parse flow parameters
672 foreach {item value} $flowConfig {
675 set txParamList $value
676 # parse tx parameters and configure tx port
677 foreach { txPort stream streamDuration scoutingStreamList } [ x.ExecuteScenario.TxParam.Parse $txParamList ] break
678 lappend flowObjectList "-tx" $stream
679 foreach scoutingStreamInfo $scoutingStreamList {
680 lappend flowPrepareObjectList "-scouting_tx" $scoutingStreamInfo
682 if { $streamDuration > $duration } {
683 set duration $streamDuration
685 # keep record of unique tx ports
686 if { [lsearch $txPorts $txPort] == -1 } {
687 lappend txPorts $txPort
691 set rxParamList $value
692 # parse rx parameters and configure rx ports
693 foreach { rxPort trigger } [ x.ExecuteScenario.RxParam.Parse $rxParamList $extended ] break
694 lappend flowObjectList "-rx" $trigger
695 # keep record of unique rx ports
696 if { [lsearch $rxPorts $rxPort] == -1 } {
697 lappend rxPorts $rxPort
701 puts "ByteBlowerHL warning: Invalid flow parameter ignored: $item"
704 }; # end parse flow configuration
705 lappend scenarioObjectList $flowObjectList
706 lappend scenarioPrepareObjectList $flowPrepareObjectList
707 }; # end parse scenario configuration
712 return [ list $txPorts $rxPorts $duration $scenarioObjectList $scenarioPrepareObjectList ]
715 proc x.ExecuteScenario.CheckTxErrors { scenarioObjectList txPorts } {
741 foreach flowObjectList $scenarioObjectList {
742 foreach {item value} $flowObjectList {
743 if {$item == "-tx"} {
744 set flow [ list $value [
expr int([ $value InitialTimeToWait.Get ] / 1e6)] ]
751 set txList [ lsort -integer -index 1 $txList ]
757 foreach txInfo $txList {
758 set flowStream [
lindex $txInfo 0 ]
759 set InitialTimeToWait [
lindex $txInfo 1 ]
763 set timer [
expr $InitialTimeToWait - $timeWaited ]
764 after [
expr $timer + 500 ] set stop 1
769 if { [ $flowStream Info -implements Tx.Stream ]} {
770 set txError [ [ $flowStream Status.Get ] ErrorStatus.Get ]
772 if { $txError != "None"} {
774 foreach txPort $txPorts {
775 foreach txPortStream [ $txPort Tx.Stream.Get ] {
776 if { $txPortStream == $flowStream} {
777 set descr [
lindex [
split [ $txPort Description.Get ] "\n" ] 0 ]
778 error "ByteBlowerHL error: $txError on $descr"
786 set timeWaited [
expr $timeWaited + $timer ]
793 proc x.ExecuteScenario.Results.Get { scenarioObjectList extended } {
811 foreach wirelessEndpoint $wirelessEndpoints {
812 $wirelessEndpoint Result.Get
816 set scenarioResultList [ list ]
818 foreach flowObjectList $scenarioObjectList {
819 set flowResultList [ list ]
821 foreach {item value} $flowObjectList {
822 switch -exact -- $item {
824 if { $value != "NA"} {
825 # If the rx side has a capture active, start it.
826 # If it has another trigger, reset it.
827 if { [$value Info -implements Rx.Capture.Basic ] } {
829 lappend flowResultList "-rx" [$value Frames.Get]
830 # If we want a pcap file, we should perform this here.
831 set fileName [
lindex $::excentis::basic::rxPcapFileNames $captureCounter ]
832 if { $fileName != "" } {
833 $value Pcap.Save $fileName
835 incr captureCounter 1
836 } elseif { [$value Info -implements Rx.Trigger.SizeDistribution ] } {
837 #SizeDistribution triggers do not support Result yet!
838 set result [ $value Result.Get ]
839 set counters [ list ]
840 lappend counters NrOfFrames [ $result PacketCount.Get ]
841 lappend counters NrOfOctets [ $result ByteCount.Get ]
842 lappend counters NrOfUndersized [ $result PacketCount.BelowMinimum.Get ]
843 lappend counters NrOfOversized [ $result PacketCount.AboveMaximum.Get]
844 lappend flowResultList "-rx" $counters
845 } elseif { [$value Info -implements Rx.Latency.Basic ] || \
846 [$value Info -implements Rx.Latency.Basic.Mobile ] } {
847 set result [ $value Result.Get ]
850 set packetcount [$result PacketCount.Get]
855 if { $packetcount != 0 } {
856 set latencyminimum [$result Latency.Minimum.Get]
857 set latencymaximum [$result Latency.Maximum.Get]
858 set latencyaverage [$result Latency.Average.Get]
859 set jitter [ $result Jitter.Get ]
862 lappend flowResultList "-rx" [ list \
863 NrOfFrames $packetcount \
864 MinLatency $latencyminimum \
865 AvgLatency $latencyaverage \
866 MaxLatency $latencymaximum \
870 } elseif { [$value Info -implements Rx.OutOfSequence.Basic ] } {
871 set result [ $value Result.Get ]
873 set rxFrames [ $result PacketCount.Get ]
876 if { $rxFrames != 0 } {
877 set rxOoS [ $result PacketCount.OutOfSequence.Get ]
880 lappend flowResultList "-rx" [ list \
881 FramesOutOfSequence $rxOoS \
882 NrOfFrames $rxFrames \
886 set result [$value Result.Get]
888 lappend flowResultList "-rx" [ list \
889 NrOfFrames [ $result PacketCount.Get ] \
890 NrOfOctets [ $result ByteCount.Get ] \
895 lappend flowResultList "-rx" "NA"
899 if { $extended == 0 } {
900 set result [$value Result.Get]
902 lappend flowResultList "-tx" [ list NrOfFramesSent [ $result PacketCount.Get ] ]
905 set result [$value Result.Get]
907 set output [ list NrOfFramesSent [ $result PacketCount.Get ] NrOfOctetsSent [ $result ByteCount.Get ] ]
908 # TODO: Add SizeDistribution...
911 foreach frame [ $value Frame.Get ] {
912 set frameOut [ list ]
913 set frameResult [ $frame Result.Get ]
914 lappend frameOut "NrOfFrames" [ $frameResult PacketCount.Get ]
915 lappend frameOut "NrOfOctets" [ $frameResult ByteCount.Get ]
917 # Mobile frames only have a limited set of counters
918 if { ![ $frame Info -implements Frame.Mobile ] } {
919 lappend frameOut "FrameSizeMinimum" [ $frameResult Framesize.Minimum.Get ]
920 lappend frameOut "FrameSizeMaximum" [ $frameResult Framesize.Maximum.Get ]
922 lappend output $frame $frameOut
926 lappend flowResultList "-tx" $output
929 # Add error info the result list
930 # If a server error can be seen, include it
931 # If not check manually for possible other (unexpected) errors
933 if { [ $value Info -implements Tx.Stream ] } {
934 set txError [ [ $value Status.Get ] ErrorStatus.Get ]
936 if { $txError != "None" } {
937 lappend flowResultList "-error" $txError
939 # Throughput too high for Tx side?
940 set result [$value Result.Get]
942 set framesSent [ $result PacketCount.Get ]
943 set framesRequested [ $value NumberOfFrames.Get ]
944 if { $framesSent < $framesRequested } {
945 lappend flowResultList "-error" "UnexpectedOutOfResources"
951 puts "ByteBlowerHL warning: Unknown flow parameter: '$item', not getting results for '$value'"
957 lappend scenarioResultList $flowResultList
959 return $scenarioResultList
962 proc x.ExecuteScenario.Timestamp.Next.Get { scenarioObjectList prevTimestamp updateinterval } {
963 if { $prevTimestamp == 0} {
967 set historyObjects [ list ]
968 foreach flowObjectList $scenarioObjectList {
969 foreach {item value} $flowObjectList {
970 switch -exact -- $item {
972 if { $value != "NA"} {
973 if { [$value Info -implements Rx.Trigger.Basic ] } {
974 set resultHistory [ $value Result.History.Get ]
975 $resultHistory Refresh
976 lappend historyObjects $resultHistory
981 set resultHistory [ $value Result.History.Get ]
982 $resultHistory Refresh
983 lappend historyObjects $resultHistory
986 puts "ByteBlowerHL warning: Unknown flow parameter: '$item', not getting next timestamp for '$value'"
994 set first_ho [
lindex $historyObjects 0 ]
995 foreach fhob [ $first_ho Cumulative.Get ] {
996 set bts [ $fhob Timestamp.Get ]
999 foreach ho [ lrange $historyObjects 1 end ] {
1001 foreach hob [ $ho Cumulative.Get ] {
1002 if { $bts == [ $hob Timestamp.Get ]} {
1008 if { $hob_found == 0} {
1009 set all_hobs_found 0
1012 if { $all_hobs_found == 0} {
1015 return [
expr $bts + ( $updateinterval * 1000000 ) ]
1022 return [
expr $prevTimestamp + ( $updateinterval * 1000000 ) ]
1032 proc x.ExecuteScenario.Bucket.Search { bucketlist timestamp } {
1040 foreach bucket $bucketlist {
1041 if { [ $bucket Timestamp.Get ] == $timestamp} {
1048 proc x.ExecuteScenario.InterRunResults.Get { scenarioObjectList txPorts extended timestamp } {
1079 set scenarioResultList [ list ]
1082 foreach flowObjectList $scenarioObjectList {
1083 set flowResultList [ list ]
1084 foreach {item value} $flowObjectList {
1085 switch -exact -- $item {
1087 if { $value != "NA"} {
1088 if { [$value Info -implements Rx.Capture.Basic ] } {
1089 # The -rx value is a RX Capture
1090 lappend flowResultList "-rx" [$value Frames.Get]
1092 } elseif { [$value Info -implements Rx.Trigger.Basic ] } {
1093 # The -rx Value is a RX Basic trigger
1094 # use the ResultHistory to fetch the latest "Cumulative
1095 # Result" to add as numRx entry
1096 set resultHistory [ $value Result.History.Get ]
1099 $resultHistory Refresh
1101 set buckets [ $resultHistory Cumulative.Get ]
1103 if { $the_bucket == "" } {
1104 set the_bucket [
lindex $buckets end ]
1106 set rxFrames [ $the_bucket PacketCount.Get ]
1108 lappend flowResultList "-rx" [ list "NrOfFrames" $rxFrames ]
1109 } elseif { [ $value Info -implements Rx.Trigger.Basic.Mobile ] } {
1110 # we don't have temporary results. Omit it...
1111 lappend flowResultList "-rx" [ list "NrOfFrames" 0 ]
1112 } elseif { ![$value Info -implements Rx.Trigger.SizeDistribution ] } {
1113 # Not trigger basic, not capture, not sizedistribution...
1114 set result [ $value Result.Get ]
1116 lappend flowResultList "-rx" [ list "NrOfFrames" [ $result PacketCount.Get ] ]
1122 set result [ $value Result.Get ]
1125 set output [ list "NrOfFrames" [ $result PacketCount.Get ] ]
1126 lappend output "NrOfOctets" [ $result ByteCount.Get ]
1127 lappend output "NrOfUndersized" [ $result PacketCount.BelowMinimum.Get ]
1128 lappend output "NrOfOversized" [ $result PacketCount.AboveMaximum.Get ]
1129 lappend flowResultList "-rx" $output
1132 lappend flowResultList "-rx" "NA"
1136 if { $extended == 0 } {
1138 set resultHistory [ $value Result.History.Get ]
1141 $resultHistory Refresh
1143 set buckets [ $resultHistory Cumulative.Get ]
1145 if { $the_bucket == "" } {
1146 set the_bucket [
lindex $buckets end ]
1148 set txFrames [ $the_bucket PacketCount.Get ]
1152 lappend flowResultList "-tx" [ list "NrOfFramesSent" $txFrames ]
1153 #lappend flowResultList "-tx" [ $value Counters.Brief.Get ]
1156 set result [$value Result.Get]
1158 set output [ list NrOfFramesSent [ $result PacketCount.Get ] ]
1159 # TODO: Add SizeDistribution...
1160 lappend flowResultList "-tx" $output
1164 if { [ $value Info -implements Tx.Stream ] } {
1165 set txError [ [ $value Status.Get ] ErrorStatus.Get ]
1167 if { $txError != "None" } {
1168 # FOUND an ERROR on a flow
1169 foreach txPort $txPorts {
1170 foreach txPortStream [ $txPort Tx.Stream.Get ] {
1171 if { $txPortStream == $value } {
1172 set descr [
lindex [
split [ $txPort Description.Get ] "\n" ] 0 ]
1173 error "ByteBlowerHL error: $txError on $descr"
1180 puts "ByteBlowerHL warning: Unknown flow parameter: '$item', not getting inter-run results for '$value'"
1184 lappend scenarioResultList $flowResultList
1186 return $scenarioResultList
1189 proc x.ExecuteScenario.Cleanup { scenarioObjectList } {
1202 foreach flowObjectList $scenarioObjectList {
1203 foreach {item value} $flowObjectList {
1204 switch -exact -- $item {
1206 foreach {tcpitem tcpvalue} $value {
1207 catch { $tcpvalue Destructor } dummy
1211 foreach { scoutingStream scoutingDuration } $value { break }
1212 catch { $scoutingStream Destructor } dummy
1216 catch { $value Destructor } dummy
1219 puts "ByteBlowerHL warning: Unknown flow parameter: '$item', calling Destructor on '$value'"
1220 catch { $value Destructor } dummy
1226 foreach wirelessEndpoint $wirelessEndpoints {
1227 catch { $wirelessEndpoint Result.Clear }
1228 catch { $wirelessEndpoint Lock 0 }
1232 proc x.ExecuteScenario.Error { scenarioObjectList errorInfo } {
1254 proc x.ExecuteScenario.TxParam.Parse { txParamList } {
1275 set srcFrameList [ list ]
1276 set numberOfFrames 100
set interframegap 10000000
set initialTimeToWait 0
1277 set timingModifier "none"
set frameModifier "none"
1278 set latencyEnable 0
set outOfSequenceEnable 0
1280 set srcScoutingFrameList [ list ]
1281 set scoutingNumberOfFrames 2
set scoutingInitialTimeToWait 0
1282 set scoutingInterframegap 10000000
1283 set scoutingStreamLeadOutTime 100000000
1285 set scoutingStreamList [ list ]
1289 foreach {item value} $txParamList {
1293 if { ! $portFound } {
1297 error "ByteBlowerHL error: Only 1 tx port allowed per tx port parameter list"
1300 -frame { lappend srcFrameList $value }
1301 -numberofframes { set numberOfFrames $value }
1302 -interframegap { set interframegap $value }
1303 -initialtimetowait { set initialTimeToWait $value }
1305 if { $frameModifier == "none" } {
1306 set frameModifier $value
1308 error "ByteBlowerHL error: Only 1 FrameModifier per frame is allowed"
1312 -timingmodifier { set timingModifier $value }
1313 -latency { set latencyEnable $value }
1314 -outofsequence { set outOfSequenceEnable $value }
1315 -scoutingframe { lappend srcScoutingFrameList $value }
1316 -scoutinginterframegap { set scoutingInterframegap $value }
1317 default { error "ByteBlowerHL error: Invalid tx port parameter: $item" }
1321 if { ! $portFound} {
1322 error "ByteBlowerHL error: No tx port found in flow parameter list"
1324 if { $numberOfFrames < 0} {
1325 error "ByteBlowerHL error: Tx port parameter <numberofframes> must be a positive integer"
1329 foreach srcScoutingFrame $srcScoutingFrameList {
1330 set scoutingStream [ $txPort Tx.Stream.Add ]
1335 $scoutingStream InitialTimeToWait.Set $scoutingInitialTimeToWait
1336 $scoutingStream InterFrameGap.Set $scoutingInterframegap
1337 $scoutingStream NumberOfFrames.Set $scoutingNumberOfFrames
1340 set scoutingDuration [
expr ( [ $scoutingStream InitialTimeToWait.Get ] / 1e6 ) + ( [ $scoutingStream InterFrameGap.Get ] / 1e6 * [ $scoutingStream NumberOfFrames.Get ] ) + ( $scoutingStreamLeadOutTime / 1e6 ) ]
1342 lappend scoutingStreamList [ list $scoutingStream $scoutingDuration ]
1346 set stream [$txPort Tx.Stream.Add]
1347 foreach srcFrame $srcFrameList {
1350 if {$latencyEnable == 1} {
1351 [ $frameObject FrameTag.Time.Get ] Enable 1
1352 }
elseif {$latencyEnable == 0} {
1355 error "ByteBlowerHL error: Invalid latency flag: $latencyEnable"
1357 if {$outOfSequenceEnable == 1} {
1358 [ $frameObject FrameTag.Sequence.Get ] Enable 1
1359 }
elseif {$outOfSequenceEnable == 0} {
1362 error "ByteBlowerHL error: Invalid out-of-sequence flag: $outOfSequenceEnable"
1365 $stream InitialTimeToWait.Set $initialTimeToWait
1366 $stream InterFrameGap.Set $interframegap
1367 $stream NumberOfFrames.Set $numberOfFrames
1370 set duration [
expr ([$stream InitialTimeToWait.Get]/1e6) + ([$stream InterFrameGap.Get] / 1e6 * $numberOfFrames)]
1373 if { $frameModifier != "none"} {
1376 if { $timingModifier != "none"} {
1379 if { [ string compare [ $timingModifierObject Get _ClassName ] TimingModifier.MultiBurst ] == 0} {
1380 set nofInterBurstGap [
expr $numberOfFrames / [$timingModifierObject BurstSize.Get]]
1381 if {[expr fmod($numberOfFrames,[$timingModifierObject BurstSize.Get])] == 0} {
1382 incr nofInterBurstGap -1
1384 set duration [
expr $duration + ($nofInterBurstGap * [$timingModifierObject InterBurstGap.Get]/1e6)]
1389 return [ list $txPort $stream $duration $scoutingStreamList ]
1392 proc x.ExecuteScenario.TxParam.Frame.Parse { stream frameDescription } {
1393 if { [ string range [ lindex $frameDescription 0 ] 0 0 ] != "-"} {
1395 puts "ByteBlowerHL warning: Creating a frame using -frame { byte byte byte } which will be deprecated, please use -frame { -bytes { byte byte byte ... } }"
1396 set frame [ $stream Frame.Add ]
1397 $frame Bytes.Set $frameDescription
1403 set payload [ list ]
1404 set destinationAddress ""
1406 set destinationPort 0
1407 set sizemodifier "none"
1408 set fieldmodifiers [ list ]
1409 set l3autochecksum 0
1411 set l4autochecksum 0
1414 foreach { item value } $frameDescription {
1424 set sourcePort $value
1427 set destinationPort $value
1429 -destinationAddress {
1430 set destinationAddress $value
1434 if { $sizemodifier != "none" } {
1435 error "ByteBlowerHL error: Only one size modifier is allowed per frame."
1437 set sizemodifier $value
1441 lappend fieldmodifiers $value
1444 set l3autochecksum $value
1447 set l3autolength $value
1450 set l4autochecksum $value
1453 set l4autolength $value
1456 error "ByteBlowerHL error: Unknown frame descriptor: $item $value."
1461 if { [ llength $bytes ] == 0 && [
llength $payload ] == 0} {
1462 error "ByteBlowerHL error: either -bytes or -payload must be given when creating a frame."
1465 if { [ llength $bytes ] != 0 && [
llength $payload ] != 0} {
1466 error "ByteBlowerHL error: only one of -bytes and -payload must be given when creating a frame."
1469 if { [ llength $payload ] != 0 && ( $sourcePort == 0 || $destinationPort == 0 || $destinationAddress == "" )} {
1470 error "ByteBlowerHL error: when using -payload, -sourcePort, -destinationPort and -destinationAddress must also be given!"
1474 set frame [ $stream Frame.Add ]
1476 if { [ llength $bytes ] != 0} {
1477 if { ! [ $stream Info -implements Tx.Stream ]} {
1478 error "ByteBlowerHL error: -bytes can only be used on a ByteBlowerPort"
1480 $frame Bytes.Set $bytes
1481 }
elseif { [ llength $payload ] != 0} {
1482 if { ! [ $stream Info -implements Tx.Stream.Mobile ]} {
1483 error "ByteBlowerHL error: -payload can only be used on a Wireless Endpoint"
1486 $frame Payload.Set $payload
1487 $stream Source.Port.Set $sourcePort
1488 $stream Destination.Port.Set $destinationPort
1489 $stream Destination.Address.Set $destinationAddress
1492 if { ![ string equal $sizemodifier "none" ]} {
1497 foreach fieldmodifier $fieldmodifiers {
1502 if { $l3autochecksum} {
1503 $frame L3.Auto.Checksum.Enable 1
1505 if { $l3autolength} {
1506 $frame L3.Auto.Length.Enable 1
1508 if { $l4autochecksum} {
1509 $frame L4.Auto.Checksum.Enable 1
1511 if { $l3autolength} {
1512 $frame L4.Auto.Length.Enable 1
1522 proc x.ExecuteScenario.TxParam.ScoutingFrame.Parse { scoutingStream frameDescription } {
1546 set l3autochecksum 1
1548 set l4autochecksum 1
1551 foreach { item value } $frameDescription {
1558 set l3autochecksum $value
1561 set l3autolength $value
1564 set l4autochecksum $value
1567 set l4autolength $value
1570 error "ByteBlowerHL error: Unknown frame descriptor: $item $value."
1575 if { [ llength $bytes ] == 0} {
1576 error "ByteBlowerHL error: -bytes must be given when creating a frame."
1579 set scoutingFrame [ $scoutingStream Frame.Add ]
1581 $scoutingFrame Bytes.Set $bytes
1583 if { $l3autochecksum} {
1584 $scoutingFrame L3.Auto.Checksum.Enable 1
1586 if { $l3autolength} {
1587 $scoutingFrame L3.Auto.Length.Enable 1
1589 if { $l4autochecksum} {
1590 $scoutingFrame L4.Auto.Length.Enable 1
1592 if { $l3autolength} {
1593 $scoutingFrame L4.Auto.Checksum.Enable 1
1597 return $scoutingFrame
1600 proc x.ExecuteScenario.TxParam.FrameFieldModifier.Parse { frame fieldModifier } {
1621 foreach {item value} $fieldModifier {
1642 set initialvalue $value
1645 error "ByteBlowerHL error: Unknown configuration item for a FrameFieldModifier $item $value"
1653 set modifier [ $frame Modifier.Field.[
string totitle $type ].Add ]
1656 error "ByteBlowerHL error: -type must be given in the FrameFieldModifier configuration"
1659 error "ByteBlowerHL error: Unknown Frame Field Modifier type $type"
1663 $modifier Offset.Set $offset
1664 $modifier Length.Set $length
1665 $modifier Minimum.Set $minimum
1666 $modifier Maximum.Set $maximum
1670 $modifier Step.Set $step
1671 $modifier InitialValue.Set $initialvalue
1674 # nothing else to do
1682 proc x.ExecuteScenario.TxParam.FrameSizeModifier.Parse { frame frameModifier } {
1696 if { ![ string equal $frameModifier "none" ]} {
1700 set minimum 60
set maximum 1514
set step 1
set iteration 1
1703 foreach {item value} $frameModifier {
1706 if { ! $typeFound } {
1708 set type [
string tolower $value]
1710 error "ByteBlowerHL error: Only 1 type allowed per frame size modifier parameter list"
1713 -minimum { set minimum $value }
1714 -maximum { set maximum $value }
1715 -step { set step $value }
1716 -iteration { set iteration $value }
1717 default { error "ByteBlowerHL error: Invalid frame size modifier parameter: $item"}
1721 if { ! $typeFound} {
1722 error "ByteBlowerHL error: No type found in frame size modifier parameter list"
1727 set frameModifierObjects [ list ]
1730 set frameModifierObject [ $frame Modifier.Size.Random.Set ]
1731 $frameModifierObject Minimum.Set $minimum
1732 $frameModifierObject Maximum.Set $maximum
1735 set frameModifierObject [ $frame Modifier.Size.Growing.Set ]
1736 $frameModifierObject Minimum.Set $minimum
1737 $frameModifierObject Maximum.Set $maximum
1738 $frameModifierObject Iteration.Set $iteration
1739 $frameModifierObject Step.Set $step
1741 default { error "ByteBlowerHL error: Unknown frame size modifier type: $type" }
1743 lappend frameModifierObjects $frameModifier
1747 return $frameModifierObjects
1751 proc x.ExecuteScenario.TxParam.FrameModifier.Parse { stream frameModifier } {
1766 puts "\[DEPRECATED\] Creating a FrameModifier on a stream is deprecated! Please create the SizeModifier on a frame."
1767 foreach frame [ $stream Frame.Get ] {
1773 proc x.ExecuteScenario.TxParam.TimingModifier.Parse { stream timingModifier } {
1787 if { ($timingModifier != "none")} {
1791 set burstSize 100
set interBurstGap 1000000000
1794 foreach {item value} $timingModifier {
1797 if { ! $typeFound } {
1799 set type [
string tolower $value]
1801 error "ByteBlowerHL error: Only 1 type allowed per timing modifier parameter list"
1804 -burstsize { set burstSize $value }
1805 -interburstgap { set interBurstGap $value }
1806 default { error "ByteBlowerHL error: Invalid timing modifier parameter: $item" }
1810 if { ! $typeFound} {
1811 error "ByteBlowerHL error: No type found in timing modifier parameter list"
1815 set timingModifierObject [ $stream Modifier.Timing.Set $type ]
1818 $timingModifierObject BurstSize.Set $burstSize
1819 $timingModifierObject InterBurstGap.Set $interBurstGap
1821 default { error "ByteBlowerHL error: Unknown timing modifier type: $type" }
1825 return $timingModifierObject
1829 proc x.ExecuteScenario.RxTupleFilter.Parse { triggerObject filter } {
1831 set remoteUdpPort ""
1834 foreach { field value } $filter {
1835 switch -- [
string tolower $field ] {
1836 "-sourceaddress" { set remoteIP $value }
1837 "-udpdestinationport" { set localUdpPort $value }
1838 "-udpsourceport" { set remoteUdpPort $value }
1840 error "ByteBlowerHL error: filter format $filterFormat does not support $field"
1845 if { $remoteIP == "" || $remoteUdpPort == "" || $localUdpPort == ""} {
1846 error "ByteBlowerHL error: filter format syntax error: all entries of -sourceaddress, -udpdestinationport and -udpsourceport are required!"
1849 $triggerObject Filter.SourceAddress.Set $remoteIP
1850 $triggerObject Filter.Udp.DestinationPort.Set $localUdpPort
1851 $triggerObject Filter.Udp.SourcePort.Set $remoteUdpPort
1855 proc x.ExecuteScenario.RxParam.Parse { rxParamList extended } {
1882 set trigger ""
set latency ""
set outofsequence ""
set capture ""
1887 foreach {item value} $rxParamList {
1890 if { ! $portFound } {
1894 error "ByteBlowerHL error: Only 1 rx port allowed per rx port parameter list"
1898 if { ! $receiverFound } {
1902 error "ByteBlowerHL error: Only 1 trigger/latency/outofsequence/capture allowed per rx port parameter list"
1906 if { ! $receiverFound } {
1910 error "ByteBlowerHL error: Only 1 trigger/latency/outofsequence/capture allowed per rx port parameter list"
1914 if { ! $receiverFound } {
1916 set outofsequence $value
1918 error "ByteBlowerHL error: Only 1 trigger/latency/outofsequence/capture allowed per rx port parameter list"
1922 if { ! $receiverFound } {
1926 error "ByteBlowerHL error: Only 1 trigger/latency/outofsequence/capture allowed per rx port parameter list"
1930 error "ByteBlowerHL error: Invalid rx port parameter: $item"
1935 if { ! $portFound} {
1936 error "ByteBlowerHL error: No rx port found in flow parameter list"
1940 if { $trigger != ""} {
1942 set filterFormat "display"
1947 set type "sizedistribution"
1949 foreach {item value} $trigger {
1951 -type { set type $value }
1952 -filterFormat { set filterFormat $value }
1953 -filter { set filter $value }
1954 -duration { set duration $value }
1955 default { error "ByteBlowerHL error: Invalid trigger parameter: $item" }
1958 if { $filter == ""} {
1959 error "ByteBlowerHL error: Please define a non-empty filter for the trigger option of the rx port"
1961 set triggerObject ""
1963 "basic" { set triggerObject [ $rxPort Rx.Trigger.Basic.Add ] }
1964 "sizedistribution" {
1965 if { [ $rxPort Info -implements WirelessEndpoint ] } {
1966 error "ByteBlowerHL error: sizedistribution trigger not supported by a WirelessEndpoint!"
1968 set triggerObject [ $rxPort Rx.Trigger.SizeDistribution.Add ]
1970 default { error "ByteBlowerHL error: Invalid trigger type: $type" }
1972 switch -- $filterFormat {
1974 bpf { $triggerObject Filter.Set $filter }
1976 if { ! [ $rxPort Info -implements WirelessEndpoint ] } {
1977 error "ByteBlowerHL error: filter format $filterFormat not supported by object of type [ $rxPort Get _ClassName ]"
1980 x.ExecuteScenario.RxTupleFilter.Parse $triggerObject $filter
1983 default { error "ByteBlowerHL error: FilterType on rx port must be bpf, display or tuple" }
1986 if { $duration != 0} {
1987 if { [ $rxPort Info -implements WirelessEndpoint ]} {
1988 $triggerObject Duration.Set $duration
1990 default { error "ByteBlowerHL error: -duration can only be set on Wireless Endpoints!" }
1994 return [ list $rxPort $triggerObject ]
1998 if { $latency != ""} {
2000 set filterFormat "display"
2005 set type "distribution"
2007 foreach {item value} $latency {
2009 -type { set type $value }
2010 -filterFormat { set filterFormat $value }
2011 -filter { set filter $value }
2012 -duration { set duration $value }
2013 default { error "ByteBlowerHL error: Invalid latency parameter: $item" }
2016 if { $filter == ""} {
2017 error "ByteBlowerHL error: Please define a non-empty filter for the latency option of the rx port"
2019 switch -- [
string tolower $type ] {
2021 distribution { set latencyObject [ $rxPort Rx.Latency.[
string totitle $type ].Add ] }
2022 default { error "ByteBlowerHL error: Unsupported latency type '${type}'" }
2025 switch -- $filterFormat {
2027 bpf { $latencyObject Filter.Set $filter }
2029 if { ! [ $rxPort Info -implements WirelessEndpoint ] } {
2030 error "ByteBlowerHL error: filter format $filterFormat not supported by object of type [ $rxPort Get _ClassName ]"
2033 x.ExecuteScenario.RxTupleFilter.Parse $latencyObject $filter
2036 default { error "ByteBlowerHL error: FilterType on rx port must be bpf, display or tuple" }
2039 if { $duration != 0} {
2040 if { [ $rxPort Info -implements WirelessEndpoint ]} {
2041 $latencyObject Duration.Set $duration
2043 default { error "ByteBlowerHL error: -duration can only be set on Wireless Endpoints!" }
2046 return [ list $rxPort $latencyObject ]
2050 if { $outofsequence != ""} {
2053 foreach {item value} $outofsequence {
2055 -type { set type $value }
2056 -filter { set filter $value }
2057 default { error "ByteBlowerHL error: Invalid outofsequence parameter: $item" }
2060 if { $filter == ""} {
2061 error "ByteBlowerHL error: Please define a non-empty filter for the outofsequence option of the rx port"
2063 switch -- [
string tolower $type ] {
2064 basic { set outofsequenceObject [ $rxPort Rx.OutOfSequence.[
string totitle $type ].Add ] }
2065 default { error "ByteBlowerHL error: Unsupported out-of-sequence type '${type}'" }
2069 return [ list $rxPort $outofsequenceObject ]
2073 if { $capture != ""} {
2076 foreach {item value} $capture {
2078 -pcap { set pcap $value }
2079 -filter { set filter $value }
2080 default { error "ByteBlowerHL error: Invalid capture parameter: $item" }
2083 set captureObject [ $rxPort Rx.Capture.Basic.Add ]
2085 lappend ::excentis::basic::rxPcapFileNames $pcap
2087 return [ list $rxPort $captureObject ]
2091 return [ list $rxPort "NA" ]