my $ua = LWP::UserAgent->new;
my $sid;
my $host;
+my $poweronms=200;
+my $poweroffms=4500;
my @fw_vars = qw(ENABLE_LAN_AUTONEG ENABLE_LAN_100 ENABLE_LAN_FDUPLEX GATEWAY
IP_ADDRESS NETMASK TFTP_FIRMWARE_FILE TFTP_ADDR_FIRMWARE ENABLE_DHCP
my $oldval = _getprop($property)->{RESP}->{PROPLIST}->{PROP}->{VAL};
if ($value eq $oldval) {
- print "${property} is already ${value}\n";
+ #print "${property} is already ${value}\n";
return;
}
sub serveraction {
my $action = shift;
+ my $pmode = 2;
+
+ setprop("SERVER_HARD_RESET_VIA_IPMI", "FALSE");
+ setprop("SERVER_POWER_CHANGE_VIA_IPMI", "FALSE");
+ #PM Mode
+ setprop("SERVER_POWER_ON_MODE", sprintf("0x%x", $pmode));
+ setprop("SERVER_POWER_OFF_MODE", sprintf("0x%x", $pmode));
+
print "${action}...\n";
my $reqstr='<?xml version="1.0"?><?RMCXML version="1.0"?><RMCSEQ><REQ CMD="serveraction"><ACT>'.$action.'</ACT></REQ></RMCSEQ>';
my $res = _req($reqstr);
}
}
+sub powerup {
+ setprop("SERVER_POWER_ON_PULSE_MS", sprintf("0x%x", $poweronms));
+ setprop("SERVER_POWER_OFF_PULSE_MS", "0x0");
+ serveraction("powercycle");
+}
+
+sub powerdown {
+ setprop("SERVER_POWER_ON_PULSE_MS", "0x0");
+ setprop("SERVER_POWER_OFF_PULSE_MS", sprintf("0x%x", $poweroffms));
+ serveraction("powercycle");
+}
+
+sub powercycle {
+ setprop("SERVER_POWER_ON_PULSE_MS", sprintf("0x%x", $poweronms));
+ setprop("SERVER_POWER_OFF_PULSE_MS", sprintf("0x%x", $poweroffms));
+ serveraction("powercycle");
+}
+
sub showprop {
my $property = shift;
close(INIFILE);
$host = ${$Config{$sections[0]}}{"host"};
+$poweronms = ${$Config{$sections[0]}}{"poweronms"} if (defined(${$Config{$sections[0]}}{"poweronms"}));
+$poweroffms = ${$Config{$sections[0]}}{"poweroffms"} if (defined(${$Config{$sections[0]}}{"poweroffms"}));
$sid = login(${$Config{$sections[0]}}{"user"}, ${$Config{$sections[0]}}{"pass"});
syslog_debug("255.255.255.255", "TRUE");
+#Power Mgmt. Pane
+setprop("FP_REMOTE_POWER", "TRUE");
+
#server_power_on modes: (com/agilent/rmc/mgui/panels/PowerMgmtConf.class)
#0: l_pmconf_option_disabled
#1: l_pmconf_option_atx
#2: l_pmconf_option_relay
#default: disabled
-my $pmode = 2;
-
-setprop("SERVER_HARD_RESET_VIA_IPMI", "FALSE");
-setprop("SERVER_POWER_CHANGE_VIA_IPMI", "FALSE");
-#Power Mgmt. Pane
-setprop("FP_REMOTE_POWER", "TRUE");
-#PM Mode
-setprop("SERVER_POWER_ON_MODE", sprintf("0x%x", $pmode));
-setprop("SERVER_POWER_OFF_MODE", sprintf("0x%x", $pmode));
-#Hack: Abuse powercycloe for powerup and down...
-#setprop("SERVER_POWER_ON_PULSE_MS", "0x0");
#$reqstr='<?xml version="1.0"?><?RMCXML version="1.0"?><RMCSEQ><REQ CMD="boardpropset"><BPROP NAME="BOARD_DESCRIPTION"><VAL>'.$boarddesc_new.'</VAL></BPROP></REQ></RMCSEQ>';
#print $reqstr."\n";
#print Dumper(_req($reqstr));
serveraction("hardreset");
-serveraction("powerup");
-serveraction("powerdown");
-serveraction("powercycle");
+powerup();
+powerdown();
+powercycle();
logout();