Web Client Guide

364
Perl Scripts | Actions and Adaptive CLI
Perl Example
The following is an example Perl script for Adaptive CLI:
#
# A script example for testing against a Cisco-XR machine.
#
# The following variables (attributes) are defined in the schema,
# and their values are assigned when the script
# is invoked from the Adaptive CLI (or Resources) manager.
# These variables will be declared with values and prepended
# to each script automatically. Something like:
#
# my $FromPort=<some number>;
# my $ToPort=<some number>;
# my $Mtu=<some number>;
# my $Desc=<some text>;
#
print("config t\n");
foreach ($FromPort .. $ToPort) {
my $Desc = "$Desc Port #$_";
my $addr = 100 + $_;
print("interface GigabitEthernet0/1/1/1.$_\n");
print("description $Desc\n");
print("ipv4 address 10.10.100.$addr 255.255.255.0\n");
print("ipv4 unreachables disable\n");
print("mtu $Mtu\n");
}
print("exit\ncommit\nexit\n");