blob: 64c7e59ae2369b59f1de524770d2be63c655a375 [file] [log] [blame]
#!/bin/bash
source ../multi-host.conf
echo "host C IP address $IP4_C1"
echo "host B IP address $IP4_B1"
echo "host A IP address $IP4_A1"
echo "host D IP address $IP4_D1"
clean_up() {
r=$(ssh $CTRL_B "sudo killall ndn-traffic-server nfd &&
sudo infoedit -f /usr/local/etc/ndn/nfd.conf -d tables.network_region./arizona/cs/telecom" 2>&1)
r=$(ssh $CTRL_C "sudo killall nfd &&
sudo infoedit -f /usr/local/etc/ndn/nfd.conf -d tables.network_region./arizona/cs" 2>&1)
r=$(ssh $CTRL_D "sudo killall ndn-traffic-server nfd &&
sudo infoedit -f /usr/local/etc/ndn/nfd.conf -d tables.network_region./ucla/cs/irl &&
sudo infoedit -f /usr/local/etc/ndn/nfd.conf -d tables.network_region./ucla/cs/software" 2>&1)
r=$(sudo killall ndn-traffic-server nfd 2>&1 &&
sudo infoedit -f /usr/local/etc/ndn/nfd.conf -d tables.network_region./ucsd/caida 2>&1)
}
mkdir -p logs
workdir=$(pwd)
# Remove any old Link objects
ssh $CTRL_C "rm -f $workdir/link-object"
# C, B, A, D: Configure network region names
ssh $CTRL_C "sudo infoedit -f /usr/local/etc/ndn/nfd.conf -r tables.network_region <<EOF
/arizona/cs
EOF"
ssh $CTRL_B "sudo infoedit -f /usr/local/etc/ndn/nfd.conf -r tables.network_region <<EOF
/arizona/cs/telecom
EOF"
sudo infoedit -f /usr/local/etc/ndn/nfd.conf -r tables.network_region <<EOF
/ucsd/caida
EOF
ssh $CTRL_D "sudo infoedit -f /usr/local/etc/ndn/nfd.conf -r tables.network_region <<EOF
/ucla/cs/irl
/ucla/cs/software
EOF"
# C, B, A, D: Start NFD and create UDP tunnels
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 B..."
ssh $CTRL_B "mkdir -p $workdir/logs;\
sudo nfd &> $workdir/logs/nfd.log &"
sleep 1
echo "starting nfd on host A..."
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_B1"
ssh $CTRL_B "nfdc face create udp4://$IP4_A1"
nfdc face create udp4://$IP4_D1
# C: Register default route toward B
ssh $CTRL_C "nfdc route add / udp4://$IP4_B1"
if [[ $? -ne 0 ]]
then
echo "Failed to create default route on C toward B"
clean_up
exit 1
fi
# B: Register route /ucla toward A
ssh $CTRL_B "nfdc route add /ucla udp4://$IP4_A1"
if [[ $? -ne 0 ]]
then
echo "Failed to create route /ucla on B toward A"
clean_up
exit 1
fi
# A: Register route /ucla/cs toward D
nfdc route add /ucla/cs udp4://$IP4_D1
if [[ $? -ne 0 ]]
then
echo "Failed to create route /ucla/cs on A toward D"
clean_up
exit 1
fi
# C: Run ndn-traffic-server for /net/ndnsim/www serving "CCCCCCCC"
echo "starting ndn-traffic-server on host C..."
ssh $CTRL_C "ndn-traffic-server $workdir/NDNTrafficServer-C.conf &> $workdir/logs/server.log &"
# B: Run ndn-traffic-server for /net/ndnsim/www serving "BBBBBBBB"
echo "starting ndn-traffic-server on host B..."
ssh $CTRL_B "ndn-traffic-server $workdir/NDNTrafficServer-B.conf &> $workdir/logs/server.log &"
# A: Run ndn-traffic-server for /net/ndnsim/www serving "AAAAAAAA"
echo "starting ndn-traffic-server on host A..."
ndn-traffic-server $workdir/NDNTrafficServer-A.conf > $workdir/logs/server.log 2>&1 &
# D: Run ndn-traffic-server for /net/ndnsim/www serving "DDDDDDDD"
echo "starting ndn-traffic-server on host D..."
ssh $CTRL_D "ndn-traffic-server $workdir/NDNTrafficServer-D.conf &> $workdir/logs/server.log &"
# C: Express Interest for /net/ndnsim/www/index.html w/
# Link object {Name=/net/ndnsim, Delegations={{10,/telia/terabits}, {20,/ucla/cs}}}
# Fail if not answered with Data containing "DDDDDDDD"
echo "From C, sending Interest for /net/ndnsim/www/index.html w/ Link object {Name=/net/ndnsim, Delegations={{10,/telia/terabits}, {20,/ucla/cs}}}"
ssh $CTRL_C "generate-link-object $workdir/link-object /net/ndnsim 10 /telia/terabits 20 /ucla/cs"
output=$(ssh $CTRL_C "ndnpeek -p --link-file $workdir/link-object /net/ndnsim/www/index.html 2>&1")
if [[ $output != "DDDDDDDD" ]]
then
echo "Interest was not answered with Data containing payload 'DDDDDDDD'"
echo "Actual: $output"
clean_up
exit 2
fi
# C: Express Interest for /net/ndnsim/www/news.html w/
# Link object {Name=/net/ndnsim, Delegations={{10,/telia/terabits}, {20,/waseda/cs}}}
# Fail if not answered with Nack with reason "NoRoute"
echo "From C, sending Interest for /net/ndnsim/www/news.html w/ Link object {Name=/net/ndnsim, Delegations={{10,/telia/terabits}, {20,/waseda/cs}}}"
ssh $CTRL_C "generate-link-object $workdir/link-object /net/ndnsim 10 /telia/terabits 20 /waseda/cs"
output=$(ssh $CTRL_C "ndnpeek -p --link-file $workdir/link-object /net/ndnsim/www/news.html 2>&1")
if [[ $output != "NoRoute" ]]
then
# TODO: Should fail for now - update when CS/PIT partitioning completed
echo "EXPECTED FAILURE: Interest was not answered with Nack with reason 'NoRoute'"
echo "Actual: $output"
fi
# C: Express Interest for /net/ndnsim/www/contact.html w/
# Link object {Name=/net/ndnsim, Delegations={{10, /arizona/cs/telecom}}}
# Fail if not answered with Data containing "BBBBBBBB"
echo "From C, sending Interest for /net/ndnsim/www/contact.html w/ Link object {Name=/net/ndnsim, Delegations={{10, /arizona/cs/telecom}}}"
ssh $CTRL_C "generate-link-object $workdir/link-object /net/ndnsim 10 /arizona/cs/telecom"
output=$(ssh $CTRL_C "ndnpeek -p --link-file $workdir/link-object /net/ndnsim/www/contact.html 2>&1")
if [[ $output != "BBBBBBBB" ]]
then
echo "Interest was not answered with Data containing payload 'BBBBBBBB'"
echo "Actual: $output"
clean_up
exit 4
fi
# C: Express Interest for /net/ndnsim/www/about.html w/
# Link object {Name=/net/ndnsim, Delegations={{10, /arizona/cs}}}
# Fail if not answered with Data containing "CCCCCCCC"
echo "From C, sending Interest for /net/ndnsim/www/about.html w/ Link object {Name=/net/ndnsim, Delegations={{10, /arizona/cs}}}"
ssh $CTRL_C "generate-link-object $workdir/link-object /net/ndnsim 10 /arizona/cs"
output=$(ssh $CTRL_C "ndnpeek -p --link-file $workdir/link-object /net/ndnsim/www/about.html 2>&1")
if [[ $output != "CCCCCCCC" ]]
then
echo "Interest was not answered with Data containing payload 'CCCCCCCC'"
echo "Actual: $output"
clean_up
exit 5
fi
# C: Express Interest for /net/ndnsim/www/info.html w/
# Link object {Name=/net/ndnsim, Delegations={{10, /arizona}}}
# Fail if not answered with Data containing "CCCCCCCC"
echo "From C, sending Interest for /net/ndnsim/www/info.html w/ Link object {Name=/net/ndnsim, Delegations={{10, /arizona}}}"
ssh $CTRL_C "generate-link-object $workdir/link-object /net/ndnsim 10 /arizona"
output=$(ssh $CTRL_C "ndnpeek -p --link-file $workdir/link-object /net/ndnsim/www/info.html 2>&1")
if [[ $output != "CCCCCCCC" ]]
then
echo "Interest was not answered with Data containing payload 'CCCCCCCC'"
echo "Actual: $output"
clean_up
exit 6
fi
# C: Express Interest for /net/ndnsim/www/logo.jpg w/
# Link object {Name=/net/ndnsim, Delegations={{10, /arizona/cs/telecom/east}}}
# Fail if not answered with Nack with reason "NoRoute"
echo "From C, sending Interest for /net/ndnsim/www/logo.jpg w/ Link object {Name=/net/ndnsim, Delegations={{10, /arizona/cs/telecom/east}}}"
ssh $CTRL_C "generate-link-object $workdir/link-object /net/ndnsim 10 /arizona/cs/telecom/east"
output=$(ssh $CTRL_C "ndnpeek -p --link-file $workdir/link-object /net/ndnsim/www/logo.jpg 2>&1")
if [[ $output != "NoRoute" ]]
then
echo "Interest was not answered with Nack with reason 'NoRoute'"
echo "Actual: $output"
clean_up
exit 7
fi
clean_up
echo "Mobility with Link Test PASSED"