python-ipmi 0.5.8__tar.gz → 0.6.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. python_ipmi-0.6.1/MANIFEST.in +1 -0
  2. python_ipmi-0.6.1/PKG-INFO +372 -0
  3. python_ipmi-0.6.1/README.md +330 -0
  4. python_ipmi-0.6.1/man/ipmitool.py.1 +1066 -0
  5. python_ipmi-0.6.1/pyipmi/__init__.py +463 -0
  6. python_ipmi-0.6.1/pyipmi/bmc.py +350 -0
  7. python_ipmi-0.6.1/pyipmi/chassis.py +413 -0
  8. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/pyipmi/constants.py +35 -0
  9. python_ipmi-0.6.1/pyipmi/dcmi.py +394 -0
  10. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/pyipmi/errors.py +34 -22
  11. python_ipmi-0.6.1/pyipmi/event.py +97 -0
  12. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/pyipmi/fields.py +41 -30
  13. python_ipmi-0.6.1/pyipmi/fru.py +1462 -0
  14. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/pyipmi/helper.py +50 -16
  15. python_ipmi-0.6.1/pyipmi/hpm.py +1457 -0
  16. python_ipmi-0.6.1/pyipmi/interfaces/__init__.py +111 -0
  17. python_ipmi-0.6.1/pyipmi/interfaces/aardvark.py +235 -0
  18. python_ipmi-0.6.1/pyipmi/interfaces/base.py +179 -0
  19. python_ipmi-0.6.1/pyipmi/interfaces/ipmb.py +624 -0
  20. python_ipmi-0.6.1/pyipmi/interfaces/ipmbdev.py +89 -0
  21. python_ipmi-0.6.1/pyipmi/interfaces/ipmidev.py +324 -0
  22. python_ipmi-0.6.1/pyipmi/interfaces/ipmitool.py +501 -0
  23. python_ipmi-0.6.1/pyipmi/interfaces/mock.py +47 -0
  24. python_ipmi-0.6.1/pyipmi/interfaces/openipmblink.py +423 -0
  25. python_ipmi-0.6.1/pyipmi/interfaces/rmcp.py +968 -0
  26. python_ipmi-0.6.1/pyipmi/interfaces/rmcpplus.py +735 -0
  27. python_ipmi-0.6.1/pyipmi/interfaces/router.py +319 -0
  28. python_ipmi-0.6.1/pyipmi/ipmitool.py +1448 -0
  29. python_ipmi-0.6.1/pyipmi/lan.py +434 -0
  30. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/pyipmi/logger.py +4 -4
  31. python_ipmi-0.6.1/pyipmi/messaging.py +388 -0
  32. python_ipmi-0.6.1/pyipmi/mixin.py +52 -0
  33. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/pyipmi/msgs/__init__.py +0 -1
  34. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/pyipmi/msgs/constants.py +98 -0
  35. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/pyipmi/msgs/dcmi.py +177 -19
  36. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/pyipmi/msgs/device_messaging.py +34 -0
  37. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/pyipmi/msgs/fru.py +3 -1
  38. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/pyipmi/msgs/hpm.py +7 -7
  39. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/pyipmi/msgs/message.py +124 -84
  40. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/pyipmi/msgs/picmg.py +7 -5
  41. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/pyipmi/msgs/registry.py +18 -9
  42. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/pyipmi/msgs/sel.py +4 -4
  43. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/pyipmi/msgs/sensor.py +19 -0
  44. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/pyipmi/msgs/vita.py +0 -1
  45. python_ipmi-0.6.1/pyipmi/picmg.py +942 -0
  46. python_ipmi-0.6.1/pyipmi/sdr.py +1149 -0
  47. python_ipmi-0.6.1/pyipmi/sel.py +374 -0
  48. python_ipmi-0.6.1/pyipmi/sensor.py +373 -0
  49. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/pyipmi/session.py +58 -34
  50. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/pyipmi/state.py +13 -5
  51. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/pyipmi/utils.py +64 -56
  52. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/pyipmi/version.py +1 -1
  53. python_ipmi-0.6.1/pyipmi/vita.py +281 -0
  54. python_ipmi-0.6.1/python_ipmi.egg-info/PKG-INFO +372 -0
  55. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/python_ipmi.egg-info/SOURCES.txt +17 -3
  56. python_ipmi-0.6.1/python_ipmi.egg-info/requires.txt +3 -0
  57. python_ipmi-0.6.1/setup.cfg +27 -0
  58. python_ipmi-0.6.1/setup.py +124 -0
  59. python_ipmi-0.6.1/tests/test_bmc.py +143 -0
  60. python_ipmi-0.6.1/tests/test_chassis.py +147 -0
  61. python_ipmi-0.6.1/tests/test_constants.py +9 -0
  62. python_ipmi-0.6.1/tests/test_dcmi.py +228 -0
  63. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/tests/test_device_messaging.py +0 -1
  64. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/tests/test_errors.py +0 -1
  65. python_ipmi-0.6.1/tests/test_event.py +69 -0
  66. python_ipmi-0.6.1/tests/test_fields.py +63 -0
  67. python_ipmi-0.6.1/tests/test_fru.py +804 -0
  68. python_ipmi-0.6.1/tests/test_helper.py +163 -0
  69. python_ipmi-0.6.1/tests/test_hpm.py +765 -0
  70. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/tests/test_ipmi.py +102 -6
  71. python_ipmi-0.6.1/tests/test_ipmitool.py +757 -0
  72. python_ipmi-0.6.1/tests/test_lan.py +190 -0
  73. python_ipmi-0.6.1/tests/test_messaging.py +99 -0
  74. python_ipmi-0.6.1/tests/test_picmg.py +356 -0
  75. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/tests/test_sdr.py +173 -7
  76. python_ipmi-0.6.1/tests/test_sel.py +260 -0
  77. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/tests/test_sensor.py +25 -2
  78. python_ipmi-0.6.1/tests/test_session.py +55 -0
  79. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/tests/test_utils.py +15 -2
  80. python_ipmi-0.6.1/tests/test_vita.py +193 -0
  81. python_ipmi-0.5.8/PKG-INFO +0 -207
  82. python_ipmi-0.5.8/README.rst +0 -170
  83. python_ipmi-0.5.8/pyipmi/__init__.py +0 -280
  84. python_ipmi-0.5.8/pyipmi/bmc.py +0 -181
  85. python_ipmi-0.5.8/pyipmi/chassis.py +0 -269
  86. python_ipmi-0.5.8/pyipmi/dcmi.py +0 -57
  87. python_ipmi-0.5.8/pyipmi/emulation.py +0 -395
  88. python_ipmi-0.5.8/pyipmi/event.py +0 -38
  89. python_ipmi-0.5.8/pyipmi/fru.py +0 -477
  90. python_ipmi-0.5.8/pyipmi/hpm.py +0 -728
  91. python_ipmi-0.5.8/pyipmi/interfaces/__init__.py +0 -38
  92. python_ipmi-0.5.8/pyipmi/interfaces/aardvark.py +0 -232
  93. python_ipmi-0.5.8/pyipmi/interfaces/ipmb.py +0 -272
  94. python_ipmi-0.5.8/pyipmi/interfaces/ipmbdev.py +0 -176
  95. python_ipmi-0.5.8/pyipmi/interfaces/ipmitool.py +0 -333
  96. python_ipmi-0.5.8/pyipmi/interfaces/mock.py +0 -25
  97. python_ipmi-0.5.8/pyipmi/interfaces/rmcp.py +0 -682
  98. python_ipmi-0.5.8/pyipmi/ipmitool.py +0 -757
  99. python_ipmi-0.5.8/pyipmi/lan.py +0 -259
  100. python_ipmi-0.5.8/pyipmi/messaging.py +0 -199
  101. python_ipmi-0.5.8/pyipmi/picmg.py +0 -504
  102. python_ipmi-0.5.8/pyipmi/sdr.py +0 -656
  103. python_ipmi-0.5.8/pyipmi/sel.py +0 -209
  104. python_ipmi-0.5.8/pyipmi/sensor.py +0 -235
  105. python_ipmi-0.5.8/python_ipmi.egg-info/PKG-INFO +0 -207
  106. python_ipmi-0.5.8/setup.cfg +0 -19
  107. python_ipmi-0.5.8/setup.py +0 -79
  108. python_ipmi-0.5.8/tests/test_bmc.py +0 -57
  109. python_ipmi-0.5.8/tests/test_chassis.py +0 -71
  110. python_ipmi-0.5.8/tests/test_event.py +0 -38
  111. python_ipmi-0.5.8/tests/test_fields.py +0 -33
  112. python_ipmi-0.5.8/tests/test_fru.py +0 -96
  113. python_ipmi-0.5.8/tests/test_helper.py +0 -32
  114. python_ipmi-0.5.8/tests/test_hpm.py +0 -94
  115. python_ipmi-0.5.8/tests/test_ipmitool.py +0 -36
  116. python_ipmi-0.5.8/tests/test_lan.py +0 -67
  117. python_ipmi-0.5.8/tests/test_picmg.py +0 -64
  118. python_ipmi-0.5.8/tests/test_sel.py +0 -154
  119. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/AUTHORS +0 -0
  120. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/COPYING +0 -0
  121. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/pyipmi/msgs/bmc.py +0 -0
  122. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/pyipmi/msgs/chassis.py +0 -0
  123. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/pyipmi/msgs/event.py +0 -0
  124. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/pyipmi/msgs/lan.py +0 -0
  125. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/pyipmi/msgs/sdr.py +0 -0
  126. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/pyipmi/msgs/session.py +0 -0
  127. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/python_ipmi.egg-info/dependency_links.txt +0 -0
  128. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/python_ipmi.egg-info/entry_points.txt +0 -0
  129. {python_ipmi-0.5.8 → python_ipmi-0.6.1}/python_ipmi.egg-info/top_level.txt +0 -0
