CiscoDevNet / ansible-dcnm

Apache License 2.0
45 stars 33 forks source link

dcnm_links: src_interface / dst_interface case sensitivity for state == query #216

Open allenrobel opened 1 year ago

allenrobel commented 1 year ago

Community Note

Description

This could probably be fixed on the NX-OS side, but submitting this to see if it could be addressed within the dcnm_links module by ignoring upper/lower-case when returning results.

The problem:

N9K-C9504 reports its loopback as: loopback0 N9K-C9336C-FX2 reports its loopback as: Loopback0

If the user runs the below task, it will return no result since both interfaces are specified with "loopback0" (below, dst_interface belongs to N9K-C9336C-FX2):

    - name: Query RS - BGW peering loopbacks
      cisco.dcnm.dcnm_links:
        state: query
        src_fabric: "EF_1"
        config:
          - dst_fabric: "DCI"
            src_interface: "loopback0"
            dst_interface: "loopback0"

In contrast, the below task returns a result:

    - name: Query RS - BGW peering loopbacks
      cisco.dcnm.dcnm_links:
        state: query
        src_fabric: "EF_1"
        config:
          - dst_fabric: "DCI"
            src_interface: "loopback0"
            dst_interface: "Loopback0"

Hence, the user has to know what switch models are deployed in order to obtain correct results. It would be wonderful if dcnm_links could ignore if-name case (see JSON below) when determining whether to include a link in the result.

For reference, below is the relevant output from the second playbook above (removing non-relevant key/values for brevity).

{
    "result": {
        "response": [
            {
                "fabricName": "EF_1<->DCI",
                "nvPairs": {
                    "DEST_FABRIC": "DCI",
                    "SOURCE_FABRIC": "EF_1",
                },
                "policyId": "POLICY-57110",
                "sw1-info": {
                    "fabric-name": "EF_1",
                    "if-name": "loopback0",
                    "sw-model-name": "N9K-C9504",
                    "switch-role": "border gateway",
                },
                "sw2-info": {
                    "fabric-name": "DCI",
                    "if-name": "Loopback0",
                    "sw-model-name": "N9K-C9336C-FX2",
                },
                "templateName": "ext_evpn_multisite_overlay_setup"
            }
        ]
    }
}

New or Affected modules(s):

NDFC version

Potential ansible task config

Please reference the two ansible task examples in the Description.

mikewiebe commented 1 year ago

@allenrobel This seems like a reasonable request. Unless there is a hidden issue here I don't see a problem with ignoring case and probably faster to fix in the collection then on NXOS

allenrobel commented 1 year ago

@mikewiebe Thanks Mike!