feat: add multi-vendor driver framework and Ciena 6500 TL1 model - #2
Merged
Merged
Conversation
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>
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.
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-authto 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_iosdriver, with the shared response-delay / fault-injection / metrics machinery factored into helpers both drivers call.What's new
internal/sshsrv/driver.go): a per-device personality resolved at session start from the manifesttemplatecolumn (previously written but unused at runtime). New vendors are one self-contained file. Shared across drivers: response-delay jitter, the three stream faults, zero-copyConfigOutputstreaming, and thecommand_duration/bytes_sentmetrics. Driver-owned: greeting/prompt, command read-unit, grammar/dispatch, and SSH-auth requirement.driver_ciena.go,internal/configs/ciena.go): bare<prompt, in-bandACT-USER::<user>:<ctag>::<pass>;login gate (anything before a valid login returns TL1DENY), and;-terminatedRTRV-*verbs (EQPT,ALM-ALL,COND-ALL,ACTIVE-USER,SW-VER,SYS) returningCOMPLD/DENY.RTRV-EQPT::ALLstreams a deterministic, generated 7-slot shelf inventory zero-copy via mmap; the other verbs are synthesized at runtime.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 manifestvendor/templatecolumns now reflect the per-device model.--ssh-auth password|driver|none: models TL1-only access (no SSH challenge;ACT-USERis the only gate) vs SSH login + TL1. Each driver declaresRequiresSSHAuth()(Cisco yes, Ciena no);drivermode consults it so mixed Cisco/Ciena fleets behave correctly.--ssh-authflag, and theciena-6500-tl1model under Configuration templates.Compatibility
No breaking changes. No CSV schema change (the
vendor/templatecolumns already existed), no renamed flags/buckets/metric label keys, and Cisco generated bytes + wire output are byte-identical. New TL1commandlabel values are additive and stay within the asserted cardinality bound. Release: v0.0.3 (pre-1.0 patch).Tests
COMPLD/DENYrendering, unknown-verb handling.--ssh-authmode × driver matrix (unit) plus over-the-wire no-auth tests, including the negative case (a Cisco device rejects a no-auth client underdrivermode).ACT-USERlogin,RTRV-EQPTstreaming, pre-loginDENY, multi-line command, and the no-auth scenarios.Gate green:
go fmt/vet/build/test ./...andgo test -tags integration ./.... Flakiness probe (5× each) clean.🤖 Generated with Claude Code