Using ProLiant Essentials Rapid Deployment Pack for scripted blade based switch configuration

Code appendix
This section includes sample scripts as a reference for examples provided throughout the HOWTO.
SwitchConfig.pl
SwitchConfig.pl is a Perl based interconnect switch configuration program that configures the
interconnect switch ports for the proper VLAN connectivity.
# Load the p-GbE2 specific telnet module.
use pGbe2; # Module to communicate with the switch using telnet. # When
using p-GbE or e-GbE, change the use line to the accurate module.
use GetSwitchInfo; # Used to get switch details.
# Obtain the rack location from the environmental variables set by RDP.
# The VLAN to use is passed as the first argument.
local($enc) = $ENV{'enclosure'};
local($rack) = $ENV{'rack'};
local($slot) = $ENV{'slot'};
$exit_status = 0;
local($vlan) = @ARGV[0];
if(!$vlan){
die "usage: $0 vlan_id\n";
}
# Get the switch port numbers that connect to the server in the given slot.
%ports = GetPortNumbers($slot);
# Obtain the switch access information for the switch A.
# The information is returned as a name-value list.
# This name-value list contains all parameters required to connect
# to the switch.
%switch_A_info = GetSwitchInfo($enc, $rack, "switchA");
# Set the switch A's VLAN on the specific ports or print an error
# message if not found.
if($switch_A_info{'host'}){
print "Configuring $switch_A_info{'host'}...\n";
@A_output = &ConfigVlan(*switch_A_info,*ports, $vlan);
} else {
print "Error: Unable to find switch A information in DB file.\n";
$exit_status = 1;
}
# Print the output captured in the named value list.
foreach $line (@A_output)
{
print "$line\n";
}
# Repeat for switch B.
%switch_B_info = GetSwitchInfo($enc, $rack, "switchB");
if($switch_B_info{'host'}){
print "Configuring $switch_B_info{'host'}...\n";
@B_output = &ConfigVlan(*switch_B_info,*ports, $vlan);
} else {
print "Error: Unable to find switch B information in DB file.\n";
$exit_status = 1;
}
foreach $line (@B_output)
{
print "$line\n";
}
exit($exit_status);
17