Eric Newberry | dbf14b1 | 2016-12-27 12:18:53 +0000 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | source ../multi-host.conf |
| 3 | echo "host C IP address $IP4_C1" |
| 4 | echo "host B IP address $IP4_B1" |
| 5 | echo "host A IP address $IP4_A1" |
| 6 | echo "host D IP address $IP4_D1" |
| 7 | |
| 8 | clean_up() { |
| 9 | r=$(ssh $CTRL_B "sudo killall ndn-traffic-server nfd && |
| 10 | sudo infoedit -f /usr/local/etc/ndn/nfd.conf -d tables.network_region./arizona/cs/telecom" 2>&1) |
| 11 | r=$(ssh $CTRL_C "sudo killall nfd && |
| 12 | sudo infoedit -f /usr/local/etc/ndn/nfd.conf -d tables.network_region./arizona/cs" 2>&1) |
| 13 | r=$(ssh $CTRL_D "sudo killall ndn-traffic-server nfd && |
| 14 | sudo infoedit -f /usr/local/etc/ndn/nfd.conf -d tables.network_region./ucla/cs/irl && |
| 15 | sudo infoedit -f /usr/local/etc/ndn/nfd.conf -d tables.network_region./ucla/cs/software" 2>&1) |
| 16 | r=$(sudo killall ndn-traffic-server nfd 2>&1 && |
| 17 | sudo infoedit -f /usr/local/etc/ndn/nfd.conf -d tables.network_region./ucsd/caida 2>&1) |
| 18 | } |
| 19 | |
| 20 | mkdir -p logs |
| 21 | workdir=$(pwd) |
| 22 | |
| 23 | # Remove any old Link objects |
| 24 | ssh $CTRL_C "rm -f $workdir/link-object" |
| 25 | |
| 26 | # C, B, A, D: Configure network region names |
| 27 | ssh $CTRL_C "sudo infoedit -f /usr/local/etc/ndn/nfd.conf -r tables.network_region <<EOF |
| 28 | /arizona/cs |
| 29 | EOF" |
| 30 | ssh $CTRL_B "sudo infoedit -f /usr/local/etc/ndn/nfd.conf -r tables.network_region <<EOF |
| 31 | /arizona/cs/telecom |
| 32 | EOF" |
| 33 | sudo infoedit -f /usr/local/etc/ndn/nfd.conf -r tables.network_region <<EOF |
| 34 | /ucsd/caida |
| 35 | EOF |
| 36 | ssh $CTRL_D "sudo infoedit -f /usr/local/etc/ndn/nfd.conf -r tables.network_region <<EOF |
| 37 | /ucla/cs/irl |
| 38 | /ucla/cs/software |
| 39 | EOF" |
| 40 | |
| 41 | # C, B, A, D: Start NFD and create UDP tunnels |
| 42 | echo "starting nfd on host C..." |
| 43 | ssh $CTRL_C "mkdir -p $workdir/logs;\ |
| 44 | sudo nfd &> $workdir/logs/nfd.log &" |
| 45 | sleep 1 |
| 46 | |
| 47 | echo "starting nfd on host B..." |
| 48 | ssh $CTRL_B "mkdir -p $workdir/logs;\ |
| 49 | sudo nfd &> $workdir/logs/nfd.log &" |
| 50 | sleep 1 |
| 51 | |
| 52 | echo "starting nfd on host A..." |
| 53 | sudo nfd &> $workdir/logs/nfd.log & |
| 54 | sleep 1 |
| 55 | |
| 56 | echo "starting nfd on host D..." |
| 57 | ssh $CTRL_D "mkdir -p $workdir/logs;\ |
| 58 | sudo nfd &> $workdir/logs/nfd.log &" |
| 59 | sleep 1 |
| 60 | |
| 61 | # C: Register default route toward B |
| 62 | ssh $CTRL_C "nfdc register / udp4://$IP4_B1" |
| 63 | if [[ $? -ne 0 ]] |
| 64 | then |
| 65 | echo "Failed to create default route on C toward B" |
| 66 | clean_up |
| 67 | exit 1 |
| 68 | fi |
| 69 | |
| 70 | # B: Register route /ucla toward A |
| 71 | ssh $CTRL_B "nfdc register /ucla udp4://$IP4_A1" |
| 72 | if [[ $? -ne 0 ]] |
| 73 | then |
| 74 | echo "Failed to create route /ucla on B toward A" |
| 75 | clean_up |
| 76 | exit 1 |
| 77 | fi |
| 78 | |
| 79 | # A: Register route /ucla/cs toward D |
| 80 | nfdc register /ucla/cs udp4://$IP4_D1 |
| 81 | if [[ $? -ne 0 ]] |
| 82 | then |
| 83 | echo "Failed to create route /ucla/cs on A toward D" |
| 84 | clean_up |
| 85 | exit 1 |
| 86 | fi |
| 87 | |
| 88 | # C: Run ndn-traffic-server for /net/ndnsim/www serving "CCCCCCCC" |
| 89 | echo "starting ndn-traffic-server on host C..." |
| 90 | ssh $CTRL_C "ndn-traffic-server $workdir/NDNTrafficServer-C.conf &> $workdir/logs/server.log &" |
| 91 | |
| 92 | # B: Run ndn-traffic-server for /net/ndnsim/www serving "BBBBBBBB" |
| 93 | echo "starting ndn-traffic-server on host B..." |
| 94 | ssh $CTRL_B "ndn-traffic-server $workdir/NDNTrafficServer-B.conf &> $workdir/logs/server.log &" |
| 95 | |
| 96 | # A: Run ndn-traffic-server for /net/ndnsim/www serving "AAAAAAAA" |
| 97 | echo "starting ndn-traffic-server on host A..." |
| 98 | ndn-traffic-server $workdir/NDNTrafficServer-A.conf > $workdir/logs/server.log 2>&1 & |
| 99 | |
| 100 | # D: Run ndn-traffic-server for /net/ndnsim/www serving "DDDDDDDD" |
| 101 | echo "starting ndn-traffic-server on host D..." |
| 102 | ssh $CTRL_D "ndn-traffic-server $workdir/NDNTrafficServer-D.conf &> $workdir/logs/server.log &" |
| 103 | |
| 104 | # C: Express Interest for /net/ndnsim/www/index.html w/ |
| 105 | # Link object {Name=/net/ndnsim, Delegations={{10,/telia/terabits}, {20,/ucla/cs}}} |
| 106 | # Fail if not answered with Data containing "DDDDDDDD" |
| 107 | echo "From C, sending Interest for /net/ndnsim/www/index.html w/ Link object {Name=/net/ndnsim, Delegations={{10,/telia/terabits}, {20,/ucla/cs}}}" |
| 108 | ssh $CTRL_C "generate-link-object $workdir/link-object /net/ndnsim 10 /telia/terabits 20 /ucla/cs" |
| 109 | output=$(ssh $CTRL_C "ndnpeek -p --link-file $workdir/link-object /net/ndnsim/www/index.html 2>&1") |
| 110 | if [[ $output != "DDDDDDDD" ]] |
| 111 | then |
| 112 | echo "Interest was not answered with Data containing payload 'DDDDDDDD'" |
| 113 | echo "Actual: $output" |
| 114 | clean_up |
| 115 | exit 2 |
| 116 | fi |
| 117 | |
| 118 | # C: Express Interest for /net/ndnsim/www/news.html w/ |
| 119 | # Link object {Name=/net/ndnsim, Delegations={{10,/telia/terabits}, {20,/waseda/cs}}} |
| 120 | # Fail if not answered with Nack with reason "NoRoute" |
| 121 | echo "From C, sending Interest for /net/ndnsim/www/news.html w/ Link object {Name=/net/ndnsim, Delegations={{10,/telia/terabits}, {20,/waseda/cs}}}" |
| 122 | ssh $CTRL_C "generate-link-object $workdir/link-object /net/ndnsim 10 /telia/terabits 20 /waseda/cs" |
| 123 | output=$(ssh $CTRL_C "ndnpeek -p --link-file $workdir/link-object /net/ndnsim/www/news.html 2>&1") |
| 124 | if [[ $output != "NoRoute" ]] |
| 125 | then |
| 126 | # TODO: Should fail for now - update when CS/PIT partitioning completed |
| 127 | echo "EXPECTED FAILURE: Interest was not answered with Nack with reason 'NoRoute'" |
| 128 | echo "Actual: $output" |
| 129 | fi |
| 130 | |
| 131 | # C: Express Interest for /net/ndnsim/www/contact.html w/ |
| 132 | # Link object {Name=/net/ndnsim, Delegations={{10, /arizona/cs/telecom}}} |
| 133 | # Fail if not answered with Data containing "BBBBBBBB" |
| 134 | echo "From C, sending Interest for /net/ndnsim/www/contact.html w/ Link object {Name=/net/ndnsim, Delegations={{10, /arizona/cs/telecom}}}" |
| 135 | ssh $CTRL_C "generate-link-object $workdir/link-object /net/ndnsim 10 /arizona/cs/telecom" |
| 136 | output=$(ssh $CTRL_C "ndnpeek -p --link-file $workdir/link-object /net/ndnsim/www/contact.html 2>&1") |
| 137 | if [[ $output != "BBBBBBBB" ]] |
| 138 | then |
| 139 | echo "Interest was not answered with Data containing payload 'BBBBBBBB'" |
| 140 | echo "Actual: $output" |
| 141 | clean_up |
| 142 | exit 4 |
| 143 | fi |
| 144 | |
| 145 | # C: Express Interest for /net/ndnsim/www/about.html w/ |
| 146 | # Link object {Name=/net/ndnsim, Delegations={{10, /arizona/cs}}} |
| 147 | # Fail if not answered with Data containing "CCCCCCCC" |
| 148 | echo "From C, sending Interest for /net/ndnsim/www/about.html w/ Link object {Name=/net/ndnsim, Delegations={{10, /arizona/cs}}}" |
| 149 | ssh $CTRL_C "generate-link-object $workdir/link-object /net/ndnsim 10 /arizona/cs" |
| 150 | output=$(ssh $CTRL_C "ndnpeek -p --link-file $workdir/link-object /net/ndnsim/www/about.html 2>&1") |
| 151 | if [[ $output != "CCCCCCCC" ]] |
| 152 | then |
| 153 | echo "Interest was not answered with Data containing payload 'CCCCCCCC'" |
| 154 | echo "Actual: $output" |
| 155 | clean_up |
| 156 | exit 5 |
| 157 | fi |
| 158 | |
| 159 | # C: Express Interest for /net/ndnsim/www/info.html w/ |
| 160 | # Link object {Name=/net/ndnsim, Delegations={{10, /arizona}}} |
| 161 | # Fail if not answered with Data containing "CCCCCCCC" |
| 162 | echo "From C, sending Interest for /net/ndnsim/www/info.html w/ Link object {Name=/net/ndnsim, Delegations={{10, /arizona}}}" |
| 163 | ssh $CTRL_C "generate-link-object $workdir/link-object /net/ndnsim 10 /arizona" |
| 164 | output=$(ssh $CTRL_C "ndnpeek -p --link-file $workdir/link-object /net/ndnsim/www/info.html 2>&1") |
| 165 | if [[ $output != "CCCCCCCC" ]] |
| 166 | then |
| 167 | echo "Interest was not answered with Data containing payload 'CCCCCCCC'" |
| 168 | echo "Actual: $output" |
| 169 | clean_up |
| 170 | exit 6 |
| 171 | fi |
| 172 | |
| 173 | # C: Express Interest for /net/ndnsim/www/logo.jpg w/ |
| 174 | # Link object {Name=/net/ndnsim, Delegations={{10, /arizona/cs/telecom/east}}} |
| 175 | # Fail if not answered with Nack with reason "NoRoute" |
| 176 | echo "From C, sending Interest for /net/ndnsim/www/logo.jpg w/ Link object {Name=/net/ndnsim, Delegations={{10, /arizona/cs/telecom/east}}}" |
| 177 | ssh $CTRL_C "generate-link-object $workdir/link-object /net/ndnsim 10 /arizona/cs/telecom/east" |
| 178 | output=$(ssh $CTRL_C "ndnpeek -p --link-file $workdir/link-object /net/ndnsim/www/logo.jpg 2>&1") |
| 179 | if [[ $output != "NoRoute" ]] |
| 180 | then |
| 181 | echo "Interest was not answered with Nack with reason 'NoRoute'" |
| 182 | echo "Actual: $output" |
| 183 | clean_up |
| 184 | exit 7 |
| 185 | fi |
| 186 | |
| 187 | clean_up |
| 188 | echo "Mobility with Link Test PASSED" |