cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Who rated this post

L5 Sessionator

I would skip the file part of this.  If your true goal is just to see the states of things, I would take advantage of the fact that fw.op() returns an xml.etree.ElementTree object and use the python functions available to iterate over the results:

 

 

result = fw.op('show vpn flow')
for entry in result.findall('./result/IPSec/entry'):
    name = entry.find('./name')
    state = entry.find('./state')
    if name is None or state is None:
        # This should never happen, but just to code defensively...
        continue
    print('{0} has state {1}'.format(name.text, state.text))

 

 

 

 

 

 

 

View solution in original post

Who rated this post