Skip to content

Conversation

mikewiebe
Copy link
Collaborator

@mikewiebe mikewiebe commented Jul 16, 2025

Cisco ND Fabric Management Module

NOTE: This PR is a work in progress [WIP] and is intended to be a starting point for the ND4.1 work the current NDFC team is working on to support creation of modules under the 4.1 manage and onemanage buckets. I will be scheduling a call to discuss this work and some of the requirements we would like to ensure are part of each new module in these buckets.

This is just a small subset of the existing fabric parameters (Proof of concept) but once we have a chance to sync we will complete the module and use this as a reference module going forward.

Overview

This PR introduces a comprehensive fabric management module for Cisco Nexus Dashboard (ND) with full CRUD operations and state-based configuration management following Ansible best practices.

Key Features Added

New Module: cisco.nd.manage.fabric

  • State-based Operations: Supports merged, replaced, deleted, overridden, and query states
  • Pydantic Model Integration: Uses FabricModel and FabricManagementModel for robust data validation
  • Comprehensive Documentation: Includes module documentation, examples, and detailed docstrings

Core Functionality

  • Fabric Lifecycle Management: Create, update, delete, and query fabric configurations
  • State Comparison: Intelligent diff calculation using DeepDiff for merged operations
  • Dependency Injection: Testable architecture with optional logger and utility injection
  • Error Handling: Robust validation and error reporting throughout the module

Class Architecture

  • GetHave: Retrieves current fabric state from ND API
  • Common: Shared utilities for parameter validation and payload construction
  • Merged: Implements merge strategy with diff-based updates
  • Replaced: Full configuration replacement operations
  • Deleted: Fabric deletion with safety checks
  • Overridden: Combined delete and replace operations
  • Query: Read-only state retrieval

Configuration Support

  • Fabric name, category, and security domain management
  • BGP ASN configuration
  • Anycast gateway MAC settings
  • Replication mode configuration (multicast/ingress)

Technical Improvements

  • Logging Integration: Comprehensive debug logging for troubleshooting
  • API Path Management: Dynamic endpoint construction for different operations
  • Payload Optimization: Efficient payload generation with minimal API calls
  • Model Validation: Automatic validation of configuration parameters

Testing Ready

The module is designed with dependency injection patterns that facilitate comprehensive unit testing and mock-based testing strategies.

This enhancement provides a [POC] foundation for Cisco ND fabric

Sample Module Task

- name: Create basic VXLAN iBGP fabric
  cisco.nd.nd_manage_fabric:
    state: merged
    config:
      - name: example-fabric
        category: fabric
        security_domain: default
        management:
          type: vxlanIbgp
          bgp_asn: "65001"
          anycast_gateway_mac: "2020.0000.00aa"
          replication_mode: multicast

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