Reply
Highlighted
L3 Networker

fw.refresh_ha_active() functionality

Hi @gfreeman  and all 

 

I am trying to use refresh_ha_active() functionality so that script always run on active device.  As per my understanding once i set the peer it will check internally and run it on active box or my understanding is wrong here ? I am trying to run test route cmd to pull interface details and then later run test security cmd and in order that we need to always connect to active box to pull details . I am trying below . Could you please suggest on below  : 

 

NOTE:  If i am giving device1 IP active device member and device2 IP standby IP , this works fine . However if i am giving device1 IP as standby and device2 IP as active , then its failing as from standby its not pulling interface details.

 

deviceip1 = input('Enter device FQDN/IP: ')
deviceip2 = input('Enter device2 FQDN/IP: ')
user = input('Enter username: ')

fw = Firewall(deviceip1, user, getpass())
fw.set_ha_peers(Firewall(deviceip2,user,getpass()))

fw.refresh_ha_active()


srcip = input ('Enter SOURCE IP: ')
dstip = input ('Enter DEST IP: ')
dstport = input ('Enter dstport: ')
proto = input('Enter protocol number: ')


z1 = fw.xapi.op(cmd='<test><routing><fib-lookup><virtual-router>default</virtual-router><ip>{}</ip></fib-lookup></routing></test>'.format(srcip) , cmd_xml=False)

<< truncated output  >>

 


Accepted Solutions
Highlighted
L4 Transporter

Re: fw.refresh_ha_active() functionality

Agree with @gfreeman .  Also, I responded with details on your GitHub issue over here:  https://github.com/PaloAltoNetworks/pandevice/issues/210

View solution in original post


All Replies
Highlighted
L4 Transporter

Re: fw.refresh_ha_active() functionality

So when you do fw.xapi.(whatever) you are bypassing all the stuff pandevice can do for you.  Since you are wanting pandevice to intervene, you should stick with fw.op() instead of doing fw.xapi.op().

 

Also, fw.op() has a param retry_on_peer that defaults to False.  I'm not sure, but try setting that to True and see if it works?

Highlighted
L4 Transporter

Re: fw.refresh_ha_active() functionality

Agree with @gfreeman .  Also, I responded with details on your GitHub issue over here:  https://github.com/PaloAltoNetworks/pandevice/issues/210

View solution in original post

Highlighted
L3 Networker

Re: fw.refresh_ha_active() functionality

Thanks @btorresgil , @gfreeman 

 

I will test it and update you .

 

Thanks 

Highlighted
L3 Networker

Re: fw.refresh_ha_active() functionality

@btorresgil , @gfreeman 

 

 

Thanks for your help . It's working now.

 

Thanks,

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 Live Community as a whole!

The Live Community thanks you for your participation!