Documentation for PythonAPI
22.40.00py2

packetlogic2.pldb.hosttriggers

This module contains functionality for accessing Host triggers.

Do NOT import this module directly. The PLConnection object should be used, e.g:

>>> import packetlogic2
>>> pl = packetlogic2.connect("192.168.1.25", "admin", "password")
>>> ht = pl.HostTriggers()

Classes defined here:

HostTrigger

Information about a Host trigger.

Returned in a list by HostTriggers.hosttrigger_list.

Methods:
Ungrouped remove(self)
Remove this host trigger from the system
update(self, script=None, in_bw=None, out_bw=None, in_cps=None, out_cps=None, conns=None, uconns=None, uconn_rate=None, out_ttls=None, qoe_in_int=None, qoe_in_ext=None, qoe_out_int=None, qoe_out_ext=None, netobject=None, trigtype=None, subitem_count=None, view_name=None)
Updates the host trigger properties
Properties:
conns Number of concurrent connections to trigger on
id ID Number of the host trigger
in_bw Inbound bandwidth limit to trigger on in Kbps
in_cps Inbound connections per second to trigger on
in_fwd Inbound forwarded bandwidth limit to trigger on in Kbps
name Name of the host trigger
netobject Netobject id the trigger is configured for when trigtype in
out_bw Outbound bandwidth limit to trigger on in Kbps
out_cps Outbound connections per second to trigger on
out_fwd Outbound forwarded bandwidth limit to trigger on in Kbps
out_ttls Number of different TTL values seen on outbound traffic to trigger on
qoe_in_ext QoE for inbound traffic on external interface to trigger on
qoe_in_int QoE for inbound traffic on internal interface to trigger on
qoe_out_ext QoE for outbound traffic on external interface to trigger on
qoe_out_int QoE for outbound traffic on internal interface to trigger on
script Script filename to execute
subitem_count Number of subitems in view tree to trigger on
trigtype Trigger type
uconn_rate Unest
uconns Number of concurrent unest
view_name DynamicLiveView the trigger is configured for when trigtype is

remove(self)

Remove this host trigger from the system.

update(self, script=None, in_bw=None, out_bw=None, in_cps=None, out_cps=None, conns=None, uconns=None, uconn_rate=None, out_ttls=None, qoe_in_int=None, qoe_in_ext=None, qoe_out_int=None, qoe_out_ext=None, netobject=None, trigtype=None, subitem_count=None, view_name=None)

Updates the host trigger properties.

Parameters:
  • script (str) - The script filename to execute
  • in_bw (int) - in bandwidth limit to trigger on in Kbps
  • out_bw (int) - out bandwidth limit to trigger on in Kbps
  • in_cps (int) - in connections per second to trigger on
  • out_cps (int) - out connections per second to trigger on
  • conns (int) - no of concurrent connections to trigger on
  • uconns (int) - no of unest. connections to trigger on
  • uconn_rate (int) - unest. connection rate to trigger on
  • out_ttls (int) - out number of different used ttls to trigger on
  • qoe_in_int (int) - QoE for in traffic on internal interface
  • qoe_in_ext (int) - QoE for in traffic on external interface
  • qoe_out_int (int) - QoE for out traffic on internal interface
  • qoe_out_ext (int) - QoE for out traffic on external interface
  • netobject (int) - Netobject id the trigger is configured for when trigtype in (TRIGTYPE_HOST_IN_NETOBJECT, TRIGTYPE_HOST_IN_NETOBJECT, TRIGTYPE_HOST_IN_NETOBJECT)
  • trigtype (int) - Trigger type. One of TRIGTYPE_HOST, TRIGTYPE_HOST_IN_NETOBJECT, TRIGTYPE_HOST_IN_NETOBJECT, TRIGTYPE_HOST_IN_NETOBJECT, TRIGTYPE_VIEW
  • subitem_count (int) - Number of subitems in view tree
  • view_name (str) - DynamicLiveView the trigger is configured for when trigtype is TRIGTYPE_VIEW
Exceptions raised:
  • PLDBUnsupportedInFirmware - If this method is called without firmware support.
  • This method requires firmware v14.1 or newer

conns

Number of concurrent connections to trigger on

id

ID Number of the host trigger

in_bw

Inbound bandwidth limit to trigger on in Kbps

in_cps

Inbound connections per second to trigger on

in_fwd

Inbound forwarded bandwidth limit to trigger on in Kbps. (Deprecated and unused in firmware version v12.0 and newer)

name

Name of the host trigger

netobject

