Skip to content

ostinato.protocols.vlanstack_pb2 module

Add and configure VlanStack in Ostinato streams to customize Q-in-Q SVLAN and CVLAN attributes

VlanStack is a combination of Svlan followed by Vlan.

To add and configure VlanStack in a stream, add a protocol to the stream and set the protocol id to ost_pb.Protocol.kVlanStackFieldNumber. However, unlike other protocols, the VlanStack object accessed via the Protocol object's Extensions dictionary using the key vlanstack_pb2.vlanStack does not have any attributes of its own. Instead you need to access the individual Svlan and Vlan objects from the Protocol object's Extensions dictionary using their respective keys.

from ostinato.protocols import svlan_pb2, vlan_pb2
...
# stream is an object of type ost_pb.Stream
proto = stream.protocol.add()
proto.protocol_id.id = ost_pb.Protocol.kVlanStackFieldNumber
my_svlan = proto.Extensions[svlan_pb2.svlan]
my_vlan = proto.Extensions[vlan_pb2.vlan]

You can then set Svlan attributes and Vlan attributes using my_svlan.<attribute> and my_vlan.<attribute> respectively.

Back to top