@@ -0,0 +1 @@
1
+ include man/ipmitool.py.1
@@ -0,0 +1,372 @@
1
+ Metadata-Version: 2.4
2
+ Name: python-ipmi
3
+ Version: 0.6.1
4
+ Summary: Pure python IPMI library
5
+ Home-page: https://github.com/kontron/python-ipmi
6
+ Download-URL: https://github.com/kontron/python-ipmi/tarball/0.6.1
7
+ Author: Michael Walle, Heiko Thiery
8
+ Author-email: michael.walle@kontron.com, heiko.thiery@kontron.com
9
+ License: LGPLv2+
10
+ Platform: any
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)
14
+ Classifier: Natural Language :: English
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown
25
+ License-File: COPYING
26
+ License-File: AUTHORS
27
+ Provides-Extra: rmcpplus
28
+ Requires-Dist: cryptography; extra == "rmcpplus"
29
+ Dynamic: author
30
+ Dynamic: author-email
31
+ Dynamic: classifier
32
+ Dynamic: description
33
+ Dynamic: description-content-type
34
+ Dynamic: download-url
35
+ Dynamic: home-page
36
+ Dynamic: license
37
+ Dynamic: license-file
38
+ Dynamic: platform
39
+ Dynamic: provides-extra
40
+ Dynamic: requires-python
41
+ Dynamic: summary
42
+
43
+ # Pure Python IPMI Library
44
+
45
+ [![Build Status](https://github.com/kontron/python-ipmi/actions/workflows/test.yml/badge.svg)](https://github.com/kontron/python-ipmi/actions/workflows/test.yml)
46
+ [![Lint](https://github.com/kontron/python-ipmi/actions/workflows/lint.yml/badge.svg)](https://github.com/kontron/python-ipmi/actions/workflows/lint.yml)
47
+ [![PyPI version](https://img.shields.io/pypi/v/python-ipmi.svg)](https://pypi.org/project/python-ipmi/)
48
+ [![Documentation Status](https://readthedocs.org/projects/python-ipmi/badge/?version=latest)](https://python-ipmi.readthedocs.io/en/latest/?badge=latest)
49
+ [![Python versions](https://img.shields.io/pypi/pyversions/python-ipmi.svg)](https://pypi.org/project/python-ipmi/)
50
+ [![License](https://img.shields.io/pypi/l/python-ipmi.svg)](https://github.com/kontron/python-ipmi/blob/master/COPYING)
51
+ [![Downloads](https://img.shields.io/pypi/dm/python-ipmi.svg)](https://pypistats.org/packages/python-ipmi)
52
+ [![Coverage Status](https://coveralls.io/repos/github/kontron/python-ipmi/badge.svg?branch=master)](https://coveralls.io/github/kontron/python-ipmi?branch=master)
53
+ [![Code Climate](https://codeclimate.com/github/kontron/python-ipmi/badges/gpa.svg)](http://codeclimate.com/github/kontron/python-ipmi)
54
+ [![Codacy Badge](https://app.codacy.com/project/badge/Grade/068eca4b1e784425aa46ae0b06aeaf37)](https://www.codacy.com/gh/kontron/python-ipmi/dashboard?utm_source=github.com&utm_medium=referral&utm_content=kontron/python-ipmi&utm_campaign=Badge_Grade)
55
+
56
+ ## Features
57
+
58
+ * RMCP interface
59
+ * native
60
+ * legacy using [ipmitool] as backend
61
+ * RMCP+ interface
62
+ * native
63
+ * legacy using [ipmitool] as backend
64
+ * system interface
65
+ * native (KCS, SMIC, BT, SSIF) using the IPMI driver on Linux
66
+ * legacy using [ipmitool] as backend
67
+ * IPMB interface
68
+ * using the [Total Phase] Aardvark
69
+ * using ipmb-dev driver on Linux
70
+
71
+ ## Tested Devices
72
+
73
+ * Kontron
74
+ * mTCA Carrier Manager
75
+ * CompactPCI boards
76
+ * VPX boards
77
+ * Pigeon Point Shelf Manager
78
+ * HPE iLO3/iLO4
79
+ * N.A.T. NAT-MCH
80
+ * DESY MMC STAMP & related AMCs (DAMC-FMC2ZUP, DAMC-FMC1Z7IO)
81
+ * Supermicro
82
+
83
+ ## Requirements
84
+
85
+ For IPMB interface a [Total Phase] Aardvark is needed.
86
+ Another option is to use ipmb-dev driver on Linux with an I2C bus, driver of which supports slave mode:
87
+ https://www.kernel.org/doc/html/latest/driver-api/ipmb.html
88
+
89
+ For the native system interface the Linux IPMI driver is needed
90
+ (`ipmi_devintf` and e.g. `ipmi_si` or `ipmi_ssif`), which provides
91
+ `/dev/ipmi0`:
92
+ https://www.kernel.org/doc/html/latest/driver-api/ipmi.html
93
+
94
+ For legacy RMCP, RMCP+ and system interface (KCS) using ipmitool as backend
95
+ the installation of ipmitool is required. Any ipmitool 1.8.x works; the
96
+ serial interface (`serial-terminal`) needs at least version 1.8.13.
97
+
98
+ The native RMCP+ interface needs the [cryptography] package for
99
+ encrypted sessions (AES-CBC-128, cipher suites 3 and 17):
100
+
101
+ ```shell
102
+ pip install python-ipmi[rmcpplus]
103
+ ```
104
+
105
+ ## Installation
106
+
107
+ ### Using `pip`
108
+
109
+ The recommended installation method is using [pip](https://pip.pypa.io):
110
+
111
+ ```shell
112
+ pip install python-ipmi
113
+ ```
114
+
115
+ ### Manual installation
116
+
117
+ Download the source distribution package for the library. Extract the package to
118
+ a temporary location and install:
119
+
120
+ ```shell
121
+ python setup.py install
122
+ ```
123
+
124
+ ### Running from the source tree
125
+
126
+ To work on the library or to use it directly from a git checkout, create a
127
+ virtual environment and install the checkout in editable mode. Changes to the
128
+ source are then active without reinstalling:
129
+
130
+ ```shell
131
+ git clone https://github.com/kontron/python-ipmi.git
132
+ cd python-ipmi
133
+ python3 -m venv .venv
134
+ . .venv/bin/activate
135
+ pip install -e '.[rmcpplus]'
136
+ ```
137
+
138
+ This also installs the `ipmitool.py` command line tool and generates
139
+ `pyipmi/version.py` with the version from `git describe`. Install the
140
+ optional packages for the interfaces you need: `pyserial` for the
141
+ openipmblink interface and `pyaardvark` for the Aardvark IPMB interface.
142
+
143
+ To run the tests:
144
+
145
+ ```shell
146
+ pip install pytest
147
+ pytest
148
+ ```
149
+
150
+ The CI also runs the linter [ruff], the type checker mypy and the spell
151
+ checker codespell. They are configured in `ruff.toml` and `setup.cfg`, so
152
+ they run without arguments. Use the versions pinned in
153
+ `.github/workflows/lint.yml` to get the same results as the CI:
154
+
155
+ ```shell
156
+ pip install ruff==0.16.10 mypy==2.4.0 codespell
157
+ ruff check .
158
+ mypy
159
+ codespell
160
+ ```
161
+
162
+ `ruff check --fix .` fixes many of the reported issues automatically.
163
+
164
+ Alternatively, the checkout can be used without installing by adding its top
165
+ directory to `PYTHONPATH`. Then `pyipmi` can be imported from any directory,
166
+ e.g. by your own scripts or the ones in `examples/`, and the tool is started
167
+ with `python3 -m pyipmi.ipmitool`:
168
+
169
+ ```shell
170
+ export PYTHONPATH=/path/to/python-ipmi
171
+ python3 -m pyipmi.ipmitool -V
172
+ ```
173
+
174
+ The optional packages have to be installed separately then, e.g.
175
+ `pip install cryptography` for encrypted RMCP+ sessions. The version is shown
176
+ as `dev` as long as `pyipmi/version.py` has not been generated, e.g. by
177
+ `python3 setup.py --version`.
178
+
179
+ ### Package version
180
+
181
+ The version of the package is taken from, in this order:
182
+
183
+ 1. `git describe --tags` in a git checkout, e.g. `0.5.8.dev77+g7c853b0`
184
+ for the 77th commit after the tag `0.5.8`
185
+ 2. `pyipmi/version.py`, which is generated by `setup.py` and is part of the
186
+ source distribution on PyPI
187
+ 3. `version_archive.txt`, which `git archive` fills in with the tag. This
188
+ makes the tarballs of the GitHub releases build with the right version,
189
+ e.g. for distribution packages.
190
+
191
+ If none of them is available, the version is `0+unknown`. The installed
192
+ version is available as `pyipmi.__version__` and with `ipmitool.py -V`.
193
+
194
+ ## Documentation
195
+
196
+ You can find the most up to date documentation at:
197
+ http://python-ipmi.rtfd.org
198
+
199
+ ## Example
200
+
201
+ The examples below talk to the BMC of a server, which has the IPMB address
202
+ `0x20`. Set a routing only for targets behind the BMC, see
203
+ [Bridged targets](#bridged-targets).
204
+
205
+ Example with the native RMCP+ interface (IPMI v2.0, like `ipmitool -I lanplus`):
206
+
207
+ ```python
208
+ import pyipmi
209
+ import pyipmi.interfaces
210
+
211
+ # without cipher_suite the cipher suites 17 and 3 are tried
212
+ interface = pyipmi.interfaces.create_interface('rmcpplus', cipher_suite=3)
213
+
214
+ connection = pyipmi.create_connection(interface)
215
+
216
+ connection.target = pyipmi.Target(0x20)
217
+ connection.session.set_session_type_rmcp('10.0.0.1', port=623)
218
+ connection.session.set_auth_type_user('admin', 'admin')
219
+ connection.session.set_priv_level('ADMINISTRATOR')
220
+
221
+ connection.open()
222
+ connection.get_device_id()
223
+ connection.close()
224
+ ```
225
+
226
+ ipmitool command:
227
+
228
+ ```shell
229
+ ipmitool -I lanplus -C 3 -H 10.0.0.1 -p 623 -U admin -P admin -L ADMINISTRATOR -t 0x20 raw 0x06 0x01
230
+ ```
231
+
232
+ Example using the [ipmitool] as backend with the lan interface:
233
+
234
+ ```python
235
+ import pyipmi
236
+ import pyipmi.interfaces
237
+
238
+ # Supported interface_types for ipmitool are: 'lan' , 'lanplus', and 'serial-terminal'
239
+ interface = pyipmi.interfaces.create_interface('ipmitool', interface_type='lan')
240
+
241
+ connection = pyipmi.create_connection(interface)
242
+
243
+ connection.target = pyipmi.Target(0x20)
244
+
245
+ connection.session.set_session_type_rmcp('10.0.0.1', port=623)
246
+ connection.session.set_auth_type_user('admin', 'admin')
247
+ connection.session.set_priv_level("ADMINISTRATOR")
248
+ connection.session.establish()
249
+
250
+ connection.get_device_id()
251
+ ```
252
+
253
+ ipmitool command:
254
+
255
+ ```shell
256
+ ipmitool -I lan -H 10.0.0.1 -p 623 -L "ADMINISTRATOR" -U "admin" -P "admin" raw 0x06 0x01
257
+ ```
258
+
259
+ Example with serial interface:
260
+
261
+ ```python
262
+ import pyipmi
263
+ import pyipmi.interfaces
264
+
265
+ interface = pyipmi.interfaces.create_interface('ipmitool', interface_type='serial-terminal')
266
+
267
+ connection = pyipmi.create_connection(interface)
268
+
269
+ connection.target = pyipmi.Target(0xb2)
270
+
271
+ # set_session_type_serial(port, baudrate)
272
+ connection.session.set_session_type_serial('/dev/tty2', 115200)
273
+ connection.session.establish()
274
+
275
+ connection.get_device_id()
276
+ ```
277
+
278
+ ipmitool command:
279
+
280
+ ```shell
281
+ ipmitool -I serial-terminal -D /dev/tty2:115200 -t 0xb2 -l 0 raw 0x06 0x01
282
+ ```
283
+
284
+ Example with the system interface using the Linux IPMI driver:
285
+
286
+ ```python
287
+ import pyipmi
288
+ import pyipmi.interfaces
289
+
290
+ interface = pyipmi.interfaces.create_interface('ipmidev', port='/dev/ipmi0')
291
+
292
+ connection = pyipmi.create_connection(interface)
293
+
294
+ connection.target = pyipmi.Target(0x20)
295
+
296
+ connection.open()
297
+ connection.get_device_id()
298
+ connection.close()
299
+ ```
300
+
301
+ ipmitool command:
302
+
303
+ ```shell
304
+ ipmitool -I open -t 0x20 raw 0x06 0x01
305
+ ```
306
+
307
+ ### Bridged targets
308
+
309
+ In ATCA and MicroTCA systems the controllers of blades and AMCs are not
310
+ reachable directly but only through the shelf manager or MCH, which forwards
311
+ (bridges) the requests on IPMB. For these targets set the IPMB address of the
312
+ target and the routing to it. A routing is a list of
313
+ `(requester address, responder address, channel)` tuples, one per hop.
314
+
315
+ Example for an ATCA blade with IPMB address `0x82` behind the shelf manager:
316
+
317
+ ```python
318
+ connection.target = pyipmi.Target(0x82)
319
+ connection.target.set_routing([(0x81, 0x20, 0), (0x20, 0x82, None)])
320
+ ```
321
+
322
+ ipmitool command:
323
+
324
+ ```shell
325
+ ipmitool -I lan -H 10.0.0.1 -p 623 -L "ADMINISTRATOR" -U "admin" -P "admin" -t 0x82 -b 0 raw 0x06 0x01
326
+ ```
327
+
328
+ Do not set a routing to talk to the BMC of a server itself, the bridged
329
+ request fails then (e.g. with completion code `0x83`, NAK on write).
330
+
331
+ Some shelf managers and carrier managers do not return the sequence number
332
+ of a bridged request in their response. If requests time out although the
333
+ device answers (the debug log shows `discarding message that does not match
334
+ the request`), create the native interface with
335
+ `quirks_cfg={'rmcp_ignore_rq_seq': True}`. With the ipmitool backend the
336
+ routing needs the bridge channel of every hop except the last one.
337
+ See the [documentation](https://python-ipmi.readthedocs.io/en/latest/quick_start.html)
338
+ for more routing examples.
339
+
340
+ ## Compatibility
341
+
342
+ Python >= 3.10 is currently supported. Python 2.x is deprecated.
343
+
344
+ ## Contributing
345
+
346
+ Contributions are always welcome. You may send patches directly (eg. `git
347
+ send-email`), do a github pull request or just file an issue.
348
+
349
+ * respect the coding style (eg. PEP8),
350
+ * provide well-formed commit message (see [this blog post](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)),
351
+ * add a Signed-off-by line (eg. `git commit -s`)
352
+
353
+ ## License
354
+
355
+ This library is free software; you can redistribute it and/or modify it
356
+ under the terms of the GNU Lesser General Public License as published by
357
+ the Free Software Foundation; either version 2.1 of the License, or (at
358
+ your option) any later version.
359
+
360
+ This library is distributed in the hope that it will be useful, but WITHOUT
361
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
362
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
363
+ License for more details.
364
+
365
+ You should have received a copy of the GNU Lesser General Public License
366
+ along with this library; if not, write to the Free Software Foundation,
367
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
368
+
369
+ [Total Phase]: http://www.totalphase.com
370
+ [ipmitool]: https://codeberg.org/IPMITool/ipmitool
371
+ [cryptography]: https://pypi.org/project/cryptography/
372
+ [ruff]: https://docs.astral.sh/ruff/
@@ -0,0 +1,330 @@
1
+ # Pure Python IPMI Library
2
+
3
+ [![Build Status](https://github.com/kontron/python-ipmi/actions/workflows/test.yml/badge.svg)](https://github.com/kontron/python-ipmi/actions/workflows/test.yml)
4
+ [![Lint](https://github.com/kontron/python-ipmi/actions/workflows/lint.yml/badge.svg)](https://github.com/kontron/python-ipmi/actions/workflows/lint.yml)
5
+ [![PyPI version](https://img.shields.io/pypi/v/python-ipmi.svg)](https://pypi.org/project/python-ipmi/)
6
+ [![Documentation Status](https://readthedocs.org/projects/python-ipmi/badge/?version=latest)](https://python-ipmi.readthedocs.io/en/latest/?badge=latest)
7
+ [![Python versions](https://img.shields.io/pypi/pyversions/python-ipmi.svg)](https://pypi.org/project/python-ipmi/)
8
+ [![License](https://img.shields.io/pypi/l/python-ipmi.svg)](https://github.com/kontron/python-ipmi/blob/master/COPYING)
9
+ [![Downloads](https://img.shields.io/pypi/dm/python-ipmi.svg)](https://pypistats.org/packages/python-ipmi)
10
+ [![Coverage Status](https://coveralls.io/repos/github/kontron/python-ipmi/badge.svg?branch=master)](https://coveralls.io/github/kontron/python-ipmi?branch=master)
11
+ [![Code Climate](https://codeclimate.com/github/kontron/python-ipmi/badges/gpa.svg)](http://codeclimate.com/github/kontron/python-ipmi)
12
+ [![Codacy Badge](https://app.codacy.com/project/badge/Grade/068eca4b1e784425aa46ae0b06aeaf37)](https://www.codacy.com/gh/kontron/python-ipmi/dashboard?utm_source=github.com&utm_medium=referral&utm_content=kontron/python-ipmi&utm_campaign=Badge_Grade)
13
+
14
+ ## Features
15
+
16
+ * RMCP interface
17
+ * native
18
+ * legacy using [ipmitool] as backend
19
+ * RMCP+ interface
20
+ * native
21
+ * legacy using [ipmitool] as backend
22
+ * system interface
23
+ * native (KCS, SMIC, BT, SSIF) using the IPMI driver on Linux
24
+ * legacy using [ipmitool] as backend
25
+ * IPMB interface
26
+ * using the [Total Phase] Aardvark
27
+ * using ipmb-dev driver on Linux
28
+
29
+ ## Tested Devices
30
+
31
+ * Kontron
32
+ * mTCA Carrier Manager
33
+ * CompactPCI boards
34
+ * VPX boards
35
+ * Pigeon Point Shelf Manager
36
+ * HPE iLO3/iLO4
37
+ * N.A.T. NAT-MCH
38
+ * DESY MMC STAMP & related AMCs (DAMC-FMC2ZUP, DAMC-FMC1Z7IO)
39
+ * Supermicro
40
+
41
+ ## Requirements
42
+
43
+ For IPMB interface a [Total Phase] Aardvark is needed.
44
+ Another option is to use ipmb-dev driver on Linux with an I2C bus, driver of which supports slave mode:
45
+ https://www.kernel.org/doc/html/latest/driver-api/ipmb.html
46
+
47
+ For the native system interface the Linux IPMI driver is needed
48
+ (`ipmi_devintf` and e.g. `ipmi_si` or `ipmi_ssif`), which provides
49
+ `/dev/ipmi0`:
50
+ https://www.kernel.org/doc/html/latest/driver-api/ipmi.html
51
+
52
+ For legacy RMCP, RMCP+ and system interface (KCS) using ipmitool as backend
53
+ the installation of ipmitool is required. Any ipmitool 1.8.x works; the
54
+ serial interface (`serial-terminal`) needs at least version 1.8.13.
55
+
56
+ The native RMCP+ interface needs the [cryptography] package for
57
+ encrypted sessions (AES-CBC-128, cipher suites 3 and 17):
58
+
59
+ ```shell
60
+ pip install python-ipmi[rmcpplus]
61
+ ```
62
+
63
+ ## Installation
64
+
65
+ ### Using `pip`
66
+
67
+ The recommended installation method is using [pip](https://pip.pypa.io):
68
+
69
+ ```shell
70
+ pip install python-ipmi
71
+ ```
72
+
73
+ ### Manual installation
74
+
75
+ Download the source distribution package for the library. Extract the package to
76
+ a temporary location and install:
77
+
78
+ ```shell
79
+ python setup.py install
80
+ ```
81
+
82
+ ### Running from the source tree
83
+
84
+ To work on the library or to use it directly from a git checkout, create a
85
+ virtual environment and install the checkout in editable mode. Changes to the
86
+ source are then active without reinstalling:
87
+
88
+ ```shell
89
+ git clone https://github.com/kontron/python-ipmi.git
90
+ cd python-ipmi
91
+ python3 -m venv .venv
92
+ . .venv/bin/activate
93
+ pip install -e '.[rmcpplus]'
94
+ ```
95
+
96
+ This also installs the `ipmitool.py` command line tool and generates
97
+ `pyipmi/version.py` with the version from `git describe`. Install the
98
+ optional packages for the interfaces you need: `pyserial` for the
99
+ openipmblink interface and `pyaardvark` for the Aardvark IPMB interface.
100
+
101
+ To run the tests:
102
+
103
+ ```shell
104
+ pip install pytest
105
+ pytest
106
+ ```
107
+
108
+ The CI also runs the linter [ruff], the type checker mypy and the spell
109
+ checker codespell. They are configured in `ruff.toml` and `setup.cfg`, so
110
+ they run without arguments. Use the versions pinned in
111
+ `.github/workflows/lint.yml` to get the same results as the CI:
112
+
113
+ ```shell
114
+ pip install ruff==0.16.10 mypy==2.4.0 codespell
115
+ ruff check .
116
+ mypy
117
+ codespell
118
+ ```
119
+
120
+ `ruff check --fix .` fixes many of the reported issues automatically.
121
+
122
+ Alternatively, the checkout can be used without installing by adding its top
123
+ directory to `PYTHONPATH`. Then `pyipmi` can be imported from any directory,
124
+ e.g. by your own scripts or the ones in `examples/`, and the tool is started
125
+ with `python3 -m pyipmi.ipmitool`:
126
+
127
+ ```shell
128
+ export PYTHONPATH=/path/to/python-ipmi
129
+ python3 -m pyipmi.ipmitool -V
130
+ ```
131
+
132
+ The optional packages have to be installed separately then, e.g.
133
+ `pip install cryptography` for encrypted RMCP+ sessions. The version is shown
134
+ as `dev` as long as `pyipmi/version.py` has not been generated, e.g. by
135
+ `python3 setup.py --version`.
136
+
137
+ ### Package version
138
+
139
+ The version of the package is taken from, in this order:
140
+
141
+ 1. `git describe --tags` in a git checkout, e.g. `0.5.8.dev77+g7c853b0`
142
+ for the 77th commit after the tag `0.5.8`
143
+ 2. `pyipmi/version.py`, which is generated by `setup.py` and is part of the
144
+ source distribution on PyPI
145
+ 3. `version_archive.txt`, which `git archive` fills in with the tag. This
146
+ makes the tarballs of the GitHub releases build with the right version,
147
+ e.g. for distribution packages.
148
+
149
+ If none of them is available, the version is `0+unknown`. The installed
150
+ version is available as `pyipmi.__version__` and with `ipmitool.py -V`.
151
+
152
+ ## Documentation
153
+
154
+ You can find the most up to date documentation at:
155
+ http://python-ipmi.rtfd.org
156
+
157
+ ## Example
158
+
159
+ The examples below talk to the BMC of a server, which has the IPMB address
160
+ `0x20`. Set a routing only for targets behind the BMC, see
161
+ [Bridged targets](#bridged-targets).
162
+
163
+ Example with the native RMCP+ interface (IPMI v2.0, like `ipmitool -I lanplus`):
164
+
165
+ ```python
166
+ import pyipmi
167
+ import pyipmi.interfaces
168
+
169
+ # without cipher_suite the cipher suites 17 and 3 are tried
170
+ interface = pyipmi.interfaces.create_interface('rmcpplus', cipher_suite=3)
171
+
172
+ connection = pyipmi.create_connection(interface)
173
+
174
+ connection.target = pyipmi.Target(0x20)
175
+ connection.session.set_session_type_rmcp('10.0.0.1', port=623)
176
+ connection.session.set_auth_type_user('admin', 'admin')
177
+ connection.session.set_priv_level('ADMINISTRATOR')
178
+
179
+ connection.open()
180
+ connection.get_device_id()
181
+ connection.close()
182
+ ```
183
+
184
+ ipmitool command:
185
+
186
+ ```shell
187
+ ipmitool -I lanplus -C 3 -H 10.0.0.1 -p 623 -U admin -P admin -L ADMINISTRATOR -t 0x20 raw 0x06 0x01
188
+ ```
189
+
190
+ Example using the [ipmitool] as backend with the lan interface:
191
+
192
+ ```python
193
+ import pyipmi
194
+ import pyipmi.interfaces
195
+
196
+ # Supported interface_types for ipmitool are: 'lan' , 'lanplus', and 'serial-terminal'
197
+ interface = pyipmi.interfaces.create_interface('ipmitool', interface_type='lan')
198
+
199
+ connection = pyipmi.create_connection(interface)
200
+
201
+ connection.target = pyipmi.Target(0x20)
202
+
203
+ connection.session.set_session_type_rmcp('10.0.0.1', port=623)
204
+ connection.session.set_auth_type_user('admin', 'admin')
205
+ connection.session.set_priv_level("ADMINISTRATOR")
206
+ connection.session.establish()
207
+
208
+ connection.get_device_id()
209
+ ```
210
+
211
+ ipmitool command:
212
+
213
+ ```shell
214
+ ipmitool -I lan -H 10.0.0.1 -p 623 -L "ADMINISTRATOR" -U "admin" -P "admin" raw 0x06 0x01
215
+ ```
216
+
217
+ Example with serial interface:
218
+
219
+ ```python
220
+ import pyipmi
221
+ import pyipmi.interfaces
222
+
223
+ interface = pyipmi.interfaces.create_interface('ipmitool', interface_type='serial-terminal')
224
+
225
+ connection = pyipmi.create_connection(interface)
226
+
227
+ connection.target = pyipmi.Target(0xb2)
228
+
229
+ # set_session_type_serial(port, baudrate)
230
+ connection.session.set_session_type_serial('/dev/tty2', 115200)
231
+ connection.session.establish()
232
+
233
+ connection.get_device_id()
234
+ ```
235
+
236
+ ipmitool command:
237
+
238
+ ```shell
239
+ ipmitool -I serial-terminal -D /dev/tty2:115200 -t 0xb2 -l 0 raw 0x06 0x01
240
+ ```
241
+
242
+ Example with the system interface using the Linux IPMI driver:
243
+
244
+ ```python
245
+ import pyipmi
246
+ import pyipmi.interfaces
247
+
248
+ interface = pyipmi.interfaces.create_interface('ipmidev', port='/dev/ipmi0')
249
+
250
+ connection = pyipmi.create_connection(interface)
251
+
252
+ connection.target = pyipmi.Target(0x20)
253
+
254
+ connection.open()
255
+ connection.get_device_id()
256
+ connection.close()
257
+ ```
258
+
259
+ ipmitool command:
260
+
261
+ ```shell
262
+ ipmitool -I open -t 0x20 raw 0x06 0x01
263
+ ```
264
+
265
+ ### Bridged targets
266
+
267
+ In ATCA and MicroTCA systems the controllers of blades and AMCs are not
268
+ reachable directly but only through the shelf manager or MCH, which forwards
269
+ (bridges) the requests on IPMB. For these targets set the IPMB address of the
270
+ target and the routing to it. A routing is a list of
271
+ `(requester address, responder address, channel)` tuples, one per hop.
272
+
273
+ Example for an ATCA blade with IPMB address `0x82` behind the shelf manager:
274
+
275
+ ```python
276
+ connection.target = pyipmi.Target(0x82)
277
+ connection.target.set_routing([(0x81, 0x20, 0), (0x20, 0x82, None)])
278
+ ```
279
+
280
+ ipmitool command:
281
+
282
+ ```shell
283
+ ipmitool -I lan -H 10.0.0.1 -p 623 -L "ADMINISTRATOR" -U "admin" -P "admin" -t 0x82 -b 0 raw 0x06 0x01
284
+ ```
285
+
286
+ Do not set a routing to talk to the BMC of a server itself, the bridged
287
+ request fails then (e.g. with completion code `0x83`, NAK on write).
288
+
289
+ Some shelf managers and carrier managers do not return the sequence number
290
+ of a bridged request in their response. If requests time out although the
291
+ device answers (the debug log shows `discarding message that does not match
292
+ the request`), create the native interface with
293
+ `quirks_cfg={'rmcp_ignore_rq_seq': True}`. With the ipmitool backend the
294
+ routing needs the bridge channel of every hop except the last one.
295
+ See the [documentation](https://python-ipmi.readthedocs.io/en/latest/quick_start.html)
296
+ for more routing examples.
297
+
298
+ ## Compatibility
299
+
300
+ Python >= 3.10 is currently supported. Python 2.x is deprecated.
301
+
302
+ ## Contributing
303
+
304
+ Contributions are always welcome. You may send patches directly (eg. `git
305
+ send-email`), do a github pull request or just file an issue.
306
+
307
+ * respect the coding style (eg. PEP8),
308
+ * provide well-formed commit message (see [this blog post](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)),
309
+ * add a Signed-off-by line (eg. `git commit -s`)
310
+
311
+ ## License
312
+
313
+ This library is free software; you can redistribute it and/or modify it
314
+ under the terms of the GNU Lesser General Public License as published by
315
+ the Free Software Foundation; either version 2.1 of the License, or (at
316
+ your option) any later version.
317
+
318
+ This library is distributed in the hope that it will be useful, but WITHOUT
319
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
320
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
321
+ License for more details.
322
+
323
+ You should have received a copy of the GNU Lesser General Public License
324
+ along with this library; if not, write to the Free Software Foundation,
325
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
326
+
327
+ [Total Phase]: http://www.totalphase.com
328
+ [ipmitool]: https://codeberg.org/IPMITool/ipmitool
329
+ [cryptography]: https://pypi.org/project/cryptography/
330
+ [ruff]: https://docs.astral.sh/ruff/