Open
Conversation
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.
Summary
This PR improves performance and fixes idempotence and diff-calculation issues in
dcnm_interface,dcnm_inventory, anddcnm_network. The changes focus on reducing expensive repeated controller calls, correcting merge behavior when controller payloads are incomplete, and preserving TOR attachments correctly across VPC and non-VPC topologies.Changes
dcnm_interface: Added bulk interface retrieval viaIF_WITH_SNOand introduced per-switch/per-interface caching so merged, deleted, and overridden workflows can avoid repeated per-interface GET calls.dcnm_interface: Prefetches interface policy details up front for targeted switches, including VPC and AA_FEX cases, so diff generation uses cached lookups instead of repeated controller round-trips.dcnm_interface: Reworked overridden-state lookup paths to use precomputed sets and dictionaries for direct interface, member, and VPC peer/member checks, reducing repeated linear scans during replace/default calculations.dcnm_interface: Flattened delete-deploy requests into a single deploy payload instead of posting multiple interface-type-specific deploy calls.dcnm_interface: Limited the extra follow-up deploy call tocheck_deploy=true, avoiding unnecessary deploy retries when deployment verification is not requested.dcnm_interface: Fixed merged diff handling when optionalnvPairskeys are missing from the current controller payload, so playbook-specified values such as native VLAN settings are still reconciled correctly.dcnm_inventory: Added cached inventory lookup by IP and cached POAP inventory lookup by serial number to eliminate repeated scans of controller responses.dcnm_inventory: Reused existing inventory data for already-known switches during create flows so the module can skip unnecessarytest-reachabilitycalls in idempotent and no-op scenarios.dcnm_inventory: Added helpers to iterate and group create payloads, then consolidated switch imports by shared role/configuration to reduce redundant work and improve diff formatting.dcnm_inventory: Optimized rediscovery, switch health polling, LAN credential lookup, and role assignment by replacing repeated nested loops with set- and dict-based lookups.dcnm_inventory: Batched ND role assignments into a single API call instead of posting per switch.dcnm_inventory: Reduced retry windows for role-assignment polling and config-save retries while keeping bounded retry behavior.dcnm_inventory: Fixed save/deploy-only reruns so a second merged call can still honorsaveanddeployeven when there is no new create diff.dcnm_network: Added logical-name inventory mapping so attachment parsing can distinguish leaf interface ports from TOR interface ports when readingportNamesfrom controller state.dcnm_network: Added VPC TOR normalization so one-sidedtor_portsintent in the playbook is mirrored across VPC peers before diffing.dcnm_network: Fixed merged TOR-port handling so merged updates append new TOR ports without dropping existing ones.dcnm_network: Preserved original attachment state during VPC peer backfill so merged and replaced flows do not accidentally blank peer TOR attachments.dcnm_network: Improved parsing of controller attachment state so TOR-only and mixed leaf/TOR attachment strings are converted back into the correct internal model.Test Coverage
dcnm_interfacebulk-fetch caching, grouped interface payloads, overridden-state lookup behavior, and the merged missing-native-VLAN regression.dcnm_networkTOR attachment handling, including:tests/integration/targets/dcnm_network/tests/dcnm/standalone/merged.yamlto validate merged behavior, preserved TOR ports, controller query state, and idempotence across all three supported TOR topologies.Impact