
default_image="orbit-1.1.4"

# Set up pxe links on repository2 for pxe boot

echo "$1" > node

node_x=`cut -f1 -d',' node`

node_y=`cut -f2 -d',' node`

node_id="node"$node_x"-"$node_y

#echo " Node ID is $node_id"

#echo " X coordinate of node is $node_x, Y co-ordinate of node is $node_y"

#echo " my console is `hostname -d | cut -f1 -d'.'` " 



sub=`/sbin/ifconfig eth1 | grep 'inet addr' | cut -c21-26`

subnet_ip=$sub"0.0"

echo "My subnet number is $subnet_ip"

#echo "The nodes given are $1"

wget -O - "http://pxe:5012/pxe/setBootImage?img=$default_image&ip=$subnet_ip"

# Reset the selected nodes using cmc service

wget -O - 'http://cmc:5012/cmc/allReset'

# Launch the frisbee server

wget -O - "http://frisbee:5012/frisbee/getAddress?img=$2"

function usage()
	{
	  echo "Usage: $0 {atheros|intel|all} image_file_path" >&2
	  echo "for example:" >&2
          echo "   $0 all tmp/image-tridencom-test.ndz" >&2
      }
      if [ $# -ne 2 ]
      then
      echo "ERROR: Wrong number of arguments: $1"
      usage
      exit 1
      fi



