def drone(request): drn = DroneProxy(host_name) log.info('connecting to drone(%s:%d)' % (drn.hostName(), drn.portNumber())) drn.connect() def fin(): drn.disconnect() request.addfinalizer(fin) return drn
def drone(request): """Baseline Configuration for all testcases in this module""" dut = DroneProxy(host_name) log.info('connecting to drone(%s:%d)' % (dut.hostName(), dut.portNumber())) dut.connect() def fin(): dut.disconnect() request.addfinalizer(fin) return dut
logging.basicConfig(level=logging.INFO) print('') print('This test uses the following topology -') print('') print(' +-------+ ') print(' | |Tx--->----+') print(' | Drone | |') print(' | |Rx---<----+') print(' +-------+ ') print('') print('A loopback port is used as both the Tx and Rx ports') print('') suite = TestSuite() drone = DroneProxy(host_name) try: # ----------------------------------------------------------------- # # TESTCASE: Verify any RPC before checkVersion() fails and the server # closes the connection # ----------------------------------------------------------------- # passed = False suite.test_begin('anyRpcBeforeCheckVersionFails') drone.channel.connect(drone.host, drone.port) try: port_id_list = drone.getPortIdList() except RpcError as e: if ('compatibility check pending' in str(e)): passed = True else:
print(' | Drone | | DUT |') print(' | |Rx---<----| |') print(' +-------+ +-------+') print('') print('Drone has 2 ports connected to DUT. Packets sent on the Tx port') print('are expected to be received back on the Rx port') print('') print('An easy way to simulate the above topology is to select the loopback') print('port as both Tx and Rx ports') print('') if not use_defaults: s = raw_input('Drone\'s Hostname/IP [%s]: ' % (host_name)) host_name = s or host_name drone = DroneProxy(host_name) try: # connect to drone log.info('connecting to drone(%s:%d)' % (drone.hostName(), drone.portNumber())) drone.connect() # retreive port id list log.info('retreiving port list') port_id_list = drone.getPortIdList() # retreive port config list log.info('retreiving port config for all ports') port_config_list = drone.getPortConfig(port_id_list)