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
Base class for ShapingObjects.
This class should not be instantiated and should instead be created and accessed through:
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 properties of the shaping object. Any unspecified (or set to
None
) property will be left as is.
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
int
) - Limit number of connections, or 0 for unlimited.
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
int
) - Deprecated alias for split_argument.
Deprecated function to change the limits in the shaping object. Any unspecified limits are left as is.
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.
list
of tuple
) - same as inbound but for outgoing traffic
list
of tuple
) - same as inbound but for both directions
Rename the current object
destroys netobject cache
str
) - The name that the object should have after rename process
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 weights used for weighted fair queueing.
int
) - Weight (in percent) to use for priority 4
int
) - Weight (in percent) to use for priority 5
int
) - Weight (in percent) to use for priority 6
int
) - Weight (in percent) to use for priority 7
int
) - Weight (in percent) to use for priority 8
int
) - Weight (in percent) to use for priority 9
Arbitrary key/value attributes stored for this shapingobject.
>>> o.attributes {} >>> o.attributes['test'] = "Arbitrary string value" >>> o.attributes {'test': "Arbitrary string value"}
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.
Date and time when this object was created
Username that created this object
Fairness_Group by type used by this object. One of the SPLIT_* constants available on the Ruleset object
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
ShapingObjectFlags object containing the flags (if any) set on this ShapingObject.
id number of this object
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.
True if this object resides on another system
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>>
Use of property 'machineid' is deprecated since v11.0beta5, use 'systemid' instead.
Maximum number of allowed connections
Date and time when this object was last modified
Username that last modified this object
Name of the shaping object
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.
Split by type used by this object. One of the SPLIT_* constants available on the Ruleset object
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
NetObject with subscriber names used to split this ShapingObject with SPLIT_SUBSCRIBER or prefix length if SPLIT_LOCAL_NETWORKPREFIX
System ID of the PacketLogic this object belongs to. (Replaces machineid)
Weights (in percent) to use for weighted fair queueing.
Used internaly to represent the flags on a ShapingObject.
Use ShapingObjects.set_flags to change the flags.
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 |
Return a list of (prop, value) tuples, similar to dict.items().
Enable BLUE AQM (requires firmware 14.0 or newer)
Enable the BROWN Shaping Algorithm
Enable CoDel AQM (requires firmware 14.0 or newer)
Enable byte counter
Enable fair split host fairness (requires firmware 14.1 or newer)
Enable fairness between hosts
Enable virtual queueing (requires firmware 14.0 or newer)
Enable WFQ configured on the wfq property on the shapingobject (requires firmware 14.0 or newer)
Mark this ShapingObject as a zero-rating object
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 |
Maximum Bits Per Second, 0 for unlimited
Maximum New Connections Per Second, 0 for unlimited
Maximum Packets Per Second, 0 for unlimited
Queue Goal in milliseconds, 0 for automatic
Queue Size in packets, 0 for automatic