2.151. vpp_pg_interface module¶
-
exception
vpp_pg_interface.
CaptureTimeoutError
¶ Bases:
Exception
Exception raised if capture or packet doesn’t appear within timeout
-
class
vpp_pg_interface.
VppPGInterface
(test, pg_index, gso, gso_size)¶ Bases:
vpp_interface.VppInterface
VPP packet-generator interface
-
add_stream
(pkts, nb_replays=None, worker=None)¶ 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
-
property
cap_name
¶ capture name for this interface
-
property
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
-
disable_capture
()¶
-
enable_capture
()¶ Enable capture on this packet-generator interface of at most n packets. If n < 0, this is no limit
-
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
-
property
gso_enabled
¶ gso enabled on packet-generator interface
-
property
gso_size
¶ gso size on packet-generator interface
-
property
in_history_counter
¶ Self-incrementing counter used when renaming old pcap files
-
property
in_path
¶ pcap file path - injected packets
-
property
input_cli
¶ CLI string to load the injected packets
-
property
out_history_counter
¶ Self-incrementing counter used when renaming old pcap files
-
property
out_path
¶ pcap file path - captured packets
-
property
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
-
wait_for_pg_stop
()¶
-
-
vpp_pg_interface.
is_ipv6_misc
(p)¶ Is packet one of uninteresting IPv6 broadcasts?