Module: firewall

Inheritance diagram

Inheritance diagram of panos.firewall

Configuration tree diagram

digraph configtree { graph [rankdir=LR, fontsize=10, margin=0.001]; node [shape=box, fontsize=10, height=0.001, margin=0.1, ordering=out]; Firewall [style=filled fillcolor=lightblue URL="../module-firewall.html#panos.firewall.Firewall" target="_top"]; Administrator [style=filled fillcolor=lightpink URL="../module-device.html#panos.device.Administrator" target="_top"]; Firewall -> Administrator; EmailServerProfile [style=filled fillcolor=lightpink URL="../module-device.html#panos.device.EmailServerProfile" target="_top"]; Firewall -> EmailServerProfile; HttpServerProfile [style=filled fillcolor=lightpink URL="../module-device.html#panos.device.HttpServerProfile" target="_top"]; Firewall -> HttpServerProfile; PasswordProfile [style=filled fillcolor=lightpink URL="../module-device.html#panos.device.PasswordProfile" target="_top"]; Firewall -> PasswordProfile; SnmpServerProfile [style=filled fillcolor=lightpink URL="../module-device.html#panos.device.SnmpServerProfile" target="_top"]; Firewall -> SnmpServerProfile; SyslogServerProfile [style=filled fillcolor=lightpink URL="../module-device.html#panos.device.SyslogServerProfile" target="_top"]; Firewall -> SyslogServerProfile; SystemSettings [style=filled fillcolor=lightpink URL="../module-device.html#panos.device.SystemSettings" target="_top"]; Firewall -> SystemSettings; Telemetry [style=filled fillcolor=lightpink URL="../module-device.html#panos.device.Telemetry" target="_top"]; Firewall -> Telemetry; Vsys [style=filled fillcolor=lightpink URL="../module-device.html#panos.device.Vsys" target="_top"]; Firewall -> Vsys; VsysResources [style=filled fillcolor=lightpink URL="../module-device.html#panos.device.VsysResources" target="_top"]; Firewall -> VsysResources; HighAvailability [style=filled fillcolor=lavender URL="../module-ha.html#panos.ha.HighAvailability" target="_top"]; Firewall -> HighAvailability; AggregateInterface [style=filled fillcolor=lightcyan URL="../module-network.html#panos.network.AggregateInterface" target="_top"]; Firewall -> AggregateInterface; EthernetInterface [style=filled fillcolor=lightcyan URL="../module-network.html#panos.network.EthernetInterface" target="_top"]; Firewall -> EthernetInterface; GreTunnel [style=filled fillcolor=lightcyan URL="../module-network.html#panos.network.GreTunnel" target="_top"]; Firewall -> GreTunnel; IkeCryptoProfile [style=filled fillcolor=lightcyan URL="../module-network.html#panos.network.IkeCryptoProfile" target="_top"]; Firewall -> IkeCryptoProfile; IkeGateway [style=filled fillcolor=lightcyan URL="../module-network.html#panos.network.IkeGateway" target="_top"]; Firewall -> IkeGateway; IpsecCryptoProfile [style=filled fillcolor=lightcyan URL="../module-network.html#panos.network.IpsecCryptoProfile" target="_top"]; Firewall -> IpsecCryptoProfile; IpsecTunnel [style=filled fillcolor=lightcyan URL="../module-network.html#panos.network.IpsecTunnel" target="_top"]; Firewall -> IpsecTunnel; LoopbackInterface [style=filled fillcolor=lightcyan URL="../module-network.html#panos.network.LoopbackInterface" target="_top"]; Firewall -> LoopbackInterface; ManagementProfile [style=filled fillcolor=lightcyan URL="../module-network.html#panos.network.ManagementProfile" target="_top"]; Firewall -> ManagementProfile; TunnelInterface [style=filled fillcolor=lightcyan URL="../module-network.html#panos.network.TunnelInterface" target="_top"]; Firewall -> TunnelInterface; VirtualRouter [style=filled fillcolor=lightcyan URL="../module-network.html#panos.network.VirtualRouter" target="_top"]; Firewall -> VirtualRouter; VirtualWire [style=filled fillcolor=lightcyan URL="../module-network.html#panos.network.VirtualWire" target="_top"]; Firewall -> VirtualWire; Vlan [style=filled fillcolor=lightcyan URL="../module-network.html#panos.network.Vlan" target="_top"]; Firewall -> Vlan; VlanInterface [style=filled fillcolor=lightcyan URL="../module-network.html#panos.network.VlanInterface" target="_top"]; Firewall -> VlanInterface; AddressGroup [style=filled fillcolor=lemonchiffon URL="../module-objects.html#panos.objects.AddressGroup" target="_top"]; Firewall -> AddressGroup; AddressObject [style=filled fillcolor=lemonchiffon URL="../module-objects.html#panos.objects.AddressObject" target="_top"]; Firewall -> AddressObject; ApplicationFilter [style=filled fillcolor=lemonchiffon URL="../module-objects.html#panos.objects.ApplicationFilter" target="_top"]; Firewall -> ApplicationFilter; ApplicationGroup [style=filled fillcolor=lemonchiffon URL="../module-objects.html#panos.objects.ApplicationGroup" target="_top"]; Firewall -> ApplicationGroup; ApplicationObject [style=filled fillcolor=lemonchiffon URL="../module-objects.html#panos.objects.ApplicationObject" target="_top"]; Firewall -> ApplicationObject; CustomUrlCategory [style=filled fillcolor=lemonchiffon URL="../module-objects.html#panos.objects.CustomUrlCategory" target="_top"]; Firewall -> CustomUrlCategory; DynamicUserGroup [style=filled fillcolor=lemonchiffon URL="../module-objects.html#panos.objects.DynamicUserGroup" target="_top"]; Firewall -> DynamicUserGroup; LogForwardingProfile [style=filled fillcolor=lemonchiffon URL="../module-objects.html#panos.objects.LogForwardingProfile" target="_top"]; Firewall -> LogForwardingProfile; Region [style=filled fillcolor=lemonchiffon URL="../module-objects.html#panos.objects.Region" target="_top"]; Firewall -> Region; ScheduleObject [style=filled fillcolor=lemonchiffon URL="../module-objects.html#panos.objects.ScheduleObject" target="_top"]; Firewall -> ScheduleObject; SecurityProfileGroup [style=filled fillcolor=lemonchiffon URL="../module-objects.html#panos.objects.SecurityProfileGroup" target="_top"]; Firewall -> SecurityProfileGroup; ServiceGroup [style=filled fillcolor=lemonchiffon URL="../module-objects.html#panos.objects.ServiceGroup" target="_top"]; Firewall -> ServiceGroup; ServiceObject [style=filled fillcolor=lemonchiffon URL="../module-objects.html#panos.objects.ServiceObject" target="_top"]; Firewall -> ServiceObject; Rulebase [style=filled fillcolor=lightsalmon URL="../module-policies.html#panos.policies.Rulebase" target="_top"]; Firewall -> Rulebase; }

