diff --git a/ipmi_constants.py b/ipmi_constants.py index 801e5658..734ed7d3 100644 --- a/ipmi_constants.py +++ b/ipmi_constants.py @@ -33,11 +33,11 @@ rmcp_codes = { } command_completion_codes = { - 0x39: { + (7,0x39): { 0x81: "Invalid user name", 0x82: "Null user disabled", }, - 0x3a: { + (7,0x3a): { 0x81: "No available login slots", 0x82: "No available login slots for requested user", 0x83: "No slot available with requested privilege level", @@ -45,11 +45,17 @@ command_completion_codes = { 0x85: "Invalid session ID", 0x86: "Requested privilege level exceeds requested user permissions on this channel", }, - 0x3b: { + (7,0x3b): { #Set session privilege level 0x80: "User is not allowed requested priveleg level", 0x81: "Requested privilege level is not allowed over this channel", 0x82: "Cannot disable user level authentication", }, + (1,8): { #set system boot options + 0x80: "Parameter not supported", + 0x81: "Attempt to set set 'set in progress' when not 'set complete'", + 0x82: "Attempt to write read-only parameter", + } + } ipmi_completion_codes = { diff --git a/ipmi_session.py b/ipmi_session.py index a4e50a04..356e6843 100644 --- a/ipmi_session.py +++ b/ipmi_session.py @@ -43,11 +43,12 @@ def get_ipmi_error(response,suffix=""): if 'error' in response: return response['error']+suffix code = response['code'] - command = response['commmand'] + command = response['command'] + netfn = response['netfn'] if code == 0: return False - if command in command_completion_codes and code in command_completion_codes[command]: - return command_completion_codes[command][code]+suffix + if (netfn,command) in command_completion_codes and code in command_completion_codes[(netfn,command)]: + return command_completion_codes[(netfn,command)][code]+suffix elif code in ipmi_completion_codes: return ipmi_completion_codes[code]+suffix else: @@ -625,7 +626,7 @@ class ipmi_session: response['netfn'] = payload[1]>>2 del payload[0:5] # remove header of rsaddr/netfn/lun/checksum/rq/seq/lun del payload[-1] # remove the trailing checksum - response['commmand']=payload[0] + response['command']=payload[0] response['code']=payload[1] del payload[0:2] response['data']=payload @@ -674,3 +675,4 @@ if __name__ == "__main__": import sys ipmis = ipmi_session(bmc=sys.argv[1],userid=sys.argv[2],password=os.environ['IPMIPASS']) print ipmis.raw_command(command=2,data=[1],netfn=0) + print get_ipmi_error({'command':8,'code':128,'netfn':1})