Documentation for PythonAPI
22.40.00py2

shapingobject

This module contains ShapingObject implementation.

There is no need to import this module directly. Use the methods of the Ruleset object to create and manipulate ShapingObjects.

>>> so = r.shapingobject_add('Test Shaping',
                             inbound=[(0, 0, 1024)], # 1024 kbyte/s inbound
                             outbound=[(0, 0, 512)]) # 512 kbyte/s outbound

Classes defined here:

ShapingObject

Base class for ShapingObjects.

This class should not be instantiated and should instead be created and accessed through:

  • Ruleset.shapingobject_add
  • Ruleset.shapingobject_find
  • Ruleset.shapingobject_find_id
  • Ruleset.shapingobject_list
  • Ruleset.shapingobject_remove

Class variables are read-only, use methods to alter the object.

Methods:
Ungrouped change(self, split=None, max_connections=None, split_argument=None, subscriber_netobject=None, split_netobjects=None, fairness_group=None, fairness_group_argument=None, speed_sc_schema=None, speed_sc_column_in=None, speed_sc_column_out=None)
Change properties of the shaping object
change_limits(self, inbound=None, outbound=None, bidir=None)
Deprecated function to change the limits in the shaping object
rename(self, newname)
Rename the current object
set_flags(self, *reset, **flags)
Set or reset one or more of the flags of the shaping object
set_wfq(self, w1, w2, w3, w4, w5, w6)
Set weights used for weighted fair queueing
Properties:
attributes Arbitrary key/value attributes stored for this shapingobject
bidir List of bidirectional shaping limits
creation_date Date and time when this object was created
creator Username that created this object
fairness_group Fairness_Group by type used by this object
fairness_group_argument NetObject with subscriber names used to split this ShapingObject with
flags ShapingObjectFlags object containing the flags (if any) set on this
id id number of this object
inbound List of inbound shaping limits
is_global True if this object resides on another system
limits Limits enforced by this shapingobject
machineid Use of property 'machineid' is deprecated since v11.0beta5, use 'systemid'
max_connections Maximum number of allowed connections
modification_date Date and time when this object was last modified
modified_by Username that last modified this object
name Name of the shaping object
outbound List of outbound shaping limits
speed_sc_column_in
speed_sc_column_out
speed_sc_schema
split Split by type used by this object
split_argument NetObject with subscriber names used to split this ShapingObject with
split_netobjects
subscriber_netobject NetObject with subscriber names used to split this ShapingObject with
systemid System ID of the PacketLogic this object belongs to
wfq Weights (in percent) to use for weighted fair queueing

change(self, split=None, max_connections=None, split_argument=None, subscriber_netobject=None, split_netobjects=None, fairness_group=None, fairness_group_argument=None, speed_sc_schema=None, speed_sc_column_in=None, speed_sc_column_out=None)

Change properties of the shaping object. Any unspecified (or set to None) property will be left as is.

Parameters:
  • split (int) - Type of split, one of: Ruleset.SPLIT_NONE, SPLIT_LOCALHOST, SPLIT_HOST_NETOBJECT, SPLIT_LOCAL_NETOBJECT, SPLIT_SERVER_NETOBJECT, SPLIT_CLIENT_NETOBJECT, SPLIT_CONNECTION, SPLIT_SUBSCRIBER, SPLIT_LOCAL_NETWORKPREFIX, SPLIT_SESSIONCONTEXTOBJECT
  • max_connections (int) - Limit number of connections, or 0 for unlimited.
  • split_argument (int) - NetObject with subscriber names used to split this ShapingObject with SPLIT_SUBSCRIBER or prefix length if SPLIT_LOCAL_NETWORKPREFIX or SessionContextObject if SPLIT_LOCAL_SESSIONCONTEXTOBJECT
  • subscriber_netobject (int) - Deprecated alias for split_argument.
Exceptions raised:
  • PLDBUnsupportedInFirmware - If split_argument argument is used and firmware doesn't support them.
  • split_argument parameter requires v13.1 firmware or newer.

change_limits(self, inbound=None, outbound=None, bidir=None)

Deprecated function to change the limits in the shaping object. Any unspecified limits are left as is.

Parameters:
  • inbound (list of tuple) - One entry list of containing the limit for incoming traffic, where limit is (max_transfer, max_packets, max_speed) max_transfer must be 0 (unlimited). Speed is specified in kbyte/s.
  • outbound (list of tuple) - same as inbound but for outgoing traffic
  • bidir (list of tuple) - same as inbound but for both directions
  • VBS is configured using attributes, therefore the limit lists may only contain one entry and specify max_transfer as 0.
  • This method is deprecated, instead use the <a href="#module-shapingobject-ShapingObject-limits">limits</a> property to modify limits.

rename(self, newname)

Rename the current object

destroys netobject cache

Parameters:
  • newname (str) - The name that the object should have after rename process

set_flags(self, *reset, **flags)

Set or reset one or more of the flags of the shaping object. You may also reset all flags with the single argument None, or clone an existing flags object. You may combine them.

If only keyword argument(s) are used, only the specified flags will be affected. For a list of valid flags see the ShapingObjectFlags class. Use a trueish value to set the flag, or falseish value to reset it.

>>> shobj.set_flags(brown=True, host_fairness=False)
>>> shobj.flags
ShapingObjectFlags(brown=True)
>>> shobj.set_flags(None)
>>> shobj.flags
ShapingObjectFlags(None)
>>> shobj.set_flags(another_shobj.flags)
>>> shobj.flags
ShapingObjectFlags(host_fairness=True)
>>> shobj.set_flags(None, brown=True)
>>> shobj.flags
ShapingObjectFlags(brown=True)

