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