2.54. 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_SIDE
L4_CONN_SIDE_ONE = 1
L4_CONN_SIDE_ZERO = 0
class util.L4_Conn(testcase, if1, if2, af, l4proto, port1, port2)

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.NumericConstant(value)

Bases: object

desc_dict = {}
util.ip4_range(ip4, s, e)
util.ip4n_range(ip4n, s, e)
util.mactobinary(mac)

Convert the : separated format into binary packet data for the API

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.