napalm-automation-community / napalm-panos

NAPALM driver for PAN-OS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Request to move code to support python3

lachlanjholmes opened this issue · comments

Description of Issue/Question

When running this module (panos.py) fails to execute when using python3 because python2 is still being referenced.

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

  • Yes
  • No

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

Fresh install of napalm-panos.

from napalm import get_network_driver

import pprint

panos_config = { "hostname": "pa-vm", "username": "REMOVED", "password": "REMOVED" }

panos_driver = get_network_driver("panos")

with panos_driver (**panos_config) as panos:
    pprint.pprint(panos.get_facts())

I commented out.

# from napalm_base.utils import py23_compat
# from napalm.base.utils import py23_compat

I find & replaced py23_compat.text_type with str and it works for get_facts.

I've not tested the other getters; and I suspect there would be more work to make this python3 only.

Error Traceback

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

Traceback (most recent call last):
  File "debug_napalm_panos.py", line 11, in <module>
    pprint.pprint(panos.get_facts())
  File "/home/user/lab/lib/python3.6/site-packages/napalm_panos/panos.py", line 408, in get_facts
    facts["vendor"] = py23_compat.text_type("Palo Alto Networks")
NameError: name 'py23_compat' is not defined