Hila Ben Abraham | a36f0d1 | 2016-02-08 18:03:47 -0600 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | source ../multi-host.conf |
| 3 | workDir=$(pwd) |
| 4 | logDir=$workDir/logs |
| 5 | testLogA=$logDir/route-inheritanceA.log |
| 6 | testLogB=$logDir/route-inheritanceB.log |
| 7 | testLogC=$logDir/route-inheritanceC.log |
| 8 | testLogD=$logDir/route-inheritanceD.log |
| 9 | mkdir -p $workDir/logs |
| 10 | |
| 11 | echo "Starting nfd on host A" > $testLogA |
| 12 | # start nfd on localhost (A) |
| 13 | sudo nfd &> $logDir/nfdA.log & |
| 14 | |
| 15 | # start nfd on hostB |
| 16 | ssh $CTRL_B "mkdir -p $logDir ; sudo nfd &> $logDir/nfdB.log &\ |
| 17 | echo 'Starting nfd on host B' > $testLogB ; sleep 2" |
| 18 | |
| 19 | # start nfd on hostC |
| 20 | ssh $CTRL_C "mkdir -p $logDir ; sudo nfd &> $logDir/nfdC.log &\ |
| 21 | echo 'Starting nfd on host C' > $testLogC ; sleep 2" |
| 22 | |
| 23 | # start nfd on hostD |
| 24 | ssh $CTRL_D "mkdir -p $logDir ; sudo nfd &> $logDir/nfdD.log &\ |
| 25 | echo 'Starting nfd on host D' > $testLogD ; sleep 2" |
| 26 | |
| 27 | # set multicast strategy for root namespace on A |
| 28 | nfdc set-strategy / /localhost/nfd/strategy/multicast |
| 29 | |
| 30 | # run traffic generator on B,C,D |
| 31 | ssh $CTRL_B "echo 'starting ndn-traffic-server on B' > $testLogB &\ |
| 32 | ndn-traffic-server $workDir/NDNTrafficServer.conf &> $logDir/serverB.log &" |
| 33 | ssh $CTRL_C "echo 'starting ndn-traffic-server on C' > $testLogC &\ |
| 34 | ndn-traffic-server $workDir/NDNTrafficServer.conf &> $logDir/serverC.log &" |
| 35 | ssh $CTRL_D "echo 'starting ndn-traffic-server on D' > $testLogD &\ |
| 36 | ndn-traffic-server $workDir/NDNTrafficServer.conf &> $logDir/serverD.log &" |
| 37 | |
| 38 | echo "setting up routes..." |
| 39 | |
| 40 | # on A, add ndn:/ , nexthop=hostB, CHILD_INHERIT=yes, CAPTURE=no |
| 41 | nfdc register ndn:/ udp4://$IP4_B1:6363 >> $testLogA |
| 42 | |
| 43 | # on A, add ndn:/ , nexthop=hostC, CHILD_INHERIT=no, CAPTURE=no |
| 44 | nfdc register -I ndn:/ udp4://$IP4_C1:6363 >> $testLogA |
| 45 | |
| 46 | # on A, add ndn:/A , nexthop=hostB, CHILD_INHERIT=yes, CAPTURE=no |
| 47 | nfdc register ndn:/A udp4://$IP4_B1:6363 >> $testLogA |
| 48 | |
| 49 | # on A, add ndn:/A/B/C , nexthop=hostD, CHILD_INHERIT=yes, CAPTURE=no |
| 50 | nfdc register ndn:/A/B/C udp4://$IP4_D1:6363 >> $testLogA |
| 51 | |
| 52 | # on A, add ndn:/D , nexthop=hostC, CHILD_INHERIT=yes, CAPTURE=yes |
| 53 | nfdc register -C ndn:/D udp4://$IP4_C1:6363 >> $testLogA |
| 54 | |
| 55 | # on A, add ndn:/D , nexthop=hostD, CHILD_INHERIT=yes, CAPTURE=no |
| 56 | nfdc register ndn:/D udp4://$IP4_D1:6363 >> $testLogA |
| 57 | |
| 58 | sleep 2 |
| 59 | |
| 60 | |
| 61 | # run traffic generator clients on A |
| 62 | echo "running traffic generator client1..." |
| 63 | ndn-traffic -c 20 -i 200 $workDir/NDNTrafficClient1.conf > $logDir/client1.log 2>&1 |
| 64 | |
| 65 | echo "running traffic generator client2..." |
| 66 | ndn-traffic -c 20 -i 200 $workDir/NDNTrafficClient2.conf > $logDir/client2.log 2>&1 |
| 67 | |
| 68 | echo "running traffic generator client3..." |
| 69 | ndn-traffic -c 20 -i 200 $workDir/NDNTrafficClient3.conf > $logDir/client3.log 2>&1 |
| 70 | |
| 71 | echo "running traffic generator client4..." |
| 72 | ndn-traffic -c 20 -i 200 $workDir/NDNTrafficClient4.conf > $logDir/client4.log 2>&1 |
| 73 | |
| 74 | |
| 75 | # stop traffic generator server on B,C,D and kill local nfd |
| 76 | echo "killing ndn-traffic-server on B, C and D..." |
| 77 | ssh $CTRL_B "sudo killall ndn-traffic-server; sudo killall nfd >> $testLogB 2>&1" |
| 78 | ssh $CTRL_C "sudo killall ndn-traffic-server; sudo killall nfd >> $testLogC 2>&1" |
| 79 | ssh $CTRL_D "sudo killall ndn-traffic-server; sudo killall nfd >> $testLogD 2>&1" |
| 80 | sudo killall nfd 2>&1 |
| 81 | |
| 82 | sleep 2 |
| 83 | |
| 84 | # collect data from servers |
| 85 | scp $CTRL_B:$logDir/serverB.log $logDir/serverB.log |
| 86 | scp $CTRL_C:$logDir/serverC.log $logDir/serverC.log |
| 87 | scp $CTRL_D:$logDir/serverD.log $logDir/serverD.log |
| 88 | |
| 89 | #### verify server numbers of server B #### |
| 90 | echo "analyzing result of server B" |
| 91 | received=$(grep -A 1 "Name=ndn:/A/P," $logDir/serverB.log | grep "Total Interests Received" | |
| 92 | cut -d= -f2 | cut -d' ' -f2) |
| 93 | if [[ $received -lt 18 ]] |
| 94 | then |
| 95 | echo "FAIL: B received $received interests of ndn:/A/P out of the 20 sent by A. &\ |
| 96 | At least 18 were supposed to arrive at B due to CHILD_INHERIT flag of /A towards B." |
| 97 | exit 1 |
| 98 | fi |
| 99 | |
| 100 | received=$(grep -A 1 "Name=ndn:/A/B/C/Q," $logDir/serverB.log | grep "Total Interests Received" | |
| 101 | cut -d= -f2 | cut -d' ' -f2) |
| 102 | if [[ $received -lt 18 ]] |
| 103 | then |
| 104 | echo "FAIL: B received $received interests of ndn:/A/B/C/Q out of the 20 sent by A. &\ |
| 105 | At least 18 were supposed to arrive at B due to CHILD_INHERIT flag of /A towards B." |
| 106 | exit 1 |
| 107 | fi |
| 108 | |
| 109 | received=$(grep -A 1 "Name=ndn:/D/R," $logDir/serverB.log | grep "Total Interests Received" | |
| 110 | cut -d= -f2 | cut -d' ' -f2) |
| 111 | if [[ $received -ne 0 ]] |
| 112 | then |
| 113 | echo "FAIL: B received $received interests of ndn:/D/R out of 20 sent by A. &\ |
| 114 | There is no available route for ndn:/D/R at A towards B so 0 interests were supposed to arrive at B." |
| 115 | exit 1 |
| 116 | fi |
| 117 | |
| 118 | received=$(grep -A 1 "Name=ndn:/S," $logDir/serverB.log | grep "Total Interests Received" | |
| 119 | cut -d= -f2 | cut -d' ' -f2) |
| 120 | if [[ $received -lt 18 ]] |
| 121 | then |
| 122 | echo "FAIL: B received $received interests of ndn:/S out of the 20 sent by A. &\ |
| 123 | At least 18 were supposed to arrive at B due to CHILD_INHERIT flag of / towards B." |
| 124 | exit 1 |
| 125 | fi |
| 126 | |
| 127 | #### verify server numbers of server C #### |
| 128 | echo "analyzing result of server C" |
| 129 | received=$(grep -A 1 "Name=ndn:/A/P," $logDir/serverC.log | grep "Total Interests Received" | |
| 130 | cut -d= -f2 | cut -d' ' -f2) |
| 131 | if [[ $received -ne 0 ]] |
| 132 | then |
| 133 | echo "FAIL: C received $received interests of ndn:/A/P out of 20 sent by A. &\ |
| 134 | There is no available route for ndn:/A/P at A towards C so 0 interests were supposed to arrive at C." |
| 135 | exit 1 |
| 136 | fi |
| 137 | |
| 138 | received=$(grep -A 1 "Name=ndn:/A/B/C/Q," $logDir/serverC.log | grep "Total Interests Received" | |
| 139 | cut -d= -f2 | cut -d' ' -f2) |
| 140 | if [[ $received -ne 0 ]] |
| 141 | then |
| 142 | echo "FAIL: C received $received interests of ndn:/A/B/C/Q out of 20 sent by A. &\ |
| 143 | There is no available route for ndn:/A/B/C/Q at A towards C so 0 interests were supposed to arrive at C." |
| 144 | |
| 145 | exit 1 |
| 146 | fi |
| 147 | |
| 148 | received=$(grep -A 1 "Name=ndn:/D/R," $logDir/serverC.log | grep "Total Interests Received" | |
| 149 | cut -d= -f2 | cut -d' ' -f2) |
| 150 | if [[ $received -lt 18 ]] |
| 151 | then |
| 152 | echo "FAIL: C received $received interests of ndn:/D/R out of the 20 sent by A. &\ |
| 153 | At least 18 were supposed to arrive at C due to CHILD_INHERIT flag of /D towards C." |
| 154 | |
| 155 | exit 1 |
| 156 | fi |
| 157 | |
| 158 | received=$(grep -A 1 "Name=ndn:/S," $logDir/serverC.log | grep "Total Interests Received" | |
| 159 | cut -d= -f2 | cut -d' ' -f2) |
| 160 | if [[ $received -lt 18 ]] |
| 161 | then |
| 162 | echo "FAIL: C received $received interests of ndn:/S out of the 20 sent by A. &\ |
| 163 | Longest-prefix match of ndn:/S in A is ndn:/ and therefore at least 18 were supposed to arrive at C." |
| 164 | |
| 165 | exit 1 |
| 166 | fi |
| 167 | |
| 168 | #### verify server numbers of server D #### |
| 169 | echo "analyzing result of server D" |
| 170 | received=$(grep -A 1 "Name=ndn:/A/P," $logDir/serverD.log | grep "Total Interests Received" | |
| 171 | cut -d= -f2 | cut -d' ' -f2) |
| 172 | if [[ $received -ne 0 ]] |
| 173 | then |
| 174 | echo "FAIL: D received $received interests of ndn:/A/P out of 20 sent by A. &\ |
| 175 | There is no available route for ndn:/A/P at A towards D so 0 interests were supposed to arrive at D." |
| 176 | |
| 177 | exit 1 |
| 178 | fi |
| 179 | |
| 180 | received=$(grep -A 1 "Name=ndn:/A/B/C/Q," $logDir/serverD.log | grep "Total Interests Received" | |
| 181 | cut -d= -f2 | cut -d' ' -f2) |
| 182 | if [[ $received -lt 18 ]] |
| 183 | then |
| 184 | echo "FAIL: D received $received interests of ndn:/A/B/C/Q out of the 20 sent by A. &\ |
| 185 | At least 18 were supposed to arrive at D due to CHILD_INHERIT flag of /A/B/C towards D." |
| 186 | exit 1 |
| 187 | fi |
| 188 | |
| 189 | received=$(grep -A 1 "Name=ndn:/D/R," $logDir/serverD.log | grep "Total Interests Received" | |
| 190 | cut -d= -f2 | cut -d' ' -f2) |
| 191 | if [[ $received -lt 18 ]] |
| 192 | then |
| 193 | echo "FAIL: D received $received interests of ndn:/D/R out of the 20 sent by A. &\ |
| 194 | At least 18 were supposed to arrive at D due to CHILD_INHERIT flag of /D towards D." |
| 195 | exit 1 |
| 196 | fi |
| 197 | |
| 198 | received=$(grep -A 1 "Name=ndn:/S," $logDir/serverD.log | grep "Total Interests Received" | |
| 199 | cut -d= -f2 | cut -d' ' -f2) |
| 200 | if [[ $received -ne 0 ]] |
| 201 | then |
| 202 | echo "FAIL: D received $received interests of ndn:/S out of 20 sent by A. &\ |
| 203 | There is no available route for ndn:/S at A towards D so 0 interests were supposed to arrive at D." |
| 204 | exit 1 |
| 205 | fi |
| 206 | |
| 207 | echo "Test passed successfully" |
| 208 | exit 0 |