2.115. vpp_pg_interface module

exception vpp_pg_interface.CaptureTimeoutError

Bases: exceptions.Exception

Exception raised if capture or packet doesn’t appear within timeout

class vpp_pg_interface.VppPGInterface(test, pg_index)

Bases: vpp_interface.VppInterface

VPP packet-generator interface

add_stream(pkts)

Add a stream of packets to this packet-generator

Parameters:pkts – iterable packets
assert_nothing_captured(remark=None, filter_out_fn=<function is_ipv6_misc>)

Assert that nothing unfiltered was captured on interface

Parameters:
  • remark – remark printed into debug logs
  • filter_out_fn – filter applied to each packet, packets for which the filter returns True are removed from capture
cap_name

capture name for this interface

capture_cli

CLI string to start capture on this interface

create_arp_req()

Create ARP request applicable for this interface

create_ndp_req()

Create NDP - NS applicable for this interface

enable_capture()

Enable capture on this packet-generator interface

generate_debug_aid(kind)

Create a hardlink to the out file with a counter and a file containing stack trace to ease debugging in case of multiple capture files present.

get_capture(expected_count=None, remark=None, timeout=1, filter_out_fn=<function is_ipv6_misc>)

Get captured packets

Parameters:
  • expected_count – expected number of packets to capture, if None, then self.test.packet_count_for_dst_pg_idx is used to lookup the expected count
  • remark – remark printed into debug logs
  • timeout – how long to wait for packets
  • filter_out_fn – filter applied to each packet, packets for which the filter returns True are removed from capture
Returns:

iterable packets

in_history_counter

Self-incrementing counter used when renaming old pcap files

in_path

pcap file path - injected packets

input_cli

CLI string to load the injected packets

out_history_counter

Self-incrementing counter used when renaming old pcap files

out_path

pcap file path - captured packets

pg_index

packet-generator interface index assigned by VPP

resolve_arp(pg_interface=None)

Resolve ARP using provided packet-generator interface

Parameters:pg_interface – interface used to resolve, if None then this interface is used
resolve_ndp(pg_interface=None, timeout=1)

Resolve NDP using provided packet-generator interface

Parameters:
  • pg_interface – interface used to resolve, if None then this interface is used
  • timeout – how long to wait for response before giving up
verify_enough_packet_data_in_pcap()

Check if enough data is available in file handled by internal pcap reader so that a whole packet can be read.

Returns:True if enough data present, else False
wait_for_capture_file(timeout=1)

Wait until pcap capture file appears

Parameters:timeout – How long to wait for the packet (default 1s)
Returns:True/False if the file is present or appears within timeout
wait_for_packet(timeout, filter_out_fn=<function is_ipv6_misc>)

Wait for next packet captured with a timeout

Parameters:timeout – How long to wait for the packet
Returns:Captured packet if no packet arrived within timeout
Raises:Exception – if no packet arrives within timeout
vpp_pg_interface.is_ipv6_misc(p)

Is packet one of uninteresting IPv6 broadcasts?