Now works - more or less fully

This commit is contained in:
Joachim Friberg committed 2026-08-28 15:12:21 +02:00
1 parent fb8d468943
commit 92701aab92
13 files changed
+1938 -12

No files matched your search

+70 -1
View File
@@ -141,9 +141,78 @@ toolchain/`go.mod`, not nested in this Python project), scaffolded from HashiCor
collides with the data source's (`hpe1810_system_description`) -- fine, since Terraform
keeps `resource.*`/`data.*` in separate namespaces. `Create` applied live (System Name
`Draupnir01` -> `draupnir01`), confirmed via curl. Delete resets all three fields to `""`.
Next write resources per the risk triage: Jumbo Frames, then Ping Test.
Correction (2026-08-25): "Jumbo Frames, then Ping Test" as the suggested next targets
was wrong -- neither is marked "y" in TODO.md, so neither is actually opted into. Check
TODO.md's "Want it?" column before picking the next write target, not just the risk
triage below (the triage says what's *safe*, TODO.md says what's *wanted*). Marked "y"
but not yet implemented, as of 2026-08-25: Time Zone, Daylight Saving Time, Port
Mirroring, Flow Control, Loop Protection Cfg (LoopProtectionCfg.html -- distinct from the
already-done read-only Loop Protection Status), Advanced Security, Secure Connection,
Trunk Configuration, Trunk Membership, LLDP Configuration, LLDP Local/Remote Device.
Note: switch only used on port 24 for uplink — avoid touching that port in any future
port-configuration resource testing.
**Update**: Time Zone, Daylight Saving Time, LLDP Configuration, Flow Control, and Port
Mirroring were built next per explicit user request (2026-08-25) -- see below. Remaining
marked-"y"-but-not-built: Loop Protection Cfg, Advanced Security, Secure Connection,
Trunk Configuration, Trunk Membership, LLDP Local/Remote Device.
- Three more write resources (2026-08-25), user-requested: `hpe1810_time_zone`
(`Time_Zone_Configuration.html`, simple 2-field scalar page, no collisions),
`hpe1810_lldp_configuration` (`LLDPConfig.html`'s "Global Mode" table only -- the page's
per-port "Interface Mode" table, with per-port field names like `1.0.24.v_2_1_2`, is a
separate not-yet-built write target), and `hpe1810_daylight_saving_time`
(`Summer_Time_Configuration.html`). DST was the trickiest: the page has THREE modes
(Disable/Recurring/NonRecurring) each with a full field set all present in the DOM at
once, several labels colliding WITHIN one table (Month/Hours/Minutes/Offset each appear
in both the NonRecurring and Recurring blocks) -- handled with a dedicated regex-based
field reader/writer (`client/dst_config.go`) rather than the generic parser, bypassing
the ambiguity entirely. Confirmed live that (unlike PortConfiguration.html) this page
does NOT need hidden context fields or the unused mode's fields sent -- submitting just
`v_1_1_1` + the Recurring block was accepted with no error. Only Disable/Recurring are
supported; NonRecurring (absolute Month/Date/Year fields) is explicitly rejected. All
three verified with real writes confirmed via curl (Time Zone acronym, LLDP
transmit_interval, DST start_hour), then reverted to the switch's actual original values
-- `tofu plan` shows zero drift.
- Two more write resources (2026-08-25), user-requested, in this order: Flow Control
first (`hpe1810_flow_control`, `SwitchConfig.html`, trivial single-boolean page, same
shape as Locator), then Port Mirroring evaluated before building -- `FDBConfig.html` is
misleadingly named (it's Port Mirroring, not FDB) and has two parts: a global
Enable+Destination Port scalar table, and a per-source-port Direction table (25 rows:
ports 1-24 + CPU, per-port field names like `1.0.25.v_1_3_2`) structurally identical in
complexity to LLDPConfig.html's deferred per-port table. User confirmed building only the
global part as `hpe1810_port_mirroring`, same scope-split precedent as LLDP
Configuration. Hit the same `FILTER_MISSING` issue as PortConfiguration.html: a hidden
context field (`v_2_2_2`, always `"1"`, sits next to Destination Port with no visible
label) must be included on every write or the switch rejects with "Error! Failed to Set
'Enable Mirroring' ... FILTER_MISSING" -- confirmed live, fixed, then both resources
verified with zero drift on `tofu plan`.
- **`hpe1810_trunk` (link aggregation / LAG), user-requested (2026-08-25)**: the first
resource with a genuinely different shape from everything above -- a named sub-entity
with real Create/Delete (`TrunkConfig.html`), not a singleton or a fixed for_each set.
Membership assignment (`TrunkMembership.html`) uses a dedicated JS file
(`lagViewAutoGen.js`) to dynamically render the picker; the raw HTML table is just a
hidden data template the JS reads, not the actual submitted form -- had to read that JS
to find the real field-naming convention (`1.<zero-based-port-index>.24.v_2_3_1/2/3`).
Three write-protocol gotchas confirmed live before writing any Go code (test trunk on
ports 5+6 only, never 24, cleaned up after): (1) `v_2_3_1` (port number) is marked
`DISABLED` in the raw HTML, but the page's own JS un-disables it right before submit --
a raw POST omitting it fails with `FILTER_MISSING`, same for the page's other hidden
context fields; (2) Delete requires resubmitting that trunk's row fields
(`v_1_5_1`..`v_1_5_6`) unchanged alongside the delete trigger
(`v_1_5_7=Enable`+`v_1_5_8=Delete`) or it fails with "Error! Failed to remove LAG.";
(3) **including the page's top-level Create-section fields
(`v_1_1_1`/`v_1_2_1`/`v_1_4_1`) in the SAME request as a delete causes the switch to
create ANOTHER trunk as a side effect instead of deleting** -- caught live (deleting
"Trunk1" while resending `v_1_4_1=Add` produced a fresh empty "Trunk2"); fixed by
omitting those fields entirely from delete requests. `admin_mode`/`static_capability`
are exposed read-only only (Computed, not settable) -- only Create/set-members/Delete
were verified live. `hpe1810_trunk`'s `members` reuses the `admin_port` guard pattern
from `resource_port.go`. Full CRUD verified live **through the actual Terraform
provider** (not just curl): Create, Update (added a member), the admin_port guard
(blocked live, port 24 confirmed untouched via curl afterward), and Delete -- all with
zero drift on `tofu plan`. Multi-trunk row-indexing (`1.<index>.1.` prefix on
TrunkConfig.html) is inferred by the same positional pattern used everywhere else in
this firmware, not independently verified against a live switch with 2+ trunks (this
homelab only ever had one during testing).
- **`save_running_config` provider flag (2026-08-25)**: new optional provider attribute
(`HPE1810_SAVE_RUNNING_CONFIG` env fallback, default `false`). If `true`, `Shutdown()`
(called once at process exit, same place as the logout below) POSTs to