Netobject id the trigger is configured for when trigtype in (TRIGTYPE_HOST_IN_NETOBJECT, TRIGTYPE_HOST_IN_NETOBJECT, TRIGTYPE_HOST_IN_NETOBJECT) (Requires firmware version v14.1 or newer)

out_bw

Outbound bandwidth limit to trigger on in Kbps

out_cps

Outbound connections per second to trigger on

out_fwd

Outbound forwarded bandwidth limit to trigger on in Kbps. (Deprecated and unused in firmware version v12.0 and newer)

out_ttls

Number of different TTL values seen on outbound traffic to trigger on

qoe_in_ext

QoE for inbound traffic on external interface to trigger on. (Requires firmware version v14.1 or newer)

qoe_in_int

QoE for inbound traffic on internal interface to trigger on. (Requires firmware version v14.1 or newer)

qoe_out_ext

QoE for outbound traffic on external interface to trigger on. (Requires firmware version v14.1 or newer)

qoe_out_int

QoE for outbound traffic on internal interface to trigger on. (Requires firmware version v14.1 or newer)

script

Script filename to execute

subitem_count

Number of subitems in view tree to trigger on.

trigtype

Trigger type. One of TRIGTYPE_HOST, TRIGTYPE_HOST_IN_NETOBJECT, TRIGTYPE_HOST_IN_NETOBJECT, TRIGTYPE_HOST_IN_NETOBJECT (Requires firmware version v14.1.2 or newer)

uconn_rate

Unest. connection rate to trigger on

uconns

Number of concurrent unest. connections to trigger on

view_name

DynamicLiveView the trigger is configured for when trigtype is TRIGTYPE_VIEW

HostTriggers

Undocumented!
Inherits from: Resource
Methods:
add(self, name, script, in_bw=0, out_bw=0, in_fwd=0, out_fwd=0, in_cps=0, out_cps=0, conns=0, uconns=0, out_ttls=0, qoe_in_int=0, qoe_in_ext=0, qoe_out_int=0, qoe_out_ext=0, netobject=0, trigtype=0, uconn_rate=0, subitem_count=0, view_name='')
Adds a new host trigger to the system
close(self)
Immediately disconnects the resource
commit(self, message='PythonAPI commit')
Store the current transaction to the database
list of HostTrigger list(self)
List all host triggers in the PacketLogic system
ping(self, string='')
Send a command to server to test if it is up
tuple of (str, int) protocol(self, protocol, strict=False)
Translate protocol name OR number to tuple with name AND number
dict of str:int and int:str protocols_dict(self)
Returns a dictionary with name:nr and nr:name items for IP protocols
rollback(self)
Abort the current transaction and discard the data
services_cmd(self, services=[], props=[])
Send services to pldbd
list of str services_list(self)
List all services
list of str services_prop_list(self)
List all properties
wait_for_commit(self, pinginterval=60)
Wait for new data to be committed on resource
list of str xfb_flags_list(self)
List all XFB (Transfer Behaviour) flags, that can be used in FlagObjects
Properties:
commitid The CommitID associated with this session
hosttrigger_add Deprecated alias for add
hosttrigger_list Deprecated alias for list

add(self, name, script, in_bw=0, out_bw=0, in_fwd=0, out_fwd=0, in_cps=0, out_cps=0, conns=0, uconns=0, out_ttls=0, qoe_in_int=0, qoe_in_ext=0, qoe_out_int=0, qoe_out_ext=0, netobject=0, trigtype=0, uconn_rate=0, subitem_count=0, view_name='')

Adds a new host trigger to the system.

QoE (Quality of Experience) triggers can have values from 100 to 0 (Corresponding to 100% to 0%). It will trigger when QoE goes below configured value. See product guide for a detailed definition of QoE values.

