napalm-automation/napalm-ansible

filter interfaces_ip does not work on napalm_get_facts

rainierpineda2 opened this issue · 12 comments

I have the following Ansible code. The commands takes over two minutes to execute and the the device only has one IP. If I use facts as a filter, there are no issues.

  • name: Get basic device facts via NAPALM
    napalm_get_facts:
    hostname: 10.45.230.250
    username: "{{ USERNAME }}"
    password: "{{ PASSWORD }}"
    dev_os: "{% if nb_platform=='cisco-ios' %}ios{%elif nb_platform=='cisco-nxos'%}nxos{%endif%}"
    filter: "interfaces_ip"

I get the following error message:

TASK [validate_device : Get basic device facts via NAPALM] *************************************************
fatal: [netbox]: FAILED! => {"changed": false, "msg": "[interfaces_ip] cannot retrieve device data: Search p
attern never detected in send_command_expect: show\ run\ interface\ F"}

@rainierpineda2 Try increasing the global_delay_factor:

- name: Get basic device facts via NAPALM
  napalm_get_facts:
  hostname: 10.45.230.250
  username: "{{ USERNAME }}"
  password: "{{ PASSWORD }}"
  dev_os: "{% if nb_platform=='cisco-ios' %}ios{%elif nb_platform=='cisco-nxos'%}nxos{%endif%}"
  filter: "interfaces_ip"
  optional_args: {"global_delay_factor": 2}        # try 2 and if that still fails, then try 4

Note, that will only work for ios so you will logic so it is not there for nxos (which use nx-api).

Did you try the global_delay_factor fix?

No worries...my additional comment was indicating that the global_delay_factor argument will fail when the napalm platform was nxos (so that is what I was trying to clarify i.e. it will only work for ios).

@rainierpineda2 Are you using napalm 2.3.3?

You are running really old code. You need to upgrade.

Probably create a new virtual environment and reinstall: napalm, napalm-ansible, and ansible.

Your performance will probably greatly increase on the new code.

Okay, I am going to close this. If there is still an issue, just re-open the issue.