Skip to content

feat: add multi-vendor driver framework and Ciena 6500 TL1 model - #2

Merged
stephenstack merged 3 commits into
mainfrom
feat/multi-vendor-ciena-tl1
Jun 6, 2026
Merged

stephenstack merged 3 commits into
mainfrom
feat/multi-vendor-ciena-tl1

Conversation

@stephenstack

Copy link
Copy Markdown
Collaborator

Summary

Adds a pluggable per-device driver framework so the SSH simulator can present multiple vendor personalities, and ships the first non-Cisco model: Ciena 6500 7-slot optical (TL1). Also adds --ssh-auth to model both real-world TL1 access patterns.

Cisco IOS behaviour is preserved byte-for-byte — the existing session loop was extracted verbatim into the cisco_ios driver, with the shared response-delay / fault-injection / metrics machinery factored into helpers both drivers call.

What's new

  • Driver framework (internal/sshsrv/driver.go): a per-device personality resolved at session start from the manifest template column (previously written but unused at runtime). New vendors are one self-contained file. Shared across drivers: response-delay jitter, the three stream faults, zero-copy ConfigOutput streaming, and the command_duration / bytes_sent metrics. Driver-owned: greeting/prompt, command read-unit, grammar/dispatch, and SSH-auth requirement.
  • Ciena 6500 TL1 (driver_ciena.go, internal/configs/ciena.go): bare < prompt, in-band ACT-USER::<user>:<ctag>::<pass>; login gate (anything before a valid login returns TL1 DENY), and ;-terminated RTRV-* verbs (EQPT, ALM-ALL, COND-ALL, ACTIVE-USER, SW-VER, SYS) returning COMPLD/DENY. RTRV-EQPT::ALL streams a deterministic, generated 7-slot shelf inventory zero-copy via mmap; the other verbs are synthesized at runtime.
  • Generator model registry (internal/configs/generator.go): the Cisco size buckets are generalised into a model registry. Select Ciena via --distribution "sm:50,ciena-6500-tl1:50". The manifest vendor/template columns now reflect the per-device model.
  • --ssh-auth password|driver|none: models TL1-only access (no SSH challenge; ACT-USER is the only gate) vs SSH login + TL1. Each driver declares RequiresSSHAuth() (Cisco yes, Ciena no); driver mode consults it so mixed Cisco/Ciena fleets behave correctly.
  • Docs: new Architecture subsection on the driver model, a Ciena TL1 data-flow, the --ssh-auth flag, and the ciena-6500-tl1 model under Configuration templates.

Compatibility

No breaking changes. No CSV schema change (the vendor/template columns already existed), no renamed flags/buckets/metric label keys, and Cisco generated bytes + wire output are byte-identical. New TL1 command label values are additive and stay within the asserted cardinality bound. Release: v0.0.3 (pre-1.0 patch).

Tests

  • Characterization tests pinning the Cisco greeting / enable-mode / session-close before the refactor — the regression gate for the byte-for-byte extraction.
  • TL1 unit tests: command parsing, login gate, COMPLD/DENY rendering, unknown-verb handling.
  • --ssh-auth mode × driver matrix (unit) plus over-the-wire no-auth tests, including the negative case (a Cisco device rejects a no-auth client under driver mode).
  • Integration: ACT-USER login, RTRV-EQPT streaming, pre-login DENY, multi-line command, and the no-auth scenarios.

Gate green: go fmt/vet/build/test ./... and go test -tags integration ./.... Flakiness probe (5× each) clean.

🤖 Generated with Claude Code

rconfig and others added 3 commits June 6, 2026 18:58
Introduce a per-device "driver" abstraction so the SSH server can present
different vendor personalities. The driver is selected at session start from
the manifest `template` column (previously written but unused at runtime), and
each vendor is one self-contained file. Cisco IOS behaviour is preserved
byte-for-byte (extracted verbatim into the cisco_ios driver; the shared
response-delay, fault-injection, and metrics machinery factored into helpers
both drivers call).

Add the first non-Cisco model, ciena-6500-tl1: a TL1 personality over SSH with
a bare `<` prompt, an in-band ACT-USER login gate, and `;`-terminated RTRV-*
verbs returning COMPLD/DENY blocks. The generator emits a deterministic
RTRV-EQPT::ALL shelf inventory per device, mmap-streamed zero-copy at runtime.
The generator's size buckets are generalised into a model registry so new
vendors/models are one registry entry plus a template.

Add --ssh-auth (password|driver|none) to model both real-world TL1 access
patterns: TL1-only (no SSH challenge; ACT-USER is the only gate) and SSH login
then TL1. Each driver declares RequiresSSHAuth() (Cisco yes, Ciena no), which
the driver mode consults so mixed fleets behave correctly.

No breaking changes: no CSV schema change (vendor/template columns already
existed), no renamed flags/buckets/metric keys, and Cisco generated bytes and
wire output are identical. New TL1 command label values are additive and stay
within the asserted cardinality bound.

Tests: characterization tests pinning the Cisco greeting/enable/close before
the refactor; TL1 unit tests (parsing, login gate, block rendering); the
ssh-auth mode matrix; and integration tests covering ACT-USER login, RTRV-EQPT
streaming, pre-login DENY, multi-line commands, and the no-auth scenarios.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add an Architecture subsection describing the per-device driver abstraction
(shared response/fault/metrics machinery vs driver-owned greeting/prompt/
read-unit/dispatch), a driver comparison table, and how to add a vendor. Add a
parallel Ciena TL1 data-flow alongside the Cisco one, and point the roadmap's
"more vendors" item at the framework.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
x/crypto 0.45.0 and x/sys 0.38.0 declare go 1.24.0, and go.mod requires the
same, so 1.22 and 1.23 cannot satisfy the directive (the 1.22 job failed; the
1.23 job only "passed" by auto-downloading the 1.24 toolchain). Set the matrix
to the real floor plus the latest stable. Update the README badge/prerequisite
and note the Go 1.24 floor in the changelog.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@stephenstack
stephenstack merged commit 217d7b2 into main Jun 6, 2026
2 checks passed
@stephenstack
stephenstack deleted the feat/multi-vendor-ciena-tl1 branch June 7, 2026 05:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants