8.3.1.8. Capture

This module contains the L23 port capture classes that deal with configuration of the capture criteria and inspection of the captured data from a port.

Whether the port is enabled for capturing packets is specified by the P_CAPTURE command. Captured packets are indexed starting from 0, and are stored in a buffer that is cleared before capture starts. While on, the capture configuration parameters cannot be changed.

The capture command names all have the form PC_<xxx> and require both a module index id and a port index id. The per-packet parameters also use a sub-index identifying a particular packet in the capture buffer.


class PC_EXTRA[source]

Bases: object

Obtains extra information about a captured packet for a port. The information comprises time of capture, latency, inter-frame gap, and original packet length. Latency is only valid for packets with test payloads and where the originating port is on the same module and therefore has the same clock.

class GetDataAttr[source]

Bases: ResponseBodyStruct

byte_time_count

The number of byte-times since previous packet.

Type:

int

latency

The number of nanoseconds since the packet was transmitted.

Type:

int

length

The real length of the packet on the wire.

Type:

int

time_captured

Time of capture, in nanoseconds since 2010-01-01.

Type:

int

get()[source]

Get extra information about a captured packet for a port.

Returns:

Extra information about a captured packet for a port.

Return type:

GetDataAttr

class PC_KEEP[source]

Bases: object

Which packets to keep once the start criteria has been triggered for a port. Also how big a portion of each packet to retain, saving space for more packets in the capture buffer.

class GetDataAttr[source]

Bases: ResponseBodyStruct

byte_count

How many bytes to keep in the buffer for of each packet. The value -1 means no limit on packet size.

Type:

int

index

Test payload id or filter index for which packets to keep.

Type:

int

kind

The type of packet to keep.

Type:

PacketType

class SetDataAttr[source]

Bases: RequestBodyStruct

byte_count

integer, how many bytes to keep in the buffer for of each packet. The value -1 means no limit on packet size.

index

integer, test payload id or filter index for which packets to keep.

kind

coded integer, which general kind of packets to keep

get()[source]

Get the configuration of how to keep captured packets.

Returns:

the configuration of how to keep captured packets

Return type:

GetDataAttr

set(kind, index, byte_count)[source]

Set the configuration of how to keep captured packets.

Parameters:
  • kind (PacketType) – which general kind of packets to keep

  • index (int) – test payload id or filter index for which packets to keep

  • byte_count (int) – how many bytes to keep in the buffer for of each packet. The value -1 means no limit on packet size.

set_all(index, byte_count)

Keep all types of packets.

set_fcserr(index, byte_count)

Only keep the packets with FCS errors.

set_filter(index, byte_count)

Only keep the packets that satisfy the given filter.

set_notpld(index, byte_count)

Only keep the packets without test payload.

set_plderr(index, byte_count)

Only keep the packets with payload error in.

set_tpld(index, byte_count)

Only keep the packets with test payload.

class PC_PACKET[source]

Bases: object

Obtains the raw bytes of a captured packet for a port. The packet data may be truncated if the PC_KEEP command specified a limit on the number of bytes kept.

class GetDataAttr[source]

Bases: ResponseBodyStruct

hex_data

The raw bytes kept for the packet.

Type:

list

get()[source]

Get the raw bytes of a captured packet for a port.

Returns:

the raw bytes of a captured packet

Return type:

GetDataAttr

class PC_STATS[source]

Bases: object

Obtains the number of packets currently in the capture buffer for a port. The count is reset to zero when capture is turned on.

class GetDataAttr[source]

Bases: ResponseBodyStruct

packets

The number of packets in the buffer.

Type:

int

start_time

Time when capture was started, in nanoseconds since 2010-01-01.

Type:

int

status

Capture status, 1 if capture has been stopped because of overflow, 0 if still running.

Type:

int

get()[source]

Get the number of packets currently in the capture buffer for a port. The count is reset to zero when capture is turned on.

Returns:

status of the capture, number of packets in the buffer, and start time in nanoseconds since 2010-01-01.

Return type:

GetDataAttr

class PC_TRIGGER[source]

Bases: object

The criteria for when to start and stop the capture process for a port. Even when capture is enabled with P_CAPTURE, the actual capturing of packets can be delayed until a particular start criteria is met by a received packet. Likewise, a stop criteria can be specified, based on a received packet. If no explicit stop criteria is specified, capture stops when the internal buffer runs full. In buffer overflow situations, if there is an explicit stop criteria, then the latest packets will be retained (and the early ones discarded), and otherwise, the earliest packets are retained (and the later ones discarded).

class GetDataAttr[source]

Bases: ResponseBodyStruct

start_criteria

The criteria for starting the actual packet capture.

Type:

StartTrigger

start_criteria_filter

The index of a particular filter for the start criteria.

Type:

int

stop_criteria

The criteria for stopping the actual packet capture.

Type:

StopTrigger

stop_criteria_filter

The index of a particular filter for the stop criteria.

Type:

int

class SetDataAttr[source]

Bases: RequestBodyStruct

start_criteria

coded integer, the criteria for starting the actual packet capture

start_criteria_filter

integer, the index of a particular filter for the start criteria.

stop_criteria

coded integer, the criteria for stopping the actual packet capture

stop_criteria_filter

integer, the index of a particular filter for the stop criteria.

get()[source]

Get the capture criteria configurations.

Returns:

capture criteria configuration.

Return type:

GetDataAttr

set(start_criteria, start_criteria_filter, stop_criteria, stop_criteria_filter)[source]

Set the capture criteria configurations.

Parameters:
  • start_criteria (StartTrigger) – the criteria for starting the actual packet capture

  • start_criteria_filter (int) – the index of a particular filter for the start criteria

  • stop_criteria (StopTrigger) – the criteria for stopping the actual packet capture

  • stop_criteria_filter (int) – the index of a particular filter for the stop criteria