atmtmcounters.tcl
来自「smartbits二次开发示例代码」· TCL 代码 · 共 597 行 · 第 1/2 页
TCL
597 行
}
set streambind($i.ucBindMode) $::STREAM_BIND_VC
set streambind($i.uiBindIndex) $j ;# This is the to-be-bound VC index
set streambind($i.uiATMFlags) $::AT_CLP_ON
}
LIBCMD HTSetStructure $::L3_DEFINE_STREAM_BINDING 0 0 0 streambind 0 $TxHub $TxSlot $TxPort
#commit the config
LIBCMD HTSetCommand $::NS_COMMIT_CONFIG 0 0 0 0 $TxHub $TxSlot $TxPort
# Clear the counters on both the ports
LIBCMD HTClearPort $TxHub $TxSlot $TxPort
LIBCMD HTClearPort $RxHub $RxSlot $RxPort
#Run the test
HTRun $::HTRUN $TxHub $TxSlot $TxPort
after 2000
HTRun $::HTSTOP $TxHub $TxSlot $TxPort
#Get counters and check the tagged cell counter
LIBCMD HTGetStructure $::AT_PORT_COUNTER_INFO 0 0 0 portCounter1 0 $TxHub $TxSlot $TxPort
LIBCMD HTGetStructure $::AT_PORT_COUNTER_INFO 0 0 0 portCounter2 0 $RxHub $RxSlot $RxPort
puts " "
puts "Port counters"
puts " Cells"
puts [format " Transmitted: %12d " $portCounter1(u64TxAssignedCells.low)]
puts [format " Received: %12d " $portCounter2(u64RxCells.low)]
puts [format "TaggedCells Received: %12d " $portCounter2(u64RxCells.low)]
puts " "
#################################################################################################
# Test Case 4
# Checking the RX TaggedCell Rate by set the TX mode to CONTINUOUS mode
# and with CLP bit on (already set in Test Case 3 above)
#################################################################################################
puts "---------------------------------------"
puts " "
puts "Test Case 4 (Speed: $speedString)"
puts "TaggedCell Rate for ATPortCounters"
puts " "
#Set VC to continuous mode since non-rate can only be retrieved during transmit
for {set i 0} {$i < $VCCount} {incr i} {
LIBCMD HTGetStructure $::AT_VC_INFO $i 0 0 VCCfg_Modify 0 $TxHub $TxSlot $TxPort
set VCCfg_Modify(ulTxMode) $::CONTINUOUS_PACKET_MODE
LIBCMD HTSetStructure $::AT_VC_MODIFY $i 0 0 VCCfg_Modify 0 $TxHub $TxSlot $TxPort
LIBCMD HTGetStructure $::AT_VC_INFO $i 0 0 VCCfg_Modify 0 $RxHub $RxSlot $RxPort
set VCCfg_Modify(ulTxMode) $::CONTINUOUS_PACKET_MODE
LIBCMD HTSetStructure $::AT_VC_MODIFY $i 0 0 VCCfg_Modify 0 $RxHub $RxSlot $RxPort
}
LIBCMD HTSetCommand $::NS_COMMIT_CONFIG 0 0 0 0 $TxHub $TxSlot $TxPort
# Clear the counters on both TX/RX ports
LIBCMD HTClearPort $TxHub $TxSlot $TxPort
LIBCMD HTClearPort $RxHub $RxSlot $RxPort
#run the test
HTRun $::HTRUN $TxHub $TxSlot $TxPort
after 2000
#retrieve counters
LIBCMD HTGetStructure $::AT_PORT_COUNTER_INFO 0 0 0 portCounter1 0 $TxHub $TxSlot $TxPort
LIBCMD HTGetStructure $::AT_PORT_COUNTER_INFO 0 0 0 portCounter2 0 $RxHub $RxSlot $RxPort
#stop the test
HTRun $::HTSTOP $TxHub $TxSlot $TxPort
puts " "
puts "Port counters"
puts " CellRate"
puts [format " Transmitted: %12d " $portCounter1(ulTxCellRate)]
puts [format " Received: %12d " $portCounter2(ulRxCellRate)]
puts [format "Received TaggedCellRate: %12d " $portCounter2(ulRxTaggedCellRate)]
puts " "
#bind streams to VC's
for {set i 0; set j 0} {$i < $StrmCount } {incr i} {
if { $i % $StrmCountPerVC == 0 && $i != 0 } {
incr j
}
set streambind($i.ucBindMode) $::STREAM_BIND_VC
set streambind($i.uiBindIndex) $j ;# This is the to-be-bound VC index
set streambind($i.uiATMFlags) $::AT_CLP_OFF
}
LIBCMD HTSetStructure $::L3_DEFINE_STREAM_BINDING 0 0 0 streambind 0 $TxHub $TxSlot $TxPort
#################################################################################################
#
# Test Case 5
# Checking the u64RxCongestedCells by set the ucPTI to AT_USRDATA_CONGESTED
# TX mode to SINGLEBURST mode
#
#################################################################################################
puts "---------------------------------------"
puts " "
puts "Test Case 5 (Speed: $speedString)"
puts "CongestedCell Number for ATPortCounters"
puts " "
#Set VC to Continuous Mode
for {set i 0} {$i < $VCCount} {incr i} {
LIBCMD HTGetStructure $::AT_VC_INFO $i 0 0 VCCfg_Modify 0 $TxHub $TxSlot $TxPort
set VCCfg_Modify(ulTxMode) $::SINGLE_BURST_MODE
set VCCfg_Modify(ucPTI) $::AT_USRDATA_CONGESTED
LIBCMD HTSetStructure $::AT_VC_MODIFY $i 0 0 VCCfg_Modify 0 $TxHub $TxSlot $TxPort
LIBCMD HTGetStructure $::AT_VC_INFO $i 0 0 VCCfg_Modify 0 $RxHub $RxSlot $RxPort
set VCCfg_Modify(ulTxMode) $::SINGLE_BURST_MODE
set VCCfg_Modify(ucPTI) $::AT_USRDATA_CONGESTED
LIBCMD HTSetStructure $::AT_VC_MODIFY $i 0 0 VCCfg_Modify 0 $RxHub $RxSlot $RxPort
}
#commit the config
LIBCMD HTSetCommand $::NS_COMMIT_CONFIG 0 0 0 0 $TxHub $TxSlot $TxPort
#clear the counters on both TX/RX ports
LIBCMD HTClearPort $TxHub $TxSlot $TxPort
LIBCMD HTClearPort $RxHub $RxSlot $RxPort
#run the test
HTRun $::HTRUN $TxHub $TxSlot $TxPort
after 200
HTRun $::HTSTOP $TxHub $TxSlot $TxPort
#retrieve counters and check the congested cell count
after 2000
LIBCMD HTGetStructure $::AT_PORT_COUNTER_INFO 0 0 0 portCounter1 0 $TxHub $TxSlot $TxPort
LIBCMD HTGetStructure $::AT_PORT_COUNTER_INFO 0 0 0 portCounter2 0 $RxHub $RxSlot $RxPort
puts " "
puts "Port counters"
puts " Cells"
puts [format " Transmitted: %12d " $portCounter1(u64TxAssignedCells.low)]
puts [format " Received: %12d " $portCounter2(u64RxCells.low)]
puts [format "Received CongestedCells: %12d " $portCounter2(u64RxCongestedCells.low)]
puts " "
#################################################################################################
#
# Test Case 6
# Checking the ulRxCongestedCellRate by set the ucPTI to AT_USRDATA_CONGESTED_SDU_0
# TX mode to CONTINUOUS mode
#
#################################################################################################
puts "---------------------------------------"
puts " "
puts "Test Case 6 (Speed: $speedString)"
puts "CongestedCell Rate for ATPortCounters"
puts " "
#Set VC to continuous mode and set the PTI to congested SDU 0
for {set i 0} {$i < $VCCount} {incr i} {
LIBCMD HTGetStructure $::AT_VC_INFO $i 0 0 VCCfg_Modify 0 $TxHub $TxSlot $TxPort
set VCCfg_Modify(ulTxMode) $::CONTINUOUS_PACKET_MODE
set VCCfg_Modify(ucPTI) $::AT_USRDATA_CONGESTED
LIBCMD HTSetStructure $::AT_VC_MODIFY $i 0 0 VCCfg_Modify 0 $TxHub $TxSlot $TxPort
LIBCMD HTGetStructure $::AT_VC_INFO $i 0 0 VCCfg_Modify 0 $RxHub $RxSlot $RxPort
set VCCfg_Modify(ulTxMode) $::CONTINUOUS_PACKET_MODE
set VCCfg_Modify(ucPTI) $::AT_USRDATA_CONGESTED
LIBCMD HTSetStructure $::AT_VC_MODIFY $i 0 0 VCCfg_Modify 0 $RxHub $RxSlot $RxPort
}
#commit the config
LIBCMD HTSetCommand $::NS_COMMIT_CONFIG 0 0 0 0 $TxHub $TxSlot $TxPort
# clear the counters on both TX/RX ports
LIBCMD HTClearPort $TxHub $TxSlot $TxPort
LIBCMD HTClearPort $RxHub $RxSlot $RxPort
#run the test
HTRun $::HTRUN $TxHub $TxSlot $TxPort
after 2000 ;# 20 is not enough to retrieve the counters
#retrieve counter during transmit
LIBCMD HTGetStructure $::AT_PORT_COUNTER_INFO 0 0 0 portCounter1 0 $TxHub $TxSlot $TxPort
LIBCMD HTGetStructure $::AT_PORT_COUNTER_INFO 0 0 0 portCounter2 0 $RxHub $RxSlot $RxPort
#stop test
HTRun $::HTSTOP $TxHub $TxSlot $TxPort
puts " "
puts "Port counters"
puts " CellRate"
puts [format " Transmitted: %12d " $portCounter1(ulTxCellRate)]
puts [format " Received: %12d " $portCounter2(ulRxCellRate)]
puts [format "Received Congested Cell Rate: %12d " $portCounter2(ulRxCongestedCellRate)]
puts " "
#################################################################################################
#
# Test Case 7
# Checking the u64RxCRCErredAAL5Frames by enable CRC in L3 stream extension
# TX mode to CONTINUOUS mode
#
#################################################################################################
puts "---------------------------------------"
puts " "
puts "Test Case 7 (Speed: $speedString)"
puts "u64RxCRCErredAAL5Frames Number for ATPortCounters, ATVCCounters and ATStreamCounters"
puts " "
#Set VC to Continuous Mode
for {set i 0} {$i < $VCCount} {incr i} {
LIBCMD HTGetStructure $::AT_VC_INFO $i 0 0 VCCfg_Modify 0 $TxHub $TxSlot $TxPort
set VCCfg_Modify(ulTxMode) $::SINGLE_BURST_MODE
set VCCfg_Modify(ucPTI) $::AT_USRDATA_NOT_CONGESTED
LIBCMD HTSetStructure $::AT_VC_MODIFY $i 0 0 VCCfg_Modify 0 $TxHub $TxSlot $TxPort
LIBCMD HTGetStructure $::AT_VC_INFO $i 0 0 VCCfg_Modify 0 $RxHub $RxSlot $RxPort
set VCCfg_Modify(ulTxMode) $::SINGLE_BURST_MODE
set VCCfg_Modify(ucPTI) $::AT_USRDATA_NOT_CONGESTED
LIBCMD HTSetStructure $::AT_VC_MODIFY $i 0 0 VCCfg_Modify 0 $RxHub $RxSlot $RxPort
}
#Enable CRC in stream extension
set stream_ext_CRC(ucCRCErrorEnable) 1
set stream_ext_CRC(ulFrameRate) $FrameRate
for {set i 1} {$i <= $StrmCount} {incr i} {
LIBCMD HTSetStructure $::L3_MOD_STREAM_EXTENSION $i 0 0 stream_ext_CRC 0 $TxHub $TxSlot $TxPort
}
#commit config
LIBCMD HTSetCommand $::NS_COMMIT_CONFIG 0 0 0 0 $TxHub $TxSlot $TxPort
# clear the counters on both TX/RX ports
LIBCMD HTClearPort $TxHub $TxSlot $TxPort
LIBCMD HTClearPort $RxHub $RxSlot $RxPort
#run the test
HTRun $::HTRUN $TxHub $TxSlot $TxPort
after 2000
HTRun $::HTSTOP $TxHub $TxSlot $TxPort
#retrieve counter
after 2000
LIBCMD HTGetStructure $::AT_PORT_COUNTER_INFO 0 0 0 portCounter1 0 $TxHub $TxSlot $TxPort
LIBCMD HTGetStructure $::AT_PORT_COUNTER_INFO 0 0 0 portCounter2 0 $RxHub $RxSlot $RxPort
puts " "
puts "Port counters"
puts " Frames"
puts [format " Transmitted: %12d " $portCounter1(u64TxAAL5Frames.low)]
puts [format "Received CRC error frames: %12d " $portCounter2(u64RxCRCErredAAL5Frames.low)]
puts " "
puts "VC counters"
puts " Frames VCIndex"
for {set i 0} {$i < $VCCount} {incr i} {
LIBCMD HTGetStructure $::AT_VC_COUNTER_INFO $i 0 0 VCCounter1 0 $TxHub $TxSlot $TxPort
LIBCMD HTGetStructure $::AT_VC_COUNTER_INFO $i 0 0 VCCounter2 0 $RxHub $RxSlot $RxPort
puts [format " Transmitted: %12d %12d" $VCCounter1(u64TxAAL5Frames.low) $i]
puts [format "Received CRC error frames: %12d %12d" $VCCounter2(u64RxCRCErredAAL5Frames.low) $i]
puts " "
}
#Check the stream counters
puts ""
puts "Stream counters:"
puts " Frames StreamIndex"
for {set i 1} {$i <= $StrmCount} {incr i} {
LIBCMD HTGetStructure $::AT_STREAM_TX_COUNTER_INFO $i 0 0 StrmCounter 0 $TxHub $TxSlot $TxPort
puts [format "Transmitted: %12d %12d" $StrmCounter(u64TxFrameCount.low) $i]
puts " "
}
puts " "
unset atmPortCfg_Dft
unset atmVCCfg_Dft
unset ip_stream
unset stream_ext
unset streambind
unset VCCounter1
unset VCCounter2
unset portCounter1
unset portCounter2
unset StrmCounter
unset VCCfg_Modify
unset stream_ext_CRC
LIBCMD HTSetCommand $::AT_VC_DELETE_ALL 0 0 0 0 $TxHub $TxSlot $TxPort
LIBCMD HTSetCommand $::AT_VC_DELETE_ALL 0 0 0 0 $RxHub $RxSlot $RxPort
}
# Release the slot
LIBCMD HTSlotRelease $TxHub $TxSlot
LIBCMD HTSlotRelease $RxHub $RxSlot
#Unlink Chassis
puts "UnLinking from the chassis now.."
LIBCMD ETUnLink
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?