3 # author__ = "Jan Medved"
4 # copyright__ = "Copyright(c) 2014, Cisco Systems, Inc."
5 # license__ = "New-style BSD"
6 # email__ = "jmedved@cisco.com"
8 # Init our own program name
12 CMD="./flow_config_blaster.py"
14 # Default number of $CMD instances
17 # Default parameters for $CMD
27 echo "usage: $program_name [-h?an] [-i instances] [-c cycles] [-f flows] [-t threads] [-o odl_host] [-p odl_port]"
28 echo " -h|? print this message"
29 echo " -a use default authentication ('admin/admin')"
30 echo " -n use the 'no-delete' flag in '$CMD'"
31 echo " -i instances number of '$CMD' instances to spawn"
32 echo " -c cycles number of cycles"
33 echo " -f flows number of flows"
34 echo " -o odl_host IP Address of the ODL controller"
35 echo " -p odl_port RESTCONF port in the ODL controller"
36 echo " -t threads number of threads"
37 echo "Optional flags/arguments [acfnopt] are passed to '$CMD'."
40 # Initialize our own variables:
43 while getopts "h?ac:f:i:no:p:t:" opt; do
68 echo "*** Creating $instances instance(s) of '$CMD' ***"
71 let "flows_per_instance=$cycles * $flows * $threads"
75 while [ $i -lt $instances ]; do
76 let "startflow=$flows_per_instance * $i"
78 CMD_STRING=$(printf '%s --cycles %s --flows %s --threads %s ' $CMD $cycles $flows $threads)
79 CMD_STRING+=$(printf ' --host %s --port %s --startflow %s' $odl_host $odl_port $startflow)
80 if [ "$auth" = true ] ; then
83 if [ "$no_delete" = true ] ; then
84 CMD_STRING+=' --no-delete'
87 echo "Starting instance $i: '$CMD_STRING'"
93 ELAPSED_TIME=$(($SECONDS - $START_TIME))
97 if [ "$ELAPSED_TIME" -gt 0 ] ; then
98 let "rate=($flows_per_instance * $instances)/$ELAPSED_TIME"
99 echo "Measured rate: $rate"
100 echo "Measured time: $ELAPSED_TIME"