Printer FriendlyEmail Article Link

SpirentTestCenter: How do I load a Spirent TestCenter GUI configuration using TCL API?

Answer

Save the configuration into .xml or .tcc format.

From the application:  File -> Save as -> Select the “Save as type” .xml or .tcc  
 
Here is the sample Script which loads the configuration.  
 
# load the STC package
package require SpirentTestCenter
 
 
# if the config is .xml format then use
stc::perform LoadFromXml -Filename sample.xml
 
# if the configurtion is .tcc format then
stc::perform LoadFromDatabaseCommand -DatabaseConnectionString sample.tcc
stc::apply
 
-------------------------------------------------------------------------------------------------
#The Saved configuration already have the Chassis IP address and port numbers.
#If you want to use the same chassis and port(s) after loading the config
set hProject [stc::get system1 -children-project]
 
#Retrieving the port handles from the configuration
set portList [stc::get $hProject -children-port]
 
set port(1) [lindex $portList 0]
set port(2) [lindex $portList 1]
 
#Connect to the chassis, reserve and map the ports"
stc::perform attachPorts -portList "$port(1) $port(2)" -autoConnect TRUE
 
-------------------------------------------------------------------------------------------------
#If you want to relocate the ports to different Chassis or Slots then follow the steps.
stc::perform LoadFromXml -Filename sample.xml
stc::apply
 
#The Saved configuration already have the Chassis IP address and port numbers. If a user want to use the same chassis and ports after loading the xml
set hProject [stc::get system1 -children-project]
 
#Retrieving the port handles from the configuration
set portList [stc::get $hProject -children-port]
 
set port(1) [lindex $portList 0]
set port(2) [lindex $portList 1]
 
stc::config $port(1) -Location //ChassisIP address/Slot#/port#
stc::config $port(2) -Location //ChassisIP address/Slot#/port#
 
#Connect to the chassis, reserve and map the ports"
stc::perform attachPorts -portList "$port(1) $port(2)" -autoConnect TRUE

 


Product : Spirent TestCenter,General Navigation,L2-3,Automation,API,Spirent TestCenter