xpath tags

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.

xpath tags

L0 Member

Trying to get some info from the XML API in the form of panxapi. 

 

I'm not sure this even works based on previous forum post by others but this is the closest I could find and it's based on the description having the term Donkey. 

 

xpath="/config/devices/entry[@name='localhost.localdomain']/device-group/pre-rulebase/security/rules/entry[description[contains(text(), 'Donkey')]]"

panxapi.py -sxr $xpath Extra options after xpath: ["'Donkey')]]"] show: error: "No such node"

show: error: "No such node"

 

My goal is to pull all Security Policies with a particular tag, xpath seems a bit limited, am I heading down the right path?

4 REPLIES 4

L7 Applicator

Hi @cgrosskopf

 

I have also experienced similar problems where the implemented xpath in PAN-OS has some limitations (or I was too stupid and the problem was a type error or something special that needs to be considered here in order to make the query work). Anyway, what I did in most cases was I did the query in a more general way and used the xpath in the programming/scripting language you need, because there you (probably) won't have these limitations and you can use whatever xpath function you need to filter the output in a mlre specific way.

Good point. I guess I just thought extracting the needed information would be best but you're right, I can use python to pull the pertinent information. 

 

Thanks!

L4 Transporter

There appears to be a syntax error in your request, as you have a hanging ")" after Donkey.

 

I do not know exactly what is wrong, but my guess is it is related to that one or the prior one, maybe it should be text('Donkey') instead of text(), 'Donkey'

L1 Bithead

It works. Thank you.

  • 3114 Views
  • 4 replies
  • 1 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!