# license__ = "New-style BSD"
# email__ = "jmedved@cisco.com"
+# Init our own program name
+program_name=$0
+
+# Command to invoke
CMD="./flow_config_blaster.py"
-programname=$0
+
+# Default number of $CMD instances
+instances=1
+
+# Default parameters for $CMD
+no_delete=false
+auth=false
+threads=1
+flows=1000
+cycles=1
+odl_host=127.0.0.1
+odl_port=8181
function usage {
- echo "usage: $programname [-h?an] [-i instances] [-c cycles] [-f flows] [- threads]"
+ echo "usage: $program_name [-h?an] [-i instances] [-c cycles] [-f flows] [-t threads] [-o odl_host] [-p odl_port]"
echo " -h|? print this message"
echo " -a use default authentication ('admin/admin')"
echo " -n use the 'no-delete' flag in '$CMD'"
echo " -i instances number of '$CMD' instances to spawn"
- echo " -c cycles number of cycles in '$CMD'"
- echo " -f flows number of flows in '$CMD'"
- echo " -t threads number of threads in '$CMD'"
+ echo " -c cycles number of cycles"
+ echo " -f flows number of flows"
+ echo " -o odl_host IP Address of the ODL controller"
+ echo " -p odl_port RESTCONF port in the ODL controller"
+ echo " -t threads number of threads"
+ echo "Optional flags/arguments [acfnopt] are passed to '$CMD'."
}
# Initialize our own variables:
-instances=1
-no_delete=false
-auth=false
-threads=1
-flows=1000
-cycles=1
-while getopts "h?ac:f:i:nt:" opt; do
+while getopts "h?ac:f:i:no:p:t:" opt; do
case "$opt" in
h|\?)
usage
;;
n) no_delete=true
;;
+ o) odl_host=$OPTARG
+ ;;
+ p) odl_port=$OPTARG
+ ;;
t) threads=$OPTARG
;;
esac
done
-echo "Running $instances instance(s), parameters:\n flows='flows', threads=$threads, cycles=$cycles, \
-no-delete='$no_delete', auth='$auth'"
-
+echo "*** Creating $instances instance(s) of '$CMD' ***"
+echo ""
let "flows_per_instance=$cycles * $flows * $threads"
-
-printf "FPI: %d\n" $flows_per_instance
-
i=0
+
START_TIME=$SECONDS
while [ $i -lt $instances ]; do
let "startflow=$flows_per_instance * $i"
- CMD_STRING=$(printf '%s --cycles %s --flows %s --threads %s --startflow %s' $CMD $cycles $flows $threads $startflow)
+ CMD_STRING=$(printf '%s --cycles %s --flows %s --threads %s ' $CMD $cycles $flows $threads)
+ CMD_STRING+=$(printf ' --host %s --port %s --startflow %s' $odl_host $odl_port $startflow)
if [ "$auth" = true ] ; then
CMD_STRING+=' --auth'
fi
wait
ELAPSED_TIME=$(($SECONDS - $START_TIME))
-let "rate=($flows_per_instance * $instances)/$ELAPSED_TIME"
echo "Done."
-echo "Measured rate: $rate"
-echo "Measured time: $ELAPSED_TIME"
-# End of file
+if [ "$ELAPSED_TIME" -gt 0 ] ; then
+ let "rate=($flows_per_instance * $instances)/$ELAPSED_TIME"
+ echo "Measured rate: $rate"
+ echo "Measured time: $ELAPSED_TIME"
+fi
\ No newline at end of file
-#!/bin/sh
+#!/bin/bash
# author__ = "Jan Medved"
# copyright__ = "Copyright(c) 2014, Cisco Systems, Inc."
# license__ = "New-style BSD"
# email__ = "jmedved@cisco.com"
-# Initialize our own variables:
-instances=0
+# Command to invoke
+CMD="./shard_perf_test.py"
+
+# Default number od $CMD instances to start
+instances=1
+
+# Default parameters for $CMD
resource="both"
auth=false
threads=1
requests=1000
+odl_host=127.0.0.1
+odl_port=8181
+
+function usage {
+ echo "usage: $programname [-h?an] [-i instances] [-c cycles] [-f flows] [-t threads] [-o odl_host] [-p odl_port]"
+ echo " -h|? print this message"
+ echo " -a use default authentication ('admin/admin')"
+ echo " -n use the 'no-delete' flag in '$CMD'"
+ echo " -i instances number of '$CMD' instances to spawn"
+ echo " -c cycles number of cycles"
+ echo " -f flows number of flows"
+ echo " -o odl_host IP Address of the ODL controller"
+ echo " -p odl_port RESTCONF port in the ODL controller"
+ echo " -t threads number of threads"
+ echo "Optional flags/arguments [acfnopt] are passed to '$CMD'."
+}
-while getopts "h?ai:n:r:t:" opt; do
+
+while getopts "h?ai:n:o:p:r:t:" opt; do
case "$opt" in
h|\?)
- echo "This would be help"
- exit 0
+ usage
+ exit 1
;;
a) auth=true
;;
;;
r) resource=$OPTARG
;;
+ o) odl_host=$OPTARG
+ ;;
+ p) odl_port=$OPTARG
+ ;;
t) threads=$OPTARG
;;
esac
done
-shift $((OPTIND-1))
-
-[ "$1" = "--" ] && shift
-echo "Running $instances instances, parameters:\n resource='$resource', requests=$requests, threads=$threads"
+echo "*** Creating $instances instance(s) of '$CMD' ***"
i=0
+START_TIME=$SECONDS
+
while [ $i -lt $instances ]; do
- echo "Starting instance $i"
+ CMD_STRING=$(printf '%s --resource %s --requests %s --threads %s' $CMD $resource $requests $threads)
+ CMD_STRING+=$(printf ' --host %s --port %s' $odl_host $odl_port)
+ if [ "$auth" = true ] ; then
+ CMD_STRING+=' --auth'
+ fi
+ echo "Starting instance $i: '$CMD_STRING'"
+ $CMD_STRING &
+
let i=$i+1
- ./shard_perf_test.py --auth --resource $resource --requests $requests --threads $threads &
done
wait
+ELAPSED_TIME=$(($SECONDS - $START_TIME))
+
echo "Done."
-# End of file
+if [ "$ELAPSED_TIME" -gt 0 ] ; then
+ let "rate=(threads * $requests * $instances)/$ELAPSED_TIME"
+ echo "Measured rate: $rate"
+ echo "Measured time: $ELAPSED_TIME"
+fi
\ No newline at end of file