switch port enable disable

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dawood munavar
    New Member
    • Apr 2011
    • 13

    switch port enable disable

    Hello, can you please suggest me how to write a perl program to enable and disable brocade switch
  • RonB
    Recognized Expert Contributor
    • Jun 2009
    • 589

    #2
    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

    Comment

    • dawood munavar
      New Member
      • Apr 2011
      • 13

      #3
      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

      • RonB
        Recognized Expert Contributor
        • Jun 2009
        • 589

        #4
        What have you tried?

        Assuming you actually have a test script, what errors/warnings are you receiving?

        What part of the process do you not know how to do?

        Comment

        • dawood munavar
          New Member
          • Apr 2011
          • 13

          #5
          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

          Working...