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", "password") >>> ch = pl.Channels()
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, int_ipv4_address=None, ext_ipv4_address=None, int_ipv6_address=None, ext_ipv6_address=None, int_ipv4_gateway=None, ext_ipv4_gateway=None, int_ipv6_gateway=None, ext_ipv6_gateway=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 |
ext_ipv4_address | IPv4 address of the external interface |
ext_ipv4_gateway | IPv4 address of the external gateway |
ext_ipv6_address | IPv6 address of the external interface |
ext_ipv6_gateway | IPv6 address of the external gateway |
external | System name of the external interface |
external_media | Media type on External interface |
extpci | PCI address of the external interface |
id | ID Number of the channel |
int_ipv4_address | IPv4 address of the internal interface |
int_ipv4_gateway | IPv4 address of the internal gateway |
int_ipv6_address | IPv6 address of the internal interface |
int_ipv6_gateway | IPv6 address of the internal gateway |
internal | System name of the internal interface |
internal_media | Media type on Internal interface |
intpci | PCI address of the internal interface |
label | The channel's label |
location | The channel's location |
role | Channel role |
type | Channel type |
Set or reset the active state on this Channel.
bool
) - The active state to set on this Channel.
Update properties on this Channel. Omitting an argument or setting it to
None
will leave that property unchanged.
int
) - One of the CHANNEL_MEDIA_ constants.
int
) - One of the CHANNEL_MEDIA_ constants.
int
) - One of the ROLE_ constants.
str
) - Label for this channel.
int
) - One of the DIRECTION_ constants.
str
) - internal ipv4 address
str
) - external ipv4 address
str
) - internal ipv6 address
str
) - external ipv6 address
str
) - internal ipv4 gateway
str
) - external ipv4 gateway
str
) - internal ipv6 gateway
str
) - external ipv6 gateway
Active state.
Capabilities bitmask. One or more of the CAPS_ constants.
Deprecated alias for 'location'.
Channel direaction. One of the DIRECTION_ constants.
IPv4 address of the external interface.
IPv4 address of the external gateway.
IPv6 address of the external interface.
IPv6 address of the external gateway.
System name of the external interface.
Media type on External interface. One of the MEDIA_ constants.
PCI address of the external interface.
ID Number of the channel.
IPv4 address of the internal interface.
IPv4 address of the internal gateway.
IPv6 address of the internal interface.
IPv6 address of the internal gateway.
System name of the internal interface.
Media type on Internal interface. One of the MEDIA_ constants.
PCI address of the internal interface.
Channel role. One of the ROLE_ constants.
Channel type. One of the TYPE_ constants.
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, role=0) Add ChannelLabel to specified channel id |
|
remove(self) Remove this ChannelLabel |
||
remove_channel(self, channel=None, role=0) Remove channel from list of channels |
||
update(self, name=None, flags=0, role=None, protocol='', schemaname='', columnname='') Update properties on this ChannelLabel |
Class Variables: | |
---|---|
CHANNEL_LABEL_FLAGS_NONE | No label flags |
CHANNEL_LABEL_FLAGS_DIVERT_RR_CONN | Round robin load balancing |
CHANNEL_LABEL_FLAGS_DIVERT_HASH_LHOST | Hash on local host |
CHANNEL_LABEL_FLAGS_LAYER3_MONITOR | Label is of type layer3 monitor |
CHANNEL_LABEL_FLAGS_ENCAP_NO_BINARY_HEADER | Do not add binary header (l3 monitor) |
CHANNEL_LABEL_FLAGS_ENCAP_WITH_BINARY_HEADER | Add binary header (l3 monitor) |
CHANNEL_LABEL_FLAGS_IP_REWRITE | Rewrite IP Addresses (l3 monitor) |
CHANNEL_LABEL_FLAGS_INCOMING_TRAFFIC | Monitor incoming traffic (l3 monitor) |
CHANNEL_LABEL_FLAGS_OUTGOING_TRAFFIC | Monitor outgoing traffic (l3 monitor) |
CHANNEL_LABEL_FLAGS_HB_DISABLED | Disable heartbeat |
CHANNEL_LABEL_FLAGS_HB_ICMP | Use ICMP heartbeat |
CHANNEL_LABEL_FLAGS_HB_HTTP | Use HTTP HEAD heartbeat |
CHANNEL_LABEL_FLAGS_NO_STRIP | Use no strip mode |
CHANNEL_LABEL_FLAGS_STRIP_L2_HDR | Use strip linklevel header mode |
CHANNEL_LABEL_FLAGS_STRIP_L3_HDR | Use strip network header mode |
CHANNEL_LABEL_FLAGS_TIMESTAMP | Include timestamp in binary header |
CHANNEL_LABEL_FLAGS_SESSION_CONTEXT | Include session context field in binary header |
Properties: | |
---|---|
channels | Channels |
columnname | Column Name |
flags | Flags |
id | Id |
name | Name |
protocol | Protocol |
schemaname | Schema Name |
Add ChannelLabel to specified channel id. The role of the specified channel must be the same as the role specified for the ChannelLabel.
Remove this ChannelLabel
Remove channel from list of channels
Update properties on this ChannelLabel. Omitting an argument or setting
it to None
will leave that property unchanged.
Channels
Column Name
Flags
Id
Name
Protocol
Schema Name
Represents channels in a label
Methods: | ||
---|---|---|
Ungrouped | 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, int_port=None, ext_port=None, destination_name=None, destination_address=None, heartbeat_url=None, heartbeat_port=None, role=0) Update properties on this ChannelLabelChannel |
Properties: | |
---|---|
channel | Channel |
destination_address | monitor destination IP |
destination_name | monitor destination reference name |
ext_address | external vlan IP |
ext_gateway | external gateway |
ext_heartbeat | external heartbeat |
ext_port | external port number for encapsulation |
flags | flags |
heartbeat_port | HTTP HEAD heartbeat port number for HEAD request |
heartbeat_url | HTTP HEAD heartbeat URL for HEAD request |
int_address | internal vlan IP |
int_gateway | internal gateway |
int_heartbeat | internal heartbeat |
int_port | internal port number for encapsulation |
vlan | vlan |
Update properties on this ChannelLabelChannel. Omitting an argument or
setting it to None
will leave that property unchanged.
Channel
monitor destination IP
monitor destination reference name
external vlan IP
external gateway
external heartbeat
external port number for encapsulation
flags
HTTP HEAD heartbeat port number for HEAD request
HTTP HEAD heartbeat URL for HEAD request
internal vlan IP
internal gateway
internal heartbeat
internal port number for encapsulation
vlan
This is the resource for Channel inquiry and manipulation. Changes needs to be commited to take effect.
Methods: | ||
---|---|---|
Ungrouped | list of Channel
|
channel_divert_label_list(self) List all ChannelLabels (divert label) in the PacketLogic system |
list of Channel
|
channel_l3_monitor_label_list(self) List all ChannelsLabels (layer 3 monitor label) in the PacketLogic system |
|
channel_label_add(self, name='', role=None, protocol='', schemaname='', columnname='') 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 |
ROLE_LAYER3 | Channel used for layer3 traffic |
ROLE_L3_MONITOR | Channel used for layer3 monitor traffic |
ROLE_L2_FLOWSYNC_L3_MONITOR | Channel used for flowsync/layer3 monitor 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 |
CAPS_LAYER3 | Channel can be used for layer-3 traffic |
CAPS_LAYER3_NEXT_HOP | Channel can be used for layer-3, with default gateways. |
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 |
List all ChannelLabels (divert label) in the PacketLogic system.
>>> ch.channel_divert_label_list() [<ChannelLabel fancydivertlabel>]
List all ChannelsLabels (layer 3 monitor label) in the PacketLogic system.
>>> ch.channel_l3_monitor_label_list() [<ChannelLabel fancymonitorlabel>]
Create ChannelLabel with given name and role.
char
) - Name of ChannelLabel.
int
) - One of the ROLE_DIVERT or ROLE_MONITOR or ROLE_L3_MONITOR constants
char
) - Static field for Layer 3 monitor binary header (protocol in pldb)
char
) - Schema name for Layer 3 monitor binary header
char
) - Schema column name for Layer 3 monitor binary header
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'>]
List all ChannelsLabels (monitor label) in the PacketLogic system.
>>> ch.channel_monitor_label_list() [<ChannelLabel fancymonitorlabel>]
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.
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.
str
) - Message recorded in the commit log. Ignored in v12.1 and earlier.
Send a command to server to test if it is up.
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.
tuple
of (str
, int
)
int
, str
or a ProtocolObject
Item) - Name or number of an IP protocol
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).
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.
dict
of str
:int
and
int
:str
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.
Send services to pldbd
Sets stringtable for services and properties. Do NOT use this unless you know exactly what you are doing.
list
of str
) - List of services
list
of str
) - List of service properties
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.
List all XFB (Transfer Behaviour) flags, that can be used in FlagObjects.
list
of str
The CommitID associated with this session. (14.0 or newer only)