Ostinato API - Wait for stream transmission to finish
The Ostinato API tutorial configures a single stream to send 5 packets then sleeps for 7 seconds - assuming transmission would have finished by then - before fetching the tx/rx stats for verification.
This is fine for a tutorial, but for production scenarios you will want to wait till the transmission is finished instead of waiting (sleeping) for a specified amount of time.
Here’s how you can do that -
# wait for transmit to finish
while True:
try:
time.sleep(5)
tx_stats = drone.getStats(tx_port)
if tx_stats.port_stats[0].state.is_transmit_on == False:
break
except KeyboardInterrupt:
log.info('transmit interrupted by user')
break
Interested in more Ostinato tips and tricks? Subscribe to receive email updates!
Leave a Comment