Skip to content

ostinato.protocols.udp_pb2 module

Configure UDP protocol attributes in Ostinato streams for customizable packet behavior, including source/destination ports, total length, and checksum.

To add and configure Udp in a stream, add a protocol to the stream, set the protocol id to ost_pb.Protocol.kUdpFieldNumber and access the Udp object from the Protocol object's Extensions dictionary using the key udp_pb2.udp

from ostinato.protocols import udp_pb2
...
# stream is an object of type ost_pb.Stream
proto = stream.protocol.add()
proto.protocol_id.id = ost_pb.Protocol.kUdpFieldNumber
my_udp = proto.Extensions[udp_pb2.udp]
You can then set Udp attributes using my_udp.<attribute>

Udp class

Class attributes

is_override_src_port

Udp.is_override_src_port : boolean
Optional. If not set, defaults to False.

is_override_dst_port

Udp.is_override_dst_port : boolean
Optional. If not set, defaults to False.

is_override_totlen

Udp.is_override_totlen : boolean
Optional. If not set, defaults to False.

is_override_cksum

Udp.is_override_cksum : boolean
Optional. If not set, defaults to False.

src_port

Udp.src_port : long
Optional. If not set, defaults to 49152.

dst_port

Udp.dst_port : long
Optional. If not set, defaults to 49153.

totlen

Udp.totlen : long
Optional. If not set, defaults to 0.

cksum

Udp.cksum : long
Optional. If not set, defaults to 0.

Back to top