ansible-dcnm icon indicating copy to clipboard operation
ansible-dcnm copied to clipboard

Need documentation in dcnm_fabric for: NETFLOW_EXPORTER_LIST, NETFLOW_RECORD_LIST, NETFLOW_MONITOR_LIST

Open aj-cruz opened this issue 10 months ago • 2 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Ansible Version and collection version

Ansible 2.18.6 cisco.dcnm 3.8.0

DCNM version

  • V 12.2.2.241

Affected module(s)

  • dcnm_fabric

Ansible Playbook

- name: Merge Test Fabric
  cisco.dcnm.dcnm_fabric:
    state: merged
    config:
      - FABRIC_NAME: Ansible-Test
        FABRIC_TYPE: VXLAN_EVPN
        BGP_AS: 65501
        ENABLE_NETFLOW: true
        NETFLOW_EXPORTER_LIST:
          - EXPORTER_NAME: MYEXPORTER1
            IP: 1.1.1.1
            VRF: Ansible-prod
            SRC_IF_NAME: mgmt0
            UDP_PORT: "2055"
        NETFLOW_RECORD_LIST:
          - RECORD_NAME: MYRECORD1
            RECORD_TEMPLATE: netflow_ipv4_record
            LAYER2_RECORD: "false"
        NETFLOW_MONITOR_LIST:
          - MONITOR_NAME: MYMONITOR1
            RECORD_NAME: MYRECORD1
            EXPORTER1: MYEXPORTER1
            EXPORTER2: ""

Debug Output

fatal: [192.168.254.32]: FAILED! => {
    "changed": false,
    "diff": [
        {
            "sequence_number": 1
        }
    ],
    "invocation": {
        "module_args": {
            "config": [
                {
                    "BGP_AS": 65501,
                    "ENABLE_NETFLOW": true,
                    "FABRIC_NAME": "Ansible-Test",
                    "FABRIC_TYPE": "VXLAN_EVPN",
                    "NETFLOW_EXPORTER_LIST": [
                        {
                            "EXPORTER_NAME": "MYEXPORTER1",
                            "IP": "1.1.1.1",
                            "SRC_IF_NAME": "mgmt0",
                            "UDP_PORT": 2055,
                            "VRF": "Ansible-prod"
                        }
                    ],
                    "NETFLOW_MONITOR_LIST": [
                        {
                            "EXPORTER1": "MYEXPORTER1",
                            "EXPORTER2": "MYEXPORTER2",
                            "MONITOR_NAME": "MYMONITOR1",
                            "RECORD_NAME": "MYRECORD1"
                        }
                    ],
                    "NETFLOW_RECORD_LIST": [
                        {
                            "LAYER2_RECORD": false,
                            "RECORD_NAME": "MYRECORD1",
                            "RECORD_TEMPLATE": "netflow_ipv4_record"
                        }
                    ]
                }
            ],
            "skip_validation": false,
            "state": "merged"
        }
    },
    "metadata": [
        {
            "action": "fabric_update",
            "check_mode": false,
            "sequence_number": 1,
            "state": "merged"
        }
    ],
    "msg": "Module failed.",
    "response": [
        {
            "DATA": "Invalid JSON response: Cannot deserialize value of type `java.lang.String` from Array value (token `JsonToken.START_ARRAY`)\n at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 27] (through reference chain: java.util.LinkedHashMap[\"NETFLOW_EXPORTER_LIST\"])",
            "MESSAGE": "Bad Request",
            "METHOD": "PUT",
            "REQUEST_PATH": "https://192.168.254.32:443/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/Ansible-Test/Easy_Fabric",
            "RETURN_CODE": 400,
            "sequence_number": 1
        }
    ],
    "result": [
        {
            "changed": false,
            "sequence_number": 1,
            "success": false
        }
    ]
}

Expected Behavior

Netflow configuration pushed to fabric

Actual Behavior

Error:

Cannot deserialize value of type `java.lang.String` from Array value (token `JsonToken.START_ARRAY`)\n at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 27] (through reference chain: java.util.LinkedHashMap[\"NETFLOW_EXPORTER_LIST\"])"

Steps to Reproduce

References

The documentation says "list / elements=string" for these parameters but does not give an example of the expected format (keys). I manually created a netflow config and saw this in the REST capture:

"NETFLOW_EXPORTER_LIST":"{\"NETFLOW_EXPORTER_LIST\":[{\"EXPORTER_NAME\":\"MYEXPORTER1\",\"IP\":\"1.1.1.1\",\"VRF\":\"prod\",\"SRC_IF_NAME\":\"mgmt0\",\"UDP_PORT\":\"2055\"}]}",
"NETFLOW_RECORD_LIST":"{\"NETFLOW_RECORD_LIST\":[{\"RECORD_NAME\":\"MYRECORD1\",\"RECORD_TEMPLATE\":\"netflow_ipv4_record\",\"LAYER2_RECORD\":\"false\"}]}",
"NETFLOW_MONITOR_LIST":"{\"NETFLOW_MONITOR_LIST\":[{\"MONITOR_NAME\":\"MYMONITOR1\",\"RECORD_NAME\":\"MYRECORD1\",\"EXPORTER1\":\"MYEXPORTER1\",\"EXPORTER2\":\"\"}]}"

I tried to use the keys I saw from that manual PUT in my Ansible playbook with no success.

aj-cruz avatar Jun 25 '25 17:06 aj-cruz

Looking closer at the error message it looks like it's expecting a string, not a dictionary. Which makes sense (list / elements=string). so I changed my playbook to this:

- name: Merge Test Fabric
  cisco.dcnm.dcnm_fabric:
    state: merged
    config:
      - FABRIC_NAME: Ansible-Test
        FABRIC_TYPE: VXLAN_EVPN
        BGP_AS: 65501
        ENABLE_NETFLOW: true
        NETFLOW_EXPORTER_LIST: "{\"NETFLOW_EXPORTER_LIST\":[{\"EXPORTER_NAME\":\"MYEXPORTER1\",\"IP\":\"1.1.1.1\",\"VRF\":\"prod\",\"SRC_IF_NAME\":\"mgmt0\",\"UDP_PORT\":\"2055\"}]}"
        NETFLOW_RECORD_LIST: "{\"NETFLOW_RECORD_LIST\":[{\"RECORD_NAME\":\"MYRECORD1\",\"RECORD_TEMPLATE\":\"netflow_ipv4_record\",\"LAYER2_RECORD\":\"false\"}]}"
        NETFLOW_MONITOR_LIST: "{\"NETFLOW_MONITOR_LIST\":[{\"MONITOR_NAME\":\"MYMONITOR1\",\"RECORD_NAME\":\"MYRECORD1\",\"EXPORTER1\":\"MYEXPORTER1\",\"EXPORTER2\":\"\"}]}"

and it worked fine.

Is it possible to accept a user-friendly list of dictionaries and do the transformation to list of string on the backend?

aj-cruz avatar Jun 25 '25 18:06 aj-cruz

@aj-cruz We will evaluate this against other prioritized asks. Thanks for raising the issue.

mikewiebe avatar Jul 09 '25 12:07 mikewiebe