Hello, can you please suggest me how to write a perl program to enable and disable brocade switch
switch port enable disable
Collapse
X
-
Tags: None
-
What type of connection does the switch support?
Net::Telnet - interact with TELNET port or other TCP ports
Net::SSH - Perl extension for secure shell
Net::SNMP - Object oriented interface to SNMP -
It is a 16-port brocade switch.And it supports a telnet port. Like my configuration is 2hosts connected to 16port switch and inturn it is connected to array controller. And i need to write a perl script to start IO on both the hosts and disable enable the switch ports. Can you please help me??Comment
-
check this perl script is correct??
#( To disable and enable the switch Ports using PERL script )
#Switch:
#Zone A: Ports 1-3-11
#Zone B: Ports 2-4-13
#HostA:
#HBA1 to ZoneA
#HBA2 to ZoneB
#HostB:
#HBA1 to ZoneA
#HBA2 to ZoneB
#ControllerA:
#HostPort1 to ZoneA
#controllerB:
#HostPort2 to ZoneB
#************** *************** *************** *************** *************** *
#!/usr/bin/perl
use strict;
use warnings;
use Net::Telnet();
my $t=new Net::Telnet(Tim eout=>10);
$t->login(my $username, my $passwd);
#step1:create volumes
#step2:Start IO from both Hosts.
#please manually start I/O from both the hosts
#step3: Disable and enable the switch ports
{
print "please enter the switchID \n";
my $switchID=<STDI N>;
print "please enter the switchuserName and switchPassword \n";
my $switchUserName =<STDIN>;
my $switchuserPwd= <STDIN>;
}
#Substitute to disable the port of the Switch for Brocade
{
print "enter the commmand \n";
my $command=<STDIN >;
print "enter the port num to disable on switch \n";
my $portNumber=<ST DIN>;
}
# Substitute to enable the port of the Switch for Brocade
{
print "enter the commmand \n";
my $command=<STDIN >;
print "enter the port num to enable on switch \n";
my $portNumber=<ST DIN>;
}
#substitute Sleep
# Subsuite to wait after port Disable or Enable
{
sleep(300);
}
#substitute portDisableEnab leBrocade
#Disable port1 and sleep 60 seconds
{
print "enter the commmand \n";
my $command="***po rtDisable***;
print "enter the port num to disable on switch \n";
my $portNumber=*** 1***;
sleep(60);
}
#Disable port3 and sleep 60seconds
{
print "enter the command \n";
my $command="***po rtDisable***;
print"enter the port num to disable on switch \n";
my $portNumber=*** 3***;
sleep(60);
}
#Enable port3 and sleep 60 seconds
{
print "enter the commmand \n";
my $command="***po rtEnable***;
print "enter the port num to Enable on switch \n";
my $portNumber=*** 3***;
sleep(60);
}
#Enable port1 and sleep 60seconds
{
print "enter the command \n";
my $command="***po rtDisable***;
print"enter the port num to Enable on switch \n";
my $portNumber=*** 1***;
sleep(60);
}
#Disable port2 and sleep 60 seconds
{
print "enter the commmand \n";
my $command="***po rtDisable***;
print "enter the port num to disable on switch \n";
my $portNumber=*** 2***;
sleep(60);
}
#Disable port4 and sleep 60seconds
{
print "enter the command \n";
my $command="***po rtDisable***;
print"enter the port num to disable on switch \n";
my $portNumber=*** 4***;
sleep(60);
}
#Enable port2 and sleep 60 seconds
{
print "enter the commmand \n";
my $command="***po rtEnable***;
print "enter the port num to Enable on switch \n";
my $portNumber=*** 2***;
sleep(60);
}
#Enable port4 and sleep 60seconds
{
print "enter the command \n";
my $command="***po rtDisable***;
print"enter the port num to Enable on switch \n";
my $portNumber=*** 4***;
sleep(60);
}
#Disable port11 and sleep 60 seconds
{
print "enter the commmand \n";
my $command="***po rtDisable***;
print "enter the port num to disable on switch \n";
my $portNumber=*** 11***;
sleep(60);
}
#Disable port13 and sleep 60seconds
{
print "enter the command \n";
my $command="***po rtDisable***;
print"enter the port num to disable on switch \n";
my $portNumber=*** 13***;
sleep(60);
}
#Enable port11 and sleep 60 seconds
{
print "enter the commmand \n";
my $command="***po rtEnable***;
print "enter the port num to Enable on switch \n";
my $portNumber=*** 11***;
sleep(60);
}
#Enable port13 and sleep 60seconds
{
print "enter the command \n";
my $command="***po rtDisable***;
print"enter the port num to Enable on switch \n";
my $portNumber=*** 13***;
sleep(60);
}
#************** *************** *************** *************** ************
#THE END
#************** *************** *************** *************** **************Comment
Comment