Printer FriendlyEmail Article Link

Spirent TestCenter-Automation: How to break and restore a Spirent TestCenter port link using TCL API?

Environment/Versions

 Spirent TestCenter

Answer

The Follwing commands can be used to Break and Restore a port link

# Break Link
  stc::perform L2TestBreakLinkCommand -Port "$hPortA"
# Restore Link
  stc::perform  L2TestRestoreLinkCommand -Port "$hPortA"
 

Please see the complete Script below

  package require SpirentTestCenter

  puts "SpirentTestCenter system version:\t[stc::get system1 -Version]"
  stc::config AutomationOptions \
          -LogTo testcenter_log.txt -LogLevel INFO
 
# Physical topology
  set szChassisAddr 10.21.10.104
  set iSlotA 1
  set iPortA 1
  set iSlotB 1
  set iPortB 2

# Create the root project object
  set hProject [stc::create project]
 
 set hTestResultSetting [stc::get $hProject -children-TestResultSetting]
 stc::config $hTestResultSetting -ResultsDirectory Master_Results -SaveResultsRelativeTo CURRENT_WORKING_DIR
 

# Create ports.
  puts "\nCreating ports"
  set hPortA [stc::create port -under $hProject -location //$szChassisAddr/$iSlotA/$iPortA \
          -useDefaultHost FALSE ]
  set hPortB [stc::create port -under $hProject -location //$szChassisAddr/$iSlotB/$iPortB \
          -useDefaultHost FALSE ]


# Use a single command to attachPorts (connect, reserve, and setup Port Mappings)
# Attach ports.
  puts "\nAttaching Ports ..."
  stc::perform attachPorts -portList [list $hPortA $hPortB] -autoConnect TRUE

# Break Link
  stc::perform L2TestBreakLinkCommand -Port "$hPortA"
# Restore Link
  stc::perform  L2TestRestoreLinkCommand -Port "$hPortA"

# Release the ports
  stc::perform detachPorts -portList [list $hPortA $hPortB]

# Disconnect the Chassis
  stc::perform chassisDisconnectAll
  stc::perform resetConfig -config system1

 

 

 


Product : Spirent TestCenter,Automation,API