Skip to content

Performance Improvements and Bug Fixes#662

Open
mikewiebe wants to merge 7 commits intodevelopfrom
int_perf_updates
Open

Performance Improvements and Bug Fixes#662
mikewiebe wants to merge 7 commits intodevelopfrom
int_perf_updates

Conversation

@mikewiebe
Copy link
Copy Markdown
Collaborator

@mikewiebe mikewiebe commented Apr 6, 2026

Summary

This PR improves performance and fixes idempotence and diff-calculation issues in dcnm_interface, dcnm_inventory, and dcnm_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 via IF_WITH_SNO and 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 to check_deploy=true, avoiding unnecessary deploy retries when deployment verification is not requested.
  • dcnm_interface: Fixed merged diff handling when optional nvPairs keys 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 unnecessary test-reachability calls 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 honor save and deploy even 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 reading portNames from controller state.
  • dcnm_network: Added VPC TOR normalization so one-sided tor_ports intent 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

  • Added and updated unit coverage for dcnm_interface bulk-fetch caching, grouped interface payloads, overridden-state lookup behavior, and the merged missing-native-VLAN regression.
  • Added unit fixtures and regression tests for dcnm_network TOR attachment handling, including:
    • VPC leaf pair connected to a TOR pair
    • VPC leaf pair connected to a single TOR
    • Single leaf connected to a single TOR
    • TOR-only merged updates and idempotence
  • Expanded integration coverage in tests/integration/targets/dcnm_network/tests/dcnm/standalone/merged.yaml to validate merged behavior, preserved TOR ports, controller query state, and idempotence across all three supported TOR topologies.

Impact

  • Improves controller interaction efficiency for large interface and inventory operations.
  • Fixes merged-state behavior when current controller payloads omit optional interface keys.
  • Fixes TOR attachment merge and replace behavior so existing TOR ports are not removed unexpectedly.
  • Strengthens unit and integration coverage around the performance changes and TOR/VPC attachment regressions.

@mikewiebe mikewiebe changed the title Int perf updates Performance Improvements and Bug Fixes Apr 6, 2026
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