Printer FriendlyEmail Article Link

Spirent TestCenter-Automation:Can we subscribe to same result type more than once in a single script?

Environment/Versions
  • Spirent TestCenter
  • Automation
  • Results
Answer

When we subscribe to specific result type for the first time say filteredstreamresults

set resultsHandle [stc::subscribe -parent [lindex [stc::get system1 -children-Project] 0] \
        -resultParent " [lindex [stc::get $project -children-Port] 1] " \
        -configType analyzer \
        -resultType filteredstreamresults \
        -filterList "" \
we will get on results object under analyzer.
 
% set filteredstreamresults1 [stc::get $Analyzer(2) -children-filteredstreamresults]
filteredstreamresults1

If we subscribe to filteredstreamresults for the second time after clearing the counter and then retrieve results after traffic is being sent we observe that two filteredstreamresult objects will get created under analyzer with the same values. Hence it will lead to the mismatch between Tx count and Rx count.

% set filteredstreamresults2 [stc::get $Analyzer(2) -children-filteredstreamresults]
filteredstreamresults1 filteredstreamresults2

So we should unsubscribe to the results before subscribing results second time. Below is the command to unsubscribe the results:

stc::unsubscribe $resultsHandle


Product : Spirent TestCenter,Automation,API,Spirent TestCenter