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 170 forks source link

Allow to retrieve root applications from API #418

Open dersoi opened 2 years ago

dersoi commented 2 years ago

There is a feature missing from the PANOS API. While you can easily retrieve all applications and all applications group, you cannot retrieve root applications.

This means that if you want to check if "Jira" is a valid application, you 'd think you can't because you would only be able to retrieve :

But Jira is a valid application, which contains all 5 above-mentioned applications.

welcome-to-palo-alto-networks[bot] commented 2 years ago

:tada: Thanks for opening your first issue here! Welcome to the community!

banachtarski-91 commented 2 years ago

Should be able to get the container app from the Predefined object instantiated in a PanDevice

from panos.firewall import Firewall

fw = Firewall( .... )
fw.predefined.refreshall_applications()
fw.predefined.application_container_objects['jira'].applications

Worth noting that that is just a list of strings of the names though. To get the object properties of each you'd need to grab them with the application method of the Predefined object.

# Not sure if this is the easiest/best way to do this, but it does work
for app in fw.predefined.application_container_objects['jira'].applications:
    fw.predefined.application(app)
dersoi commented 2 years ago

This only gives me the applications mentioned above, but not "jira"...