2.103. util module¶
test framework utilities
-
class
util.
ForeignAddressFactory
¶ Bases:
object
-
count
= 0¶
-
get_ip4
()¶
-
net
= '10.10.10.0/24'¶
-
net_template
= '10.10.10.{}'¶
-
prefix_len
= 24¶
-
-
class
util.
Host
(mac=None, ip4=None, ip6=None, ip6_ll=None)¶ Bases:
object
Generic test host “connected” to VPPs interface.
-
bin_mac
¶ MAC address
-
ip4
¶ IPv4 address - string
-
ip4n
¶ IPv4 address of remote host - raw, suitable as API parameter.
-
ip6
¶ IPv6 address - string
-
ip6_ll
¶ IPv6 link-local address - string
-
ip6n
¶ IPv6 address of remote host - raw, suitable as API parameter.
-
ip6n_ll
¶ IPv6 link-local address of remote host - raw, suitable as API parameter.
-
mac
¶ MAC address
-
-
class
util.
L4_Conn
(testcase, if1, if2, af, l4proto, port1, port2)¶ Bases:
object
L4 ‘connection’ tied to two VPP interfaces
-
pkt
(side, l4args={}, payload='x')¶
-
recv
(side)¶
-
send
(side, flags=None, payload='')¶
-
send_pingpong
(side, flags1=None, flags2=None)¶
-
send_through
(side, flags=None, payload='')¶
-
-
class
util.
LoggerWrapper
(logger=None)¶ Bases:
object
-
debug
(*args, **kwargs)¶
-
error
(*args, **kwargs)¶
-
-
util.
check_core_path
(logger, core_path)¶
-
util.
fragment_rfc791
(packet, fragsize, _logger=None)¶ Fragment an IPv4 packet per RFC 791 :param packet: packet to fragment :param fragsize: size at which to fragment :note: IP options are not supported :returns: list of fragments
-
util.
fragment_rfc8200
(packet, identification, fragsize, _logger=None)¶ Fragment an IPv6 packet per RFC 8200 :param packet: packet to fragment :param fragsize: size at which to fragment :note: IP options are not supported :returns: list of fragments
-
util.
get_core_path
(tempdir)¶
-
util.
get_core_pattern
()¶
-
util.
ip4_range
(ip4, s, e)¶
-
util.
ip4n_range
(ip4n, s, e)¶
-
util.
ip6_normalize
(ip6)¶
-
util.
is_core_present
(tempdir)¶
-
util.
mk_ll_addr
(mac)¶
-
util.
ppc
(headline, capture, limit=10)¶ Return string containing ppp() printout for a capture.
- Parameters
headline – printed as first line of output
capture – packets to print
limit – limit the print to # of packets
-
util.
ppp
(headline, packet)¶ Return string containing the output of scapy packet.show() call.
-
util.
reassemble4
(listoffragments)¶
-
util.
reassemble4_core
(listoffragments, return_ip)¶
-
util.
reassemble4_ether
(listoffragments)¶