question

naveenbajaj avatar image
naveenbajaj asked DebbieLandis edited

Hi , i am beginner to spirent abacus . i need to make Tcl script using Abacus API automate with TCL .CAn you proviide a sample script that using tcl with abacus api connecting to Spirent abacus system controller

automationapitcl scriptAbacus
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
DebbieLandis avatar image
DebbieLandis answered

Hi @naveenbajaj,

A basic Abacus TCL script will set the path to API's, configure namespaces, set variables, connect to a system controller, and select cards (optional w/Abacus 100). Complete script introduction can be found in the Abacus TCL Automation User Guide which installs with the latest software patch to the default directory:

C:\Abacus 5000\6.22\MANUAL.

If you are familiar with the Tcl scripting language, you'll probably include messaging and error checking.

Hope the following example helps!

Debbie

A simple script with error checking looks something like this:

lappend auto_path "C:/Abacus 5000/6.22/TCL/APIClasses"

set response [package require tclreadyapi] puts "package require tclreadyapi: $response"

set response [package require tdom] puts "package require tdom: $response"

set response [package require Itcl] puts "package require Itcl: $response"

::aba::ApiApplication app ::aba::ApiSystemInformation sysinfo ::aba::ApiTest test ::aba::ApiResults results ::aba::ApiReports rep set server_ip localhost set envfile "EnvironmentName.env" set abacus_chassis_ip 10.10.10.10

set response [app Enter $server_ip] if { $response == 0 } { puts "Unable to establish connection! ($response)"; exit -1 } puts "Established connection to $server_ip ($response)"

set response [app Load $envfile] if { $response != "OK" } { puts "Error loading '$envfile'! ($response)"; exit -1 } puts "Loaded environment '$envfile' ($response)"

set response [sysinfo SetConnection $abacus_chassis_ip ""] if { $response != 1 } { puts "Error opening connection to chassis! ($response)"; exit -1 } puts "Opened connection to chassis '$abacus_chassis_ip' ($response)"

puts "Sleeping for 20 seconds..." ::aba::sleep 20

set response [sysinfo AddCard $abacus_chassis_ip 1] if { $response != 1 } { puts "Error adding card 1! ($response)"; exit -1 } puts "Added card 1 ($response)"

::aba::ApiProtocolSelection ps_api set response [ps_api GetCurrentConfig] puts $response

set response [test Start] if { $response != "OK" } { puts "Error starting test! ($response)"; exit -1 } puts "Test started ($response)"

::aba::sleep 10

set response [test GetStatus] puts "Test status: $response"

set response [test Stop] if { $response != "OK" } { puts "Error stopping test! ($response)"; exit -1 } puts "Test stopped ($response)"

set response [test GetStatus] puts "Test status: $response"

set VrType 0 set OutputOpt 0 set response [results GetVariances $VrType $OutputOpt] puts $response

set response [RemoveConnection RemoveConnection $abacus_chassis_ip] puts "Attempted to release chassis ($response)"

exit 0

10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.