Task #210 — Modbus server-side factory + seed SQL #216

Merged
dohertj2 merged 1 commits from task-210-modbus-factory-seed into v2 2026-04-21 11:08:22 -04:00
Owner

Parent: #209. First of four driver-factory PRs that unblock e2e stages 3-5.

What this does

Adds ModbusDriverFactoryExtensions + a seed-modbus-smoke.sql so a DriverType='Modbus' row in the Config DB actually boots a ModbusDriver + publishes its tags as OPC UA variables. Before this PR, DriverInstanceBootstrapper silently skipped any row whose DriverType wasn't Galaxy or FOCAS.

Changes

  • src/ZB.MOM.WW.OtOpcUa.Driver.Modbus/ModbusDriverFactoryExtensions.cs — mirrors the Galaxy + FOCAS extension classes. CreateInstance(driverInstanceId, driverConfigJson) deserialises ModbusDriverConfigDto to a full ModbusDriverOptions (Host/Port/UnitId/TimeoutMs/Probe/Tags with strict enum parsing for Region / DataType / ByteOrder / StringByteOrder).
  • src/ZB.MOM.WW.OtOpcUa.Server/Program.cs — register the factory after Galaxy + FOCAS.
  • src/ZB.MOM.WW.OtOpcUa.Driver.Modbus.csproj — add Core project reference (the factory needs DriverFactoryRegistry from Core.Hosting; Galaxy/FOCAS already have this).
  • src/ZB.MOM.WW.OtOpcUa.Server.csproj — add Driver.Modbus ProjectReference so the registration compiles.
  • scripts/smoke/seed-modbus-smoke.sql — one-cluster smoke seed modelled on seed-phase-7-smoke.sql. Creates modbus-smoke cluster + node + Draft generation + Namespace + UnsArea/UnsLine/Equipment + one Modbus DriverInstance + one Tag at HR[200]:UInt16. Ends with sp_PublishGeneration. HR[100] deliberately avoided — pymodbus standard.json runs an auto-increment action there.

Test plan

  • Full-solution build: 0 errors, only pre-existing xUnit1051 noise
  • Live boot verification deferred to the exit-gate PR once all four factories ship (#211 #212 #213)

AB CIP / S7 / AB Legacy follow in their own PRs.

Parent: #209. First of four driver-factory PRs that unblock e2e stages 3-5. ## What this does Adds `ModbusDriverFactoryExtensions` + a `seed-modbus-smoke.sql` so a `DriverType='Modbus'` row in the Config DB actually boots a `ModbusDriver` + publishes its tags as OPC UA variables. Before this PR, `DriverInstanceBootstrapper` silently skipped any row whose DriverType wasn't `Galaxy` or `FOCAS`. ## Changes - `src/ZB.MOM.WW.OtOpcUa.Driver.Modbus/ModbusDriverFactoryExtensions.cs` — mirrors the Galaxy + FOCAS extension classes. `CreateInstance(driverInstanceId, driverConfigJson)` deserialises `ModbusDriverConfigDto` to a full `ModbusDriverOptions` (Host/Port/UnitId/TimeoutMs/Probe/Tags with strict enum parsing for Region / DataType / ByteOrder / StringByteOrder). - `src/ZB.MOM.WW.OtOpcUa.Server/Program.cs` — register the factory after Galaxy + FOCAS. - `src/ZB.MOM.WW.OtOpcUa.Driver.Modbus.csproj` — add `Core` project reference (the factory needs `DriverFactoryRegistry` from `Core.Hosting`; Galaxy/FOCAS already have this). - `src/ZB.MOM.WW.OtOpcUa.Server.csproj` — add `Driver.Modbus` ProjectReference so the registration compiles. - `scripts/smoke/seed-modbus-smoke.sql` — one-cluster smoke seed modelled on `seed-phase-7-smoke.sql`. Creates `modbus-smoke` cluster + node + Draft generation + Namespace + UnsArea/UnsLine/Equipment + one Modbus DriverInstance + one Tag at `HR[200]:UInt16`. Ends with `sp_PublishGeneration`. HR[100] deliberately avoided — pymodbus `standard.json` runs an auto-increment action there. ## Test plan - [x] Full-solution build: 0 errors, only pre-existing xUnit1051 noise - [ ] Live boot verification deferred to the exit-gate PR once all four factories ship (#211 #212 #213) AB CIP / S7 / AB Legacy follow in their own PRs.
dohertj2 added 1 commit 2026-04-21 11:08:19 -04:00
Parent: #209. Adds the server-side wiring so a Config DB `DriverType='Modbus'`
row actually boots a Modbus driver instance + publishes its tags under OPC UA
NodeIds, instead of being silently skipped by DriverInstanceBootstrapper.

Changes:
 - `ModbusDriverFactoryExtensions` (new) — mirrors
   `GalaxyProxyDriverFactoryExtensions` + `FocasDriverFactoryExtensions`.
   `DriverTypeName="Modbus"`, `CreateInstance` deserialises
   `ModbusDriverConfigDto` (Host/Port/UnitId/TimeoutMs/Probe/Tags) to a full
   `ModbusDriverOptions` and hands back a `ModbusDriver`. Strict enum parsing
   (Region / DataType / ByteOrder / StringByteOrder) — unknown values fail
   fast with an explicit "expected one of" error rather than at first read.
 - `Program.cs` — register the factory after Galaxy + FOCAS.
 - `Driver.Modbus.csproj` — add `Core` project reference (the DI-free factory
   needs `DriverFactoryRegistry` from `Core.Hosting`). Matches the FOCAS
   driver's reference shape.
 - `Server.csproj` — add the `Driver.Modbus` ProjectReference so the
   Program.cs registration compiles against the same assembly the server
   loads at runtime.
 - `scripts/smoke/seed-modbus-smoke.sql` (new) — one-cluster smoke seed
   modelled on `seed-phase-7-smoke.sql`. Creates a `modbus-smoke` cluster +
   `modbus-smoke-node` + Draft generation + Namespace + UnsArea/UnsLine/
   Equipment + one Modbus `DriverInstance` pointing at the pymodbus standard
   fixture (`127.0.0.1:5020`) + one Tag at `HR[200]:UInt16`, ending in
   `EXEC sp_PublishGeneration`. HR[100] is deliberately *not* used because
   pymodbus `standard.json` runs an auto-increment action on that register.

Full-solution build: 0 errors, only the pre-existing xUnit1051 warnings.

AB CIP / S7 / AB Legacy factories follow in their own PRs per #211 / #212 /
#213. Live boot verification happens in the exit-gate PR once all four
factories are in place.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
dohertj2 merged commit 35d24c2f80 into v2 2026-04-21 11:08:22 -04:00
dohertj2 deleted branch task-210-modbus-factory-seed 2026-04-21 11:08:23 -04:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dohertj2/lmxopcua#216