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 (IPv4Network) – IPv4 address of the internal channel interface. Applicable only if channel is used for Layer3.

  • ext_ipv4_address (IPv4Network) – IPv4 address of the external channel interface. Applicable only if channel is used for Layer3.

  • int_ipv6_address (IPv6Network) – IPv6 address of the internal channel interface. Applicable only if channel is used for Layer3.

  • ext_ipv6_address (IPv6Network) – 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.

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.

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 or False.

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, 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.

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_LAN – 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).

  • ext_port (int) – Destination port (8888).

  • 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).

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)])