2
0
mirror of https://opendev.org/x/pyghmi synced 2025-08-29 06:18:07 +00:00
Commit Graph

963 Commits

Author SHA1 Message Date
Jarrod Johnson
6d3c032312 Fix KCS on python 2
In python2, cannot directly copy a memoryview to a ctypes
string.  Catch and try with a copy of the memoryview
data for python2.

Change-Id: I6dc0183921e4e888aca131fe7968d820b25dc5d5
2020-04-07 08:52:51 -04:00
Jarrod Johnson
92f1ed7b7d Disable OEM on KCS
When using KCS, OEM extensions are not going
to work well.  For now, disable such extensions.

Change-Id: Ic9668ec00906382f4aba94eff0b33ff270869d6b
2020-04-06 09:16:29 -04:00
Jarrod Johnson
ec3411b492 Fix localsession for python2
Commands without data were causing problems
for python2 ctypes interface.  Skip the
copy attempt when there is no data to
copy.

Change-Id: If115a1145c277992aa4ffbe420a582dc08d0926e
2020-04-02 08:09:02 -04:00
Jarrod Johnson
5391281a7e Give up on etag checking for log clear
Some firmware just gives etags that are random and useless
for guarding log clear.

Change-Id: I16ed712e012f9d5b0092fb3224618cf146e480c8
2020-03-30 18:32:05 -04:00
Zuul
bb2e8a24fc Merge "Bump hacking to 3.0.0" 2020-03-30 15:41:36 +00:00
Riccardo Pittau
b76d3b3cd2 Bump hacking to 3.0.0
The new version enables a lot of standard flake8 checks, so a few
fixes are required. W503 is disabled as it conflicts with W504
and the latter seems to be preferred nowadays.

Change-Id: I0d2fa8c88f081d553ebefb5f764397b2761dc2b5
2020-03-30 16:33:49 +02:00
Jarrod Johnson
1ae0ddcf29 Fix SEL sensor id with LUN
With support for non-zero LUN,
update portions of event log
to be consistent.  PET does not
seem to have LUN in the data,
so for the time being just assume 0 there.

Change-Id: I24b6b27f81fe1c24a516d28788a2c0efc2f9ccbb
2020-03-30 10:22:47 -04:00
Jarrod Johnson
72b092f449 Filter out disabled sensors
When get sensor reading says
a sensor is disabled without
also saying it is unavailable,
mark it as unavailable.

Change-Id: I00c61824f3539373b48223da9b37acfed97f6576
2020-03-27 14:49:02 -04:00
Jarrod Johnson
85b2b6e5ab Fix endless loop with log clear attempt in redfish
Some redfish implementations endlessly mutate
their etag.  This makes it impossible to
fully establish atomicity.

Move the logic as much server side as possible.
There is still a window where entries change
between fetching the entries and the loginfo,
but there is little hope.

Change-Id: I9135b96acf82f06bc8622efb4d53d0bc695d1758
2020-03-26 10:21:39 -04:00
Jarrod Johnson
35351756bf Make reset Bios configuration adaptive
So of course it turns out that in redfish
multiple firmware developers implemented
another exactly identical behavior with
different requirements.

Accomodate by trying to detect at least two
variants seen in the industry.

Change-Id: I5aec979f12fd775bcf8570fde411eaee787ba9c3
2020-03-25 12:03:04 -04:00
Jarrod Johnson
9f7e4415a9 Restore cloned webclient TLS validation behavior
In supporting the standard validation, custom validation
was broken when a webclient was cloned.

Change-Id: Ib2e2b8ca9c1582c778539b35ff7ee456f3118f82
2020-03-20 16:43:38 -04:00
Jarrod Johnson
1287100c7b Add SMM support for dhcp options 12 and 60
Provide access to dhcp settings for options 12 and 60.

Change-Id: If5b079fc7123d1ab0ac6ae2bacc6f3b5a06abbe8
2020-03-20 14:36:07 -04:00
Jarrod Johnson
767efd60a8 Fallback to standard TLS validation
If the caller provides no custom validation, use normal validation.

Historically, this webclient has been used for internal networks where
custom validation was more feasible than normal TLS validation.

However, it is starting to be used to communicate with internet sites,
so a change is required to work with that model sanely.

Change-Id: I31dae103bfbe534aa326a648f9207ad86b86d550
2020-03-20 13:07:08 -04:00
Jarrod Johnson
59f44fa9c8 Reduce instances of duplicate login
While XCC is aggressive about expiring tokens, sometimes it isn't.

In such a case, throw a logout request to the 'stale' session in case it
isn't to avoid consuming too many session slots.

Change-Id: I01819786755d5d5d29014c58d4dcbe5468c63607
2020-03-20 09:20:01 -04:00
Jarrod Johnson
ec4b503edb Have BMC side reply to get cipher suites
Newest ipmitool expects a reply to get cipher suites.  For
now give a static reply that only cipher suite 3 is supported.

