summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2017-01-18 12:19:19 +0200
committerYaroslav Brustinov <ybrustin@cisco.com>2017-01-18 12:19:19 +0200
commitcb80d2072257ba45c248833d7555e1b77c846aae (patch)
tree04046c6fc4f340bd73ec86ed98c92b41a6f0b51f /src/main.cpp
parent8df11b2eaab2a43c6f27ce69936d988e359e63a8 (diff)
bp-sim: add duration argument
Change-Id: Ic8ded1dbf03ccfa7891a66e991611b4359da41d0 Signed-off-by: Yaroslav Brustinov <ybrustin@cisco.com>
Diffstat (limited to 'src/main.cpp')
-rwxr-xr-xsrc/main.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 15bd99dd..dc9e89f4 100755
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -38,7 +38,7 @@ using namespace std;
enum { OPT_HELP, OPT_CFG, OPT_NODE_DUMP, OP_STATS,
OPT_FILE_OUT, OPT_UT, OPT_PCAP, OPT_IPV6, OPT_CLIENT_CFG_FILE,
OPT_SL, OPT_DP_CORE_COUNT, OPT_DP_CORE_INDEX, OPT_LIMIT,
- OPT_DRY_RUN};
+ OPT_DRY_RUN, OPT_DURATION};
@@ -69,8 +69,10 @@ static CSimpleOpt::SOption parser_options[] =
{ OP_STATS, "-s", SO_NONE },
{ OPT_CFG, "-f", SO_REQ_SEP },
{ OPT_CLIENT_CFG_FILE, "--client_cfg", SO_REQ_SEP },
+ { OPT_CLIENT_CFG_FILE, "--client-cfg", SO_REQ_SEP },
{ OPT_FILE_OUT , "-o", SO_REQ_SEP },
{ OPT_NODE_DUMP , "-v", SO_REQ_SEP },
+ { OPT_DURATION, "-d", SO_REQ_SEP },
{ OPT_PCAP, "--pcap", SO_NONE },
{ OPT_IPV6, "--ipv6", SO_NONE },
{ OPT_SL, "--sl", SO_NONE },
@@ -95,7 +97,8 @@ static int usage(){
printf(" Usage: bp_sim [OPTION] -f cfg.yaml -o outfile.erf \n");
printf(" \n");
printf(" \n");
- printf(" options \n");
+ printf(" options:\n");
+ printf(" -d [s] duration time of simulated traffic in seconds\n");
printf(" -v [1-3] verbose mode \n");
printf(" 1 show only stats \n");
printf(" 2 run preview do not write to file \n");
@@ -194,12 +197,16 @@ static int parse_options(int argc,
params["limit"] = atoi(args.OptionArg());
break;
+ case OPT_DURATION:
+ sscanf(args.OptionArg(),"%f", &po->m_duration);
+ break;
+
case OPT_DRY_RUN:
params["dry"] = 1;
break;
default:
- usage();
+ printf("Error: option %s is defined, but not handled.\n\n", args.OptionText());
return -1;
break;
} // End of switch