X-Git-Url: https://gerrit.akraino.org/r/gitweb?p=ta%2Fremote-installer.git;a=blobdiff_plain;f=src%2Fremoteinstaller%2Finstaller%2Fbmc_management%2Fbmctools.py;h=f7d635838deda81a28dfcc0b507fcd7c3f825abf;hp=cbe9565fd6feb9fe0efafd9e5464d502c45f88e5;hb=f67d243ed72be60eb02dacad2584eb189cf6f4b7;hpb=3b665c4c4524f586c291935265a8613c8fe9c982 diff --git a/src/remoteinstaller/installer/bmc_management/bmctools.py b/src/remoteinstaller/installer/bmc_management/bmctools.py index cbe9565..f7d6358 100644 --- a/src/remoteinstaller/installer/bmc_management/bmctools.py +++ b/src/remoteinstaller/installer/bmc_management/bmctools.py @@ -1,5 +1,6 @@ # Copyright 2019 Nokia - +# Copyright 2020 ENEA +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -61,7 +62,7 @@ class BMC(object): self._run_ipmitool_command('bmc reset cold') - success = self._wait_for_bmc_reset(180) + success = self._wait_for_bmc_reset(360) if not success: raise BMCException('BMC reset failed, BMC did not come up') @@ -201,15 +202,13 @@ class BMC(object): @staticmethod def _convert_to_hex(ascii_string, padding=False, length=0): - hex_value = ''.join('0x{} '.format(c.encode('hex')) for c in ascii_string).strip() - if padding and (len(ascii_string) < length): - hex_value += ''.join(' 0x00' for _ in range(len(ascii_string), length)) - - return hex_value + if padding: + ascii_string = ascii_string.ljust(length, '\0') + return ' '.join('0x{}'.format(c.encode('hex')) for c in ascii_string) @staticmethod def _convert_to_ascii(hex_string): - return ''.join('{}'.format(c.decode('hex')) for c in hex_string) + return hex_string.replace('0x','').replace(' ','').decode('hex') def _execute_ipmitool_command(self, ipmi_command): command = 'ipmitool -I lanplus -H {} -U {} -P {} -L {} {}'.format(self._host, self._user, self._passwd, self._priv_level, ipmi_command)