Spirent Testcenter自动化测试脚本 TCL -1
基本功能
2015-06-18 浏览(69)
#!/bin/sh
# aTemplate.tcl
exec tclsh \
#----------------------------------------------------- # #
#-----------------------------------------------------
#引用STC API ,SpirentTestCenter.tcl的路径
source {C:ProgramFilesSpirentCommunicationsSpirentTestCenter 4.20Spirent TestCenterApplicationSpirentTestCenter.tcl}
#开启日志,-logTo:日志保存路径,使用stdout为标准输出; -loglevel:可选 DEBUG、 INFO 、WARN 和 ERROR 四种;
stc::configautomationoptions -logTo \
#配置机框Ip槽位端口号
set chassisAddress \
set slotPort1 \
set slotPort2 \
#创建一个项目
set ProjectA [stc::create project]
#在项目ProjextA下创建一个发送端口和一个接收端口
set TxPort [stc::create port -under $ProjectA]
set RxPort [stc::create port -under $ProjectA]
set portReturn [stc::config $TxPort -location \
set portReturn [stc::config $RxPort -location \
#配置端口类型,根据实际端口类型选择参数:Ethernet10GigFiber、Ethernet100GigFiber、Ethernet40GigFiber、Ethernet10GigCopper、EthernetCopper等;
set ethernetFiber(1) [stc::create \-Name \
set ethernetFiber(2) [stc::create \-Name \
#在发送端口下创建StreamBlock(1)
set StreamBlock(1) [stc::create \ -under $TxPort
-frameConfig \ -FrameLengthMode \ -FixedFrameLength \
-name \
#在StreamBlock(1)中添加EthII头
set StrEthII [stc::create ethernet:EthernetII -under $StreamBlock(1) -name eht_1 -srcMac 11:11:11:11:11:11 -dstMac 22:22:22:22:22:22 ]
#添加IPv4头
set strIPv4 [stc::create ipv4:IPv4 -under $StreamBlock(1) -name Ipv4_1 -sourceAddr 10.10.10.10 -destAddr 20.20.20.20]
#添加TCP头
set strTcp [stc::create tcp:Tcp -under $StreamBlock(1) -name tcp1 -sourcePort 10 -destPort 20 ]
#创建Streamblock2