2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-09-05 20:47:55 +00:00
Commit Graph

38 Commits

Author SHA1 Message Date
Kilian Cavalotti 0b4695eef2 Accept MIB labels for genpdu enumerated values
With PDU2-MIB loaded, SNMP.pm returns an enumerated INTEGER as its label
rather than its number: a PX4 answers inletSensorUnits with "amp" rather
than "2". That failed the numeric test, fell back to none(-1) and
dropped the unit suffix from every rvitals reading.

Add pdu2_enum, which accepts the number, the label, or the label(value)
form Net-SNMP produces with quick printing off, and use it for the
sensor units and for outletSwitchingState.

Also stop requiring the switching probe to read on or off. An outlet can
be in any SensorStateEnumeration state, and pdu2_get has already ruled
out an absent instance, so any answer proves the outlet is switchable.

Signed-off-by: Kilian Cavalotti <kilian@stanford.edu>
2026-08-25 17:44:23 -07:00
Kilian Cavalotti daef2d7bae Distinguish SNMP failures from absent objects in genpdu
A missing object is exception text under v2c/v3 and an error under v1,
and genpdu treated both the same. Add pdu2_get, returning a value and an
ok, absent or failed status. A failed signed minimum read now skips the
sensor, and rinv no longer prints "No Such Instance currently exists at
this OID" for a nameplate field the model does not populate.

Read the signed minimum per entity: the MIB indexes it that way, and it
decides which value column is read.

In the session probe, fall back to the PDU2 nameplate rather than
sysDescr, so a credential that cannot read PDU2 is rejected, return
early when the pduCount read fails at the transport level, and warn once
per PDU.

Signed-off-by: Kilian Cavalotti <kilian@stanford.edu>
2026-08-24 16:32:41 -07:00
Kilian Cavalotti 30dc723b6d Fix genpdu sensor value column and connection detection
genpdu read negative-capable sensors from the unsigned value column,
which the MIB leaves undefined for them: a PX4 answers it with 0 for
inlet reactive power and carries the reading in the signed column. Use
SensorSignedMinimum to pick the column, as the MIB specifies. The
unsigned column is still needed for active energy, whose range exceeds
Integer32 and reads 0 in the signed one.

An unreachable PDU or a wrong credential looked like a PDU without
switched outlets, since the switching probe was the first exchange with
the device. Probe pduCount first (implemented by every PDU2 agent,
verified on PX2, PX3 and PX4) and return no session when it fails, so
callers print "Couldn't connect to <pdu>". Warn when pduCount is not 1
rather than refusing: a linked primary still answers for its own
outlets.

Add unit tests for the genpdu sensor, session and inventory paths.

Signed-off-by: Kilian Cavalotti <kilian@stanford.edu>
2026-08-24 16:32:41 -07:00
Kilian Cavalotti 657b17570a Add genpdu pdutype for generic SNMP PDUs (PDU2-MIB)
Add a new pdutype (genpdu) for PDUs implementing the Raritan PDU2-MIB.
A single MIB covers the Raritan PX2/PX3/PX4/PXC/SRC/PXO/BCM series, the
Server Technology PRO3X/PRO4X series, the Legrand intelligent PDUs, and
all PDUs following the PDU2-MIB.

Supports rpower (whole-PDU and per-outlet), rinv and rvitals over SNMP
v1, v2c or v3, with credentials read from the pdu table).

Unlike the existing types, sensor units and decimal precision are read
from the MIB per sensor rather than hardcoded, so readings are correct
across models that report differing precision for the same sensor.
Outlet switching capability is probed at connect time, so metered-only
models report a single "unsupported" message instead of a per-outlet error.

rspconfig is not supported for genpdu; PDU linking and BCM2/PMC power
meters are out of scope.

Tested on Raritan PX4-5851-E7V2 (fw 4.2.10.5-50400, switched),
PX3-1901U-N1 and PX3-1901U-N1A6 (fw 4.0.20.5-49038, metered), and
PX2-1901U-N1A6 (fw 4.0.20.5-49038, metered).