set_wfq(self, w1, w2, w3, w4, w5, w6)

Set weights used for weighted fair queueing.

Parameters:
  • w1 (int) - Weight (in percent) to use for priority 4
  • w2 (int) - Weight (in percent) to use for priority 5
  • w3 (int) - Weight (in percent) to use for priority 6
  • w4 (int) - Weight (in percent) to use for priority 7
  • w5 (int) - Weight (in percent) to use for priority 8
  • w6 (int) - Weight (in percent) to use for priority 9
  • wfq requires v14.0 firmware or newer.

attributes

Arbitrary key/value attributes stored for this shapingobject.

>>> o.attributes
{}
>>> o.attributes['test'] = "Arbitrary string value"
>>> o.attributes
{'test': "Arbitrary string value"}

bidir

List of bidirectional shaping limits.

Each entry in the list is a tuple of (max_transfer, max_packets, max_speed). Same format used in shapingobject_add.

creation_date

Date and time when this object was created

creator

Username that created this object

fairness_group

Fairness_Group by type used by this object. One of the SPLIT_* constants available on the Ruleset object

fairness_group_argument

NetObject with subscriber names used to split this ShapingObject with SPLIT_SUBSCRIBER or prefix length if SPLIT_LOCAL_NETWORKPREFIX or SessionContextObject if SPLIT_LOCAL_SESSIONCONTEXTOBJECT

flags

ShapingObjectFlags object containing the flags (if any) set on this ShapingObject.

id

id number of this object

inbound

List of inbound shaping limits.

Each entry in the list is a tuple of (max_transfer, max_packets, max_speed). Same format used in shapingobject_add.

is_global

True if this object resides on another system

limits

Limits enforced by this shapingobject.

>>> o.limits
<inbound=<Unlimited>, outbound=<Unlimited>, bidir=<Unlimited>>
>>> o.limits.inbound.bps = 128000
>>> o.limits.inbound.queue_goal = 100
>>> o.limits
<inbound=<bps=128000, queue_goal=100>, outbound=<Unlimited>, bidir=<Unlimited>>

machineid

Use of property 'machineid' is deprecated since v11.0beta5, use 'systemid' instead.

max_connections

Maximum number of allowed connections

modification_date

Date and time when this object was last modified

modified_by

Username that last modified this object

name

Name of the shaping object

outbound

List of outbound shaping limits.

Each entry in the list is a tuple of (max_transfer, max_packets, max_speed). Same format used in shapingobject_add.

speed_sc_column_in

Undocumented!

speed_sc_column_out

Undocumented!

speed_sc_schema

Undocumented!

split

Split by type used by this object. One of the SPLIT_* constants available on the Ruleset object

split_argument

NetObject with subscriber names used to split this ShapingObject with SPLIT_SUBSCRIBER or prefix length if SPLIT_LOCAL_NETWORKPREFIX or SessionContextObject if SPLIT_LOCAL_SESSIONCONTEXTOBJECT

split_netobjects

Undocumented!

subscriber_netobject

NetObject with subscriber names used to split this ShapingObject with SPLIT_SUBSCRIBER or prefix length if SPLIT_LOCAL_NETWORKPREFIX

systemid

System ID of the PacketLogic this object belongs to. (Replaces machineid)

wfq

Weights (in percent) to use for weighted fair queueing.

ShapingObjectFlags

Used internaly to represent the flags on a ShapingObject.

Use ShapingObjects.set_flags to change the flags.

Inherits from: BaseFlags
Methods:
Inherited from BaseFlags items(self)
Return a list of (prop, value) tuples, similar to dict.items()
Properties:
blue Enable BLUE AQM (requires firmware 14.0 or newer)
brown Enable the BROWN Shaping Algorithm
codel Enable CoDel AQM (requires firmware 14.0 or newer)
counter Enable byte counter
fairsplit Enable fair split host fairness (requires firmware 14.1 or newer)
host_fairness Enable fairness between hosts
virtual_queueing Enable virtual queueing (requires firmware 14.0 or newer)
wfq Enable WFQ configured on the wfq property on the shapingobject (requires
zero_rating Mark this ShapingObject as a zero-rating object

items(self)

Return a list of (prop, value) tuples, similar to dict.items().

blue

Enable BLUE AQM (requires firmware 14.0 or newer)

brown

Enable the BROWN Shaping Algorithm

codel

Enable CoDel AQM (requires firmware 14.0 or newer)

counter

Enable byte counter

fairsplit

Enable fair split host fairness (requires firmware 14.1 or newer)

host_fairness

Enable fairness between hosts

virtual_queueing

Enable virtual queueing (requires firmware 14.0 or newer)

wfq

Enable WFQ configured on the wfq property on the shapingobject (requires firmware 14.0 or newer)

zero_rating

Mark this ShapingObject as a zero-rating object

ShapingObjectLimit

Undocumented!
Properties:
bps Maximum Bits Per Second, 0 for unlimited
cps Maximum New Connections Per Second, 0 for unlimited
pps Maximum Packets Per Second, 0 for unlimited
queue_goal Queue Goal in milliseconds, 0 for automatic
queue_size Queue Size in packets, 0 for automatic

bps

Maximum Bits Per Second, 0 for unlimited

cps

Maximum New Connections Per Second, 0 for unlimited

pps

Maximum Packets Per Second, 0 for unlimited

queue_goal

Queue Goal in milliseconds, 0 for automatic

queue_size

Queue Size in packets, 0 for automatic

ShapingObjectLimitGroup

Undocumented!
Properties:
bidir
inbound
outbound

bidir

Undocumented!

inbound

Undocumented!

outbound

Undocumented!