def main():
    usagestr = "usage: %prog [-h] [options] [args]"
    parser = optparse.OptionParser(usage = usagestr)
    parser.set_defaults(numnodes = 10, linkprob = 0.35, delay = 20, seed = None)

    parser.add_option("-n", "--numnodes", dest = "numnodes", type = int,
                      help = "number of nodes")
    parser.add_option("-p", "--linkprob", dest = "linkprob", type = float,
                      help = "link probabilty")
    parser.add_option("-d", "--delay", dest = "delay", type = float,
                      help = "wait time before checking")
    parser.add_option("-s", "--seed", dest = "seed", type = int,
                      help = "specify integer to use for random seed")
    parser.add_option("-v", "--verbose", dest = "verbose",
                      action = "store_true", help = "be more verbose")
    parser.add_option("-l", "--logfile", dest = "logfile", type = str,
                      help = "log detailed output to the specified file")

    def usage(msg = None, err = 0):
        sys.stdout.write("\n")
        if msg:
            sys.stdout.write(msg + "\n\n")
        parser.print_help()
        sys.exit(err)

    # parse command line options
    (options, args) = parser.parse_args()

    if options.numnodes < 2:
        usage("invalid numnodes: %s" % options.numnodes)
    if options.linkprob <= 0.0 or options.linkprob > 1.0:
        usage("invalid linkprob: %s" % options.linkprob)
    if options.delay < 0.0:
        usage("invalid delay: %s" % options.delay)

    for a in args:
        sys.stderr.write("ignoring command line argument: '%s'\n" % a)

    if options.seed:
        random.seed(options.seed)

    me = ManetExperiment(options = options, start=datetime.datetime.now())
    me.info("creating topology: numnodes = %s; linkprob = %s" % \
                (options.numnodes, options.linkprob))
    me.topology(options.numnodes, options.linkprob)
    
    me.info("waiting %s sec" % options.delay)
    time.sleep(options.delay)
    me.info("checking neighbor state and routes")
    me.checknodes()
    me.info("done")
    me.info((datetime.datetime.now() - me.start) % "elapsed time: %s")
    me.logend()
    
    return me
dataset/ETHPy150Open coreemu/core/daemon/examples/netns/ospfmanetmdrtest.py/main/swapped operands of `%`