First, 203_TC_FRAMERATE-1.TCL
Set CHASSISADDR 10.132.238.190 set Islot 1
Set Portlist {9}; #端口的排列顺序是port1, Port2
Set IPList {10.0.0.3 20.0.0.3}; #ip列表与端口的排列顺序相对应
Set Maclist {00-00-00-00-00-01 00-00-00-00-00-02}
Set Gwlist {10.0.0.1 20.0.0.1}
Set Iframelen 256
Set Streamload 100
If {[Catch {
Cd.. /source
#加载HLAPI Lib
source./cstc.tcl
Setlogoption-debug Enable
# Start connecting Machines
Testdevice Chassis1 $chassisAddr
# Start reserving two ports
For {set I 0} {$i <[llength $portList]} {incr i} {
Chassis1 createtestport-portlocation $islot/[lindex $portList $i]-portname port[expr $i +1]-porttype Ethernet
}
Port1 Createtraffic-trafficname Traffic1
Traffic1 createprofile-name profile1-trafficload 100-trafficloadunit fps
Traffic1 createstream-streamname stream1-framelen 500-profilename profile1 \
-l2 ethernet-l3 ipv4-l4 udp-ipsrcaddr 192.168.0.1-ipdstaddr 192.168.5.7-udpsrcport 2000-udpdstport 3000
Traffic1 configstream-streamname stream1-l2 ethernet-l3 ipv4-ethdst 00:00:10:e1:01:08-ethsrc
#创建统计和分析对象Statistics1, Statistics2,analysis2.
Port1 Createstaengine-staenginename Statistics1-statype Statistics
Port2 createstaengine-staenginename Statistics2-statype Statistics
Analysis of Port2 Createstaengine-staenginename Analysis2-statype
#SaveConfigAsXML "C:/framerate.xml"
Puts "Configure capture mode, capture the datagram to the specified file, and can be used for packet analysis"
Analysis2 configcapturemode-capturemode allpkt-capturefile "C:/framerate.pcap"
# Start capturing messages
Puts "Start capturing messages"
For {set I 0} {$i < 1} {incr i} {
Traffic1 configprofile-name profile1-trafficload [expr + $i *]-trafficloadunit fps
Analysis2 startcapture
Puts "Configure capture mode to capture the datagram to the specified file"
Analysis2 configcapturemode-capturemode allpkt-capturefile "c:/framerate[expr + $i * 100].pcap"
Port1 Startstaengine
Port2 Startstaengine
Port1 starttraffic
# wait 5 Seconds #
After 5000
# Stop traffic sending at TX Port
Port1 stoptraffic
After 5000
Array set stats1 [STATISTICS1 Getportstats]
Parray Stats1
Array set stats2 [STATISTICS2 Getportstats]
Parray stats2
# based on the stream, gets the stream1,stream2,stream3,stream4 statistic value, stores in the stats array and prints out
Array set stats3 [STATISTICS1 getstreamstats-streamname stream1]
Parray Stats3
#array set STATS4 [Statistics1 getstreamstats-streamname stream2]
#parray STATS4
#array set stats5 [Statistics1 getstreamstats-streamname STREAM3]
#parray STATS5
Port1 Stopstaengine
Port2 Stopstaengine
Analysis2 stopcapture
}
#清除测试过程中所作的所有配置和释放测试过程中占用的所有资源
Chassis1 Cleanuptest
} Err]} {
Puts "error occurred in script run: $err"
#清除测试过程中所作的所有配置和释放测试过程中占用的所有资源
Chassis1 Cleanuptest
}
Second, 203_tc_framerate-2.tcl
Set CHASSISADDR 10.132.238.190
Set Islot 1
Set Portlist {9}; #端口的排列顺序是port1, Port2
Set IPList {10.0.0.3 20.0.0.3}; #ip列表与端口的排列顺序相对应
Set Maclist {00-00-00-00-00-01 00-00-00-00-00-02}
Set Gwlist {10.0.0.1 20.0.0.1}
Set Iframelen {64 128 256 512 1518}
Set Streamload 100
If {[Catch {
Cd.. /source
#加载HLAPI Lib
source./cstc.tcl
Setlogoption-debug Enable
# Start connecting Machines
Testdevice Chassis1 $chassisAddr
# Start reserving two ports
For {set I 0} {$i <[llength $portList]} {incr i} {
Chassis1 createtestport-portlocation $islot/[lindex $portList $i]-portname port[expr $i +1]-porttype Ethernet
}
Port1 Createtraffic-trafficname Traffic1
Traffic1 createprofile-name profile1-trafficload 100-trafficloadunit fps
Traffic1 createstream-streamname stream1-framelen 500-profilename profile1 \
-l2 ethernet-l3 ipv4-l4 udp-ipsrcaddr 192.168.0.1-ipdstaddr 192.168.5.7-udpsrcport 2000-udpdstport 3000
Traffic1 configstream-streamname stream1-l2 ethernet-l3 ipv4-ethdst 00:00:10:e1:01:08-ethsrc
#创建统计和分析对象Statistics1, Statistics2,analysis2.
Port1 Createstaengine-staenginename Txstatistics1-statype Statistics
Port2 createstaengine-staenginename Rxstatistics1-statype Statistics
Analysis of Port2 Createstaengine-staenginename Analysis2-statype
#SaveConfigAsXML "C:/framerate.xml"
Puts "Configure capture mode, capture the datagram to the specified file, and can be used for packet analysis"
Analysis2 configcapturemode-capturemode allpkt-capturefile "C:/framerate.pcap"
# Start capturing messages
Puts "Start capturing messages"
For {set I 0} {$i < 3} {incr i} {
Traffic1 configprofile-name profile1-trafficload [expr + $i *]-trafficloadunit fps
Traffic1 configstream-streamname Stream1-framelen [lindex $iFramelen $i]
Analysis2 startcapture
Puts "Configure capture mode to capture the datagram to the specified file"
Analysis2 configcapturemode-capturemode allpkt-capturefile "c:/framerate[expr + $i * 100].pcap"
Port1 Startstaengine
Port2 Startstaengine
Port1 starttraffic
# wait 5 Seconds #
After 5000
# Stop traffic sending at TX Port
Port1 stoptraffic
After 5000
Set TxStats1 [TXSTATISTICS1 Getportstats]
Puts "-------------------------------"
Puts $TxStats 1
Puts "-------------------------------"
Set txframeindex [Lsearch $TxStats 1-txsignature]
Set txframerateindex [Lsearch $TxStats 1-txsignaturerate]
Set txframenum [lindex $TxStats 1 [expr $txFrameIndex + 1]]
Set txframerate [lindex $TxStats 1 [expr $txFrameRateIndex + 1]]
#array set RxStats1 [RXSTATISTICS1 Getportstats]
Set RxStats1 [RXSTATISTICS1 Getportstats]
Puts "-------------------------------"
Puts $RxStats 1
Puts "-------------------------------"
Set rxframeindex [Lsearch $RxStats 1-rxsignature]
Set rxframerateindex [Lsearch $RxStats 1-rxsignaturerate]
Set rxframenum [lindex $RxStats 1 [expr $rxFrameIndex + 1]]
Set rxframerate [lindex $RxStats 1 [expr $rxFrameRateIndex + 1]]
Puts "Txframe= $txFrameNum"
Puts "Rxframe= $rxFrameNum"
Port1 Stopstaengine
Port2 Stopstaengine
Analysis2 stopcapture
}
#清除测试过程中所作的所有配置和释放测试过程中占用的所有资源
Chassis1 Cleanuptest
} Err]} {
Puts "error occurred in script run: $err"
#清除测试过程中所作的所有配置和释放测试过程中占用的所有资源
Chassis1 Cleanuptest
}