PaloAltoNetworks / pan-os-python

The PAN-OS SDK for Python is a package to help interact with Palo Alto Networks devices (including physical and virtualized Next-generation Firewalls and Panorama). The pan-os-python SDK is object oriented and mimics the traditional interaction with the device via the GUI or CLI/API.
https://pan-os-python.readthedocs.io
ISC License
347 stars 172 forks source link

Firewall Object returning only one AddressObject where there are many exists in the firewall configs #567

Closed manuadoor closed 5 months ago

manuadoor commented 5 months ago

Describe the bug

Firewall Object returning only one AddressObject where there are many exists in the firewall GUI

Current behavior

DEBUG:panos.base:016201026921: refreshall called on <class 'panos.objects.AddressObject'> type
* There are 1 address object(s) currently *
[<AddressObject <objectname> 0x101b8e230>]

Steps to reproduce

from panos.firewall import Firewall
from panos.objects import AddressObject
import logging

# Enable logging at the DEBUG level
logging.basicConfig(level=logging.DEBUG)

fw = Firewall("FW_NAME", "FW_USERNAME", "FW_PASSWORD")
fw.vsys = 'vsys1'
print("Firewall system info: {0}".format(fw.refresh_system_info()))
original_objects = AddressObject.refreshall(fw,add=True)
print("* There are {0} address object(s) currently *".format(len(original_objects)))
print(fw.children)
manuadoor commented 5 months ago

setting the correct vsys while creating firewall object solved it, please close it