Documentation for PythonAPI
17.2.0py1

packetlogic2.pldb.channels

This module contains functionality for managing channels on the PacketLogic system.

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

>>> import packetlogic2
>>> pl = packetlogic2.connect("192.168.1.25", "admin", "pldemo00")
>>> ch = pl.Channels()

Classes defined here:

  • Channel - Information about a Channel
  • Channels - This is the resource for Channel inquiry and manipulation

Channel

Information about a Channel.

Returned in a list by Channels.channel_list.

Methods:
Ungrouped set_active(self, active)
Set or reset the active state on this Channel
update(self, internal_media=None, external_media=None, role=None, label=None, direction=None)
Update properties on this Channel
Class Variables:
__slots__ For internal use only.
Properties:
active Active state
caps Capabilities bitmask
description Deprecated alias for 'location'
direction Channel direaction
external System name of the external interface
external_media Media type on External interface
id ID Number of the channel
internal System name of the internal interface
internal_media Media type on Internal interface
label The channel's label
location The channel's location
role Channel role
type Channel type

set_active(self, active)

Set or reset the active state on this Channel.

Parameters:
  • active (bool) - The active state to set on this Channel.

update(self, internal_media=None, external_media=None, role=None, label=None, direction=None)

Update properties on this Channel. Omitting an argument or setting it to None will leave that property unchanged.

Parameters:
  • internal_media (int) - One of the CHANNEL_MEDIA_ constants.
  • external_media (int) - One of the CHANNEL_MEDIA_ constants.
  • role (int) - One of the ROLE_ constants.
  • label (str) - Label for this channel.
  • direction (int) - One of the DIRECTION_ constants.

active

Active state.

caps

Capabilities bitmask. One or more of the CAPS_ constants.

description

Deprecated alias for 'location'.

direction

Channel direaction. One of the DIRECTION_ constants.

external

System name of the external interface.

external_media

Media type on External interface. One of the MEDIA_ constants.

id

ID Number of the channel.

internal

System name of the internal interface.

internal_media

Media type on Internal interface. One of the MEDIA_ constants.

label

The channel's label.

Label used for referencing this channel from filtering rules.

location

The channel's location.

A string describing the channels location. e.g: "Channel 1/2"

role

Channel role. One of the ROLE_ constants.

type

Channel type. One of the TYPE_ constants.

ChannelLabel

Information about a Channel label.

Returned in a list by Channels.channel_divert_label_list or Channels.channel_monitor_label_list.

Methods:
Ungrouped add_channel(self, channelid)
Add ChannelLabel to specified channel id
remove(self)
Remove this ChannelLabel
remove_channel(self, channel=None)
Remove channel from list of channels
update(self, name=None, flags=None)
Update properties on this ChannelLabel
Properties:
channels Channels
flags Flags
id Id
name Name

add_channel(self, channelid)

Add ChannelLabel to specified channel id. The role of the specified channel must be the same as the role specified for the ChannelLabel.

remove(self)

Remove this ChannelLabel

remove_channel(self, channel=None)

Remove channel from list of channels

update(self, name=None, flags=None)

Update properties on this ChannelLabel. Omitting an argument or setting it to None will leave that property unchanged.

channels

Channels

flags

Flags

id

Id

name

Name

ChannelLabelChannel

Undocumented!
Methods:
update(self, channel=None, vlan=None, flags=None, int_address=None, int_heartbeat=None, int_gateway=None, ext_address=None, ext_heartbeat=None, ext_gateway=None)
Update properties on this ChannelLabelChannel
Properties:
channel Channel
ext_address external vlan IP
ext_gateway external gateway
ext_heartbeat external heartbeat
flags flags
int_address internal vlan IP
int_gateway internal gateway
int_heartbeat internal heartbeat
vlan vlan

update(self, channel=None, vlan=None, flags=None, int_address=None, int_heartbeat=None, int_gateway=None, ext_address=None, ext_heartbeat=None, ext_gateway=None)

Update properties on this ChannelLabelChannel. Omitting an argument or setting it to None will leave that property unchanged.

channel

Channel

ext_address

external vlan IP

ext_gateway

external gateway

ext_heartbeat

external heartbeat

flags

flags

int_address

internal vlan IP

int_gateway

internal gateway

int_heartbeat

internal heartbeat

vlan

vlan

Channels

This is the resource for Channel inquiry and manipulation. Changes needs to be commited to take effect.

