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 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:
- kind
The type of packet to keep.
- Type:
- 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:
- 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 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 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:
- stop_criteria
The criteria for stopping the actual packet capture.
- Type:
- 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:
- 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