kontron / python-ipmi

A pure python IPMI library
GNU Lesser General Public License v2.1
187 stars 75 forks source link

Document native rmcp transport #67

Open rustyscottweber opened 5 years ago

rustyscottweber commented 5 years ago

In refference to issue #24. I've FINALLY had a bit of time to mess with this a little bit. Apologies for being so busy on other things. I'm trying to figure out what the correct way to make an rmpc native connection is. I've tried the following, but I can't seem to make the rmcp interface work.

interface = create_interface("rmcp")
interface.port = 623
interface.host = self.hostname
ipmi = pyipmi.create_connection(self.interface)
ipmi.session.set_auth_type_user(self.username, self.password)
ipmi.session.set_session_type_rmcp(self.hostname, port=623)
ipmi.target = pyipmi.Target(0x82)
# ipmi.target.set_routing([(0x81,0x20,0),(0x20,0x82,7)])
ipmi.get_chassis_status()

If we can get a quick start for rmcp going, I'll take some time to update the readme markdown on the front page.

hthiery commented 5 years ago

The example in the readme is an advanced scenario with a double bridge command. I think we should do here a more easier example like the one documented here: https://python-ipmi.readthedocs.io/en/latest/quick_start.html#native-rmcp-interface or https://github.com/kontron/python-ipmi/blob/master/examples/interface_rmcp.py

rustyscottweber commented 5 years ago

Attempting the first quick start instructions. I get the following stack trace:

File "C:\Program Files\Python37\lib\site-packages\pyipmi\interfaces\rmcp.py", line 450, in establish_session
    rsp = self._get_session_challenge(session)
  File "C:\Program Files\Python37\lib\site-packages\pyipmi\interfaces\rmcp.py", line 403, in _get_session_challenge
    check_completion_code(rsp.completion_code)
  File "C:\Program Files\Python37\lib\site-packages\pyipmi\utils.py", line 47, in check_completion_code
    raise CompletionCodeError(cc)
pyipmi.errors.CompletionCodeError: CompletionCodeError cc=0xc1 desc=Invalid Command

Obviously, this works for the older klunkier ipmitool.

