04-19-2022 07:16 AM
I am working on a Python automation project that will accept a user entering an IP address, then making API calls to Panorama to find the IP in the network.
So far, I'm able to call the Panorama API call to get aggregate interfaces and ethernet interfaces - and build a dictionary of where subnets are - with their site. Now that I know the subnetwork, I want to call the active firewall at that site, and get the ARP entry for the IP the user entered.
I'd like to know which firewall is active at the site, and the management IP of it, to make a call directly to it, to retrieve the ARP information.
I cannot find where to get the firewall status or the management IP - through the Panorama API. Is it even available through the API? Or would I need to use the pan-os-python SDK?
05-16-2022 02:33 AM
Hi,
I would say pan-os-python SDK is the best option, and there is a method, refresh_devices, inside of panorama module which should give the HA peer relationships. I've tried to write a simple script to get that information but until now i didn't understood how.
09-08-2022 08:36 AM
Hi @BrannenTaylor,
The XML API call https://{{host}}/api?key={{key}}&type=op&cmd=<show><devices><all/></devices></show> will get you an XML response for you to parse, which includes the hostname, management IP and HA status (active/passive). You could do the same OP command with pan-os-python with this, or use the suggestion from @adeliomoreira, which uses the same XML API call under the hood.
Hope that helps!
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!