removed session manager, since CoreEmu does this now, set future examples to serve as API examples, removed netns examples that are replaced by these API variations
This commit is contained in:
parent
8644e9d61e
commit
dc751dde2b
18 changed files with 12 additions and 996 deletions
41
daemon/examples/api/parser.py
Normal file
41
daemon/examples/api/parser.py
Normal file
|
@ -0,0 +1,41 @@
|
|||
import argparse
|
||||
|
||||
DEFAULT_NODES = 2
|
||||
DEFAULT_TIME = 10
|
||||
DEFAULT_STEP = 1
|
||||
|
||||
|
||||
def parse_options(name):
|
||||
parser = argparse.ArgumentParser(description="Run %s example" % name)
|
||||
parser.add_argument("-n", "--nodes", type=int, default=DEFAULT_NODES,
|
||||
help="number of nodes to create in this example")
|
||||
parser.add_argument("-t", "--time", type=int, default=DEFAULT_TIME,
|
||||
help="example iperf run time in seconds")
|
||||
|
||||
options = parser.parse_args()
|
||||
|
||||
# usagestr = "usage: %prog [-h] [options] [args]"
|
||||
# parser = optparse.OptionParser(usage=usagestr)
|
||||
#
|
||||
# parser.add_option("-n", "--nodes", dest="nodes", type=int, default=DEFAULT_NODES,
|
||||
# help="number of nodes to create in this example")
|
||||
#
|
||||
# parser.add_option("-t", "--time", dest="time", type=int, default=DEFAULT_TIME,
|
||||
# help="example iperf run time in seconds")
|
||||
|
||||
# def usage(msg=None, err=0):
|
||||
# print
|
||||
# if msg:
|
||||
# print "%s\n" % msg
|
||||
# parser.print_help()
|
||||
# sys.exit(err)
|
||||
|
||||
# parse command line options
|
||||
# options, args = parser.parse_args()
|
||||
|
||||
if options.nodes < 2:
|
||||
parser.error("invalid min number of nodes: %s" % options.nodes)
|
||||
if options.time < 1:
|
||||
parser.error("invalid test time: %s" % options.time)
|
||||
|
||||
return options
|
Loading…
Add table
Add a link
Reference in a new issue