napalm-automation-community / napalm-panos

NAPALM driver for PAN-OS
Apache License 2.0
29 stars 31 forks source link

napalm_get_facts fails with freshly created PA-VM #75

Closed lachlanjholmes closed 2 years ago

lachlanjholmes commented 4 years ago

Description of Issue/Question

Function _extract_interface_list doesn't handle Palo Alto VM-Series with no interfaces.

Did you follow the steps from https://github.com/napalm-automation/napalm#faq

Setup

napalm-panos version

(Paste verbatim output from pip freeze | grep napalm-panos between quotes below)

napalm-panos==0.5.2

Steps to Reproduce the Issue

Create a new Palo Alto VM-Series box. Configure management interface. Do not configure a dataplane interface.

---
- hosts: panos
  gather_facts: False
  tasks:    
    - napalm_get_facts:
        dev_os: panos
      register: output

    - debug:
        var: output

Error Traceback

(Paste the complete traceback of the exception between quotes below)

The full traceback is:
  File "/tmp/ansible_napalm_get_facts_payload_nzmccub2/ansible_napalm_get_facts_payload.zip/ansible/modules/napalm_get_facts.py", line 244, in main
  File "/home/user/lab/lib/python3.6/site-packages/napalm_panos/panos.py", line 392, in get_facts
    facts['interface_list'] = self._extract_interface_list()
  File "/home/user/lab/lib/python3.6/site-packages/napalm_panos/panos.py", line 363, in _extract_interface_list
    for entry_contents in entry.values():
"msg": "[facts] cannot retrieve device data: 'NoneType' object has no attribute 'values'"
itdependsnetworks commented 2 years ago

Fixed in #103