nd_interface_port_channel_trunk_host#270
Open
allenrobel wants to merge 13 commits into
Open
Conversation
39e151c to
4e69ab6
Compare
835edb8 to
6e2ccb3
Compare
4e69ab6 to
b861768
Compare
akinross
reviewed
May 5, 2026
6e2ccb3 to
bdd7390
Compare
b861768 to
55fb7a3
Compare
bdd7390 to
532a0ff
Compare
55fb7a3 to
1770181
Compare
532a0ff to
b741c2c
Compare
1770181 to
9eacb19
Compare
a6b89bd to
bba871b
Compare
22ea587 to
6009d17
Compare
6009d17 to
c6c9b99
Compare
bba871b to
5baf130
Compare
c6c9b99 to
6465a0f
Compare
5baf130 to
6421474
Compare
6feffd8 to
1e1d26d
Compare
274aae3 to
a0eb2e2
Compare
1e1d26d to
69c77c5
Compare
69c77c5 to
b993187
Compare
01d4292 to
3061435
Compare
3061435 to
31f1f7c
Compare
31f1f7c to
b8f83bc
Compare
b8f83bc to
a042e60
Compare
Mirrors nd_interface_port_channel_access structure for the trunkPoHost policy type. 42-field policy model covers the full ND OpenAPI intPortChannelTrunkHostTemplate superset, including bandwidth, linkType, negotiateAuto, vlan_mapping/dot1q-tunnel, and storm-control float fields. policyType is hardcoded to "trunkPoHost" and not exposed in the argspec. Integration tests cover merged/replaced/overridden/deleted, member uniqueness ordering, and a non-9000v vlan_mapping block. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Covers PortChannelTrunkHostInterfaceModel and PortChannelTrunkHostInterfaceOrchestrator: field defaults, snake_case/camelCase construction, allowed_vlans regex (with int->str coercion for ND's single-id-as-int responses), native_vlan/bandwidth/inherit_bandwidth range checks, AsciiDescription, storm-control float-from-string coercion, vlan_mapping entries, composite identifier round-trips, hardcoded policyType, query_all filtering to trunkPoHost only. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Add module docstring, scope a wrong-import-position disable to the post-DOCUMENTATION import block, and replace dict() call with a literal. Pylint score now 10.00/10. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Addressed #270 (comment)
Replace shape-only regex with Annotated types (AllowedVlans, CustomerVlanIdList) backed by a shared per-token validator that enforces VLAN ids in 1..4094 and rejects reversed ranges. Addresses review feedback on lines 57-58 of port_channel_trunk_host_interface.py and closes the same gap on customer_vlan_id. Mark both types with a TODO to consolidate into models/types.py once sibling branches merge. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
VlanId (1..4094) recurs as Field(ge=1, le=4094) on multiple fields across the interface family. Defer the cleanup to the same post-merge PR that introduces AllowedVlans / CustomerVlanIdList in models/types.py. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Address review comment requesting that the valid VLAN id range (1-4094) be stated in the module docstring. The model validators already enforce this range; this only updates the user-facing documentation for parity with native_vlan and similar fields. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Address review comment asking why only merged and deleted examples were shown. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Replace verbatim-repeated module argument blocks (check / normal / idempotent runs of the same call) with YAML anchors. Reduces ~140 lines of duplication across deleted, merged, replaced, overridden, and vlan_mapping task files, and removes a class of typo where one of the duplicated blocks could drift from its siblings. Anchors are defined at first use within each section to keep them local to the reader.
Move the top-of-file SETUP block from merged.yaml (delete port-channel501/502/503) into a dedicated tasks/setup.yaml and call it from main.yaml before the state-test blocks. Makes the orchestration explicit and keeps merged.yaml focused on its state. Intra-test setup that's coupled to specific tests stays inline: - Reset-to-baseline before the membership tests in merged.yaml - port-channel504 cleanup after the no-deploy test in merged.yaml - vlan_mapping.yaml's local SETUP/CLEANUP for port-channel501
…y_all tests validate_for_mutation reads freeze status from cached fabric_summary (see fabric_context.py:166), so query_all no longer issues a separate GET to /deploymentFreeze. The extra _freeze response was being consumed by the next request in the sequence, breaking the happy-path test (00400) and silently masking the no-match (00410) and switch-404 (00430) tests. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…arg spec Same change as ethernet_access (5ecd435): drop interface_type, mode, and network_os_type from get_argument_spec() and DOCUMENTATION; narrow each in the Pydantic model to Literal[<value>] (or keep the existing Enum for policy_type) and add Field(frozen=True) so the values are immutable post-construction. Updates the argspec assertion test, the interface_type/mode existence tests, and the network_os_type test to verify the Literal lock instead of accepting "ios-xe". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
YAML 1.1 parses an unquoted `on` as the boolean True, so the DOCUMENTATION block's `choices: [ on, active, passive ]` resolved to `[True, 'active', 'passive']` while the argument_spec correctly used the string 'on'. This tripped two ansible-test validate-modules checks: doc-choices-do-not-match-spec and doc-choices-incompatible-type. Quote 'on' so the documented choices parse as strings and match the spec. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
a042e60 to
297e66c
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)
N/A
Proposed Changes
nd_interface_port_channel_trunk_hostAnsible module managingtrunkPoHostport-channel interfaces on Cisco Nexus Dashboard 4.2.nd_interface_port_channel_accessstructure: composite identifier (switch_ip,interface_name),policyTypehardcoded to"trunkPoHost"and not exposed in argspec, full ND OpenAPIintPortChannelTrunkHostTemplatefield set (42 policy fields includingbandwidth,link_type,negotiate_auto,vlan_mappingwith selective dot1q-tunnel, storm-control float fields).TrunkPoHostPolicyTypeEnum,LinkTypeEnuminplugins/module_utils/models/interfaces/enums.py.PortChannelBaseOrchestrator; managed policy types filter to{"trunkPoHost"}only.state: overriddendeletes viainterfaceActions/remove(mirrors access PC);state: querydeferred consistent with current parity stance.allowed_vlansregex withint -> strcoercion for ND's single-id-as-int responses), AsciiDescription, storm-control float-from-string coercion, vlan_mapping entries, composite identifier round-trips, andquery_allfiltering.vlan_mappingblock guarded bynd_test_platform.Test Notes
pytest tests/unit/module_utils/ -k port_channel_trunk_host -v(156 passed). Full suite (pytest tests/unit/): 705 passed, no regressions.blackandpylintclean (matching access PC scoring).vlan_mappingblock skipped on 9000v as expected.policyType: "trunkPoHost"and accepts the model's payload shape (verified with POST/GET/PUT/DELETE round-trip during development).allowedVlansas a JSON int rather than string; the model coercesint -> strin amode='before'validator and a unit test locks the behavior.Cisco Nexus Dashboard Version
4.2
Related ND API Resource Category
Checklist
Stacking
This PR is stacked on top of #269 (
nd_interface_port_channel_access). Base branch isnd_interface_port_channel_access; merge after #269 lands.🤖 Generated with Claude Code