Enhancing Fabric Type Support for Switches Module#405
Conversation
|
@AKDRG — a heads-up and a question, not a request to change anything here. This PR is doing the right thing; the collision is on my side. Situation. In #404 I added a Proposal. Promote This shouldn't cost you anything. Done as a move + re-export — leaving The question I actually want your read on. Your enums look deliberately endpoint-scoped — One detail either way: Happy to do the move in #404 if you're good with it, or leave it to you if you'd rather own that file. |
get_platform_type() resolves via PlatformTypeEnum(raw) inside a try/except ValueError, falling through to None for any value the enum does not know. With SONIC absent, a SONiC switch silently reported "no platform type" rather than its actual platform -- the exact failure the enum exists to prevent. Found while checking PlatformTypeEnum against develop's pre-existing PlatformType (plugins/module_utils/models/manage_switches/enums.py), which has carried SONIC all along. Whether the two enums converge is an open question being discussed with @AKDRG on #405; this gap is a defect either way, so fix it now rather than leave it pending that outcome. If PlatformTypeEnum is later dropped in favor of a promoted PlatformType, this member goes with it. Test: extends 00230 with a fourth switch reporting platformType "sonic", asserting it resolves to PlatformTypeEnum.SONIC. Verified to fail against the unfixed enum (AttributeError: type object 'PlatformTypeEnum' has no attribute 'SONIC'). module_utils suite green: 3036 passed. black/isort/pylint/mypy clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aJ3Y2TJEAqJZBeUKdUnGa
get_platform_type() resolves via PlatformTypeEnum(raw) inside a try/except ValueError, falling through to None for any value the enum does not know. With SONIC absent, a SONiC switch silently reported "no platform type" rather than its actual platform -- the exact failure the enum exists to prevent. Found while checking PlatformTypeEnum against develop's pre-existing PlatformType (plugins/module_utils/models/manage_switches/enums.py), which has carried SONIC all along. Whether the two enums converge is an open question being discussed with @AKDRG on #405; this gap is a defect either way, so fix it now rather than leave it pending that outcome. If PlatformTypeEnum is later dropped in favor of a promoted PlatformType, this member goes with it. Test: extends 00230 with a fourth switch reporting platformType "sonic", asserting it resolves to PlatformTypeEnum.SONIC. Verified to fail against the unfixed enum (AttributeError: type object 'PlatformTypeEnum' has no attribute 'SONIC'). module_utils suite green: 3036 passed. black/isort/pylint/mypy clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aJ3Y2TJEAqJZBeUKdUnGa
allenrobel
left a comment
There was a problem hiding this comment.
Code review
Four findings, each as an inline comment: endpoint-import coupling in shared utils.py, role: None rejected by the new fabric-capability validation, a now-dead all_preserve_config flag, and an undocumented ValueError in normalize_platform_type.
🤖 Generated with Claude Code
get_platform_type() resolves via PlatformTypeEnum(raw) inside a try/except ValueError, falling through to None for any value the enum does not know. With SONIC absent, a SONiC switch silently reported "no platform type" rather than its actual platform -- the exact failure the enum exists to prevent. Found while checking PlatformTypeEnum against develop's pre-existing PlatformType (plugins/module_utils/models/manage_switches/enums.py), which has carried SONIC all along. Whether the two enums converge is an open question being discussed with @AKDRG on #405; this gap is a defect either way, so fix it now rather than leave it pending that outcome. If PlatformTypeEnum is later dropped in favor of a promoted PlatformType, this member goes with it. Test: extends 00230 with a fourth switch reporting platformType "sonic", asserting it resolves to PlatformTypeEnum.SONIC. Verified to fail against the unfixed enum (AttributeError: type object 'PlatformTypeEnum' has no attribute 'SONIC'). module_utils suite green: 3036 passed. black/isort/pylint/mypy clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aJ3Y2TJEAqJZBeUKdUnGa
allenrobel
left a comment
There was a problem hiding this comment.
LGTM after comments were addressed.
Proposed Changes
This PR improves nd_manage_switches support for fabric-specific switch onboarding by adding fabric capability validation, exposing supported switch platform types, and improving lifecycle output visibility for config-save and deploy operations.
Changes
Test Notes
Validated against live controller
pytest tests/unit/module_utils/test_nd_switch_resources.py -q
44 passed
Cisco Nexus Dashboard Version
4.2(1)
Related ND API Resource Category
Checklist