drone.modifyStream(stream_cfg) # clear tx/rx stats log.info('clearing tx/rx stats') drone.clearStats(tx_port) drone.clearStats(rx_port) # ----------------------------------------------------------------- # # TESTCASE: Verify a RPC with missing required fields in request fails # and subsequently passes when the fields are initialized # ----------------------------------------------------------------- # passed = False suite.test_begin('rpcWithMissingRequiredFieldsFails') pid = ost_pb.PortId() try: sid_list = drone.getStreamIdList(pid) except RpcError as e: if ('missing required fields in request' in str(e)): passed = True log.info("Retrying RPC after adding the missing fields") pid.id = tx_port_number try: sid_list = drone.getStreamIdList(pid) except: passed = False raise else: raise finally: suite.test_end(passed)
rx_port_number = port.port_id.id if tx_port_number < 0 or rx_port_number < 0: log.warning('loopback port not found') sys.exit(1) print('Using port %d as tx/rx port(s)' % tx_port_number) tx_port = ost_pb.PortIdList() tx_port.port_id.add().id = tx_port_number; rx_port = ost_pb.PortIdList() rx_port.port_id.add().id = rx_port_number; # delete existing streams, if any, on tx port sid_list = drone.getStreamIdList(tx_port.port_id[0]) drone.deleteStream(sid_list) # add a stream stream_id = ost_pb.StreamIdList() stream_id.port_id.CopyFrom(tx_port.port_id[0]) stream_id.stream_id.add().id = 1 log.info('adding tx_stream %d' % stream_id.stream_id[0].id) drone.addStream(stream_id) # configure the stream stream_cfg = ost_pb.StreamConfigList() stream_cfg.port_id.CopyFrom(tx_port.port_id[0]) s = stream_cfg.stream.add() s.stream_id.id = stream_id.stream_id[0].id s.core.is_enabled = True