Useful Methods

These methods are the most commonly used and can be called on any object in a configuration tree.

Configuration Methods

Modify the configuration tree or the live device with these methods.

  • C: Changes the pan-os-python configuration tree
  • L: Connects to a live device (firewall or Panorama) via the API
  • M: Modifies the live device by making a change to the device’s configuration
  • B: Bulk operation modifies more than one object in a single API call
Method C L M B Description
add()       Add an object as a child of this object
extend()       Add a list of objects as children
insert()       Insert an object as a child at an index
pop()       Remove a child object at an index
remove()       Remove a child object from this object
remove_by_name()       Remove a child object by its name
removeall()       Remove all children of this object
refresh()       Set params of object from live device
refreshall()       Pull all children from the live device
refresh_variable()       Set a single param from the live device
create()     Push object to the live device (nd)
apply()     Push object to the live device (d)
update()     Push single object param to live device
delete()   Delete from live device and config tree
rename()   Rename on live device and config tree
move()   Reorder on live device and config tree
create_similar()   Push objects of this type to live device (nd)
apply_similar()   Push objects of this type to live device (d)
delete_similar()   Delete objects of this type from live device
  • (d): Destructive - Method overwrites an object on the live device with the same name
  • (nd): Non-destructive - Method combines object with one on live device with the same name

Informational Methods

These methods provide information about an object in the configuration tree.

Method Description
about() Return all the params set on this object and their values
equal() Test if two objects are equal and return a boolean
xpath() Return the XPath of this object
element() Return the XML of this object as an ElementTree
element_str() Return the XML of this object as a string
hierarchy_info() Return hierarchical information about this object

Device Methods

These methods can be called on a PanDevice object (a Firewall or Panorama), but not on any other PanObject.

Method Description
refresh_system_info() Return and retain important information about the device
commit() Trigger a commit on a Firewall or Panorama
commit_all() Trigger a configuration push from Panorama to the Firewalls
syncjob() Wait for a job on the device to finish
refresh_devices() Pull all the devices attached to Panorama as Firewall objects
op() Execute an operational command
watch_op() Same as ‘op’, then watch for a specific result

There are many other convenience methods available. They’re all documented in the PanDevice class.