netascode / ansible-dc-vxlan

Ansible Collection for configuring a VXLAN Fabric using Direct to Controller (DTC) or Direct To Device (DTD) workflows.
https://galaxy.ansible.com/ui/repo/published/cisco/nac_dc_vxlan/
MIT License
6 stars 6 forks source link

Fabric interfaces configurations miss default descriptions #153

Closed marehler closed 1 month ago

marehler commented 1 month ago

When configuring fabric interfaces, the default descriptions are missing. Sample data:

---
vxlan:
  topology:
    switches:
      - name: N9Kv-SPINE3
        <...>
        interfaces:
          - name: Ethernet1/3
            mode: routed

Resulting configuration:

interface Ethernet1/3
  no switchport
  mtu 9216
  no shutdown

Expected configuration:

interface Ethernet1/3
  description NetAsCode Routed Interface
  no switchport
  mtu 9216
  no shutdown

Robot tests fail. Example:

Verify Interface ('N9Kv-SPINE3', 'Ethernet1/3')                         
  Traceback (most recent call last):
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    File  /Users/marehler/nac-vxlan/ansible-dc-vxlan-example/tests/results/config/topology/interfaces.robot:32
    T:  Verify Interface ('N9Kv-SPINE3', 'Ethernet1/3')    
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    File  /Users/marehler/nac-vxlan/ansible-dc-vxlan-example/tests/results/config/topology/interfaces.robot:306
      Should Be Equal As Strings    ${api_interface_description}    NetAsCode Routed Interface    msg=description
      |  ${api_interface_description} = not_defined (str)

Root cause:

In nac_dc_vxlan/roles/dtc/common/templates/ndfc_interface_routed.j2, the default description is not included:

  description: {{ interface['description'] | default(omit) }}

Proposed fix:

  description: {{ interface['description'] | default(defaults.vxlan.topology.switches.interfaces.topology_switch_routed_interface.description) }}

The same applies to the other interface types.