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
28 echo "usage: $program_name [-h?an] [-i instances] [-c cycles] [-f flows] [-t threads] [-o odl_host] [-p odl_port]"
29 echo " -h|? print this message"
30 echo " -a use default authentication ('admin/admin')"
31 echo " -b batchsize # offlows per RESTCONF add-flow request"
32 echo " -n use the 'no-delete' flag in '$CMD'"
33 echo " -i instances number of '$CMD' instances to spawn"
34 echo " -c cycles number of cycles"
35 echo " -f flows number of flows"
36 echo " -h host IP Address of the ODL controller"
37 echo " -p port RESTCONF port in the ODL controller"
38 echo " -t threads number of threads"
39 echo "Optional flags/arguments [acfnopt] are passed to '$CMD'."
42 # Initialize our own variables:
45 while getopts "h?ab:c:f:i:no:p:t:" opt; do
72 echo "*** Creating $instances instance(s) of '$CMD' ***"
75 let "flows_per_instance=$cycles * $flows * $threads"
79 while [ $i -lt $instances ]; do
80 let "startflow=$flows_per_instance * $i"
82 CMD_STRING=$(printf '%s --cycles %s --flows %s --threads %s ' $CMD $cycles $flows $threads)
83 CMD_STRING+=$(printf ' --host %s --port %s --startflow %s --fpr %s' $host $port $startflow $fpr)
84 if [ "$auth" = true ] ; then
87 if [ "$no_delete" = true ] ; then
88 CMD_STRING+=' --no-delete'
91 echo "Starting instance $i: '$CMD_STRING'"
97 ELAPSED_TIME=$(($SECONDS - $START_TIME))
101 if [ "$ELAPSED_TIME" -gt 0 ] ; then
102 let "rate=($flows_per_instance * $instances)/$ELAPSED_TIME"
103 echo "Measured rate: $rate"
104 echo "Measured time: $ELAPSED_TIME"