nd_interface_subinterface_managed#296
Open
allenrobel wants to merge 2 commits into
Open
Conversation
8 tasks
25234e8 to
34ff7cc
Compare
d6ffd4d to
fe87d36
Compare
34ff7cc to
a9585f0
Compare
fe87d36 to
28b57a4
Compare
a9585f0 to
c0cfd8d
Compare
28b57a4 to
0a92a71
Compare
c0cfd8d to
27070bc
Compare
0a92a71 to
c85f5d4
Compare
27070bc to
5013a1e
Compare
c85f5d4 to
f5ebacf
Compare
5013a1e to
3b0704c
Compare
f5ebacf to
8c05c0d
Compare
3b0704c to
a73e6bf
Compare
8c05c0d to
b63fa6f
Compare
a73e6bf to
51e9005
Compare
b63fa6f to
ec2060a
Compare
Manages L3 (managed) subinterfaces on Cisco Nexus Dashboard via the Manage Interfaces API. Mirrors the SVI / loopback / ethernet-access patterns: composite identifier (switch_ip, interface_name), bulk POST per switch, partial PUT, bulk remove via interfaceActions/remove followed by interfaceActions/deploy. The subinterface family of policies is split into two modules per the one-policy-per-module convention. This commit covers the managed variant (policyType: subinterface) which carries the L3 field set: admin_state, description, extra_config, mtu, vlan_id, vrf_interface, ip/prefix, ipv6/ipv6_prefix, routing_tag, ip_redirects, pim_sparse, pim_dr_priority, netflow, netflow_monitor, netflow_sampler. The unmanaged variant (policyType: monitorSubinterface) will follow as a separate module stacked on top of this one. Field bounds are aligned with the live intSubifTemplate schema on ND 4.2.1 (prefix 8-31, vlan_id 2-4094, mtu 576-9216). Two wire quirks worked around in the model: - routing_tag: ND accepts string on POST/PUT but returns int on GET. Coerce int -> str so round-trips compare equal. Marked TODO(4.2.1). - interface_name: ND accepts canonical case on POST (Ethernet1/3.2) but returns lowercase on GET (ethernet1/3.2, port-channel10.5). The field validator now accepts any case and normalizes to the canonical form so user input, POST payloads, and GET responses all compare equal. Marked TODO(4.2.1). One handler-layer workaround in the orchestrator: - ND returns HTTP 207 Multi-Status with per-item status: "failed" when the parent interface is not in routed mode (or other policy validation fails). Our RestSend response_handler classifies 207 as success, so without this check the orchestrator would silently report changed=True with nothing actually created. create() and create_bulk() now inspect the body and raise with the ND failure message. To be removed once #295 lands at the RestSend layer. The module's `notes:` documents the parent-must-be-routed prerequisite, including why typical L2 vPC port-channels and peer-links reject subinterface creation in practice. Test notes: integration target covers merged/replaced/overridden/ deleted lifecycles plus check-mode and idempotency assertions, on both Ethernet and Port-channel parents. Live-verified against ND 4.2.1 lab SITE1 with a routed Port-channel parent and a routed Ethernet parent. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
51e9005 to
59b26ee
Compare
ec2060a to
94796ca
Compare
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.
Related Issue(s)
References #295 (the 207-status:failed silent-success bug in
response_handler_nd.pyis worked around in this module via_raise_on_multi_status_failures; remove the workaround when #295 lands).Proposed Changes
nd_interface_subinterface_managedmodule to manage L3 subinterfaces (managed variant,policyType: subinterface) on Cisco Nexus Dashboard 4.2.SubinterfaceManagedInterfaceModel(Pydantic v2 via the project'spydantic_compatshim) andSubinterfaceManagedInterfaceOrchestrator, both following the loopback / SVI / ethernet-access patterns.(switch_ip, interface_name); bulk POST per switch; partial PUT; bulk remove viainterfaceActions/removefollowed byinterfaceActions/deploy.nd_interface_svi; the unmanaged-variant module (policyType: monitorSubinterface) follows as a separate PR stacked on this one.L3 field set:
admin_state,description,extra_config,mtu,vlan_id,vrf_interface,ip,prefix,ipv6,ipv6_prefix,routing_tag,ip_redirects,pim_sparse,pim_dr_priority,netflow,netflow_monitor,netflow_sampler.Test Notes
Ethernet1/3andPort-channel10onS1_TOR1).ansible-test sanity --dockerclean on the touched files.notes:.routing_tagis echoed as int on GET despite being string on POST/PUT — model has amode='before'validator coercing int → str. MarkedTODO(4.2.1).interface_nameechoed lowercased on GET — field validator canonicalizes toEthernet.../Port-channel...so idempotency comparisons work.Cisco Nexus Dashboard Version
4.2.1
Related ND API Resource Category
Checklist
🤖 Generated with Claude Code