9 amc_ipmb_addresses= [0x72, 0x74, 0x76, 0x78, 0x7a, 0x7c, 0x7e, 0x80, 0x82, 0x84, 0x86, 0x88]
10 amc_ipmb_adr = amc_ipmb_addresses[amc_slot-1]
12 interface = pyipmi.interfaces.create_interface(
'ipmitool', interface_type=
'lan')
13 connection = pyipmi.create_connection(interface)
15 connection.target = pyipmi.Target(amc_ipmb_adr)
16 connection.target.set_routing([(0x81,0x20,0),(0x20,0x82,7),(0x20,amc_ipmb_adr,
None)])
17 connection.session.set_session_type_rmcp(mch_ip_adr, port=623)
18 connection.session.set_auth_type_user(
'',
'')
19 connection.session.establish()
26 raw_read_cmd = b
'\x00\x02\x4B\x01\x01'
27 cmd = raw_read_cmd+struct.pack(
"B", reg)
33 if read_attempts > max_attempts:
34 raise click.ClickException(
"Failed to read value of reg {} after {} attempts".format(hex(reg), max_attempts))
36 result = ipmi_connection.raw_command(0x00, 0x30, cmd)
38 read_cmd_result.append(char)
39 if read_cmd_result[1] == 1
and read_cmd_result[2] == 1:
40 return read_cmd_result[3]
48 raw_write_cmd = b
'\x00\x02\x4B\x02\x01'
49 cmd = raw_write_cmd+struct.pack(
"B", reg)+struct.pack(
"B", data)
55 if write_attempts > max_attempts:
56 raise click.ClickException(
"Failed to write value of reg {} after {} attempts".format(hex(reg), max_attempts))
58 result = ipmi_connection.raw_command(0x00, 0x30, cmd)
60 write_cmd_result.append(char)
61 if write_cmd_result[1] == 2
and write_cmd_result[2] == 1: