-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Labels
v4-enhancementEnhancement planned for hier_config v4.0.0Enhancement planned for hier_config v4.0.0
Description
Description
Currently get_hconfig_view() in constructors.py uses a hardcoded isinstance chain to map drivers to views. Only 5 of 10 platforms have views; the rest raise ValueError. With #226 introducing driver registration, views should follow the same pattern.
Proposed Change
Add a view_class parameter to register_driver() or a separate register_view():
# Option A: view_class on register_driver
register_driver("MY_NOS", MyNOSDriver, view_class=MyNOSView)
# Option B: separate register_view
register_view(Platform.CISCO_IOS, HConfigViewCiscoIOS)Built-in views are registered at import time alongside their drivers. get_hconfig_view() reads from the registry instead of using isinstance checks.
Benefits
- Users can provide views for custom platforms
- Users can override built-in views
- Eliminates the hardcoded isinstance chain in constructors.py
get_hconfig_view()returnsNone(or raises a clear error) for platforms without views instead of a generic ValueError
Related
- v4: Driver registration system for user-defined and override drivers #226 (driver registration system)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
v4-enhancementEnhancement planned for hier_config v4.0.0Enhancement planned for hier_config v4.0.0