Skip to content

nd_interface_subinterface_unmanaged#297

Open
allenrobel wants to merge 14 commits into
nd_interface_subinterface_managedfrom
nd_interface_subinterface_unmanaged
Open

nd_interface_subinterface_unmanaged#297
allenrobel wants to merge 14 commits into
nd_interface_subinterface_managedfrom
nd_interface_subinterface_unmanaged

Conversation

@allenrobel
Copy link
Copy Markdown
Collaborator

Related Issue(s)

References #295 (the 207-status:failed silent-success bug in response_handler_nd.py is worked around in this module via _raise_on_multi_status_failures; remove the workaround when #295 lands).

Note: This PR is stacked on #296 (nd_interface_subinterface_managed). Please review #296 first; this PR will be retargeted to develop and rebased once #296 merges.

Proposed Changes

  • Add the nd_interface_subinterface_unmanaged module to manage L3 subinterfaces in monitor mode (unmanaged variant, policyType: monitorSubinterface) on Cisco Nexus Dashboard 4.2.
  • Add SubinterfaceUnmanagedInterfaceModel and SubinterfaceUnmanagedInterfaceOrchestrator, mirroring the managed variant's structure but with the policy body reduced to its policyType discriminator only.
  • All scaffolding fields (interface_type, mode, network_os_type, policy_type) are hardcoded via Literal[...] + Field(frozen=True) and hidden from the user-facing argument spec. The user supplies only switch_ip and interface_name per item.
  • query_all filters on policyType in {monitorSubinterface} via a dedicated SubinterfaceUnmanagedPolicyTypeEnum, so managed and unmanaged subinterfaces are cleanly partitioned across the two modules.
  • Defensive extra="ignore" on the policy model absorbs any read-only fields ND echoes under policy on GET (e.g. the schema's userDefined discriminator branch siblings).
  • Orchestrator unit tests at 98% coverage (23 tests, including the _raise_on_multi_status_failures matrix and a positive assertion that query_all filters out the managed subinterface policyType).
  • Integration test target with sub-id range .20-.29 to coexist with the managed target's .2-.5 range. Phases: merged (single, multi, Port-channel parent, idempotency), replaced (no-op on existing + fall-back-to-create on missing), overridden (fabric-wide reduce), deleted.

Test Notes

  • Integration tests pass on ND 4.2.1 lab SITE1 against routed-mode parents (Ethernet1/3 and Port-channel10 on S1_TOR1). Both managed and unmanaged targets were run successfully back-to-back to confirm the sub-id ranges do not collide.
  • 23 unit tests pass (python -m pytest tests/unit/module_utils/orchestrators/test_subinterface_unmanaged_interface.py).
  • ansible-test sanity --docker clean on the touched files.
  • Two carried-over ND 4.2.1 wire workarounds:
    • Parent must be in routed (L3) mode — same as managed; surfaced via _raise_on_multi_status_failures and documented in notes:.
    • interface_name echoed lowercased on GET — same normalize_interface_name field validator pattern as the managed variant.
  • The routing_tag int→str workaround does NOT apply here (no policy fields with that name in the unmanaged body).

Cisco Nexus Dashboard Version

4.2.1

Related ND API Resource Category

  • analyze
  • infra
  • manage
  • onemanage
  • other

Checklist

  • Latest commit is rebased from develop with merge conflicts resolved
  • New or updates to documentation has been made accordingly
  • Assigned the proper reviewers

🤖 Generated with Claude Code

@allenrobel allenrobel changed the title Add nd_interface_subinterface_unmanaged module nd_interface_subinterface_unmanaged May 28, 2026
@allenrobel allenrobel force-pushed the nd_interface_subinterface_managed branch from d6ffd4d to fe87d36 Compare May 28, 2026 17:34
@allenrobel allenrobel force-pushed the nd_interface_subinterface_unmanaged branch from c2c53a1 to c83a9f2 Compare May 28, 2026 17:34
@allenrobel allenrobel force-pushed the nd_interface_subinterface_managed branch from fe87d36 to 28b57a4 Compare May 28, 2026 17:56
@allenrobel allenrobel force-pushed the nd_interface_subinterface_unmanaged branch from c83a9f2 to 6edb32c Compare May 28, 2026 17:56
@allenrobel allenrobel force-pushed the nd_interface_subinterface_managed branch from 28b57a4 to 0a92a71 Compare May 28, 2026 18:15
@allenrobel allenrobel force-pushed the nd_interface_subinterface_unmanaged branch from 6edb32c to f209152 Compare May 28, 2026 18:15
@allenrobel allenrobel force-pushed the nd_interface_subinterface_managed branch from 0a92a71 to c85f5d4 Compare May 29, 2026 17:54
@allenrobel allenrobel force-pushed the nd_interface_subinterface_unmanaged branch from f209152 to 0892797 Compare May 29, 2026 17:54
@allenrobel allenrobel force-pushed the nd_interface_subinterface_managed branch from c85f5d4 to f5ebacf Compare May 29, 2026 20:20
@allenrobel allenrobel force-pushed the nd_interface_subinterface_unmanaged branch from 0892797 to cfd6e5e Compare May 29, 2026 20:20
@allenrobel allenrobel force-pushed the nd_interface_subinterface_managed branch from f5ebacf to 8c05c0d Compare May 29, 2026 22:13
@allenrobel allenrobel force-pushed the nd_interface_subinterface_unmanaged branch from cfd6e5e to ceb752b Compare May 29, 2026 22:13
@allenrobel allenrobel force-pushed the nd_interface_subinterface_managed branch from 8c05c0d to b63fa6f Compare May 29, 2026 22:36
@allenrobel allenrobel force-pushed the nd_interface_subinterface_unmanaged branch from ceb752b to 0140a79 Compare May 29, 2026 22:36
@allenrobel allenrobel force-pushed the nd_interface_subinterface_managed branch from b63fa6f to ec2060a Compare May 29, 2026 22:46
@allenrobel allenrobel force-pushed the nd_interface_subinterface_unmanaged branch from 0140a79 to 26f876c Compare May 29, 2026 22:46
allenrobel and others added 4 commits May 29, 2026 12:47
Sibling to SubinterfaceManagedPolicyTypeEnum. One value: monitorSubinterface.
Used by the upcoming nd_interface_subinterface_unmanaged module.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Pydantic model for the unmanaged-variant L3 subinterface. Mirrors the
managed model's nesting (configData/networkOS/policy) but the policy
body carries only policyType=monitorSubinterface. Scaffolding fields
hardcoded via Literal+frozen and excluded from the arg spec per the
frozen-scaffolding convention.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…lding

Class signature, ClassVars, _raise_on_multi_status_failures helper.
Test file boilerplate and an empty fixture file with TEST_NOTES.
Body methods follow in subsequent commits, TDD-style.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Seven cases covering success/failed/error/empty/missing/none/non-dict.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
allenrobel and others added 10 commits May 29, 2026 12:47
Covers happy path, 207 status:failed raise, and 500 _request failure.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Covers happy path and 500 _request failure.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Queues remove + deploy; covers happy path and unknown-switch-IP error.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Groups by switch, one POST per switch, covers 207 success and 500 failure.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Queues remove + deploy for each instance; no API calls until remove_pending/deploy_pending.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
query_one, query_all (filtering for monitorSubinterface only), and the
remaining CRUD methods. Coverage at 98% on the orchestrator file.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Wires SubinterfaceUnmanagedInterfaceModel + Orchestrator into the
NDStateMachine. DOCUMENTATION exposes only switch_ip + interface_name
under config; all scaffolding is hidden.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
ansible-test sanity runs pylint against py3.8 compat, which rejects
PEP 604 X | None syntax at file scope. The future-annotations import
makes all annotations lazy strings; runtime behavior unchanged.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Mirrors the managed sibling's structure. Sub-id .20-.29 range to avoid
collision with the managed target's .2-.5 range so both targets can run
on the same testbed without interference.

Phases:
- setup: bulk cleanup
- merged: create Ethernet + Port-channel subinterfaces, multi-item task,
  idempotency on re-apply
- replaced: no-op on existing (no user-configurable fields to overwrite);
  fall-back-to-create on missing; idempotency on re-apply
- overridden: reduce to subset, assert removed entries are gone, idempotency
- deleted: delete single, idempotency, bulk teardown

Requires parents in routed (L3) policy on the target switch:
- Ethernet1/3 in a routed Ethernet policy (e.g. routedHost)
- Port-channel10 in l3PortChannel

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@allenrobel allenrobel force-pushed the nd_interface_subinterface_managed branch from ec2060a to 94796ca Compare May 29, 2026 22:48
@allenrobel allenrobel force-pushed the nd_interface_subinterface_unmanaged branch from 26f876c to 0864073 Compare May 29, 2026 22:48
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.

1 participant