2.39. 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)

Bases: object

Generic test host “connected” to VPPs interface.

ip4

IPv4 address - string

ip4n

IPv4 address of remote host - raw, suitable as API parameter.

ip6

IPv6 address - string

ip6n

IPv6 address of remote host - raw, suitable as API parameter.

mac

MAC address

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.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.