kontron / python-ipmi

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

Not able to established session #62

Open paragshagun opened 5 years ago

paragshagun commented 5 years ago

import pyipmi import pyipmi.interfaces

interface = pyipmi.interfaces.create_interface(interface='ipmitool', interface_type='lanplus') ipmi = pyipmi.create_connection(interface) ipmi.session.set_session_type_rmcp('10.20.100.40', port=623) ipmi.session.set_auth_type_user('admin', 'admin') ipmi.target = pyipmi.Target(ipmb_address=0x82, routing=[(0x81,0x20,0),(0x20,0x82,7)]) ipmi.session.establish() device_id = ipmi.get_device_id()

Response : Traceback (most recent call last): File "ipmitool.py", line 13, in device_id = ipmi.get_device_id() File "/usr/lib/python2.7/site-packages/pyipmi/bmc.py", line 25, in get_device_id return DeviceId(self.send_message_with_name('GetDeviceId')) File "/usr/lib/python2.7/site-packages/pyipmi/init.py", line 206, in send_message_with_name rsp = self.send_message(req) File "/usr/lib/python2.7/site-packages/pyipmi/init.py", line 190, in send_message rsp = self.interface.send_and_receive(req) File "/usr/lib/python2.7/site-packages/pyipmi/interfaces/ipmitool.py", line 145, in send_and_receive req_data.tostring()) File "/usr/lib/python2.7/site-packages/pyipmi/interfaces/ipmitool.py", line 117, in send_and_receive_raw raise RuntimeError('ipmitool failed with rc=%d' % rc) RuntimeError: ipmitool failed with rc=1

hthiery commented 5 years ago

what kind of device you try to connect?

in your snippet you have configured a double bridged target like we use for AMCs in ATCA carriers

if you want to connect to normal BMC dont use the ipmi.target line

karolg58 commented 4 years ago

Without a target I get result:

File "/usr/local/lib/python3.7/site-packages/pyipmi/interfaces/ipmitool.py", line 147, in send_and_receive req_data.tostring()) File "/usr/local/lib/python3.7/site-packages/pyipmi/interfaces/ipmitool.py", line 96, in send_and_receive_raw cmd = self._build_ipmitool_cmd(target, lun, netfn, raw_bytes) File "/usr/local/lib/python3.7/site-packages/pyipmi/interfaces/ipmitool.py", line 205, in _build_ipmitool_cmd cmd += self._build_ipmitool_target(target) File "/usr/local/lib/python3.7/site-packages/pyipmi/interfaces/ipmitool.py", line 165, in _build_ipmitool_target if target.routing is not None: AttributeError: 'NoneType' object has no attribute 'routing'

hthiery commented 4 years ago

what kind of ipmi target do you use?

please take a look into the example: https://github.com/kontron/python-ipmi/blob/master/examples/dcmi.py

coolcoolkg21 commented 2 years ago

I'm running into the same situation. Can somebody help me out? I've tried changing the ipmp address to 0x20 and editing the routing to the value specified in this tutorial, but still cannot work.