Commit 665a8e69 authored by Mike Hibler's avatar Mike Hibler

New shi...um, "stuff" to allow running tcpdump on end nodes for tracing.

Set the magic variable in auto-pelab.ns and swapin your experiment.
Logs will wind up in /proj/blahblah/exp/blahblah/logs/<node>/<name>.tcpdump
after you run stop-experiment.

I did this with the program agent and duct tape.  If it turns out that
you can already do this with the link tracing framework, then someone in
Oregon is going to whomp me upside the head with a clue-stick and he'll
never let me forget...at least til he forgets in a day or two.
parent 197fc583
......@@ -23,6 +23,13 @@ set fake_plab 1
#
set real_plab 0
#
# If set to 1, we run tcpdump on all end nodes (in addition to all delay
# nodes) and transfer that data back.
#
set trace_end_nodes 0
set tcpdump_args ""
#
# If you want to get specific real planetlab nodes, ask for them here by site
# or by emulab node ID.
......@@ -62,6 +69,7 @@ set plabnodes {}
#
set pelab_tar "/proj/tbres/CHANGEME.tar.gz"
#
# When using a fake plab, these are the parameters for the fake Internet
# 'cloud' connecting the plab nodes. For now, all nodes have the same
......@@ -101,7 +109,20 @@ set clientprog "/usr/bin/iperf -t 60 -c "
# End of user-settable options
##########
tb-set-delay-os FBSD54-FUTURE
#
# -DNODE has fixes but is not as heavily tested
#
set delay_os FBSD54-FUTURE
#set delay_os FBSD54-DNODE
tb-set-delay-os $delay_os
#
# XXX temporary: cannot delay plab and elab nodes with the same delay node
#
if {$fake_plab && $delay_os != "FBSD54-DNODE"} {
tb-set-delay-capacity 1
}
#
# Tarballs and RPMs we install on all nodes
......@@ -120,11 +141,13 @@ set planetservers {}
set serverlist {}
set clientlist {}
set tflist {}
set tdlist {}
#
# Create all of the nodes
#
set tfix 1
set tdix 1
for {set i 1} {$i <= $num_pcs} {incr i} {
if {$real_plab} {
......@@ -163,6 +186,12 @@ for {set i 1} {$i <= $num_pcs} {incr i} {
set tfupdate($tfix) [$plab($i) program-agent -command "sudo /usr/local/etc/emulab/update -t"]
lappend tflist $tfupdate($tfix)
incr tfix
if {$trace_end_nodes} {
set tcpdump($tdix) [$plab($i) program-agent -command "/bin/sh /local/pelab/run-tcpdump.sh plab $i $tcpdump_args"]
lappend tdlist $tcpdump($tdix)
incr tdix
}
}
set elab($i) [$ns node]
......@@ -182,6 +211,12 @@ for {set i 1} {$i <= $num_pcs} {incr i} {
set tfupdate($tfix) [$elab($i) program-agent -command "sudo /usr/local/etc/emulab/update -t"]
lappend tflist $tfupdate($tfix)
incr tfix
if {$trace_end_nodes} {
set tcpdump($tdix) [$elab($i) program-agent -command "/bin/sh /local/pelab/run-tcpdump.sh elab $i $tcpdump_args"]
lappend tdlist $tcpdump($tdix)
incr tdix
}
}
#
......@@ -200,6 +235,9 @@ set allservers [$ns event-group $serverlist]
set allclients [$ns event-group $clientlist]
set tfhosts [$ns event-group $tflist]
if {$trace_end_nodes} {
set tdhosts [$ns event-group $tdlist]
}
#
# Fake 'Internet' cloud for fake plab nodes
......@@ -244,4 +282,3 @@ if {$fake_plab} {
}
$ns run
#!/bin/sh
if [ $# -lt 2 ]; then
echo "usage: run-tcpdump type index [ tcpdump-args ... ]"
exit 1
fi
kind=$1
if [ $kind = "planet" ]; then
echo "cannot do real planetlab nodes yet"
exit 1
fi
ix=$2
shift; shift
ARGS=$*
findif="/proj/tbres/bin/findif-linux"
if [ ! -x $findif ]; then
echo "need $findif"
exit 1
fi
case $kind in
elab)
ip="10.0.0.$ix"
iface=`$findif -i $ip`
;;
plab)
ip="10.1.0.$ix"
iface=`$findif -i $ip`
;;
*)
echo "unrecognized node type $kind"
exit 1
;;
esac
if [ -z "$ip" ]; then
echo "Could not find interface for IP $ip"
exit 1
fi
ARGS="-i $iface -w /local/logs/$kind-$ix.tcpdump $ARGS"
echo "$kind-${ix}: Running tcpdump $ARGS"
sudo tcpdump $ARGS &
PID=$!
trap "sudo kill $PID; sudo killall tcpdump" EXIT
wait
exit 0
......@@ -126,6 +126,15 @@ if (system "$TEVC -e $pid/$eid now planetc-tracemon stop") {
die "Error running tevc\n";
}
#
# Smack down host tcpdumps
#
print "##### Stopping host tcpdumps\n";
if (system "$TEVC -e $pid/$eid now tdhosts stop") {
die "Error running tevc\n";
}
#
# Restart the server program
......@@ -181,6 +190,14 @@ if (system "$TEVC -e $pid/$eid now planetc-tracemon start") {
die "Error running tevc\n";
}
#
# Start host tcpdumps
#
print "##### Starting host tcpdumps\n";
if (system "$TEVC -e $pid/$eid now tdhosts start") {
die "Error running tevc\n";
}
#
# Start up the stubs and monitors
#
......
......@@ -51,6 +51,14 @@ if (system "$TEVC -e $pid/$eid now elabc-tracemon stop") {
die "Error running tevc\n";
}
#
# Smack down host tcpdumps
#
print "##### Stopping host tcpdumps\n";
if (system "$TEVC -e $pid/$eid now tdhosts stop") {
die "Error running tevc\n";
}
#
# Stop running servers
#
......
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