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

if($slot > 0 && $slot <= 8){ #Insure a slot number was passed in
$switch_ports{'nic_0-1'} = (2 * $slot) - 1;
$switch_ports{'nic_2-3'} = (2 * $slot);
} else {
die "Invalid slot number $slot\n";
}
return %switch_ports;
}
1;
pGbE2.pm (Switch specific code for p-Class GbE2 Interconnect Switch)
Note: Change the use line in switchconfing.pl to match the module used.
use Net::Telnet;
# Connect to the switch using the passed in switch access information
# configure the port specified by the passed in port number to the
# passed in vlan ID.
sub ConfigVlan
{
local(*switch_info) = @_[0]; # Switch login information.
local(*ports) = @_[1]; # List of ports for this slot.
local($vlan) = @_[2];
local(@lines);
# Obtain switch login information.
$host = $switch_info{'host'};
$password = $switch_info{'password'};
# For this example, we are changing NIC 2 and NIC3.
# The first port is the iLO (switch B) and PXE (switch A)
# NIC that we are not changing.
$port = $ports{'nic_2-3'};
# Set prompt to use.
my $prompt = '/\\>\\>.*#/';
# Create Telnet access object.
$telnet = new Net::Telnet(Host => $host,
Prompt => $prompt);
# Open the telnet session, wait for login prompt, and login.
$ok = $telnet->open();
$ok = $telnet->waitfor(Match => "/password[: ]*/i");
$ok = $telnet->print($password);
# After the prompt, set to not page or ask questions.
$ok = $telnet->waitfor( Match => $prompt);
$ok = $telnet->cmd("lines 0"); # no 'press any key' stuff
$ok = $telnet->cmd("verbose 0"); # no questions
# Add the port to the defined VLAN with commands and collect output.
@tmp = $telnet->cmd("/cfg/vlan $vlan/add $port");
push(@lines, @tmp);
@tmp = $telnet->cmd("/cfg/port $port/pvid $vlan");
push(@lines, @tmp);
# Apply the change and save to take effect if the switch is restarted.
@tmp = $telnet->cmd("apply");
push(@lines, @tmp);
@tmp = $telnet->cmd("save");
push(@lines, @tmp);
# Logoff and return the output.
$telnet->close();
return @lines;
}
# Using the passed in slot number, calculate the switch port numbers
# assigned to:
# iLO (Right Switch) or PxE (Left Switch). This is nic_0-1.
# NIC3 (Right Switch) or NIC2 (Left Switch). This is nic_2-3.
sub GetPortNumbers
{
local(%switch_ports);
local($slot) = @_[0]; # Get passed in slot number.
if($slot > 0 && $slot <= 8){ # Ensure a slot number was passed in.
20