["alias=", "node="]) except getopt.GetoptError, err: # print help information and exit: print str(err) # will print something like "option -a not recognized" usage() sys.exit(2) for opt, arg in opts: if opt == "-v": verbose = True elif opt == "-V": verbose = True connection.network.verbose = True elif opt in ("-a", "--alias"): alias = int(arg) elif opt in ("-n", "--node"): nodeID = canolcbutils.splitSequence(arg) elif opt == "-t": identifynode = True else: assert False, "unhandled option" if identifynode: import getUnderTestAlias dest, nodeID = getUnderTestAlias.get(alias, None, verbose) if nodeID == None: nodeID = otherNodeId # now execute retval = test(alias, nodeID, connection) connection.network.close() exit(retval)
# print help information and exit: print str(err) # will print something like "option -a not recognized" usage() sys.exit(2) for opt, arg in opts: if opt == "-v": verbose = True elif opt == "-V" : connection.network.verbose = True verbose = True elif opt in ("-a", "--alias"): # needs hex processing alias = int(arg) elif opt in ("-d", "--dest"): # needs hex processing dest = int(arg) elif opt in ("-c", "--content"): content = canolcbutils.splitSequence(arg) elif opt == "-t": identifynode = True else: assert False, "unhandled option" if identifynode : import getUnderTestAlias dest, nodeID = getUnderTestAlias.get(alias, None, verbose) retval = test(alias, dest, content, connection, verbose) connection.network.close() exit(retval) def test(alias, dest, content, connection, verbose) : return sendOneDatagram(alias, dest, content, connection, verbose)
# print help information and exit: print str(err) # will print something like "option -a not recognized" usage() sys.exit(2) for opt, arg in opts: if opt == "-v": verbose = True elif opt == "-V": connection.network.verbose = True verbose = True elif opt in ("-a", "--alias"): # needs hex processing alias = int(arg) elif opt in ("-d", "--dest"): # needs hex processing dest = int(arg) elif opt in ("-n", "--node"): nodeID = canolcbutils.splitSequence(arg) elif opt == "-t": identifynode = True else: assert False, "unhandled option" if identifynode : import getUnderTestAlias dest, otherNodeId = getUnderTestAlias.get(alias, None, verbose) if nodeID == None : nodeID = otherNodeId retval = test(alias, dest, nodeID, connection, verbose) connection.network.close() exit(retval) def test(alias, dest, nodeID, connection, verbose) :