- Updated multi-blaster.sh and shard_multi_test.sh to allow host and port command...
authorJan Medved <jmedved@cisco.com>
Mon, 1 Dec 2014 05:13:36 +0000 (21:13 -0800)
committerJan Medved <jmedved@cisco.com>
Mon, 1 Dec 2014 05:16:42 +0000 (21:16 -0800)
- Updated shard_multi_test.sh to print help string and to measure the total rate.

Change-Id: I6ce4b5a6ad194bf7f28e3d04b2f4dc831a304814
Signed-off-by: Jan Medved <jmedved@cisco.com>
test/tools/odl-mdsal-clustering-tests/clustering-performance-test/multi-blaster.sh
test/tools/odl-mdsal-clustering-tests/clustering-performance-test/shard_multi_test.sh

index 0b8dc1b586837d020b64f9cb10b4e306b09fbce1..154c1501e50b1bfa0a559a7cbc64ee04da86dee7 100755 (executable)
@@ -5,30 +5,42 @@
 # 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
@@ -44,25 +56,27 @@ while getopts "h?ac:f:i:nt:" opt; do
         ;;
     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
@@ -78,9 +92,10 @@ done
 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
index 558788c8d657d68f373232c3346a2478e84c6d30..c923835b8b0097c5e6f6b33f8ed45f03558630b0 100755 (executable)
@@ -1,22 +1,44 @@
-#!/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
         ;;
@@ -26,25 +48,40 @@ while getopts "h?ai:n:r:t:" opt; do
         ;;
     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