Signed-off-by: Kilian Cavalotti <kilian@stanford.edu>
2026-08-20 18:51:02 -07:00
cxhong 24727f3962 Remove stty command from Expect process 2020-02-02 14:40:24 -05:00
GONG Jie 747ce629bf Remove trailing spaces in file xCAT-server/lib/xcat/plugins/pdu.pm 2017-12-31 23:59:59 +00:00
Casandra Qiu 55581cb2db Modify output message for PDU outlet state 2018-05-17 15:04:53 -04:00
Casandra Qiu 60e3eb2566 ange pduhash to global value 2018-02-12 22:15:03 -05:00
Casandra Qiu 79df80057c add example of snmpv3 configuration for chdef 2018-02-09 13:41:38 -05:00
Casandra Qiu 862fa5973e Support user defined password from pdu table 2018-02-06 18:59:16 -05:00
Casandra Qiu 3e4d70383a return sub routine if ip is not reachable 2018-01-31 12:11:08 -05:00
Casandra Qiu 2acd4365f0 Support hostname and network setting changes for IRPDU 2018-01-25 13:34:37 -05:00
Casandra Qiu d694ac9683 Modify rvitals output 2018-01-10 15:27:53 -05:00
Casandra Qiu 13882e69ff add message in the fill_outletCount 2018-01-09 09:30:05 -05:00
Casandra Qiu 96ff31599e pre-defined variables for the OIDs 2018-01-08 14:16:10 -05:00
Casandra Qiu f438e1b432 Add rvitals support for Infrastructure PDUs 2018-01-05 13:29:37 -05:00
Casandra Qiu 34a4403efd remove $line with "******" 2018-01-05 10:21:03 -05:00
Casandra Qiu 9590c50927 Support rinv command for irpdu 2017-12-21 11:11:55 -05:00
Casandra Qiu a6724dae24 comment from ErTao 2017-12-12 11:36:25 -05:00
Casandra Qiu a1efbea5e3 Relay action and snmp configuration support for Coral PDU 2017-11-29 14:53:42 -05:00
Casandra Qiu 9ff54dede6 Change format of rinv/rvitals output for PDU 2017-09-29 15:30:22 -04:00
Casandra Qiu 8f0f59c373 Handle TIMEOUT error message for change pdu ip address 2017-09-14 16:57:09 -04:00
Casandra Qiu 555eef7794 modify netcfg and add rinv and rvitals command 2017-09-14 09:50:44 -04:00
Casandra Qiu 9f2f40609a change network command from "," to space 2017-08-18 09:49:36 -04:00
Casandra Qiu 02c82d4a04 Support rspconfig command to change PDU's ip address, netmask and
hostname
2017-08-07 21:00:50 -04:00
Casandra Qiu 71a7151d97 remove results 2017-07-26 09:11:12 -04:00
Casandra Qiu 86e4b9ccb3 modify sshcfg 2017-07-25 10:18:04 -04:00
Casandra Qiu de9b4b575f Support passwordless ssh for pdu 2017-07-24 10:18:30 -04:00
Casandra Qiu 762ee31628 modified from review 2017-07-21 10:38:31 -04:00
Casandra Qiu c3159a5b20 Support pdudiscover command to discover PDU 2017-07-19 17:18:31 -04:00
Casandra Qiu ea2d22887b Modify pdu error message and check pdu version for different OID 2017-05-22 15:27:11 -04:00
Jarrod Johnson 27613cdc18 Fix syntax of newmib
It has to be referenced as a hash element.
2017-05-10 10:25:07 -04:00
Jarrod Johnson 494cf232f4 Support newer PDU firmware
Newer PDU firmware renumbered OIDs.  Detect and adapt
to new OIDs on the newer firmware.
2017-05-10 10:19:58 -04:00
Casandra Qiu 865527400f ADD support for power reset of PDU outlet 2017-03-21 12:01:42 -04:00
Casandra Qiu 6a5b8b3bbc Handle bad return code from pdu commands 2017-03-09 17:26:35 -05:00
Casandra Qiu 2f21fea044 modify changes from weihua's comments 2017-03-03 09:13:15 -05:00
Casandra Qiu 040ab4c0cb Remove Error message for rpower command when node has pdu attributes 2017-03-02 10:50:19 -05:00
Casandra Qiu c4e0f637c9 Add pdu support 2017-02-13 16:33:11 -05:00