Printer FriendlyEmail Article Link

Spirent TestCenter-Automation: How do I access the results not in the first page of results using API?

Environment/Versions

Spirent TestCenter

Answer

By default the Spirent TestCenter only keeps the first 100 records for any given result statistic.

 To access the other results records you need to page through the result records.

 Please see below example.

# Step through each page.
 puts "\nTx Stream Results Data Sets"
 set iPageCount [stc::get $hTxStreamResultsDataSet -TotalPageCount]

 set lstPortNames {}
 set lstStreamblockNames {}

 for {set iPage 1} {$iPage <= $iPageCount} {incr iPage} {
                puts "\npage: $iPage"
                stc::config $hTxStreamResultsDataSet -PageNumber $iPage
                stc::apply
                set lstResults [stc::get $hTxStreamResultsDataSet -ResultHandleList]
                set iResultCount 0

                foreach hResult $lstResults {
                            puts \t$hResult
                            incr iResultCount

                           set hStreamblock [stc::get $hResult -parent]
                           set hTxStreamResults [stc::subscribe -Parent project1 -ConfigType StreamBlock \
                                         -ResultParent $hStreamblock \
                                         -resulttype TxStreamResults]
                           array set aStreamblockInfo [stc::get $hStreamblock -parent -name]
                           set szPortName $aStreamblockInfo(-parent)
                           set szStreamblockName $aStreamblockInfo(-name)
                          

                           after 1500


                           set txsummResults [stc::get $hTxStreamResults -ResultHandleList]
                           foreach htxSummaryResults $txsummResults { 
                                                            lappend atxResults($szPortName.$szStreamblockName.rx_results) [stc::get $htxSummaryResults -StreamIndex -FrameRate]
                           }
                           stc::unsubscribe $hTxStreamResults

                           if {[lsearch -exact $lstPortNames $szPortName] < 0} { lappend lstPortNames $szPortName }
                           if {[lsearch -exact $lstStreamblockNames $szStreamblockName] < 0} { lappend lstStreamblockNames $szStreamblockName }
                           set aResults($szPortName.$szStreamblockName.tx_results) "frameCount [stc::get $hResult -FrameCount ]"
                }

               puts "\n\t$iResultCount result objects returned"
 }


Product : Automation,API,Spirent TestCenter