schema(#293): get_signal_contact sense_ps_state per-PSU dict {psid: bool} - #384
Merged
Merged
Conversation
…ool}
1.17 anchor: per-PSU dict on ssh/mops/snmp; {} when no rows.
- snmp: index [group, inner] (SigConID.PSID) replaces key_field collapse
- mops: inner_index_field _enumerate (no PSID column; 1.17 row order)
- ssh: Power Supply/Status table (table section 1, key_column 0, column 1,
sigcon_sense_ssh) on the existing per-contact show; no extra fanout
- schema default false -> {}
Related: #293
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rank1 soft —
get_signal_contact.sense_ps_stateas a per-PSU dict (read side)Related: #293
Anchor: 1.17 clerk trail (issue comment 5823364677).
sense_ps_stateis a per-PSU dict{psu_id: bool}on ssh, mops and snmp. The MIB table ishm2SigConPSEntry INDEX {hm2SigConID, hm2PSID}. When there are no rows the result is{}, never a bool and never None. Before this PR crude returned a scalar: mopsTrue(last row won), sshFalse(default), snmp collapsed bykey_field.Changes (YAML only; existing driver primitives, same recipe as archive
signal_contact.yamlps_state):wire/diagnostic.yamlindex_fields+key_field: hm2SigConID(collapsed to one value per contact) →index: [group, inner]. SuffixSigConID.PSIDgives{cid: {psid: bool}}, with HmEnabledStatus 1/2 → True/False through the existing matrix.wire/diagnostic.yamlindex_field: hm2SigConID+inner_index_field: _enumerate. The rows have no hm2PSID column, so PSID comes from the per-contact row order, as in 1.17mops_hiosand the archive. The unusedindex_fieldslist was dropped.wire/ssh/diagnostic.yamlhm2sigconsensepsstateread on the existingshow signal-contact {entity} all(iterate_from: [1, 2], which shares the iterate cache, so no extra show):parser: table, section: 1, key_column: 0, column: 1, tag: value_map, map: sigcon_sense_ssh(existing tokensmonitored→ true, default false).schemas/signal_contact.yamlsense_ps_state: false→{}, so a contact with no PS rows is honestly{}.Offline checks (drivers + shaping, mocked I/O):
_gather_walkson{'1.1':1,'1.2':2,'2.1':1,'2.2':1}gives{'1': {'1': True, '2': False}, '2': {'1': True, '2': True}}. An empty walk gives{}.gatheron 4 rows (SigConID + state only) gives the same nested dict. 0 rows gives{}._parse_responseon a representative layout (title underline, then thePower Supply Statustable, then theIntf Statustable) gives{'1': 'monitored', '2': 'ignored'}, mapped to{'1': True, '2': False}. An empty orError:response gives{}._shape_table_outputgives rows{'1': {'1': True, '2': False}, …}. With no PS data, every row gets{}.No aggregation into a bool, no new primitive, no engine/driver edit, no invented tokens.
validate_schemas.py --errorsgives 46 | 45 | 0 errors | 1 warning, same as baseline.Watch in proof / leftovers:
section: 1comes from the archive and assumes a title underline before the PS table. If Test raw shows the PS table is separator 0, it's a one-token retune.set_signal_contactstill has no per-PSU dict ingress, so that's out of scope for this read-side PR.sense_fan/sense_humidity/sense_stp_port_blockNone vs False, and the emptyclilist (get_interfaces.read: SSH parse remainder (cli listed; n=1 vs mops 36) #226 class), are not touched here.Proof: python3 tests/release_matrix.py --inspect --method get_signal_contact --trace --device