ipmitool -H $hostname -I lanplus -U $user -P $password sdr
UID              | 0x01              | ok
Sys Health LED   | 0x00              | ok
01-Inlet Ambient | 17 degrees C      | ok
02-CPU 1         | 40 degrees C      | ok
03-CPU 2         | 40 degrees C      | ok
04-P1 DIMM 1-6   | 27 degrees C      | ok
05-P1 DIMM 7-12  | 26 degrees C      | ok
06-P2 DIMM 1-6   | 24 degrees C      | ok
07-P2 DIMM 7-12  | 24 degrees C      | ok
08-HD Max        | 35 degrees C      | ok
09-Exp Bay Drive | disabled          | ns
10-Chipset       | 37 degrees C      | ok
11-PS 1 Inlet    | 23 degrees C      | ok
12-PS 2 Inlet    | 24 degrees C      | ok
13-VR P1         | 32 degrees C      | ok
14-VR P2         | 29 degrees C      | ok
15-VR P1 Mem     | 28 degrees C      | ok
16-VR P1 Mem     | 29 degrees C      | ok
17-VR P2 Mem     | 28 degrees C      | ok
18-VR P2 Mem     | 26 degrees C      | ok
19-PS 1 Internal | 40 degrees C      | ok
20-PS 2 Internal | 40 degrees C      | ok
21-PCI 1         | 40 degrees C      | ok
22-PCI 2         | disabled          | ns
23-PCI 3         | disabled          | ns
24-PCI 4         | 40 degrees C      | ok
25-PCI 5         | disabled          | ns
26-PCI 6         | disabled          | ns
27-HD Controller | 40 degrees C      | ok
28-LOM Card      | 43 degrees C      | ok
29-LOM           | disabled          | ns
30-Front Ambient | 26 degrees C      | ok
31-PCI 1 Zone.   | 30 degrees C      | ok
32-PCI 2 Zone.   | 32 degrees C      | ok
33-PCI 3 Zone.   | 33 degrees C      | ok
34-PCI 4 Zone    | 29 degrees C      | ok
35-PCI 5 Zone    | 31 degrees C      | ok
36-PCI 6 Zone    | 30 degrees C      | ok
37-HD Cntlr Zone | 30 degrees C      | ok
38-I/O Zone      | 30 degrees C      | ok
39-P/S 2 Zone    | 27 degrees C      | ok
40-Battery Zone  | 29 degrees C      | ok
41-iLO Zone      | 35 degrees C      | ok
42-Rear HD Max   | disabled          | ns
43-Storage Batt  | 23 degrees C      | ok
44-Fuse          | 27 degrees C      | ok
Fan 1            | 18.42 percent     | ok
Fan 1 DutyCycle  | 18.42 percent     | ok
Fan 1 Presence   | 0x2f              | ok
Fan 2            | 37.24 percent     | ok
Fan 2 DutyCycle  | 37.24 percent     | ok
Fan 2 Presence   | 0x5f              | ok
Fan 3            | 37.24 percent     | ok
Fan 3 DutyCycle  | 37.24 percent     | ok
Fan 3 Presence   | 0x5f              | ok
Fan 4            | 37.24 percent     | ok
Fan 4 DutyCycle  | 37.24 percent     | ok
Fan 4 Presence   | 0x5f              | ok
Fan 5            | 37.24 percent     | ok
Fan 5 DutyCycle  | 37.24 percent     | ok
Fan 5 Presence   | 0x5f              | ok
Fan 6            | 29.79 percent     | ok
Fan 6 DutyCycle  | 29.79 percent     | ok
Fan 6 Presence   | 0x4c              | ok
Power Supply 1   | 85 Watts          | ok
PS 1 Output      | 85 Watts          | ok
PS 1 Presence    | 0x11              | ok
Power Supply 2   | 80 Watts          | ok
PS 2 Output      | 80 Watts          | ok
PS 2 Presence    | 0x10              | ok
Power Meter      | 165 Watts         | ok
PwrMeter Output  | 165 Watts         | ok
Power Supplies   | 0x00              | ok
Fans             | 0x00              | ok
Megacell Status  | 0x00              | ok
Memory Status    | 0x00              | ok
C1 P1I Bay 2     | 0x01              | ok
C1 P1I Bay 1     | 0x01              | ok
rustyscottweber commented 5 years ago

Maybe this is my ignorance, but what does:

slave_address=0x81, host_target_address=0x20

do? Is there a way to determine these values automatically?

hthiery commented 5 years ago

ipmitool -H $hostname -I lanplus -U $user -P $password sdr

Unfortunatly you use the RMCP+ (ipmitool lanplus) interface and the library only have support for the RMCP (ipmitool lan) interface.

Could you try it with the ipmitool lan interface?

hthiery commented 5 years ago

Maybe this is my ignorance, but what does:

slave_address=0x81, host_target_address=0x20

do? Is there a way to determine these values automatically?

currently I have no idea if this is possible to determine these values.

rustyscottweber commented 5 years ago

Ah. I see the error of my ways... The lan interface will obviously not work for me since all of my BMC's are all newer and thus use the rmcp+ protocol and can't even down negotiate to just rmcp. I guess the only real difference between rmcp and rmcp+ is encryption and authentication, but that's a rather large work load. Given that the rmcp is relatively new, I don't suppose that there is a road map for rmcp+ is there?

hthiery commented 5 years ago

You're right. Currently we have no plan to implement the rcmp+.

rustyscottweber commented 5 years ago

Should we make a plan?

hthiery commented 5 years ago

As we currently do not do any development at this project I cannot suggest a plan for that feature from our site. Please feel free to start implenting the native RMCP+ interface. I can support you but with low prio.