]>
Commit | Line | Data |
---|---|---|
190cff13 MG |
1 | #!/usr/bin/perl -w |
2 | ||
3 | use LWP::UserAgent; | |
4 | use XML::Simple; | |
5 | use Data::Dumper; | |
6 | use MIME::Base64; | |
7 | use Digest::MD5 qw(md5); | |
8 | ||
9 | my $ua = LWP::UserAgent->new; | |
10 | my $sid; | |
bd1a6723 | 11 | my $host; |
190cff13 | 12 | |
874e09fb MG |
13 | my @fw_vars = qw(ENABLE_LAN_AUTONEG ENABLE_LAN_100 ENABLE_LAN_FDUPLEX GATEWAY |
14 | IP_ADDRESS NETMASK TFTP_FIRMWARE_FILE TFTP_ADDR_FIRMWARE ENABLE_DHCP | |
15 | ENABLE_DNS DNS_SERVER DNS_DOMAIN_NAME DHCP_CONFIGURE_DNS | |
16 | ACCESS_CONTROL_SERVER_1 ACCESS_CONTROL_SERVER_2 ACCESS_CONTROL_SERVERS | |
17 | ACPI_DISABLE_BIOS_SCAN ACPI_FORCE_RSDP_ADDRESS ACPI_FORCE_RSDT_ADDRESS | |
18 | ACPI_RSDP_BIOS_ROM_ADDRESS ACPI_SCAN_DELAY_SECONDS AMR_AUTH_METHOD | |
19 | AMR_DISABLE_PCI AMR_ENABLE_ISCSI_TIMEOUT AMR_ENABLED AMR_HOST_INTERFACE | |
20 | AMR_SERVER_LIST AMR_USB_FDD_CBI_UFI_TRANSPORT AMR_USB_R2T_TIMEOUT_MSEC | |
21 | AVR_4BIT_ACTION AVR_4BIT_SAMPLE_TIME AVR_ARCHITECTURE AVR_CHIP_TYPE | |
22 | AVR_CLIENT_LANGUAGE AVR_DISABLE_SVR_MOUSE_ON_SESSION_START | |
23 | AVR_KB_VERSION AVR_MAX_SESSION_COUNT AVR_MOUSE_ACCELERATION | |
24 | AVR_MOUSE_MAX_STEP_SIZE AVR_NUMB_MOUSE_PACKETS | |
25 | AVR_PCI_PATTERN_HANDS_OFF_ENABLED AVR_PREF_KB_STICKY_KEY_MODE_ON | |
26 | AVR_PREF_KB_TYPING_MODE_ON AVR_PREF_KB_WARN_UNID_EV | |
27 | AVR_REGISTERS_BASE_ADDR AVR_RESET_PAUSE AVR_SCREEN_REFRESH | |
28 | AVR_SUPPORTED_CHIP AVR_TILE_TIMEOUT AVR_VIDEO_MEM_BASE_ADDR BAUDRATE | |
29 | BAUDRATE_MODEM BAUDRATE_PPP BMC_SUPPORTS_GRACEFULL | |
30 | BMC_TIMESYNC_INTERVAL CARD_NAME CONSOLE_IPMI_MOUSE_BYTE_TIME | |
31 | CONSOLE_KEYBOARD_ACCESS_MODE CONSOLE_MOUSE_ACCESS_MODE | |
32 | CONSOLE_VIDEO_PARAM_MODE CONTACT CONTACT_PHONE CRIT_TEMP_SHUTDOWN | |
33 | CRIT_VOLT_SHUTDOWN DHCP_ADD_EXTENSION DHCP_ADD_SERIAL | |
34 | DHCP_CONFIGURE_DNS DHCP_HOSTNAME_EXT DHCP_SERVER DHCP_USE_CARDNAME | |
35 | DIAG_URL DNS_DOMAIN_NAME DNS_SERVER ENABLE_ANON_IPMI ENABLE_ANON_PCI | |
36 | ENABLE_ANON_WEB ENABLE_AVR_CHIP_DETECT ENABLE_BMC_AUTODETECT | |
37 | ENABLE_BMC_TIMESYNC ENABLE_CRTC_FETCH ENABLE_DHCP ENABLE_DHCP_HOSTNAME | |
38 | ENABLE_DNS ENABLE_DS_CONNECTIVITY ENABLE_IO_UART_DECODER ENABLE_LAN_100 | |
39 | ENABLE_LAN_AUTONEG ENABLE_LAN_FDUPLEX ENABLE_MEM_UART_DECODER | |
40 | ENABLE_PPP ENABLE_REMOTE_FLOPPY_BOOT ENABLE_SELF_DELETE | |
41 | ENABLE_SERIAL_DBG ETHDRIVER_SID EXPROM_BANNER EXPROM_EBDA_COMPATIBILITY | |
42 | EXPROM_ENTRY EXPROM_EXIT_DELAY_SEC EXPROM_F3_DELAY_SEC | |
43 | EXPROM_INT13_COMPATIBILITY EXPROM_SETUP_BANNER FIRMWARE_REVISION | |
44 | FP_ACDC FP_AMR FP_AVR_ASR FP_AVR_GRAPHIC_CONSOLE FP_AVR_TEXT_CONSOLE | |
45 | FP_AVRMANCONF_4BIT_SAMPLE FP_AVRMANCONF_ACCESS_MODES FP_AVRMANCONF_CHIP | |
46 | FP_AVRMANCONF_MOUSE_ACCELERATION FP_AVRMANCONF_MOUSE_TYPE | |
47 | FP_AVRMANCONF_RESET_PAUSE FP_AVRMANCONF_SCREEN_REFRESH FP_BATTERY | |
48 | FP_BOARDRESET_BUTTON FP_COMREDIRECT FP_F3_PPP FP_I2C FP_ICMB FP_INSTR | |
49 | FP_INTERNAL_LAN FP_KEY_CONSOLE FP_LAN_SPEED | |
50 | FP_LAST_BOARD_POWER_WARNING_ENABLED FP_NO_BLADE_PANEL | |
51 | FP_NO_CARDCONF_PANEL FP_NO_DIAG_PANEL FP_NO_DSAUTHCONF_PANEL | |
52 | FP_NO_MANAGE_PANEL FP_NO_MEMORY_PANEL FP_NO_SENSOR_PANEL | |
53 | FP_NO_SERVERCONF_PANEL FP_NO_SSL_PANEL FP_NO_SYSLOG_PANEL | |
54 | FP_NO_USERCONF_PANEL FP_PAGING_EMAIL FP_PAGING_SERIAL FP_PAGING_SNMP | |
55 | FP_PCI_CONFIG FP_PPP FP_PROP_BAUDRATE_REQBOOT FP_PROP_PPP_INIT_REQBOOT | |
56 | FP_PROP_PS_REQBOOT FP_PROP_TERM_DIRECT_CONNECT_REQBOOT FP_REMOTE_BOOT | |
57 | FP_REMOTE_DISK FP_REMOTE_POWER FP_SAC_CONSOLE FP_SEL FP_SENSOR_HISTORY | |
58 | FP_SEQ_SEL FP_SERVER_POWER FP_SERVER_REBOOT FP_SERVER_RESET | |
59 | FP_SERVER_SHUTDOWN FP_SMM FP_SSL FP_STATUS_DIAG_PANEL | |
60 | FP_STATUS_MEMORY_PANEL FP_STATUS_PCI_CONFIG FP_STATUS_SAC_CONSOLE | |
61 | FP_SYSTEM_LAN FP_TEXT_ASR FP_TEXT_CONSOLE FP_TUI FP_VERSION FP_VGA_ASR | |
62 | FP_VGA_CONSOLE FP_VT100_CONSOLE GATEWAY GATEWAY_MAC | |
63 | GRATUITOUS_ARP_INTERVAL HELP_LOCATION HIST0_SAMPLE_TIME HIST0_SENSOR_ID | |
64 | HIST1_SAMPLE_TIME HIST1_SENSOR_ID HIST2_SAMPLE_TIME HIST2_SENSOR_ID | |
65 | HIST3_SAMPLE_TIME HIST3_SENSOR_ID HTTP_PORT_NUM HTTP_SSL_PORT_NUM | |
66 | I2C_ADDR_8BIT_CHASSIS_BMC I2C_ADDR_8BIT_MY_BMC I2C_ADDR_8BIT_THIS_CARD | |
67 | INFOTXT_BPROP_ACCESS INFOTXT_DB_ACCESS IP_ADDRESS IP_ADDRESS_SOURCE | |
68 | IPMB_RETRY_TIMEOUT IPMB_SEQ_NUM_TIMEOUT IPMB_TX_RETRIES | |
69 | IPMI_COUNTRY_SELECT IPV4_HEADER_PARAMETERS ISCSI_DEVICE_VENDOR | |
70 | ISCSI_PRODUCT_EMUL_BD ISCSI_PRODUCT_EMUL_CD ISCSI_PRODUCT_EMUL_FD | |
71 | LAST_CARD_NAME LAST_ENABLE_DHCP LAST_GATEWAY LAST_IP_ADDRESS | |
72 | LAST_NETMASK LOCATION MAC_ADDRESS MODEM_CONNECT MODEM_CONNECT2 | |
73 | MODEM_SEPARATOR NETMASK PAGE_RETRIES PAGE_RETRY_DELAY_SEC POST_ERRCODE | |
74 | POST_PROP PPP_AVAILABLE PPP_INIT PPP_IP_ADDR PPP_NETMASK PPP_PORT | |
75 | PPP_STATUS PPP_STAY_ALIVE_SECS PPP_WELCOME PPP2_BAUDRATE PPP2_INIT | |
76 | PPP2_IP_ADDR PPP2_NETMASK PPP2_PORT PPP2_STAY_ALIVE_SECS PRODUCT | |
77 | PRODUCT_ABBR PS_ASR PS_DISK PS_FAN PS_HARDWARE PS_MEMORY PS_NETWORK | |
78 | PS_OTHER PS_POST PS_RMC PS_SECURITY PS_SYS_POWER PS_SYS_STATUS | |
79 | PS_TEMPERATURE PS2_ADAPTER_POWER_UP_MODE PS2_FW_UPDATE_CMD | |
80 | PS2_FW_UPDATE_IMG_NAME PS2_FW_UPDATE_STATUS RMC_DS_GROUP SAC_PORT | |
81 | SERVER_CODEPAGE SERVER_HARD_RESET_PULSE_MS SERVER_HARD_RESET_VIA_IPMI | |
82 | SERVER_ID SERVER_IP SERVER_KEYBOARD SERVER_KEYBOARD_LANGUAGES_LIST | |
83 | SERVER_MEMORY SERVER_NAME SERVER_POWER_CHANGE_VIA_IPMI | |
84 | SERVER_POWER_OFF_MODE SERVER_POWER_OFF_PULSE_MS SERVER_POWER_ON_MODE | |
85 | SERVER_POWER_ON_PULSE_MS SERVER_TIMEZONE SERVER_URL | |
86 | SESSION_MANAGER_SESSION_TIMEOUT SI_DEF_POLL_INTERVAL_MS | |
87 | SI_DEF_POLL_OFFSET_MS SMTP_RESP_TIME_SEC SMTP_RETRIES | |
88 | SMTP_RETRY_DELAY_SEC SMTP_REVERSE_PATH SMTP_SERVER SNMP_AGENT_ENABLED | |
89 | SNMP_COMMUNITY SNMP_ENTERPRISE_ID SNMP_SERVER SNMP_SERVER_1 | |
90 | SNMP_SERVER_2 SNMP_SERVER_3 SNMP_SERVER_4 SNMP_SERVER_5 SNMP_SERVER_6 | |
91 | SNMP_SERVER_7 SNMP_SERVER_MAC SNMP_SYSOID SNMP_TRAP_MASK | |
92 | SNMP_TRAP_VERSION SSL_40_OR_128_ENCRYPTION SSL_CAPABLE_FIRMWARE | |
93 | SSL_ENABLE_ALOG SSL_ENABLE_ALOG_FALLBACK SSL_ENABLE_CLIENT_CERT | |
94 | SSL_ENABLE_HTTP SSL_ENABLE_HTTPS SSL_ENABLE_NOTIFY | |
95 | SSL_NOTIFICATION_TIME TELNET_ENABLE TELNET_PORT_NUM | |
96 | TERMINAL_DIRECT_CONNECT TERMINAL_ENCODING TEXT_CONSOLE_TIMEOUT | |
97 | TFTP_ADDR_FIRMWARE TFTP_ADDR_REBOOT TFTP_FIRMWARE_FILE TFTP_REBOOT_FILE | |
98 | TXT_REMOTE_CONSOLE_COLOR_MAP TXT_REMOTE_CONSOLE_FREQ | |
99 | USB_DEVICE_SETTINGS USE_SERVER_IP_ADDRESS USER_TIMEOUT VENDOR | |
100 | RMC_AUTODETECT RMC_FUNCTIONS RMC_MODULES AGENT_VERSION BIOS_VER | |
101 | BOARD_MFT BOARD_MODEL BOARD_PART_NUM BOARD_SERIAL BOARD_VER CAB_MFT | |
102 | CAB_MODEL CAB_PROD_NUM CAB_PROD_VER CAB_SERIAL CHA_MODEL | |
103 | CSV_ConfAlarmMailFrom CSV_ConfAlarmMailMessage CSV_ConfAlarmMailSubject | |
104 | CSV_ConfAlarmMailType CSV_ConfAlarmMailUserInfo0 | |
105 | CSV_ConfAlarmMailUserInfo1 PER_USER_PAGING RMC_SEL_FILTER | |
106 | SERVER_AD_NAME SERVER_AD_NAME2 SERVER_AD_NAME3 SERVER_AD_NAME4 | |
107 | SERVER_CONTACT SERVER_DESCRIPTION SERVER_IP_ADDRESS SERVER_IP_ADDRESS2 | |
108 | SERVER_IP_ADDRESS3 SERVER_IP_ADDRESS4 SERVER_IP_DHCP SERVER_IP_DHCP2 | |
109 | SERVER_IP_DHCP3 SERVER_IP_DHCP4 SERVER_IP_GATEWAY SERVER_IP_GATEWAY2 | |
110 | SERVER_IP_GATEWAY3 SERVER_IP_GATEWAY4 SERVER_IP_NETMASK | |
111 | SERVER_IP_NETMASK2 SERVER_IP_NETMASK3 SERVER_IP_NETMASK4 | |
112 | SERVER_LOCATION SERVER_MAC_ADDRESS SERVER_MAC_ADDRESS2 | |
113 | SERVER_MAC_ADDRESS3 SERVER_MAC_ADDRESS4 SERVER_MAX_LAN_ADAPTER | |
114 | SERVER_OS SERVER_OS_VENDOR); | |
115 | ||
190cff13 MG |
116 | sub _crc16 { |
117 | my $str = shift; | |
118 | my $crc = 0; | |
119 | for my $k (0..length($str)-1) { | |
120 | $crc ^= ord(substr($str, $k, 1)) << 8; | |
121 | for (0..7) { | |
122 | $crc = (($crc & 0x8000) == 32768 ? ($crc<<1) ^ 0x1021 : $crc<<1); | |
123 | } | |
124 | } | |
125 | $crc = $crc & 0xFFFF; | |
126 | return $crc; | |
127 | } | |
128 | ||
129 | sub _hash { | |
130 | my ($password, $challenge) = @_; | |
131 | my @challenge_bytes = unpack 'c16', decode_base64($challenge); | |
132 | my @pwd_hash = unpack 'c16', md5($password); | |
133 | my @xor_bytes; | |
134 | for my $i (0..15) { | |
135 | $xor_bytes[$i] = $challenge_bytes[$i] ^ $pwd_hash[$i]; | |
136 | }; | |
137 | my $hash = md5(pack 'c16', @xor_bytes); | |
138 | my $crc = _crc16($hash); | |
139 | $hash .= chr($crc & 0xff) . chr($crc >> 8 & 0xff); | |
140 | return encode_base64($hash, ""); | |
141 | } | |
142 | ||
143 | sub _req { | |
144 | my $xml = shift; | |
145 | $request = HTTP::Request->new(POST => "http://${host}/cgi/bin"); | |
146 | $request->header(Cookie => "sid=$sid"); | |
147 | $request->content_type('application/x-www-form-urlencoded'); | |
148 | $request->content($xml); | |
149 | $response = $ua->request($request); | |
150 | die("Error in request: " . $response->status_line . "\n") unless ($response->is_success); | |
151 | XMLin($response->content); | |
152 | } | |
153 | ||
154 | sub _getprop { | |
155 | my $property = shift; | |
156 | ||
157 | my $reqstr='<?xml version="1.0"?><?RMCXML version="1.0"?><RMCSEQ><REQ CMD="propget"><PROPLIST><PROP NAME="'.$property.'"/></PROPLIST></REQ></RMCSEQ>'; | |
158 | my $resp = _req($reqstr); | |
159 | ||
160 | if ($resp->{RESP}->{RC} ne '0x0') { | |
874e09fb | 161 | $resp->{RESP}->{RC}; |
190cff13 | 162 | } else { |
874e09fb | 163 | $resp; |
190cff13 MG |
164 | } |
165 | } | |
166 | ||
167 | sub logout { | |
168 | print "Logout\n"; | |
169 | my $request = HTTP::Request->new(GET => "http://${host}/cgi/logout"); | |
170 | $request->header(Cookie => "sid=$sid"); | |
171 | my $response = $ua->request($request); | |
172 | die("While trying to logout: " . $response->status_line . "\n") unless ($response->is_success); | |
173 | ||
174 | my $xmlin = XMLin($response->decoded_content); | |
175 | die "Error logging out: ".$xmlin->{RC} if ($xmlin->{RC} ne '0x0'); | |
176 | } | |
177 | ||
178 | sub setprop { | |
179 | my $property = shift; | |
180 | my $value = shift; | |
181 | ||
874e09fb | 182 | my $oldval = _getprop($property)->{RESP}->{PROPLIST}->{PROP}->{VAL}; |
190cff13 MG |
183 | |
184 | if ($value eq $oldval) { | |
185 | print "${property} is already ${value}\n"; | |
186 | return; | |
187 | } | |
188 | ||
189 | my $reqstr='<?xml version="1.0"?><?RMCXML version="1.0"?><RMCSEQ><REQ CMD="propset"><PROP NAME="'.$property.'"><VAL>'.$value.'</VAL></PROP></REQ></RMCSEQ>'; | |
190 | my $res = _req($reqstr); | |
191 | ||
192 | if ($res->{RESP}->{RC} ne '0x0') { | |
193 | print "Error setting ${property} to ${value}: ".$res->{RESP}->{RC}."\n"; | |
194 | } else { | |
195 | print "${property}: ${oldval} -> ${value}\n"; | |
196 | } | |
197 | } | |
198 | ||
199 | sub serveraction { | |
200 | my $action = shift; | |
201 | ||
202 | print "${action}...\n"; | |
203 | my $reqstr='<?xml version="1.0"?><?RMCXML version="1.0"?><RMCSEQ><REQ CMD="serveraction"><ACT>'.$action.'</ACT></REQ></RMCSEQ>'; | |
204 | my $res = _req($reqstr); | |
205 | ||
206 | if ($res->{RESP}->{RC} ne '0x0') { | |
207 | print "FAILED:".$res->{RESP}->{RC}."\n"; | |
208 | } | |
209 | } | |
210 | ||
211 | sub showprop { | |
212 | my $property = shift; | |
213 | ||
874e09fb MG |
214 | my $phash = _getprop($property)->{RESP}->{PROPLIST}->{PROP}; |
215 | ||
216 | print "${property}: " . ${phash}->{VAL} . " (" . ${phash}->{PERMS} . ")\n"; | |
217 | } | |
218 | ||
219 | sub board_properties { | |
220 | my $reqstr='<?xml version="1.0"?><?RMCXML version="1.0"?><RMCSEQ><REQ CMD="boardpropget"><PROPLIST><PROP NAME=""/></PROPLIST></REQ></RMCSEQ>'; | |
221 | my $resp = _req($reqstr); | |
222 | ||
223 | print " * Board Properties:\n"; | |
224 | foreach my $bprop (@{$resp->{RESP}->{BPROPLIST}->{BPROP}}) { | |
225 | print " * " . ${bprop}->{NAME} . ": " . ${bprop}->{VAL} . "\n"; | |
226 | } | |
227 | } | |
228 | ||
bd1a6723 MG |
229 | sub show_boarddesc { |
230 | my $reqstr='<?xml version="1.0"?><?RMCXML version="1.0"?><RMCSEQ><REQ CMD="boardpropget"><BPROPLIST><BPROP NAME="BOARD_DESCRIPTION"/></BPROPLIST></REQ></RMCSEQ>'; | |
231 | my $boarddesc64 = _req($reqstr)->{RESP}->{BPROPLIST}->{BPROP}->{VAL}; | |
232 | my $boarddesc = decode_base64($boarddesc64); | |
233 | my @board = split(//, $boarddesc); | |
234 | foreach my $byte (@board) { | |
235 | printf ("0x%02x ", ord($byte)); | |
236 | } | |
237 | print "\n"; | |
238 | } | |
239 | ||
874e09fb MG |
240 | sub show_all_vars { |
241 | foreach my $fwvar (@fw_vars) { | |
242 | showprop($fwvar); | |
243 | } | |
190cff13 MG |
244 | } |
245 | ||
99b39951 MG |
246 | sub syslog_debug { |
247 | my $destination_ip = shift; | |
248 | my $bcast = shift; | |
249 | ||
250 | $reqstr='<?xml version="1.0"?><?RMCXML version="1.0"?><RMCSEQ><REQ CMD="dbgmsglancfg"><IP>'.${destination_ip}.'</IP><BCAST>'.${bcast}.'</BCAST><STORE>FALSE</STORE></REQ></RMCSEQ>'; | |
251 | $res = _req($reqstr); | |
252 | if ($res->{RESP}->{RC} ne '0x0') { | |
253 | print "FAILED:".$res->{RESP}->{RC}."\n"; | |
254 | return; | |
255 | } | |
256 | ||
39dccf16 | 257 | $reqstr='<?XML version="1.0"?><?RMCXML version="1.0"?><RMCSEQ><REQ CMD="dbgmsgcfg"><ON>TRUE</ON><CHANNELMASK>0x1</CHANNELMASK><MMASK>0x1</MMASK><STORE>FALSE</STORE></REQ></RMCSEQ>'; |
99b39951 MG |
258 | $res = _req($reqstr); |
259 | if ($res->{RESP}->{RC} ne '0x0') { | |
260 | print "FAILED:".$res->{RESP}->{RC}."\n"; | |
261 | return; | |
262 | } | |
263 | ||
264 | print "Debug messages will be sent to ${destination_ip} (broadcast: ${bcast})\n"; | |
265 | } | |
266 | ||
bd1a6723 MG |
267 | sub login { |
268 | my $user = shift; | |
269 | my $pass = shift; | |
270 | ||
271 | my $response = $ua->get("http://${host}/cgi/challenge"); | |
272 | die $response->status_line if (!($response->is_success)); | |
273 | ||
274 | my $xmlin = XMLin($response->decoded_content); | |
275 | die "Error getting Challenge: ".$xmlin->{RC} if ($xmlin->{RC} ne '0x0'); | |
276 | my $challenge = $xmlin->{CHALLENGE}; | |
277 | print "Challenge: ${challenge}\n"; | |
278 | ||
279 | $sid = $response->headers->header('Set-Cookie'); | |
280 | die "No SessionID!" if (!defined($sid)); | |
281 | chomp($sid); | |
282 | $sid =~ s/.*sid=(.*);.*/$1/; | |
283 | print "SID: ${sid}\n"; | |
284 | ||
285 | my $login_hash = _hash($pass, $challenge); | |
286 | print "Hash: ${login_hash}\n"; | |
287 | ||
288 | my $request = HTTP::Request->new(GET => "http://${host}/cgi/login?user=${user}&hash=${login_hash}"); | |
289 | $request->header(Cookie => "sid=$sid"); | |
290 | $response = $ua->request($request); | |
291 | die("While trying to login: " . $response->status_line . "\n") unless ($response->is_success); | |
292 | ||
293 | $xmlin = XMLin($response->decoded_content); | |
294 | die "Error logging in: ".$xmlin->{RC} if ($xmlin->{RC} ne '0x0'); | |
295 | ||
296 | $sid; | |
190cff13 | 297 | } |
bd1a6723 MG |
298 | |
299 | open(INIFILE,"<$ENV{HOME}/.rsbs2rc") || die("can't open config: $ENV{HOME}/.rsbs2rc: $!"); | |
300 | my %Config = (); | |
301 | my @sections = (); | |
302 | while(<INIFILE>) { | |
303 | chomp; | |
304 | ||
305 | next if (m/^#/); | |
306 | ||
307 | if (m/^\s*\[(.*)\]\s*$/) { | |
308 | push @sections, $1; | |
309 | next; | |
310 | } | |
311 | ||
312 | if (@sections) { | |
313 | if (m/^\s*(.+)\s*=\s*(.*)\s*$/) { | |
314 | ${$Config{$sections[$#sections]}}{$1} = $2; | |
315 | } | |
316 | } | |
317 | } | |
318 | close(INIFILE); | |
319 | ||
320 | $host = ${$Config{$sections[0]}}{"host"}; | |
321 | ||
322 | $sid = login(${$Config{$sections[0]}}{"user"}, ${$Config{$sections[0]}}{"pass"}); | |
323 | ||
324 | show_boarddesc(); | |
190cff13 | 325 | |
874e09fb MG |
326 | #showprop("FP_REMOTE_POWER"); |
327 | #showprop("FP_REMOTE_BOOT"); | |
328 | #showprop("SERVER_HARD_RESET_VIA_IPMI"); | |
329 | #showprop("SERVER_HARD_RESET_PULSE_MS"); | |
330 | #showprop("SERVER_POWER_CHANGE_VIA_IPMI"); | |
331 | #showprop("SERVER_POWER_ON_MODE"); | |
332 | #showprop("SERVER_POWER_ON_PULSE_MS"); | |
333 | #showprop("SERVER_POWER_OFF_MODE"); | |
334 | #showprop("SERVER_POWER_OFF_PULSE_MS"); | |
874e09fb MG |
335 | |
336 | board_properties(); | |
337 | ||
efa5896a | 338 | #show_all_vars(); |
190cff13 | 339 | |
99b39951 MG |
340 | syslog_debug("255.255.255.255", "TRUE"); |
341 | ||
190cff13 MG |
342 | #server_power_on modes: (com/agilent/rmc/mgui/panels/PowerMgmtConf.class) |
343 | #0: l_pmconf_option_disabled | |
344 | #1: l_pmconf_option_atx | |
345 | #2: l_pmconf_option_relay | |
346 | #default: disabled | |
347 | ||
348 | my $pmode = 2; | |
349 | ||
350 | setprop("SERVER_HARD_RESET_VIA_IPMI", "FALSE"); | |
351 | setprop("SERVER_POWER_CHANGE_VIA_IPMI", "FALSE"); | |
352 | #Power Mgmt. Pane | |
353 | setprop("FP_REMOTE_POWER", "TRUE"); | |
354 | #PM Mode | |
355 | setprop("SERVER_POWER_ON_MODE", sprintf("0x%x", $pmode)); | |
356 | setprop("SERVER_POWER_OFF_MODE", sprintf("0x%x", $pmode)); | |
efa5896a | 357 | #Hack: Abuse powercycloe for powerup and down... |
99b39951 | 358 | #setprop("SERVER_POWER_ON_PULSE_MS", "0x0"); |
190cff13 MG |
359 | |
360 | #$reqstr='<?xml version="1.0"?><?RMCXML version="1.0"?><RMCSEQ><REQ CMD="boardpropset"><BPROP NAME="BOARD_DESCRIPTION"><VAL>'.$boarddesc_new.'</VAL></BPROP></REQ></RMCSEQ>'; | |
361 | #print $reqstr."\n"; | |
362 | #print Dumper(_req($reqstr)); | |
190cff13 | 363 | |
efa5896a | 364 | serveraction("hardreset"); |
99b39951 MG |
365 | serveraction("powerup"); |
366 | serveraction("powerdown"); | |
efa5896a | 367 | serveraction("powercycle"); |
190cff13 MG |
368 | |
369 | logout(); |