mirror of
https://github.com/Wojtek242/route0.git
synced 2024-11-21 23:05:24 +01:00
Check if topology/scenario combination is supported before running
This commit is contained in:
parent
f992fc0426
commit
dd663e35c6
15
route-0.py
15
route-0.py
@ -79,6 +79,11 @@ if __name__ == "__main__":
|
||||
"isis": Isis,
|
||||
}
|
||||
|
||||
supported = {
|
||||
"one_node": set(["plain", "basic"]),
|
||||
"two_nodes": set(["plain", "basic", "isis"]),
|
||||
}
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Launch a network scenario Mininet.')
|
||||
parser.add_argument('--topology', type=str, required=True,
|
||||
@ -87,7 +92,11 @@ if __name__ == "__main__":
|
||||
parser.add_argument('--scenario', type=str, required=True,
|
||||
choices=scenario.keys(),
|
||||
help='the scenario to set up in the network')
|
||||
ARGS = parser.parse_args()
|
||||
|
||||
args = parser.parse_args()
|
||||
run(topology[args.topology](),
|
||||
scenario[args.scenario]())
|
||||
if ARGS.scenario not in supported[ARGS.topology]:
|
||||
raise ValueError("Scenario \"{}\" is not supported for topology \"{}\""
|
||||
.format(ARGS.scenario, ARGS.topology))
|
||||
|
||||
run(topology[ARGS.topology](),
|
||||
scenario[ARGS.scenario]())
|
||||
|
Loading…
Reference in New Issue
Block a user