Parameters:
  • name (str) - The new triggers name
  • script (str) - The script filename to execute
  • in_bw (int) - Inbound bandwidth limit to trigger on in Kbps
  • out_bw (int) - Outbound bandwidth limit to trigger on in Kbps
  • in_fwd (int) - Inbound forwarded bandwidth limit to trigger on in Kbps (not available in firmware versions v12.0 and newer)
  • out_fwd (int) - Outbound forwarded bandwidth limit to trigger on in Kbps (not available in firmware versions v12.0 and newer)
  • in_cps (int) - Inbound connections per second to trigger on
  • out_cps (int) - Outbound connections per second to trigger on
  • conns (int) - Number of concurrent connections to trigger on
  • uconns (int) - Number of concurrent unestablished connections to trigger on
  • out_ttls (int) - Number of different TTL values seen on outbound traffic to trigger on (requires firmware 13.1 or newer)
  • qoe_in_int (int) - QoE for in traffic on internal interface. (requires firmware 14.1 or newer)
  • qoe_in_ext (int) - QoE for in traffic on external interface. (requires firmware 14.1 or newer)
  • qoe_out_int (int) - QoE for out traffic on internal interface. (requires firmware 14.1 or newer)
  • qoe_out_ext (int) - QoE for out traffic on external interface. (requires firmware 14.1 or newer)
  • netobject (int) - Netobject id the trigger is configured for when trigtype in (TRIGTYPE_HOST_IN_NETOBJECT, TRIGTYPE_NETOBJECT or TRIGTYPE_NETOBJECT_CHILD)
  • trigtype (int) - Trigger type. One of TRIGTYPE_HOST, TRIGTYPE_HOST_IN_NETOBJECT, TRIGTYPE_NETOBJECT, TRIGTYPE_NETOBJECT_CHILD or TRIGTYPE_VIEW
  • uconn_rate (int) - Unestablished connection rate to trigger on. (requires firmware 15.0 or newer)
  • subitem_count (int) - Number of subitems in view tree
  • view_name (str) - DynamicLiveView the trigger is configured for when trigtype is TRIGTYPE_VIEW
  • in_fwd and out_fwd are deprecated and will generate an exception if they have other values than 0.
  • Triggering on out_ttls requires v13.1 firmware or newer.
  • Triggering on qoe values requires v14.1 firmware or newer.
  • Trigger types TRIGTYPE_HOST_IN_NETOBJECT, TRIGTYPE_NETOBJECT or TRIGTYPE_NETOBJECT_CHILD requires 14.1 firmware or newer.
  • Triggering on uconn_rate requires v15.0 firmware.

close(self)

Immediately disconnects the resource.

After this method has been called this object becomes useless.

It may be used to force a disconnect when the garbage collector can't be trusted to do a timely disconnect.

commit(self, message='PythonAPI commit')

Store the current transaction to the database.

When you do this PacketLogic will reload the ruleset. This will take a lot of CPU resources from the system, try to do this in batches.

Observe that if you don't commit the changes you've made, no other resource (including the client) will see your changes.

Parameters:
  • message (str) - Message recorded in the commit log. Ignored in v12.1 and earlier.
  • message parameter is ignored in v12.1 firmware and earlier.

list(self)

List all host triggers in the PacketLogic system.

>>> ht.hosttrigger_list()
[<HostTrigger #1 'filter hosts with 100 CPS'>]
Returns:

ping(self, string='')

Send a command to server to test if it is up.

protocol(self, protocol, strict=False)

Translate protocol name OR number to tuple with name AND number. Can be used to e.g translate numerical protocol in connlog.search() result to protocol name.

An unknown protocol will be translated to e.g '#7' or -1, unless strict is set to True, in which case ValueError is raised for unknown protocols.

Returns:
  • Tuple with name and nr of specified protocol.
  • tuple of (str, int)
Parameters:
  • protocol (int, str or a ProtocolObject Item) - Name or number of an IP protocol
  • strict (bool) - If True, ValueError is raised for an unknown protocol, if False (default), an unknown protocol translates to number -1 or name '#7' (where 7 is the supplied unknown protocol number).

protocols_dict(self)

Returns a dictionary with name:nr and nr:name items for IP protocols. Can be used to e.g translate numerical protocol in connlog.search() result to protocol name.

Returns:
  • Dict with name:nr and nr:name items for IP protocols.
  • dict of str:int and int:str

rollback(self)

Abort the current transaction and discard the data.

This will also automatically happen if your connection drops or that you exit the program without commit.

Exceptions raised:
  • resource.PLDBError - If the rollback command failed.

services_cmd(self, services=[], props=[])

Send services to pldbd

Sets stringtable for services and properties. Do NOT use this unless you know exactly what you are doing.

Parameters:
  • services (list of str) - List of services
  • props (list of str) - List of service properties

services_list(self)

List all services

Returns:
  • List of services
  • list of str

services_prop_list(self)

List all properties.

Returns:
  • List of service properties
  • list of str

wait_for_commit(self, pinginterval=60)

Wait for new data to be committed on resource.

This method returns as soon as the server signals that another client has committed new data to the resource. It also periodically tests the connection to the server. If connection is broken (or any other error happens) an exception is raised.

Parameters:
  • pinginterval (int) - Interval used to check if connection still is alive.

xfb_flags_list(self)

List all XFB (Transfer Behaviour) flags, that can be used in FlagObjects.

Returns:
  • List of XFB flags
  • list of str

commitid

The CommitID associated with this session. (14.0 or newer only)

hosttrigger_add

Deprecated alias for add

hosttrigger_list

Deprecated alias for list