Add nd_interface_loopback module with integration tests#220
Open
allenrobel wants to merge 19 commits intond42_integrationfrom
Open
Add nd_interface_loopback module with integration tests#220allenrobel wants to merge 19 commits intond42_integrationfrom
allenrobel wants to merge 19 commits intond42_integrationfrom
Conversation
1. Team decided not to allow switch level deploy in resource modules.
- Removed deploy_type parameter and use only interface-level deploy endpoint.
- Updated module documentation
2. Leverage bulk endpoint for interface deletion.
POST …interfaceActions/remove
3. Remove single-interface DELETE endpoint
DELETE …interfaces/{interface_name}
4. Add initial unit tests for nd_interface_loopback
* Update galaxy.yml * Update galaxy.yml
* update actions jobs to normalize names, steps, and python/ansible matrix * update job name typo for galaxy-importer * update on push & pr targets * fix ansible version var reference name * update actions package and collection name based on python and ansible versions * update galaxy-importer-log per python/ansible version * remove ansible-core 2.15 from actions * remove scheduler for time being * update actions package versions * update unit test name and fix coverage misspelling * uncomment but disable integration tests * test ansible partner certification * test ansible partner certification * retest partner cert job * add anisble-lint file * fix comment for partner cert failure * address review comment where int tests used global python env but they are disabled for now anyway * update to leverage ansible anchors
… interfaces query_all() in LoopbackInterfaceOrchestrator previously filtered interfaces only by interfaceType == "loopback", which included system-provisioned loopbacks (Loopback0 routing, Loopback1 VTEP) that ND creates during initial switch role configuration. These have policyType "underlayLoopback" and are not deletable. When state:overridden was used, the module saw these system loopbacks in the before collection, identified them as "not in proposed", and queued them for removal. ND silently rejected the delete requests (the interfaces have deletable: false), but the module incorrectly reported changed=true and made unnecessary API calls. The fix adds a second filter stage to query_all() that checks each loopback's configData.networkOS.policy.policyType against the set of policy types this module manages (loopback, ipfmLoopback, userDefined). System loopbacks with policyType "underlayLoopback" are now excluded from the before collection. This ensures: - Accurate changed flag (no false positives from undeletable interfaces) - No unnecessary remove API calls for system-managed interfaces - The module correctly understands its own management scope Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Integration test suite covering all four states (merged, replaced, overridden, deleted) for the nd_interface_loopback module. Tests are organized into separate task files per state for easier debugging and selective execution. Test coverage includes: - Merged: create single/multiple, idempotency, update, deploy=false - Replaced: full replace, idempotency, multi-interface replace - Overridden: reduce to single, idempotency, system loopback filtering, swap interfaces in one pass - Deleted: single/multi delete, idempotency, non-existent interface The overridden tests include a dedicated system loopback filtering test that verifies Loopback0/Loopback1 (policyType "underlayLoopback") do not appear in the before collection and are not targeted for deletion. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Python script that serves dual purpose: - Generator mode (no args): reads ND connection and testbed topology from environment variables and writes a static inventory.networking file for use with ansible-test network-integration - Dynamic inventory mode (--list): outputs JSON inventory to stdout for direct use with ansible-playbook -i inventory.py Required env vars: ND_IP4, ND_USERNAME, ND_PASSWORD, ND_DOMAIN Optional env vars: ND_FABRIC_NAME, ND_SWITCH_IP (with defaults) The generator approach is needed because ansible-test sanitizes the subprocess environment, stripping arbitrary env vars at runtime. Running the generator beforehand bakes values into a static INI file that ansible-test picks up automatically. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Unit tests for the EpManageInterfaces endpoint classes used by nd_interface_loopback: Get, ListGet, Post, Put, Deploy, and Remove. Covers path construction, HTTP verb assignment, and fabric/switch identifier injection. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove shebang from tests/integration/inventory.py (non-module files must not have a shebang line per ansible-test sanity rules) - Fix author format in nd_interface_loopback.py DOCUMENTATION block from 'Cisco Systems, Inc.' to 'Allen Robel (@allenrobel)' to match the required 'Name (@github_handle)' format Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1. Ansible sanity requires author to be Name (@github_handle) Changed all files in this PR to: # Copyright: (c) 2026, Allen Robel (@allenrobel) 2. Removed the following legacy Python 2.x remnant: # -*- coding: utf-8 -*-
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
nd_interface_loopbackAnsible module for managing loopback interfaces on Nexus Dashboard 4.2state:overriddenincorrectly attempting to delete system-provisioned loopback interfaces (Loopback0/Loopback1 withpolicyType: "underlayLoopback")tests/integration/inventory.py) for running integration tests against live ND testbedsDetails
System loopback filtering fix
query_all()inLoopbackInterfaceOrchestratorpreviously filtered only byinterfaceType == "loopback", which included system-provisioned loopbacks that ND creates during switch role configuration. These interfaces havepolicyType: "underlayLoopback"and cannot be deleted.The fix adds a second filter that checks
policyTypeagainst the set of policy types this module manages (loopback,ipfmLoopback,userDefined). System loopbacks are now excluded from the before collection, ensuring accuratechangedflags and no unnecessary API calls.Integration tests
Test coverage organized into per-state task files:
deploy: falseDynamic inventory generator
tests/integration/inventory.pyreads ND connection params from environment variables and generates a staticinventory.networkingforansible-test, which sanitizes the subprocess environment. Also works directly as a dynamic inventory withansible-playbook -i.Test plan
python -m pytest tests/unit/)ansible-test network-integration nd_interface_loopback🤖 Generated with Claude Code