p4utils.utils.traffic_utils module

p4utils.utils.traffic_utils.recv_udp_flow(dport)[source]

Receiving function.

Parameters:dport (int) – port to listen
p4utils.utils.traffic_utils.send_udp_flow(dst='10.0.0.2', sport=5000, dport=5001, tos=0, rate='10M', duration=0, packet_size=1400, batch_size=1, **kwargs)[source]

Udp sending function that keeps a constant rate and logs sent packets to a file.

Parameters:
  • dst (str, optional) – destination IP. Defaults to “10.0.0.2”.
  • sport (int, optional) – destination port. Defaults to 5000.
  • dport (int, optional) – source port. Defaults to 5001.
  • tos (int, optional) – type of service. Defaults to 0.
  • rate (str, optional) – flow rate. Defaults to ‘10M’.
  • duration (int, optional) – flow duration. Defaults to 0, i.e. no time limit.
  • packet_size (int, optional) – packet size. Defaults to 1400.
  • batch_size (int, optional) – batch size. Defaults to 1.
p4utils.utils.traffic_utils.setSizeToInt(size)[source]

Converts the sizes string notation to the corresponding integer (in bytes). Input size can be given with the following magnitudes: B, K, M and G.