removed usage of iperf in examples, to remove need of another dependency, renamed parser module examples used to avoid conflict with std library module
This commit is contained in:
parent
8c4931819b
commit
866e13e0ef
3 changed files with 25 additions and 30 deletions
32
daemon/examples/python/params.py
Normal file
32
daemon/examples/python/params.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
import argparse
|
||||
|
||||
DEFAULT_NODES = 2
|
||||
DEFAULT_TIME = 10
|
||||
DEFAULT_STEP = 1
|
||||
|
||||
|
||||
def parse(name):
|
||||
parser = argparse.ArgumentParser(description=f"Run {name} example")
|
||||
parser.add_argument(
|
||||
"-n",
|
||||
"--nodes",
|
||||
type=int,
|
||||
default=DEFAULT_NODES,
|
||||
help="number of nodes to create in this example",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-c",
|
||||
"--count",
|
||||
type=int,
|
||||
default=DEFAULT_TIME,
|
||||
help="number of time to ping node",
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.nodes < 2:
|
||||
parser.error(f"invalid min number of nodes: {args.nodes}")
|
||||
if args.count < 1:
|
||||
parser.error(f"invalid ping count({args.count}), count must be greater than 0")
|
||||
|
||||
return args
|
Loading…
Add table
Add a link
Reference in a new issue