Class Reference

Palo Alto Networks Firewall object

class panos.firewall.Firewall(hostname=None, api_username=None, api_password=None, api_key=None, serial=None, port=443, vsys=None, is_virtual=None, multi_vsys=None, *args, **kwargs)[source]

A Palo Alto Networks Firewall

This object can represent a firewall physical chassis, virtual firewall, or individual vsys.

Parameters:
  • hostname – Hostname or IP of device for API connections
  • api_username – Username of administrator to access API
  • api_password – Password of administrator to access API
  • api_key – The API Key for connecting to the device’s API
  • serial – The serial number of this firewall
  • port – Port of device for API connections
  • vsys – The vsys of this firewall (eg. “vsys1”, “vsys2”, etc.)
  • is_virtual (bool) – Physical or Virtual firewall
  • timeout – The timeout for asynchronous jobs
  • interval – The interval to check asynchronous jobs
apply()[source]

Apply this object to the device, replacing any existing object of the same name

Modifies the live device

create()[source]

Create this object on the device

Modifies the live device

This method is nondestructive. If the object exists, the variables are added to the device without changing existing variables on the device. If a variables already exists on the device and this object has a different value, the value on the firewall is changed to the value in this object.

create_vsys()[source]

Create the vsys on the live device that this Firewall object represents

delete()[source]

Delete this object from the firewall

Modifies the live device

delete_vsys()[source]

Delete the vsys on the live device that this Firewall object represents

element()[source]

Construct an ElementTree for this PanObject and all its children

Parameters:
  • with_children (bool) – Include children in element.
  • comparable (bool) – Element will be used in a comparison with another.
Returns:

An ElementTree instance representing the

xml form of this object and its children

Return type:

xml.etree.ElementTree

op(cmd=None, vsys=None, xml=False, cmd_xml=True, extra_qs=None, retry_on_peer=False)[source]

Perform operational command on this Firewall

Parameters:
  • cmd (str) – The operational command to execute
  • vsys (str) – Vsys id. Defaults to the vsys of the firewall or the Vsys object in the parent tree.
  • xml (bool) – Return value should be a string (Default: False)
  • cmd_xml (bool) – True: cmd is not XML, False: cmd is XML (Default: True)
  • extra_qs – Extra parameters for API call
  • retry_on_peer (bool) – Try on active Firewall first, then try on passive Firewall
Returns:

The result of the operational command. May also return a string of XML if xml=True

Return type:

xml.etree.ElementTree

organize_into_vsys(create_vsys_objects=True, refresh_vsys=True)[source]

Organizes all imported objects under the appropriate Vsys object.

Parameters:
  • create_vsys_objects (bool) – Create the vsys objects (True) or use the ones already connected to this firewall (False).
  • refresh_vsys (bool) – Refresh all vsys objects’ parameters before doing the reorganization or not. This is assumed True if create_vsys_objects is True.
refreshall_from_xml(xml, refresh_children=False, variables=None)[source]

Factory method to instantiate class from firewall config.

This method is a factory for the class. It takes an xml config from a firewall and generates instances of this class for each item this class represents in the xml config. For example, if the class is AddressObject and there are 5 address objects on the firewall, then this method will generate 5 instances of the class AddressObject.

Parameters:
  • xml (xml.etree.ElementTree) – A section of XML configuration from a firewall or Panorama. It should not contain the response or result tags.
  • refresh_children (bool) – Refresh children objects or not.
  • variables (iterable) – A list or tuple of the variables to parse from the XML. Note that this is only used when invoked against classes not derived from VersionedPanObject.
Returns:

created instances of class

Return type:

list

shared = None

Set to True to act on the shared part of this firewall

state = None

Panorama state variables refreshed by Panorama

vsys

Return the vsys for this object

Traverses the tree to determine the vsys from a panos.firewall.Firewall or panos.device.Vsys instance somewhere before this node in the tree.

Returns:The vsys id (eg. vsys2)
Return type:str
class panos.firewall.FirewallCommit(description=None, admins=None, exclude_device_and_network=False, exclude_shared_objects=False, exclude_policy_and_objects=False, force=False)[source]

Normalization of a firewall commit.

element()[source]

Returns an xml representation of the commit requested.

Returns:xml.etree.ElementTree