Using Python API to transmit on multiple ports simultaneously

9 views
Skip to first unread message

Vinith Mundhra

unread,
Mar 14, 2022, 7:48:11 AMMar 14
to ostinato
Hi,
I have 5 Ethernet ports on my PC. Using Python and Ostinato, I need to transmit (specific streams) on all 5 ports simultaneously. I have looked at the ostinato-example.py and tried to base that on my requirement. However, when I run the code, I see that Port5 is transmitted first, then Port4, then Port3 and so on - and not simultaneously. Could you please help?
If the ostinato-example.py could be modified to do just that, it would be great.
Thanks,
Vinith

Srivats P

unread,
Mar 14, 2022, 8:30:46 AMMar 14
to Vinith Mundhra, ostinato
Vinith,

Sounds like you wrapped the start/stop transmit code in a loop. Something like this maybe?

for port_id in [1, 2, 3, 4, 5]:
    tx_port = ost_pb.PortIdList()
    tx_port.port_id.add().id = port_id

    drone.startTransmit(tx_port)

    # wait for transmit to finish
    time.sleep(7)

    drone.stopTransmit(tx_port)

Note that startTransmit and stopTransmit take port lists as the input parameter - so you can provide the list of ports to it on which to start/stop the transmit.

e.g. use a code like this -

tx_port = ost_pb.PortIdList()
for port_id in [1, 2, 3, 4, 5]: # use the actual port Ids here
    tx_port.port_id.add().id = port_id

drone.startTransmit(tx_port)

# wait for transmit to finish
time.sleep(7)

drone.stopTransmit(tx_port)

Of course you should have configured the streams on all ports (i.e. call drone.build on each port) before invoking the startTransmit.

Let me know if you have any questions.

Srivats (Founder, Ostinato)
Generate 🚀 wire speed 10/25/40G traffic with the new Ostinato Turbo add-on!

--
Get Ostinato News and Updates on Twitter - Follow @ostinato (http://twitter.com/ostinato)
---
You received this message because you are subscribed to the Google Groups "ostinato" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ostinato+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ostinato/dcab429c-1b50-4ecb-8996-4bdbb7c976c4n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages