ansible-collections / cisco.nxos

Ansible Network Collection for Cisco NXOS
GNU General Public License v3.0
115 stars 109 forks source link

Handle Empty LLDP Neighbor Information in facts #889

Closed roverflow closed 2 weeks ago

roverflow commented 2 weeks ago
SUMMARY

Fixes an issue where the LLDP neighbor information returns an error when empty.

ISSUE TYPE
COMPONENT NAME
ADDITIONAL INFORMATION

Fixes: Below error when lldp neighbours empty

{
  "module_stdout": "",
  "module_stderr": "'TABLE_nbor'",
  "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
  "_ansible_no_log": false,
  "changed": false
}

Facts when no neighbours:

    ansible_net_neighbors:
      mgmt0:
      - host: NXOS9000v(9FLFSK4RT9R)
        port: mgmt0
        sysname: NXOS9000v(9FLFSK4RT9R)

Facts when neighbours exists:

    ansible_net_neighbors:
      Ethernet1/1:
      - host: NXOS9000v(9FLFSK4RT9R)
        port: Ethernet1/1
        sysname: NXOS9000v(9FLFSK4RT9R)
      mgmt0:
      - host: NXOS9000v(9FLFSK4RT9R)
        port: mgmt0
        sysname: NXOS9000v(9FLFSK4RT9R)