ostinato.protocols.ip4over4_pb2 module¶
Create IPv4 over IPv4 Ostinato streams by adding the protocol and customizing both outer and inner IPv4 attributes efficiently
Ip4over4 is a combination of Ip4 followed by Ip4.
To add and configure Ip4over4 in a stream, add a protocol to the stream, set the protocol id to ost_pb.Protocol.kIp4over4FieldNumber
and access the Ip4over4 object from the Protocol object's Extensions
dictionary using the key ip4over4_pb2.ip4over4
. The outer and inner Ip4 objects can then be accessed using the Ip4over4 object's Extensions
dictionary using the keys ip4over4_pb2.ip4_outer
and ip4over4_pb2.ip4_inner
respectively.
from ostinato.protocols import ip4over4_pb2
...
# stream is an object of type ost_pb.Stream
proto = stream.protocol.add()
proto.protocol_id.id = ost_pb.Protocol.kIp4over4FieldNumber
my_ip4over4 = proto.Extensions[ip4over4_pb2.ip4over4]
my_ip4_outer = my_ip4over4.Extensions[ip4over4_pb2.ip4_outer]
my_ip4_inner = my_ip4over4.Extensions[ip4over4_pb2.ip4_inner]
You can then set outer and inner Ip4 attributes using my_ip4_outer.<attribute>
and my_ip4_inner.<attribute>
respectively.