init-by-file.pl 868 Bytes
Newer Older
1 2 3 4 5 6 7 8 9

#usage: init-by-file.pl proj exp input-file
#
# Input file is generated by init-elabnodes.pl using the -o option.

$proj = $ARGV[0];
$exp = $ARGV[1];
$filename = $ARGV[2];

10 11 12 13 14 15 16
sub psystem(@) {
  print join(' ', @_);
  print "\n";
  system(@_);
  die unless $? == 0;
}

17 18
open(FILE, "<".$filename) or die("Cannot open $filename\n");

19 20 21 22 23 24
# reset the links
# wait only on the reset event
psystem("/usr/testbed/bin/tevc -e $proj/$exp now elabc clear");
psystem("/usr/testbed/bin/tevc -w -e $proj/$exp now elabc reset");
psystem("/usr/testbed/bin/tevc -e $proj/$exp now elabc create");

25 26 27
while ($line = <FILE>)
{
    $line =~ /^10.0.0.([0-9]+) ([0-9.]+) ([0-9.]+) ([0-9.]+) [0-9.]+$/;
28 29
    psystem("/usr/testbed/bin/tevc -e $proj/$exp now elabc-elab-$1 modify dest=$2 bandwidth=$3");
    psystem("/usr/testbed/bin/tevc -e $proj/$exp now elabc-elab-$1 modify dest=$2 delay=$4");
30
}
31 32