Skip to content

ostinato.protocols.mac_pb2 module

Configure MAC settings in your network stream using ostinato.protocols.mac_pb2. Customize fixed or varying mac addresses for layer 2 testing

To add and configure Mac in a stream, add a protocol to the stream, set the protocol id to ost_pb.Protocol.kMacFieldNumber and access the Mac object from the Protocol object's Extensions dictionary using the key mac_pb2.mac

from ostinato.protocols import mac_pb2
...
# stream is an object of type ost_pb.Stream
proto = stream.protocol.add()
proto.protocol_id.id = ost_pb.Protocol.kMacFieldNumber
my_mac = proto.Extensions[mac_pb2.mac]
You can then set Mac attributes using my_mac.<attribute>

Mac class

Class constants

MacAddrMode

Mac.e_mm_fixed 
Mac.e_mm_inc 
Mac.e_mm_dec 
Mac.e_mm_resolve 

Class attributes

dst_mac

Mac.dst_mac : long
Optional. If not set, defaults to 0.

dst_mac_mode

Mac.dst_mac_mode : MacAddrMode
Optional. If not set, defaults to e_mm_resolve.

See MacAddrMode

dst_mac_count

Mac.dst_mac_count : long
Optional. If not set, defaults to 16.

dst_mac_step

Mac.dst_mac_step : long
Optional. If not set, defaults to 1.

src_mac

Mac.src_mac : long
Optional. If not set, defaults to 0.

src_mac_mode

Mac.src_mac_mode : MacAddrMode
Optional. If not set, defaults to e_mm_resolve.

See MacAddrMode

src_mac_count

Mac.src_mac_count : long
Optional. If not set, defaults to 16.

src_mac_step

Mac.src_mac_step : long
Optional. If not set, defaults to 1.

Back to top