Change-Id: I31f77818ffa746954eb86fa95269b1e5a7e09879
1.5.13
2020-03-18 15:18:11 -04:00
Jarrod Johnson
dd10bb7579 Fix download error reporting
Threaded downloads now
store the exception for passing
to the caller.

Change-Id: Ibe4a7a267b04a2775ad3775dd904a4e3c7520ebb
2020-03-11 11:06:07 -04:00
Zuul
daf2c36fb5 Merge "Rewrite download loop" 2020-03-10 19:27:49 +00:00
Jarrod Johnson
4d0ee6238e Rewrite download loop
The sentinal value would not get hit with
python3 ('' versus b'').  Change to use
an easier to use while loop.

Change-Id: I4d7f4b763aff1fdf13e5a53377146606de199a11
2020-03-10 14:23:40 -04:00
Jarrod Johnson
1be749343b Fix setting instanced config on XCC
XCC has some numeric data
that must be forced to str for
XML.

Change-Id: I86fed505d80d53b3ce3b4db33af678d548da847f
2020-03-10 13:53:02 -04:00
Jarrod Johnson
32f2e2827f Fix python3 on IMM
There was a python2 assumption in the
imm code for pre-XCC devices.  Fix
this mistake.

Change-Id: I48871f3d6d34533db0ad6d7facb8e693f4eca37a
2020-03-06 09:29:31 -05:00
Dmitry Tantsur
52228f84c2 Add a non-voting job with virtualbmc
Change-Id: I5c2b601689649ff70535b8c25d209946f7d04231
2020-03-04 21:32:45 +01:00
Jarrod Johnson
51ab5ca823 Fix server session to properly support rqlun
Honor rqlun from client, if not zero.  There are BMC implementations
that fail to follow the spec and do rqlun of zero, but pyghmi
implements it correctly.  In practice I have never seen an
rqlun of non-zero except as an experiment.

Closes-Bug: #1865987

Change-Id: I73e59672ce5e146cf24386c2228fa8dae3bc579c
1.5.12
2020-03-04 09:01:02 -05:00
Zuul
a3001d87a7 Merge "Rework LUN support" 1.5.11 2020-03-03 21:03:29 +00:00
Connor Reed
584f51cdd8 feat(redfish): Add port option to be able to specify redfish server port
Change-Id: Id60b6fe82c81d9eea9aba1b6b3b6a55c6d9d8f9e
2020-03-03 15:36:05 -05:00
Jarrod Johnson
b48cdba5f3 Force body to str for json
Some versions of python cannot take bytes
for the json payload.  Workaround by explicitly
decoding from utf8 in such a case.

Change-Id: Idb86003fcf6643e5c67e13202de41be6c35607a0
2020-03-03 14:37:37 -05:00
Jarrod Johnson
aa1bc4d183 Rework LUN support
Make code more closely resemble the spec mostly for readability.

Change-Id: I89e229645b6cea942f1dca6082f57083a935955a
2020-03-03 09:13:47 -05:00
Jarrod Johnson
39a1fa0985 Another fix for non-zero LUN
Accidentally did not have it treated properly
in add_sdr and get_sensor_data.

Change-Id: I5b55de6baf393fdfb686f6a574fee874e610a9a0
1.5.10
2020-02-28 15:39:09 -05:00
Jarrod Johnson
b497af048f Fix incorrect sdr cache naming
The order of operations was incorrect, be explicit
about the order of bitshift versus addition.

Change-Id: I8e3e92e47b82b6f84ffc54437c9c0e9888faa9a6
2020-02-28 15:14:23 -05:00
Jarrod Johnson
fa7e271f54 Discard rsLun in reply
After adding support for non-zero lun, some reports came back of
dropping responses.  However, there is at least one platform that
incorrectly puts 0 in rsLun in replies to packet that had 0 in rsLun.

Workaround by masking out the rsLun value in replies before checking for a
match.

Change-Id: I23a46fce23327ce90d2be845a806d6ba0c4b975e
1.5.9
2020-02-28 14:24:24 -05:00
Jarrod Johnson
ba8087a2ed Set daemon for IO thread
The IO thread is meant to be a background task.  Mark it
as such to be treated properly on interpreter exit.

Change-Id: I73003625d014f823d26c55bdd22217e19f6bf1c9
2020-02-28 13:10:51 -05:00
Jarrod Johnson
6bc53a1546 Add a simplesession option
simplesession represents a stripped down session.

For now it doesn't support many bells and whistles, but it
should suffice for one-off command usage.

Caller has to opt-in to the experimental simplesession by
calling select_simplesession() method in command:
import pyghmi.ipmi.command
pyghmi.ipmi.command.select_simplesession()

Change-Id: I3884762621306d4a895f4b56d173fc80526a095c
1.5.8
2020-02-26 16:31:09 -05:00
Jarrod Johnson
0f397ac0d9 Support non-zero LUN
Some sensors may have non-zero LUN.  Support this behavior.

