Porting¶
If you are porting your scripts from an earlier version of the Ostinato Python API to a newer version, you will find helpful information here.
To version 1.0¶
- Default MAC mode has changed from fixed to resolve; scripts which assumed the default mac mode as fixed MUST be changed to set the mac mode explicitly. e.g.
from ostinato.protocols.mac_pb2 import mac, Mac # <--- import Mac
# ...
p = s.protocol.add()
p.protocol_id.id = ost_pb.Protocol.kMacFieldNumber
p.Extensions[mac].dst_mac_mode = Mac.e_mm_fixed # <-- add this statement
p.Extensions[mac].src_mac_mode = Mac.e_mm_fixed # <-- add this statement
p.Extensions[mac].dst_mac = 0x001122334455
p.Extensions[mac].src_mac = 0x00aabbccddee
- A new API has been added DroneProxy.build() to explicitly trigger a prebuild of packets. Although optional, it is highly recommend to use this API before invoking startTransmit().
# prebuild all packets to be sent before actually sending them
build_cfg = ost_pb.BuildConfig()
build_cfg.port_id.CopyFrom(tx_port.port_id[0])
drone.build(build_cfg)