API call to Panorama to get active Firewall and Management IP Address?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Please sign in to see details of an important advisory in our Customer Advisories area.

API call to Panorama to get active Firewall and Management IP Address?

L0 Member

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?

2 REPLIES 2

L0 Member

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.

 

 

L5 Sessionator

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!

 

Help the community: "Like" helpful comments, and click "Accept as Solution" if you found your answer 🙂
  • 2116 Views
  • 2 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

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!