Change-Id: Ibad7a1c378ef0ef5955fa81e3f110db0e8c42e90
2020-02-26 11:33:03 -05:00
Connor Reed
ba699294ca fix(kcs): Fix the command class to use bytearray instead of lists for raw data
Change-Id: I55ef076827447d3e0b8bbbd9d9dd8d0006804232
2020-02-25 11:20:46 -05:00
Jarrod Johnson
3221bb1ed3 Fix IMM/XCC over network
The change for KCS inadvertently used wrong variable name blocking
online usage.

Change-Id: I3b629e3697d73f6b36b2dc9d9755797fd348af0f
2020-02-20 13:02:40 -05:00
Jarrod Johnson
04b2d5cd69 Fix building under wheezy
The supported wheezy platform we are now adding
pyca to.  Additionally, the options were wrong for
such old debian build utilites.

Change-Id: If92de1356cd45c5f4a260b6df72144dbbfe70c3d
2020-02-20 08:58:24 -05:00
Jarrod Johnson
c180933281 Fix IMM on KCS
IMM on KCS did not even partially
work, allow at least partial functionality.

Change-Id: Ia42f4f91cdf29505423e05961101e7d7651f55d2
2020-02-19 17:06:49 -05:00
Jarrod Johnson
9958b75cc6 Transform IPMI version number for XCC
XCC convention is to zero-pad the minor number
if less than ten.  Support this and make it look less odd.

Change-Id: I093019d68d5c47ffe73d49eba736da5c1bd9ce32
2020-02-19 13:40:12 -05:00
Jarrod Johnson
2e12f5ce15 Fix KCS problems introduced by pep8 restore
The effort to restore pep8 made mistakes and mangled some
data.  Additionally correct a python2/3 incompatibility.

Change-Id: I247d00c3214c30d135c2c131d7ab7bd411dfb476
1.5.7
2020-02-19 10:33:41 -05:00
Zuul
01191cfd1a Merge "Guess a more specific type than Other" 1.5.6 2020-02-06 15:07:01 +00:00
Jarrod Johnson
2d72952e8e Guess a more specific type than Other
Some implementations use 'Other' since none of the specified
categories are technically Power.

For such a case, when it is in W, Ws, Wm, or Wh, correctly
flag them as power or energy category.

Change-Id: I515f74af6fc0cf3c2d14c6f94b74a295929cf082
2020-02-06 09:32:53 -05:00
Jarrod Johnson
4046a847a7 Redfish accept bytes as credentials
If the caller uses bytes, then try
to decode to string using utf-8.
This fixes compatibility with some
scenarios, particularly involving python
2/3 compatibility.

Change-Id: I78692db4f9e8abb885567eaf0e5500908e71a5a0
2020-02-04 08:40:28 -05:00
Jarrod Johnson
5d8a80c6e3 Remove vestigial argument of abandoned API choice
This API choice was aborted before it began, clean it up.

Change-Id: I0abd43e5c8f5286e1b7e3562a5e9519045b8a9d3
2020-01-31 14:01:52 -05:00
Jarrod Johnson
296f7d30dd Extend overwrite protection to ipmi module
This affords the same protection that the redfish module now
has.

Change-Id: Icc3e4f90427b2912d4d18d60af6f1f599b8005d9
2020-01-31 11:20:18 -05:00
Jarrod Johnson
d93718e306 Prevent overwrite of existing files.
Fetching new licence keys or diagnostic data should never
overrite existing content.

Change-Id: I41519dc59544165e244b39cef2f510eeb4c0f15f
2020-01-31 10:20:48 -05:00
Jarrod Johnson
9c0843443e Add SMM PSU configuration to bmc_configuration
When dealing with an SMM, give access to the PSU policy
configuration.

Change-Id: Ie6b5016e7db27391ddaa7a798a744f08bfd32ced
2020-01-30 10:09:32 -05:00
Jarrod Johnson
71932ba1c0 Fix IMM/XCC get extended configuration
Was modifying a dictionary while iterating, fix by
taking a list() explicitly before iterating.

Change-Id: I6a6310fabd7d205b4705a2f2216d316be502bbe5
2020-01-29 13:54:02 -05:00
Jarrod Johnson
3799dd3f9b Change API for extended BMC configuration
Keep extended configuration utterly separate to ease confusion
by calling code as to what belongs to which category.

Change-Id: Ic97ad79fa796f63b8825db48059450a4c78f75c9
2020-01-29 11:18:31 -05:00
Jarrod Johnson
27e8e36d23 Speed up uefi settings management
Bypassing the merged configuration makes the command go exceedingly
faster.

Change-Id: I86cb7baa09edfbcffdebf75a2019bf3c48cbe5f2
2020-01-29 08:28:44 -05:00
Jarrod Johnson
b4d4734df8 Wire redfish clear config to IPMI TSMA
When using 'ipmi', use redfish to provide reset UEFI
default configuration.

Change-Id: I744136c6ecadc8b0d1ddbdd9be528cf7780758ed
2020-01-27 11:11:17 -05:00
Zuul
2e3c8d4f1e Merge "Show True and False as choices for booleans" 1.5.5 2020-01-23 21:29:33 +00:00