#!/bin/sh
#
# Run netperf between all pairs of nodes in the rip cluster

# NOTE: this script is highly dependent about the node names and will currently only work at
# Fermilab.

echo -e "\n\nfrom/to\trip1\trip2\trip3\trip4\trip5\trip6\trip7\trip8\trip9\trip10\trip11\trip12\n"

fromNode=1

while [ "$fromNode" -le 12 ]
do
  toNode=$fromNode

  echo -n "rip$fromNode"
  tabNum=1
  while [ "$tabNum" -lt "$fromNode" ]
  do
    echo -e -n "\t"
    tabNum=`expr $tabNum + 1`
  done

  while [ "$toNode" -le 12 ]
  do
#    echo -e -n "rip$fromNode to rip$toNode: \t"
    echo -e -n "\t"
    eval enrsh rip$fromNode \"/opt/netperf/netperf -l 2 -H rip$toNode\" | tail -1 \
             | tr -s " " | cut -f 6 -d " " | tr -d "\012"
#    echo enrsh rip$fromNode \"/opt/netperf/netperf -l 1 -H rip$toNode\"
    toNode=`expr $toNode + 1`
  done

  fromNode=`expr $fromNode + 1`
  echo
  echo

done
