Commit c9e91919 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Add delay agent startup code for Abhijeet.

parent 0f0f2f05
...@@ -48,6 +48,8 @@ script-install: dir-install ...@@ -48,6 +48,8 @@ script-install: dir-install
$(INSTALL) -m 755 $(SRCDIR)/update $(INSTALL_DIR)/update $(INSTALL) -m 755 $(SRCDIR)/update $(INSTALL_DIR)/update
$(INSTALL) -m 755 $(SRCDIR)/rc.testbed $(INSTALL_DIR)/rc.testbed $(INSTALL) -m 755 $(SRCDIR)/rc.testbed $(INSTALL_DIR)/rc.testbed
$(INSTALL) -m 755 $(SRCDIR)/rc.setup $(INSTALL_DIR)/rc.setup $(INSTALL) -m 755 $(SRCDIR)/rc.setup $(INSTALL_DIR)/rc.setup
$(INSTALL) -m 755 $(SRCDIR)/rc.agents $(INSTALL_DIR)/rc.agents
$(INSTALL) -m 755 $(SRCDIR)/rc.delayagent $(INSTALL_DIR)/rc.delayagent
$(INSTALL) -m 755 $(SRCDIR)/rc.delta $(INSTALL_DIR)/rc.delta $(INSTALL) -m 755 $(SRCDIR)/rc.delta $(INSTALL_DIR)/rc.delta
$(INSTALL) -m 755 $(SRCDIR)/runstartup $(INSTALL_DIR)/runstartup $(INSTALL) -m 755 $(SRCDIR)/runstartup $(INSTALL_DIR)/runstartup
$(INSTALL) -m 755 $(SRCDIR)/sethostname $(INSTALL_DIR)/sethostname $(INSTALL) -m 755 $(SRCDIR)/sethostname $(INSTALL_DIR)/sethostname
......
...@@ -68,6 +68,7 @@ my $TMCCCMD_DELAY = "delay"; ...@@ -68,6 +68,7 @@ my $TMCCCMD_DELAY = "delay";
# #
sub os_cleanup_node () { sub os_cleanup_node () {
unlink $TMDELAY; unlink $TMDELAY;
unlink $TMDELMAP;
printf STDOUT "Resetting passwd and group files\n"; printf STDOUT "Resetting passwd and group files\n";
if (system("$CP -f $TMGROUP /etc/group") != 0) { if (system("$CP -f $TMGROUP /etc/group") != 0) {
...@@ -262,6 +263,9 @@ sub dodelays () ...@@ -262,6 +263,9 @@ sub dodelays ()
if (@delays) { if (@delays) {
$count = 69; $count = 69;
$mindelay = 10000; $mindelay = 10000;
open(MAP, ">$TMDELMAP")
or die("Could not open $TMDELMAP");
open(DEL, ">$TMDELAY") open(DEL, ">$TMDELAY")
or die("Could not open $TMDELAY"); or die("Could not open $TMDELAY");
...@@ -270,9 +274,6 @@ sub dodelays () ...@@ -270,9 +274,6 @@ sub dodelays ()
print DEL "sysctl -w net.link.ether.bridge_ipfw=0\n"; print DEL "sysctl -w net.link.ether.bridge_ipfw=0\n";
print DEL "sysctl -w net.link.ether.bridge_cfg="; print DEL "sysctl -w net.link.ether.bridge_cfg=";
open(MAP, ">$TMDELMAP")
or die("Could not open $TMDELMAP");
foreach $delay (@delays) { foreach $delay (@delays) {
$delay =~ /DELAY INT0=([\d\w]+) INT1=([\d\w]+) /; $delay =~ /DELAY INT0=([\d\w]+) INT1=([\d\w]+) /;
my $iface1 = libsetup::findiface($1); my $iface1 = libsetup::findiface($1);
...@@ -335,9 +336,8 @@ sub dodelays () ...@@ -335,9 +336,8 @@ sub dodelays ()
print STDOUT " $iface1/$iface2 pipe $p2 config delay "; print STDOUT " $iface1/$iface2 pipe $p2 config delay ";
print STDOUT "${delay2}ms bw ${bandw2}Kbit/s plr $plr2\n"; print STDOUT "${delay2}ms bw ${bandw2}Kbit/s plr $plr2\n";
print MAP "$linkname $iface1 $p1\n"; print MAP "$linkname duplex $iface1 $iface2 $p1 $p2\n";
print MAP "$linkname $iface2 $p2\n";
$count++; $count++;
} }
# #
......
#!/bin/sh
#
# Start the agents. The scripts decide themselves whether to do anything.
#
if [ -x /etc/testbed/rc.delayagent ]; then
/etc/testbed/rc.delayagent
fi
#!/usr/bin/perl -w
use English;
#
# Be nice to get this from libloc, but how do you get a package variable?
#
my $MAPFILE = "/etc/testbed/delay_mapping";
#
# Untaint path
#
$ENV{'PATH'} = '/bin:/sbin:/usr/bin:/usr/local/bin:/etc/testbed';
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
#
# Load the OS independent support library. It will load the OS dependent
# library and initialize itself.
#
use lib "/etc/testbed";
use libsetup;
if (! -s $MAPFILE) {
exit(0);
}
print "Starting Delay Agent ...\n";
#
# We use the tmcc to figure out where the Testbed Event Daemon is running.
# Don't worry about the port for now.
#
my ($bossname) = split(" ", `tmcc bossinfo`);
system("delay_agent -s $bossname -d -f $MAPFILE &");
exit($? >> 0);
...@@ -35,6 +35,10 @@ if [ -s /etc/testbed/startupcmd ]; then ...@@ -35,6 +35,10 @@ if [ -s /etc/testbed/startupcmd ]; then
echo "/etc/testbed/runstartup" | at -q S 'now + 2 minutes' echo "/etc/testbed/runstartup" | at -q S 'now + 2 minutes'
fi fi
if [ -x /etc/testbed/rc.agents ]; then
/etc/testbed/rc.agents
fi
# #
# Generate an event that says we are up and running # Generate an event that says we are up and running
# #
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment