Channels
- class activelogic.Channels
This is the resource that governs the configuration management of physical channels on an ActiveLogic system.
Channels is a database-bound resource. Thus changes will not take effect until the database transaction is committed.
- async Channels.list(cls)
Generic list function for all kind of data that belongs to this resource.
- Parameters:
cls – Object type that determines what kind of data to get.
- Returns:
A list of given dataclass type.
- Raises:
ValueError – Invalid dataclass type.
PLDBNewDataCommitted – Conflict with new data committed by an other session.
The following data can be listed from this resource:
Channel: Lists all channels.
ChannelLabel: Lists all channel labels.
List may or may not be cached, depending on if
cache_enabled
is set.>>> sd.list(Channel) [Channel(id=1500, active=True, location='Virtual Channel 1'), ...]
The result can be filtered using Python’s list comprehension syntax. For example, to list all labels for divert channels:
>>> [l for l in ch.list(ChannelLabel) if l.role == ChannelRole.DIVERT] [ChannelLabel(id=1, name='My divert label')]
- class activelogic.Channel
Object representing information about a physical channel.
- Parameters:
id (int) – The ID of the channel.
active (bool) – Determines if channel is activated or not.
label (str) – The channel label.
location (str) – The location of the channel.
internal (str) – System name of the internal interface.
intpci (str) – PCI address of the internal interface.
internal_media (ChannelMedia) – The internal media.
external (str) – System name of the external interface.
extpci (str) – PCI address of the external interface.
external_media (ChannelMedia) – The external media.
channel_type (ChannelType) – Channel type.
caps (int) – Channel capabilities bitmask.
role (ChannelRole) – The intended use of the channel.
direction (ChannelDirection) – The channel interface direction. Only used for Traffic Role.
int_ipv4_address (IPv4Interface) – IPv4 address of the internal channel interface. Applicable only if channel is used for Layer3.
ext_ipv4_address (IPv4Interface) – IPv4 address of the external channel interface. Applicable only if channel is used for Layer3.
int_ipv6_address (IPv6Interface) – IPv6 address of the internal channel interface. Applicable only if channel is used for Layer3.
ext_ipv6_address (IPv6Interface) – IPv6 address of the external channel interface. Applicable only if channel is used for Layer3.
int_ipv4_gateway_address (IPv4Address) – Next hop IPv4 address for the internal gateway. Applicable only if channel is used for Layer3.
ext_ipv4_gateway_address (IPv4Address) – Next hop IPv4 address for the external gateway. Applicable only if channel is used for Layer3.
int_ipv6_gateway_address (IPv6Address) – Next hop IPv6 address for the internal gateway. Applicable only if channel is used for Layer3.
ext_ipv6_gateway_address (IPv6Address) – Next hop IPv6 address for the external gateway. Applicable only if channel is used for Layer3.
- class activelogic.ChannelRole
Defines a set of constants for the intended use of a channel:
- Variables:
NONE – Channel is not used.
TRAFFIC – Channel is used for traffic inspection, management and forwarding.
DIVERT – Channel is enabled for divert.
MONITOR – Channel is enabled for monitoring.
FLOWSYNC – Channel is used for FlowSync.
SHUNT – Channel shunts all traffic.
LAYER3 – Channel is used for Layer3 traffic.
L3_MONITOR – Channel is enabled for Layer3 monitoring.
L2_FLOWSYNC_L3_MONITOR – Internal interface of the channel is used for FlowSync and the external interface is enabled for monitoring.
LAYER3_ENDPOINT – TBD.
BOND_LAYER3 – Channel used for layer3 bonded traffic
LAYER3_FLOWSYNC – Channel used for Layer3 flowsync.
LAYER3_SHUNT – Channel used for Layer3 shunt.
- class activelogic.ChannelDirection
Defines a set of constants for available channel interface directions:
- Variables:
DEFAULT – Keeps the default direction with int being an internal interface and ext an external interface.
REVERSE – Swaps the direction to make the interface marked int act as an external interface and vice versa.
INTERNAL – Sets both interfaces to act as internal interfaces.
EXTERNAL – Sets both interfaces to act as external interfaces.
- class activelogic.ChannelMedia
Defines a set of constants for available channel media types:
- Variables:
MEDIA_AUTO – Media type is Auto Negotiated.
MEDIA_10HD – Media type is 10 Mbps Half Duplex.
MEDIA_10FD – Media type is 10 Mbps Full Duplex.
MEDIA_100HD – Media type is 100 Mbps Half Duplex.
MEDIA_100FD – Media type is 100 Mbps Full Duplex.
MEDIA_1000FD – Media type is 1 Gbps Full Duplex.
MEDIA_10000FD – Media type is 10 Gbps Full Duplex.
MEDIA_40000FD – Media type is 40 Gbps Full Duplex.
MEDIA_100000FD – Media type is 100 Gbps Full Duplex.
MEDIA_25000FD – Media type is 25 Gbps Full Duplex.
MEDIA_50000FD – Media type is 50 Gbps Full Duplex.
- class activelogic.ChannelBondMode
Defines a set of modes present for a bond channels/label
- Variables:
BOND_STATIC – Bond channel is used in static mode
BOND_LACP – Bond channel is used in LACP mode
- class activelogic.ChannelBondXMITPolicy
Defines a set of bond xmit policies for Bond label/channel
- Variables:
BOND_XMIT_POLICY_L2 – Bond channel is used with Layer 2 trasmit policy
BOND_XMIT_POLICY_L2L3 – Bond channel is used with Layer 2 and 3 trasmit policy
BOND_XMIT_POLICY_L3L4 – Bond channel is used with Layer 3 and 4 transmit policy
Updating Channel Configurations
- async Channels.activate_channel(channel_id, activate)
Activates or deactivates a channel.
- Parameters:
channel_id (
Channel
or int) – The channel or ID of the channel.activate (bool) –
True
orFalse
.
- Raises:
KeyError – Channel is not found.
PLDBError – Current user lacks write permissions on this resource.
PLDBError – Resource is locked for writing by another user.
PLDBNewDataCommitted – Conflict with new data committed by another session.
>>> ch = conn.channels() >>> ch.activate_channel(1501, False)
- async Channels.update_channel(channel_id, internal_media=None, external_media=None, role=None, label=None, direction=None, subchannels=None, internal=None, external=None, channel_type=None, caps=None, fabric=None, location=None, intpci=None, extpci=None, int_ipv4_address=None, ext_ipv4_address=None, int_ipv6_address=None, ext_ipv6_address=None, int_ipv4_gateway_address=None, ext_ipv4_gateway_address=None, int_ipv6_gateway_address=None, ext_ipv6_gateway_address=None)
Update properties of a channel. Omitting an argument or setting it to
None
will leave that property unchanged.- Parameters:
channel_id (
Channel
or int) – The channel or ID of the channel.internal_media (ChannelMedia) – Media type on internal interface.
external_media (ChannelMedia) – Media type on external interface.
role (ChannelRole) – Role of the channel.
label (str) – Label of the channel.
direction (ChannelDirection) – Direction of the channel.
int_ipv4_address (str) – IPv4 address of the internal interface.
ext_ipv4_address (str) – IPv4 address of the external interface.
int_ipv6_address (str) – IPv6 address of the internal interface.
ext_ipv6_address (str) – IPv6 address of the external interface.
int_ipv4_gateway_address (str) – IPv4 address of the internal gateway.
ext_ipv4_gateway_address (str) – IPv4 address of the external gateway.
int_ipv6_gateway_address (str) – IPv6 address of the internal gateway.
ext_ipv6_gateway_address (str) – IPv6 address of the external gateway.
- Raises:
KeyError – The channel was not found.
PLDBError – The channel is still in use by label.
PLDBError – The current user lacks write permissions on this resource.
PLDBError – The resource is locked for writing by another user.
PLDBNewDataCommitted – Conflict with new data committed by another session.
PLDBUnsupportedInHardware – Hardware does not support the given values.
PLDBUnsupportedInFirmware – Firmware does not support the given property or value.
ValueError – The given value is invalid or not within range.
AddressValueError – The given IP address is not valid.
>>> ch = conn.channels() >>> ch.update_channel(1502, role=ChannelRole.DIVERT)
Channel Labels
- class activelogic.ChannelLabelFlag
Defines a set of constants for flags that can be applied to a channel label:
- Variables:
NONE – No label flags.
DIVERT_RR_CONN – Round robin load balancing.
DIVERT_HASH_LHOST – Hash on local host.
LAYER3_MONITOR – Label is of type Layer3 monitor.
ENCAP_NO_BINARY_HEADER – Do not add binary header (L3 monitor).
ENCAP_WITH_BINARY_HEADER – Add binary header (L3 monitor).
IP_REWRITE – Rewrite IP Addresses (L3 monitor).
INCOMING_TRAFFIC – Monitor incoming traffic (L3 monitor).
OUTGOING_TRAFFIC – Monitor outgoing traffic (L3 monitor).
HB_DISABLED – Disable heartbeat.
HB_ICMP – Use ICMP heartbeat.
HB_HTTP – Use HTTP HEAD heartbeat.
NO_STRIP – Use no-strip mode.
STRIP_L2_HDR – Use strip linklevel header mode.
STRIP_L3_HDR – Use strip network header mode.
TIMESTAMP – Include timestamp in binary header.
SESSION_CONTEXT – Include session context field in binary header.
BOND_TRANSMIT_LAYER2 –
BOND_TRANSMIT_LAYER23 –
BOND_TRANSMIT_LAYER34 –
BOND_MODE_STATIC –
BOND_MODE_LACP –
BOND_ENABLED –
- class activelogic.ChannelLabelRecordFlag
Defines a set of constants for flags that can be applied to a channel record in a channel label
- Variables:
NONE – No flags.
ASYM_VLAN – Divert vlan should use asymmetric vlans.
- class activelogic.ChannelLabel
Object representing a divert or monitoring label and its channel records.
- Parameters:
id (int) – The ID of the label.
role (ChannelRole) – Label type.
flags (ChannelLabelFlag) – Additional label properties.
name (str) – Label name.
protocol (str) – Label protocol.
schemaname (str) – Schemaname.
columnname (str) – Columnname.
records (list) – Channel records.
- class activelogic.ChannelLabelRecord
Object that represents a channel record in a label.
- Parameters:
channel_id (int) – The ID of the channel.
vlan (int) – VLAN ID or 0 for Untagged.
flags (ChannelLabelRecordFlag) – Additional record properties (NONE).
int_address (str) – Internal address (‘169.254.250.1/24’).
int_gateway (str) – Internal gateway (‘169.254.250.254’).
int_heartbeat (str) – Internal gateway (‘169.254.251.1’).
ext_address (str) – External address (‘169.254.240.1/24’).
ext_gateway (str) – External gateway (‘169.254.240.254’).
ext_heartbeat (str) – External heartbeat (‘169.254.241.1’).
int_port (int) – Source port (7777). In layer 3 monitoring this is the UDP source port.
ext_port (int) – Destination port (8888). In layer 3 monitoring this is the UDP destination port.
destination_name (str) – Destination name (‘’).
destination_address (str) – Destination address (‘169.254.230.1’).
heartbeat_url (str) – Heartbeat URL (‘/’).
heartbeat_port (int) – Heartbeat port (80).
- class activelogic.ChannelBondLabel
Object representing a bond label and its channel records.
- Parameters:
id (int) – The ID of the Label.
name (str) – Label name.
role (ChannelRole.LAYER3 or ChannelRole.LAYER3_ENDPOINT) – The role of the bond channel.
bond_mode (ChannelBondMode) – Channel bond mode.
bond_xmit_policy (ChannelBondXMITPolicy) – Channel bond transmit policy.
active (bool) – Determines if channel is activated or not.
primary_channel (int) – Primary channel of the bond label
int_ipv4_address (IPv4Interface) – IPv4 address of the internal interface.
ext_ipv4_address (IPv4Interface) – IPv4 address of the external interface.
int_ipv6_address (IPv6Interface) – IPv6 address of the internal interface.
ext_ipv6_address (IPv6Interface) – IPv6 address of the external interface.
int_ipv4_gateway_address (IPv4Address) – Next hop IPv4 address for the internal gateway.
ext_ipv4_gateway_address (IPv4Address) – Next hop IPv4 address for the external gateway.
int_ipv6_gateway_address (IPv6Address) – Next hop IPv6 address for the internal gateway.
ext_ipv6_gateway_address (IPv6Address) – Next hop IPv6 address for the external gateway.
records (list) – Channel records.
- async Channels.remove_label(label_id)
Removes a channel label.
- Parameters:
label_id (int) – ID of the label to remove.
- Raises:
KeyError – A label with the given ID was not found.
PLDBError – The current user lacks write permissions on this resource.
PLDBError – The resource is locked for writing by another user.
PLDBNewDataCommitted – Conflict with new data committed by another session.
- async Channels.add_label(role, name, flags=ChannelLabelFlag.NONE, protocol='', schemaname='', columnname='', records=None)
Adds a new channel label.
- Parameters:
role (ChannelRole) – Label type.
name (str) – Label name.
flags (ChannelLabelFlag) – Additional label properties.
protocol (str) – Label protocol.
schemaname (str) – Schemaname.
columnname (str) – Columnname.
records (list) – Label records.
- Returns:
The ID of the new label.
- Return type:
int
- Raises:
ValueError – The given role is not valid for labels.
PLDBError – A label with that name already exists.
PLDBError – The channel is not used for divert, monitoring etc.
PLDBError – The current user lacks write permissions on this resource.
PLDBError – The resource is locked for writing by another user.
PLDBNewDataCommitted – Conflict with new data committed by another session.
Channel labels can be added for MONITOR, DIVERT, L3_MONITOR and L2_FLOWSYNC_L3_MONITOR roles. The channels referenced by the label records must match this role.
Records can be given as a list of
ChannelLabelRecord
or tuples.>>> ch = conn.channels() >>> ch.update_channel(1500, role=ChannelRole.DIVERT) >>> ch.add_label(ChannelRole.DIVERT, 'My divert label', records=[ChannelLabelRecord(1500, 0)]) 4
- async Channels.update_label(label_id, name=None, protocol=None, schemaname=None, columnname=None, flags=None, records=None)
Update an existing channel label. Omitting an argument or setting it to
None
will leave that property unchanged.- Parameters:
label_id (int) – The ID of the label to update.
name (str) – Label name.
protocol (str) – Protocol.
schemaname (str) – Schemaname.
columnname (str) – Columnname.
flags (ChannelLabelFlag) – Additional label properties.
records (list) – Channel records.
- Raises:
KeyError – A label with given ID was not found.
PLDBError – A label with that name already exists.
PLDBError – The channel is not used for divert, monitoring etc.
PLDBError – The current user lacks write permissions on this resource.
PLDBError – The resource is locked for writing by another user.
PLDBNewDataCommitted – Conflict with new data committed by another session.
>>> ch = conn.channels() >>> records = [l for l in ch.list(ChannelLabel) if l.id == 4][0].records >>> ch.update_label(4, records=records + [(1502, 0)])
- async Channels.remove_bond_label(label_id)
Removes a channel bond label.
- Parameters:
label_id (int) – ID of the label to remove.
- Raises:
KeyError – A label with the given ID was not found.
PLDBError – The current user lacks write permissions on this resource.
PLDBError – The resource is locked for writing by another user.
PLDBNewDataCommitted – Conflict with new data committed by another session.
- async Channels.add_bond_label(name, primary_channel, role=ChannelRole.LAYER3, bond_mode=ChannelBondMode.BOND_STATIC, bond_xmit_policy=ChannelBondXMITPolicy.BOND_XMIT_POLICY_L2, int_ipv4_address=None, ext_ipv4_address=None, int_ipv6_address=None, ext_ipv6_address=None, int_ipv4_gateway_address=None, ext_ipv4_gateway_address=None, int_ipv6_gateway_address=None, ext_ipv6_gateway_address=None, active=True, records=None)
Adds a new bond channel label.
- Parameters:
name (str) – Label name.
primary_channel (int) – Primary channel of the bond label
role (ChannelRole.LAYER3 or ChannelRole.LAYER3_ENDPOINT) – The role of the bond channel.
bond_mode (ChannelBondMode) – Channel bond mode.
bond_xmit_policy (ChannelBondXMITPolicy) – Channel bond transmit policy.
int_ipv4_address (str) – IPv4 address of the internal interface.
ext_ipv4_address (str) – IPv4 address of the external interface.
int_ipv6_address (str) – IPv6 address of the internal interface.
ext_ipv6_address (str) – IPv6 address of the external interface.
int_ipv4_gateway_address (str) – Next hop IPv4 address for the internal gateway.
ext_ipv4_gateway_address (str) – Next hop IPv4 address for the external gateway.
int_ipv6_gateway_address (str) – Next hop IPv6 address for the internal gateway.
ext_ipv6_gateway_address (str) – Next hop IPv6 address for the external gateway.
active (bool) – Determines if channel is activated or not.
- Returns:
The ID of the new label.
- Return type:
int
- Raises:
ValueError – The given role is not valid for labels.
PLDBError – A label with that name already exists.
PLDBError – The channel is not used for bond_layer3.
PLDBError – The current user lacks write permissions on this resource.
PLDBError – The resource is locked for writing by another user.
PLDBNewDataCommitted – Conflict with new data committed by another session.
Records can be given as a list of
ChannelLabelRecord
>>> ch = conn.channels() >>> ch.update_channel(1500, role=ChannelRole.BOND_LAYER3) >>> ch.add_bond_label(name="My bond label", primary_channel=1500, int_ipv4_address='192.0.2.1/24',ext_ipv4_address='192.0.3.1/24')
- async Channels.update_bond_label(label_id, name=None, bond_xmit_policy=ChannelBondXMITPolicy.BOND_XMIT_POLICY_L2, int_ipv4_address=None, ext_ipv4_address=None, int_ipv6_address=None, ext_ipv6_address=None, int_ipv4_gateway_address=None, ext_ipv4_gateway_address=None, int_ipv6_gateway_address=None, ext_ipv6_gateway_address=None, active=None, records=None)
Update an existing channel bond label. Omitting an argument or setting it to
None
will leave that property unchanged.- Parameters:
label_id (int) – The ID of the label to update.
name (str) – Label name.
bond_xmit_policy (ChannelBondXMITPolicy) – Channel bond transmit policy.
int_ipv4_address (str) – IPv4 address of the internal interface.
ext_ipv4_address (str) – IPv4 address of the external interface.
int_ipv6_address (str) – IPv6 address of the internal interface.
ext_ipv6_address (str) – IPv6 address of the external interface.
int_ipv4_gateway_address (str) – Next hop IPv4 address for the internal gateway.
ext_ipv4_gateway_address (str) – Next hop IPv4 address for the external gateway.
int_ipv6_gateway_address (str) – Next hop IPv6 address for the internal gateway.
ext_ipv6_gateway_address (str) – Next hop IPv6 address for the external gateway.
active (bool) – Determines if channel is activated or not.
records (list) – Channel records.
- Raises:
KeyError – A label with given ID was not found.
PLDBError – A label with that name already exists.
PLDBError – The channel is not used for bond_layer3.
PLDBError – The current user lacks write permissions on this resource.
PLDBError – The resource is locked for writing by another user.
PLDBNewDataCommitted – Conflict with new data committed by another session.
>>> ch = conn.channels() >>> ch.update_bond_label(label_id=600, name="updated bond label")