p4utils.utils.p4runtime_API.p4runtime module

class p4utils.utils.p4runtime_API.p4runtime.P4RuntimeClient(device_id, grpc_addr, election_id)[source]

Bases: object

api_version()[source]
get_digest_list(timeout=None)[source]

Retrieve DigestList and send back acknowledgment.

Parameters:timeout (int or None) – time to wait for packet, if set to None, the function will wait indefinitely
Returns:DigestList packet (protobuf message) or None if the timeout has expired and no packet has been received.
Notice:
See https://github.com/p4lang/p4runtime/blob/45d1c7ce2aad5dae819e8bba2cd72640af189cfe/proto/p4/v1/p4runtime.proto#L543 for further details.
get_p4info()[source]
get_stream_packet(type_, timeout=1)[source]

Retrieve packet from the StreamChannel.

Parameters:
  • type (string) – name of a field present in the packet
  • timeout (int or None) – time to wait for packet, if set to None, the function will wait indefinitely
Returns:

packet (protobuf message)

handshake()[source]
read_one(entity)[source]
set_fwd_pipe_config(p4info_path, bin_path)[source]
set_up_stream()[source]
tear_down()[source]
write(req)[source]
write_update(update)[source]
exception p4utils.utils.p4runtime_API.p4runtime.P4RuntimeErrorFormatException(message)[source]

Bases: Exception

class p4utils.utils.p4runtime_API.p4runtime.P4RuntimeErrorIterator(grpc_error)[source]

Bases: object

exception p4utils.utils.p4runtime_API.p4runtime.P4RuntimeException(grpc_error)[source]

Bases: Exception

exception p4utils.utils.p4runtime_API.p4runtime.P4RuntimeWriteException(grpc_error)[source]

Bases: Exception

p4utils.utils.p4runtime_API.p4runtime.parse_p4runtime_error(f)[source]
p4utils.utils.p4runtime_API.p4runtime.parse_p4runtime_write_error(f)[source]