| #!/bin/bash |
| source ../multi-host.conf |
| |
| echo "host A IP addresses $IP4_A1 and $IP4_A2" |
| echo "host C IP address $IP4_C1" |
| echo "host D IP address $IP4_D1" |
| |
| clean_up() { |
| r=$(ssh $CTRL_C "sudo killall nfd" 2>&1) |
| r=$(ssh $CTRL_D "sudo killall test-congestionmark-producer" 2>&1) |
| r=$(ssh $CTRL_D "sudo killall nfd" 2>&1) |
| r=$(sudo killall nfd 2>&1) |
| } |
| |
| ### Setup |
| |
| # Start NFD on hosts A, C, and D |
| workdir=$(pwd) |
| echo "starting nfd on host A..." |
| mkdir -p $workdir/logs; sudo nfd > $workdir/logs/nfd.log 2>&1 & |
| sleep 1 |
| |
| echo "starting nfd on host C..." |
| ssh $CTRL_C "mkdir -p $workdir/logs; sudo nfd &> $workdir/logs/nfd.log &" |
| sleep 1 |
| |
| echo "starting nfd on host D..." |
| ssh $CTRL_D "mkdir -p $workdir/logs; sudo nfd &> $workdir/logs/nfd.log &" |
| sleep 1 |
| |
| # Create faces |
| ssh $CTRL_C "nfdc face create udp4://$IP4_A1" |
| nfdc face create udp4://$IP4_D1 |
| |
| # Set up routes |
| ssh $CTRL_C "nfdc route add /arizona/cs udp4://$IP4_A1" |
| if [[ $? -ne 0 ]]; then |
| echo "C: Failed to create route for /arizona/cs toward A" |
| clean_up |
| exit 1 |
| fi |
| |
| ssh $CTRL_C "nfdc route add /ucla/cs udp4://$IP4_A1" |
| if [[ $? -ne 0 ]]; then |
| echo "C: Failed to create route for /ucla/cs toward A" |
| clean_up |
| exit 1 |
| fi |
| |
| ssh $CTRL_C "nfdc route add /ucsd/caida udp4://$IP4_A1" |
| if [[ $? -ne 0 ]]; then |
| echo "C: Failed to create route for /ucsd/caida toward A" |
| clean_up |
| exit 1 |
| fi |
| |
| nfdc route add /arizona/cs udp4://$IP4_D1 |
| if [[ $? -ne 0 ]]; then |
| echo "A: Failed to create route for /arizona/cs toward D" |
| clean_up |
| exit 1 |
| fi |
| |
| nfdc route add /ucla/cs udp4://$IP4_D1 |
| if [[ $? -ne 0 ]]; then |
| echo "A: Failed to create route for /ucla/cs toward D" |
| clean_up |
| exit 1 |
| fi |
| |
| nfdc route add /ucsd/caida udp4://$IP4_D1 |
| if [[ $? -ne 0 ]]; then |
| echo "A: Failed to create route for /ucsd/caida toward D" |
| clean_up |
| exit 1 |
| fi |
| |
| ### TestCase 1 |
| |
| # A: Use CongestionMarkStrategy (value=7) strategy for /arizona/cs namespace |
| nfdc strategy set /arizona/cs /localhost/nfd/strategy/congestion-mark/%FD%01/7/true |
| if [[ $? -ne 0 ]]; then |
| echo "A: Failed to set CongestionMarkStrategy for /arizona/cs prefix" |
| clean_up |
| exit 2 |
| fi |
| |
| # D: Start producer for /arizona/cs |
| ssh $CTRL_D "test-congestionmark-producer /arizona/cs &>/dev/null &" |
| |
| # C: Send Interest for /arizona/cs |
| output=$(ssh $CTRL_C "test-congestionmark-consumer /arizona/cs") |
| status=$? |
| if [[ $? -ne 0 ]]; then |
| echo "Consumer for Interest /arizona/cs did not exit with status 0" |
| echo "Actual: $status" |
| clean_up |
| exit 6 |
| fi |
| if [[ $output != "CongestionMark=7" ]]; then |
| echo "Interest /arizona/cs not answered with a Data containing a congestion mark with a value of 7" |
| echo "Actual: $output" |
| clean_up |
| exit 3 |
| fi |
| |
| ### TestCase 2 |
| |
| # D: Start producer for /ucla/cs |
| ssh $CTRL_D "test-congestionmark-producer /ucla/cs &>/dev/null &" |
| |
| # C: Send Interest for /ucla/cs |
| output=$(ssh $CTRL_C "test-congestionmark-consumer /ucla/cs") |
| status=$? |
| if [[ $? -ne 0 ]]; then |
| echo "Consumer for Interest /ucla/cs did not exit with status 0" |
| echo "Actual: $status" |
| clean_up |
| exit 6 |
| fi |
| if [[ $output != "CongestionMark=0" ]]; then |
| echo "Interest /ucla/cs not answered with a Data without a congestion mark" |
| echo "Actual: $output" |
| clean_up |
| exit 4 |
| fi |
| |
| ### TestCase 3 |
| |
| # D: Start producer for /ucsd/caida |
| ssh $CTRL_D "test-congestionmark-producer /ucsd/caida &>/dev/null &" |
| sleep 1 |
| |
| # C: Use CongestionMarkStrategy (value=2) strategy for /ucsd/caida namespace |
| ssh $CTRL_C "nfdc strategy set /ucsd/caida /localhost/nfd/strategy/congestion-mark/%FD%01/2/true" |
| if [[ $? -ne 0 ]]; then |
| echo "C: Failed to set CongestionMarkStrategy for /ucsd/caida prefix" |
| clean_up |
| exit 2 |
| fi |
| |
| # A: Use CongestionMarkStrategy (value=3, override) strategy for /ucsd/caida namespace |
| nfdc strategy set /ucsd/caida /localhost/nfd/strategy/congestion-mark/%FD%01/3/false |
| if [[ $? -ne 0 ]]; then |
| echo "A: Failed to set CongestionMarkStrategy for /ucsd/caida prefix" |
| clean_up |
| exit 2 |
| fi |
| |
| # C: Send Interest for /ucsd/caida |
| output=$(ssh $CTRL_C "test-congestionmark-consumer /ucsd/caida") |
| status=$? |
| if [[ $? -ne 0 ]]; then |
| echo "Consumer for Interest /ucsd/caida did not exit with status 0" |
| echo "Actual: $status" |
| clean_up |
| exit 6 |
| fi |
| if [[ $output != "CongestionMark=3" ]]; then |
| echo "Interest /ucsd/caida not answered with a Data containing a congestion mark with a value of 3" |
| echo "Actual: $output" |
| clean_up |
| exit 5 |
| fi |