diff options
Diffstat (limited to 'util/vnet_run')
-rwxr-xr-x | util/vnet_run | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/util/vnet_run b/util/vnet_run index 0539b23..39d72a6 100755 --- a/util/vnet_run +++ b/util/vnet_run @@ -15,6 +15,10 @@ START_SHELL = "/bin/bash" DEVICE_TYPE_ROUTER = "router" DEVICE_TYPE_HOST = "host" + +VHOST_BINARY_NAME = "vhost" +VROUTER_BINARY_NAME = "vrouter" + VERBOSE_MODE = False @@ -127,15 +131,17 @@ def main(input_args): parser = argparse.ArgumentParser() - parser.add_argument("--router", type=str, default="", help="Path to router binary") - parser.add_argument("--host", type=str, default="", help="Path to host binary") + parser.add_argument("--router", type=str, default="", help="Path to vrouter binary") + parser.add_argument("--host", type=str, default="", help="Path to vhost binary") + parser.add_argument("--bin-dir", type=str, default=".", + help="Path to directory with vhost/vrouter binaries") parser.add_argument("--bin-config", type=str, default="", help="Run nodes using binaries.json Overrides --host and --router") parser.add_argument("--clean", action="store_true", help="Terminate any open virtual network sessions before starting") parser.add_argument("lnx_dir", type=str, help="Directory with lnx files") parser.add_argument("extra_args", nargs="*", - help="Extra arguments to add when executing each node") + help="Extra arguments to add when executing each node", default="") parser.add_argument("--verbose", action="store_true", help="Print commands as they are run") @@ -159,11 +165,15 @@ def main(input_args): if args.bin_config: bin_info = BinManager.from_bin_config(args.bin_config) else: - if args.router == "" or args.host == "": - do_exit("Must specify host and router binaries with --host and --router") - - router_bin = args.router - host_bin = args.host + if args.bin_dir: + host_bin = pathlib.Path(args.bin_dir).resolve() / VHOST_BINARY_NAME + router_bin = pathlib.Path(args.bin_dir).resolve() / VROUTER_BINARY_NAME + else: + if args.router == "" or args.host == "": + do_exit("Must specify host and router binaries with --bin-dir or (--host and --router)") + + router_bin = pathlib.Path(args.router).resolve() + host_bin = pathlib.Path(args.host).resolve() check_bin_exists(router_bin) check_bin_exists(host_bin) |