import pyssh
# Timeouts in seconds
-TELNET_TIMEOUT = 30
+TELNET_TIMEOUT = 45
# Event class ID from pcu events
#NODE_POWER_CONTROL = 3
self.close()
return 0
+class APCBrazil(PCUControl):
+ def run(self, node_port, dryrun):
+ self.open(self.host, self.username)
+ self.sendPassword(self.password)
+
+ self.ifThenSend("\r\n> ", "1", ExceptionPassword)
+ self.ifThenSend("\r\n> ", str(node_port))
+ # 4- Immediate Reboot
+ self.ifThenSend("\r\n> ", "4")
+
+ if not dryrun:
+ self.ifThenSend("Enter 'YES' to continue or <ENTER> to cancel",
+ "YES\r\n",
+ ExceptionSequence)
+ else:
+ self.ifThenSend("Enter 'YES' to continue or <ENTER> to cancel",
+ "", ExceptionSequence)
+ self.ifThenSend("Press <ENTER> to continue...", "", ExceptionSequence)
+
+ self.close()
+ return 0
+
+class APCBerlin(PCUControl):
+ def run(self, node_port, dryrun):
+ self.open(self.host, self.username)
+ self.sendPassword(self.password)
+
+ self.ifThenSend("\r\n> ", "1", ExceptionPassword)
+ self.ifThenSend("\r\n> ", "2")
+ self.ifThenSend("\r\n> ", "1")
+ self.ifThenSend("\r\n> ", str(node_port))
+ # 3- Immediate Reboot
+ self.ifThenSend("\r\n> ", "3")
+
+ if not dryrun:
+ self.ifThenSend("Enter 'YES' to continue or <ENTER> to cancel",
+ "YES\r\n",
+ ExceptionSequence)
+ else:
+ self.ifThenSend("Enter 'YES' to continue or <ENTER> to cancel",
+ "", ExceptionSequence)
+ self.ifThenSend("Press <ENTER> to continue...", "", ExceptionSequence)
+
+ self.close()
+ return 0
+
class APCFolsom(PCUControl):
def run(self, node_port, dryrun):
self.open(self.host, self.username)
apc = APCEurope(values, verbose, ['22', '23'])
rb_ret = apc.reboot(values[nodename], dryrun)
+ elif values['pcu_id'] in [1110,86]:
+ apc = APCBrazil(values, verbose, ['22', '23'])
+ rb_ret = apc.reboot(values[nodename], dryrun)
+
+ elif values['pcu_id'] in [1221]:
+ apc = APCBerlin(values, verbose, ['22', '23'])
+ rb_ret = apc.reboot(values[nodename], dryrun)
+
elif values['pcu_id'] in [1173,1221,1220,1225]:
apc = APCFolsom(values, verbose, ['22', '23'])
rb_ret = apc.reboot(values[nodename], dryrun)
# iLO
elif continue_probe and values['model'].find("HP iLO") >= 0:
- hpilo = HPiLO(values, verbose, ['22'])
- rb_ret = hpilo.reboot(0, dryrun)
- if rb_ret != 0:
+ try:
+ hpilo = HPiLO(values, verbose, ['22'])
+ rb_ret = hpilo.reboot(0, dryrun)
+ if rb_ret != 0:
+ hpilo = HPiLOHttps(values, verbose, ['443'])
+ rb_ret = hpilo.reboot(0, dryrun)
+ except:
hpilo = HPiLOHttps(values, verbose, ['443'])
rb_ret = hpilo.reboot(0, dryrun)