feat(platforms): implement Platform Registry as single source of truth#36
Merged
mischadiehm merged 5 commits intomainfrom Dec 26, 2025
Merged
feat(platforms): implement Platform Registry as single source of truth#36mischadiehm merged 5 commits intomainfrom
mischadiehm merged 5 commits intomainfrom
Conversation
…endor
Replace legacy firmware calls with “nw firmware {upgrade,downgrade,bios}”
Remove deprecated “nw config-backup”; use “nw backup config” everywhere
Add vendor capability hints: “nw firmware vendors” and “nw backup vendors”
Update supported platforms list for IP targets (add cisco_ios, nokia_srlinux)
Add vendor page: index.md and nav entry; fix nav “Installation”
Correct outdated sequence example to “nw run …”
Refresh vendor guides (Cisco, MikroTik) and Vendors overview
Tweak Scrapli expansion plan wording to match firmware namespace
Fix mkdocs.yml indentation/labels; docs-only changes
Replace scattered platform metadata with centralized registry system. Now adding platforms requires updating only one file instead of 10+. Core Implementation: - Created registry.py with Pydantic models (PlatformStatus, PlatformCapabilities, PlatformInfo) - PLATFORM_REGISTRY: 10 platforms (3 implemented, 3 sequences_only, 4 planned) - Deleted 3 constants.py files - registry is single source - Updated factory.py and operations classes to query registry - Updated config.py to use registry for device types CLI Commands: - nw platforms list (filter by status/vendor/capability) - nw platforms info <platform> - Rich tables with status indicators Documentation: - Auto-generation script (scripts/generate_platform_docs.py) - docs/adding-platforms.md (767 line contributor guide) - Updated multi-vendor-support.md and vendors/index.md with snippets Testing: - 49 registry tests (models, queries, validation, integrity) - 24 CLI tests (list filters, info, error handling) - All 73 platform tests passing CI/CD: - Added generate-docs task to Taskfile.yml - Added doc generation to GitHub Actions workflow Benefits: Single file updates, auto-generated docs, self-service CLI, type-safe validation
Integrate main branch changes with Platform Registry feature. Resolved conflicts: - .github/copilot-instructions.md: accepted main's phrasing - .github/workflows/docs.yml: merged both, kept validation + added platform doc gen - Taskfile.yml: merged task dependencies from both branches - docs/backups.md: accepted main (removed deprecated --store-results) - docs/multi-vendor-support.md: accepted main's CLI syntax - src/network_toolkit/cli.py: kept both register_sync and register_platforms Main branch additions merged: - API layer (12 modules) for CLI/Library separation - Inventory system (Nornir, SSH config sync) - Multi-inventory support and session pooling - LLM agent configurations - Extensive test coverage This branch additions preserved: - Platform Registry as single source of truth - nw platforms list/info CLI commands - Auto-generated platform documentation - Nokia SR Linux vendor page
- Add api/platforms.py with list_platforms() and get_platform_details() - Refactor commands/platforms.py to use API layer (CLI/Library separation) - Export platform API types from api/__init__.py - Fix broken doc links in generate_platform_docs.py (remove ../ prefix) - Add CLI docs generation step to docs.yml CI workflow - Fix outdated test expecting Cisco to not support config_backup - Add comprehensive unit tests for api/platforms.py (30 tests)
The vendor_list.md is included from docs/vendors/index.md via pymdownx.snippets. Links to vendor docs like 'vendors/mikrotik/index.md' were becoming 'vendors/vendors/mikrotik/index.md' (doubled prefix) when included. Strip the 'vendors/' prefix in generate_vendor_list() since the file is included from within the vendors/ directory.
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.
Overview
Implement a centralized Platform Registry that serves as the single source of truth for all platform metadata. Previously, platform information was scattered across 10+ files. Now adding a new platform requires updating only one file.
Core Implementation
PlatformStatus,PlatformCapabilities,PlatformInfo)constants.pyfiles - registry is now the single sourcefactory.pyand operations classes to query registryconfig.pyto use registry for device type validationCLI Commands
Python API
Auto-Generated Documentation
scripts/generate_platform_docs.pygenerates docs from registrydocs/.generated/are included via MkDocs snippetsNew Documentation
docs/adding-platforms.md: 800-line contributor guide with examples and checklistsdocs/multi-vendor-support.mdwith CLI examplesdocs/vendors/index.mdwith auto-generated vendor listTesting
Squash commit message
Test plan
network_toolkit.api