Inherits from: Resource
Methods:
Ungrouped list of Channel channel_divert_label_list(self)
List all ChannelLabels (divert label) in the PacketLogic system
channel_label_add(self, name='', role=None)
Create ChannelLabel with given name and role
list of Channel channel_list(self)
List all Channels (Traffic Interface Pairs) in the PacketLogic system
list of Channel channel_monitor_label_list(self)
List all ChannelsLabels (monitor label) in the PacketLogic system
Inherited from Resource close(self)
Immediately disconnects the resource
commit(self, message='PythonAPI commit')
Store the current transaction to the database
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
Class Variables:
CHANNEL_MEDIA_AUTO Media type is Auto Negotiated
CHANNEL_MEDIA_10HD Media type is 10 Mbps Half Duplex
CHANNEL_MEDIA_10FD Media type is 10 Mbps Full Duplex
CHANNEL_MEDIA_100HD Media type is 100 Mbps Half Duplex
CHANNEL_MEDIA_100FD Media type is 100 Mbps Full Duplex
CHANNEL_MEDIA_1000FD Media type is 1 Gbps Full Duplex
CHANNEL_MEDIA_10000FD Media type is 10 Gbps Full Duplex
CHANNEL_MEDIA_40000FD Media type is 40 Gbps Full Duplex
CHANNEL_MEDIA_100000FD Media type is 100 Gbps Full Duplex
ROLE_NONE Channel is not used
ROLE_TRAFFIC Channel used for passing traffic
ROLE_DIVERT Channel used for divert
ROLE_MONITOR Channel used for sending out monitored traffic
ROLE_FLOWSYNC Channel used for flowsync
ROLE_SHUNT Channel used for shunting traffic
CAPS_AUTONEG Channel can do auto negotiation
CAPS_10HD Channel can do 10 Mbps Half Duplex
CAPS_10FD Channel can do 10 Mbps Full Duplex
CAPS_100HD Channel can do 100 Mbps Half Duplex
CAPS_100FD Channel can do 100 Mbps Full Duplex
CAPS_1000FD Channel can do 1 Gbps Full Duplex
CAPS_10000FD Channel can do 10 Gbps Full Duplex
CAPS_40000FD Channel can do 40 Gbps Full Duplex
CAPS_100000FD Channel can do 100 Gbps Full Duplex
CAPS_TRAFFIC Channel can be used for passing traffic
CAPS_DIVERT Channel can be used for divert
CAPS_MONITOR Channel can be used for sending out monitored traffic
CAPS_FLOWSYNC Channel can be used for flowsync
CAPS_LINK_TOGGLE Channel link can be toggled on/off
CAPS_SHUNT Channel can be used for shunting traffic
DIRECTION_DEFAULT Channel is working in the default directions.
DIRECTION_REVERSE Channel is reversed.
DIRECTION_INTERNAL Both ports in the channel is internal
DIRECTION_EXTERNAL Both ports in the channel is external
Properties:
commitid The CommitID associated with this session

channel_divert_label_list(self)

List all ChannelLabels (divert label) in the PacketLogic system.

>>> ch.channel_divert_label_list()
[<ChannelLabel fancydivertlabel>]
Returns:
  • List containing a Channel object for each channel available on the system.
  • list of Channel

channel_label_add(self, name='', role=None)

Create ChannelLabel with given name and role.

Parameters:
  • name (char) - Name of ChannelLabel.
  • role (int) - One of the ROLE_DIVERT or ROLE_MONITOR constants

channel_list(self)

List all Channels (Traffic Interface Pairs) in the PacketLogic system.

>>> ch.channel_list()
[<Channel #299 'Slot 4/GE.5 (Reserved)'>,
 <Channel #216 'Slot 4/GE.4'>,
 <Channel #212 'Slot 4/GE.3'>,
 <Channel #208 'Slot 4/GE.2'>,
 <Channel #204 'Slot 4/GE.1'>,
 <Channel #200 'Slot 4/10GE'>,
 <Channel #199 'Slot 3/GE.5 (Monitor/FlowSync)'>,
 <Channel #116 'Slot 3/GE.4'>,
 <Channel #112 'Slot 3/GE.3'>,
 <Channel #108 'Slot 3/GE.2'>,
 <Channel #104 'Slot 3/GE.1'>,
 <Channel #100 'Slot 3/10GE'>]
Returns:
  • List containing a Channel object for each channel available on the system.
  • list of Channel

channel_monitor_label_list(self)

List all ChannelsLabels (monitor label) in the PacketLogic system.

>>> ch.channel_monitor_label_list()
[<ChannelLabel fancymonitorlabel>]
Returns:
  • List containing a Channel object for each channel available on the system.
  • list of Channel

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.

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)