Commit 47dbf238 authored by Hejing Li's avatar Hejing Li Committed by Antoine Kaufmann
Browse files

pktgen script dumbbell

parent 1f4fbb86
...@@ -5,6 +5,7 @@ RUN_DIR="/tmp/hejing-work/pktgen" ...@@ -5,6 +5,7 @@ RUN_DIR="/tmp/hejing-work/pktgen"
NUM_HOST=$1 NUM_HOST=$1
ALL_PIDS="" ALL_PIDS=""
PKTGEN_PIDS="" PKTGEN_PIDS=""
SWITCH_PIDS=""
# -inst num # -inst num
run_pktgen(){ run_pktgen(){
echo "starting host $1" echo "starting host $1"
...@@ -35,6 +36,48 @@ run_switch(){ ...@@ -35,6 +36,48 @@ run_switch(){
return $pid return $pid
} }
run_switch_dumbbell(){
echo "Starting switch dumbbell"
SWITCH_EXE=/DS/endhost-networking/work/sim/hejing/simbricks/sims/net/switch/net_switch
args_0=""
args_1=""
iface=0
half=$(($1/2))
while [ $iface -lt $half ]
do
args_0="$args_0 -s $RUN_DIR/eth.$iface"
#((iface+=2))
((iface+=1))
done
#iface=1
#num_inc=$(($1+1))
#while [ $iface -lt $num_inc ]
while [ $iface -lt $1 ]
do
args_1="$args_1 -s $RUN_DIR/eth.$iface"
#((iface+=2))
((iface+=1))
done
$SWITCH_EXE -m 0 -S 500 -E 500 \
$args_0 -h $RUN_DIR/s0eth > $RUN_DIR/log.switch &
pid=$!
ALL_PIDS="$ALL_PIDS $pid"
SWITCH_PIDS="$SWITCH_PIDS $pid"
sleep 1
$SWITCH_EXE -m 0 -S 500 -E 500 \
$args_1 -s $RUN_DIR/s0eth > $RUN_DIR/log.switch &
pid=$!
ALL_PIDS="$ALL_PIDS $pid"
SWITCH_PIDS="$SWITCH_PIDS $pid"
return $pid
}
cleanup() { cleanup() {
echo "Cleaning up" echo "Cleaning up"
...@@ -63,13 +106,18 @@ do ...@@ -63,13 +106,18 @@ do
done done
sleep 2 sleep 2
run_switch $1 #run_switch $1
SWITCH_PID=$! run_switch_dumbbell $1
#SWITCH_PID=$!
for p in $PKTGEN_PIDS ; do for p in $PKTGEN_PIDS ; do
wait $p wait $p
done done
echo "kill switch" echo "Pktgen Done, kill switch"
kill -9 $SWITCH_PID #kill -9 $SWITCH_PID
for p in $SWITCH_PIDS ; do
kill -9 $p
done
date date
\ No newline at end of file
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