Using ProLiant Essentials Rapid Deployment Pack for scripted blade based switch configuration
$switch_ports{'nic_i0-1'} = (2 * $slot) - 1;
$switch_ports{'nic_2-3'} = (2 * $slot);
} else {
die "Invalid slot number $slot\n";
}
return %switch_ports;
}
1;
e-Gbe.pm (Switch specific code for e-Class GbE 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);
if($switch_info{'side'} eq 'switchA'){
print "Warning: Ignorning configure request for e-GbE switchA\n";
return;
}
# Obtain switch login information.
$host = $switch_info{'host'};
$password = $switch_info{'password'};
$user = $switch_info{'user'};
# 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_0-1'};
# Set prompt to use.
my $prompt = "/>+/";
# Create Telnet access object.
$telnet = new Net::Telnet(Host => $host, Prompt => $prompt);
# Connect to the switch.
$ok = $telnet->open();
# We wait for the switch to prompt for the user/password.
$ok = $telnet->waitfor(Match => '/username:*/i');
# Log onto the switch using the user and password.
$ok = $telnet->print($user);
$ok = $telnet->waitfor(Match => '/password:*/i');
$ok = $telnet->print($password);
# Send a Return. This will be a no-operation if already in CLI mode
# and will switch to CLI if in menu mode as "switch to CLI"
# is the first item in the menu.
$ok = $telnet->print("");
$ok = $telnet->waitfor(Match => $prompt);
# Set paging mode off so the CLI is not looking for interactive commands.
$ok = $telnet->cmd("paging off");
# Set the port to operate on the specified vlan.
@tmp = $telnet->cmd("vlan create id $vlan name vlan_$vlan");
push(@lines, @tmp);
@tmp = $telnet->cmd("vlan add port id $vlan eg untagged $port");
push(@lines, @tmp);
@tmp = $telnet->cmd("vlan set pvid port $port id $vlan");
push(@lines, @tmp);
# Save the configuration change. It will be in effect even after a reboot.
21