Warning: Can't synchronize with the repository (/nfs/projects/capforge.org/trac/cap does not appear to be a Subversion repository.). Look in the Trac log for more information.

Draft

  • think of varying power, console, manage, status, network, even pdsh connection methods that could be supported
  • 1/10/07, think about how to arrange for wol power, reboot/shutdown cli from node if up
    Contructor("devicename_or_ip")
    
    
    # ports can be specified ... this also eliminates the need to list
    #   the ports to communicate on if necessary on the cap.conf file
    #   this is done in cap3.8 too .. will default to a port
    # COMMAND: "on, off, cycle, reset, status"
    # OPTIONS:
    Power ("device", "command", OPT_PORT, OPTIONS)
    Power ("device_array_ref", "command", OPT_PORTS, OPTIONS)
    Power ("devices_array", "command", OPT_PORTS, OPTIONS)
    
    # OPTIONS, interactive (default), log file, monitor
    Console ("device", "command", OPT_PORT, OPTIONS)
    Console ("device_array_ref", "command", OPT_PORTS, OPTIONS)
    Console ("devices_array", "command", OPT_PORTS, OPTIONS)
    
    # OPTIONS: lots o options
    Manage ("device", "command", OPT_PORT, OPTIONS)
    Manage ("device_array_ref", "command", OPT_PORTS, OPTIONS)
    Manage ("devices_array", "command", OPT_PORTS, OPTIONS)
    
    # OPTIONS:
    Network ("device", "command", OPT_PORT, OPTIONS)
    Network ("device_array_ref", "command", OPT_PORTS, OPTIONS)
    Network ("devices_array", "command", OPT_PORTS, OPTIONS)
    
    # OPTIONS:
    Status ("device", "command", OPT_PORT, OPTIONS)
    Status ("device_array_ref", "command", OPT_PORTS, OPTIONS)
    Status ("devices_array", "command", OPT_PORTS, OPTIONS)
    
    
    helpers
    
  • old
    # hash w/
        %powerdevices
        $powerdevicename1 => {@ports1, @devices1}
        $powerdevicename2 => {@ports2, @devices2}
    ...
    
    Power($device, $command, $powerdev, $powerport)
    # when grouped to one device
    Power(@devices, $command, $powerdev, @powerports)
    # when grouped to many power devices, powerdevs is a hash that has each powerdev, w/ ports
    Power(@devices, $command, %powerdevs{powerports})
    
    ===================================================================
    power rpcmd.pl
    GetOptions (
                'powermake=s'     => \$powermake,
                'powermodel=s'    => \$powermodel,
                'powerip=s'       => \$powerip,
                'verbose'         => \$debug,
                'debug'           => \$debug,
                'help'            => \$help
    );
    # input variables passed from command line or calling script
    $device = $ARGV[0];
    $command = $ARGV[1];
    $powerdevice = $ARGV[2];
    $powerport = $ARGV[3];
    
    
    ===================================================================
    # console
    $monitored=1;
    GetOptions (
                'consolemake=s'   => \$consolemake,
                'consolemodel=s'  => \$consolemodel,
                'interactive'     => \$interactive,
            'logfile=s'       => \$logfile,
            'log'         => \$log,
                'monitor'         => \$monitored,
                'verbose'         => \$debug,
                'debug'           => \$debug,
                'help'            => \$help
    );
    
    $number_of_args=1;
    PrintHelp() if scalar @ARGV < $number_of_args || $help;
    $monitored=0 if $interactive;
    
    # input variables passed from command line or calling script
    $device = $ARGV[0];
    $consoledev = $ARGV[1];
    $consoleport = $ARGV[2];
    $date = `date +%m%d%Y%H%M`;
    $logfile = "$ENV{'CAPHOME'}/tmp/console.$device.$date" if $log and !$logfile;
    chomp($logfile);
    
    ===================================================================
    # manage
    GetOptions (
                'mgmtdev=s'      => \$mgmtdev,
                'mgmtport=i'     => \$mgmtport,
                'mgmtmake=s'     => \$mgmtmake,
                'mgmtmodel=s'    => \$mgmtmodel,
                'mgmtip=s'       => \$mgmtip,
                'status'         => \$status,
                'lightson'       => \$lightson,
                'lightsoff'      => \$lightsoff,
                'lightsstatus'   => \$lightsstatus,
                'poweron'        => \$poweron,
                'poweroff'       => \$poweroff,
                'powercycle'     => \$powercycle,
                'powerstatus'    => \$powerstatus,
                'powerreset'     => \$powerreset,
                'powerhalt'      => \$powerhalt,
                'powerreboot'    => \$powerreboot,
                'console'        => \$console,
                'consoleconfig'  => \$consoleconfig,
                'mgmtcardreset'  => \$mgmtcardreset,
            'setaccess'      => \$setaccess,
                'firmwareupdate' => \$firmwareupdate,
                'osfirmwareupdate' => \$osfirmwareupdate,
                'firmwarestatus' => \$firmwarestatus,
                'osfirmwarestatus' => \$osfirmwarestatus,
                'tftpserver=s'   => \$tftpserver,
                'node'           => \$node,
                'verbose'        => \$debug,
                'debug'          => \$debug,
                'help'           => \$help,
               );
    $device = $ARGV[0];
    $firmwarelocation = $ARGV[1] if $firmwareupdate;
    
    ===================================================================
    #network
    $debug=0;
    $node=1;
    GetOptions (
                'netmake=s'     => \$networkmake,
                'netmodel=s'    => \$networkmodel,
                'netip=s'       => \$networkip,
                'status'        => \$status,
                'reset'         => \$networkcardreset,
                'discover'      => \$discover,
                'verbose'       => \$debug,
                'debug'         => \$debug,
                'help'          => \$help,
               );
    
    PrintHelp() if scalar @ARGV != 4;
    
    $device = $ARGV[0];
    $networkdevice = $ARGV[1];
    $networkblade = $ARGV[2];
    $networkport = $ARGV[3];