try: log.info('sleeping for 4s ...') time.sleep(4) log.info('starting transmit multiple times') drone.startTransmit(tx_port) time.sleep(1) drone.startTransmit(tx_port) time.sleep(1) drone.startTransmit(tx_port) time.sleep(1) log.info('waiting for transmit to finish ...') time.sleep(5) drone.stopTransmit(tx_port) drone.stopCapture(rx_port) buff = drone.getCaptureBuffer(rx_port.port_id[0]) drone.saveCaptureBuffer(buff, 'capture.pcap') log.info('dumping Rx capture buffer') cap_pkts = subprocess.check_output([tshark, '-r', 'capture.pcap']) print(cap_pkts) if '5.6.7.8' in cap_pkts: passed = True os.remove('capture.pcap') except RpcError as e: raise finally: drone.stopTransmit(tx_port) suite.test_end(passed) # ----------------------------------------------------------------- # # TESTCASE: Verify invoking startCapture() during capture is a NOP,
log.info('stopping capture') drone.stopCapture(rx_port) # get tx/rx stats log.info('retreiving stats') tx_stats = drone.getStats(tx_port) rx_stats = drone.getStats(rx_port) #log.info('--> (tx_stats)' + tx_stats.__str__()) #log.info('--> (rx_stats)' + rx_stats.__str__()) log.info('tx pkts = %d, rx pkts = %d' % (tx_stats.port_stats[0].tx_pkts, rx_stats.port_stats[0].rx_pkts)) # retrieve and dump received packets log.info('getting Rx capture buffer') buff = drone.getCaptureBuffer(rx_port.port_id[0]) drone.saveCaptureBuffer(buff, 'capture.pcap') log.info('dumping Rx capture buffer') os.system('tshark -r capture.pcap') os.remove('capture.pcap') # delete streams log.info('deleting tx_stream %d' % stream_id.stream_id[0].id) drone.deleteStream(stream_id) # bye for now drone.disconnect() except Exception as ex: log.exception(ex) sys.exit(1)