[abcip] AbCip — CSV tag import/export #349

Merged
dohertj2 merged 1 commits from auto/abcip/2.4 into auto/driver-gaps 2026-04-25 18:36:20 -04:00
Owner

Summary

CSV tag import / export for AbCip, matching Kepware's column layout.

  • Import/CsvTagImporter.cs — header-lookup column order (Tag Name, Address, Data Type, Respect Data Type, Client Access, Scan Rate, Description, Scaling). RFC-4180-ish quoting. Blank-row + ;/# marker skip. Client Access R/WWritable.
  • Import/CsvTagExporter.cs — renders tag list with the standard 8-column Kepware header. Works against the live merged tag table (declared / L5K / L5X / CSV).
  • Cli/Commands/TagExportCommand.cstag-export --driver-options-json --out. Pure transform: runs the declared/L5K/L5X/CSV merge in-memory, no PLC contact.
  • AbCipDriverOptions.CsvImports — new collection (AbCipCsvImportOptions record mirrors L5K/L5X options shape).
  • AbCipDriver.InitializeAsyncMergeCsvImport step. Precedence: declared > L5K > L5X > CSV.

Test plan

  • dotnet build src/ZB.MOM.WW.OtOpcUa.Driver.AbCip + Driver.AbCip.Cli — clean (0 / 0)
  • dotnet test tests/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Tests309 / 309 passed (10 new in CsvTagImporterTests: RW mapping, ReadOnly mapping, blank/marker skip, quoted-comma, escaped-quote, name prefix, unknown-type → Structure, missing default device throws, full round-trip, column reordering)
  • Integration tests — skipped (live PLC required)

🤖 Auto-generated by the Mode-B execution loop. Closes #232.

Closes #232

## Summary CSV tag import / export for AbCip, matching Kepware's column layout. - **`Import/CsvTagImporter.cs`** — header-lookup column order (Tag Name, Address, Data Type, Respect Data Type, Client Access, Scan Rate, Description, Scaling). RFC-4180-ish quoting. Blank-row + `;`/`#` marker skip. `Client Access` `R/W` → `Writable`. - **`Import/CsvTagExporter.cs`** — renders tag list with the standard 8-column Kepware header. Works against the live merged tag table (declared / L5K / L5X / CSV). - **`Cli/Commands/TagExportCommand.cs`** — `tag-export --driver-options-json --out`. Pure transform: runs the declared/L5K/L5X/CSV merge in-memory, no PLC contact. - **`AbCipDriverOptions.CsvImports`** — new collection (`AbCipCsvImportOptions` record mirrors L5K/L5X options shape). - **`AbCipDriver.InitializeAsync`** — `MergeCsvImport` step. Precedence: **declared > L5K > L5X > CSV**. ## Test plan - [x] `dotnet build src/ZB.MOM.WW.OtOpcUa.Driver.AbCip` + `Driver.AbCip.Cli` — clean (0 / 0) - [x] `dotnet test tests/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Tests` — **309 / 309 passed** (10 new in `CsvTagImporterTests`: RW mapping, ReadOnly mapping, blank/marker skip, quoted-comma, escaped-quote, name prefix, unknown-type → Structure, missing default device throws, full round-trip, column reordering) - [ ] Integration tests — skipped (live PLC required) 🤖 Auto-generated by the Mode-B execution loop. Closes #232. Closes #232
dohertj2 added 1 commit 2026-04-25 18:36:15 -04:00
CsvTagImporter / CsvTagExporter parse and emit Kepware-format AB CIP tag
CSVs (Tag Name, Address, Data Type, Respect Data Type, Client Access,
Scan Rate, Description, Scaling). Import maps Tag Name → AbCipTagDefinition.Name,
Address → TagPath, Data Type → DataType, Description → Description,
Client Access → Writable. Skips blank rows + ;/# section markers; honours
column reordering via header lookup; RFC-4180-ish quoting.

CsvImports collection on AbCipDriverOptions mirrors L5kImports/L5xImports
and is consumed by InitializeAsync (declared > L5K > L5X > CSV precedence).

CLI tag-export command dumps the merged tag table from a driver-options JSON
to a Kepware CSV — runs the same import-merge precedence the driver uses but
without contacting any PLC.

Tests cover R/W mapping, blank-row skip, quoted comma, escaped quote, name
prefix, unknown-type fall-through, header reordering, and a load → export →
reparse round-trip.

Closes #232
dohertj2 merged commit 27878d0faf into auto/driver-gaps 2026-04-25 18:36:20 -04:00
dohertj2 deleted branch auto/abcip/2.4 2026-04-25 18:36:20 -04:00
Sign in to join this conversation.