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: raise finally: drone.channel.disconnect() suite.test_end(passed) # ----------------------------------------------------------------- # # TESTCASE: Verify DroneProxy.connect() fails for incompatible version # ----------------------------------------------------------------- # passed = False suite.test_begin('connectFailsForIncompatibleVersion') try:
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) if len(port_config_list.port) == 0: log.warning('drone has no ports!') sys.exit(1) # print port list and get tx/rx port id print('Port List') print('---------') for port in port_config_list.port: print('%d.%s (%s)' % (port.port_id.id, port.name, port.description)) # use a loopback port as default tx/rx port