Customer Service Center
Home
Knowledge Base
Contact Support
License Activation
|
Contact Support
|
License Activation
|
Spirent KB Article
Doc ID: FAQ17481
Printer Friendly
Email Article Link
Spirent TestCenter-JTAPI: How to break the link and Restore of a port in JTAPI?
Environment/Versions
Spirent TestCenter
Automation-JTAPI
Answer
Below is the code. Use Bring_link_status API without Duration to break the link and then use all_lasers_on() to restore the link.
# Initialise the ports.
my $port1 = "10.61.39.164/6/1";
my $port2 = "10.61.39.164/6/2";
my @ports = (
{ port=>"$port1"},
{ port=>"$port2"}
);
$rt->init_modules(port=>\@ports, arp=>0);
my $actphy1 = $rt->invoke("stc::get port1 -activephy-targets");
my $status1 = $rt->invoke("stc::get $actphy1 -linkstatus");
my $actphy2 = $rt->invoke("stc::get port2 -activephy-targets");
my $status2 = $rt->invoke("stc::get $actphy2 -linkstatus");
print "1. ++++++++++++ $status1 /t $status2 +++++++++++++";
$rt->bring_link_status_down(ports=>["$port1"]);
sleep 5;
$actphy1 = $rt->invoke("stc::get port1 -activephy-targets");
$status1 = $rt->invoke("stc::get $actphy1 -linkstatus");
$actphy2 = $rt->invoke("stc::get port2 -activephy-targets");
$status2 = $rt->invoke("stc::get $actphy2 -linkstatus");
print "2. ++++++++++++ $status1 /t $status2 +++++++++++++";
$rt->all_lasers_on ();
sleep 10;
$actphy1 = $rt->invoke("stc::get port1 -activephy-targets");
$status1 = $rt->invoke("stc::get $actphy1 -linkstatus");
$actphy2 = $rt->invoke("stc::get port2 -activephy-targets");
$status2 = $rt->invoke("stc::get $actphy2 -linkstatus");
print "2. ++++++++++++ $status1 /t $status2 +++++++++++++";
Version
1.0
Publish Date
2016-07-18
Categories
Product : Automation,API,Spirent TestCenter
Related Articles