blob: 77e5a8f7949d5e57212806232cb8c76f075dfbc5 [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
Eric Newberry7745c1a2017-04-20 00:23:05 -070028nfdc strategy set prefix / strategy /localhost/nfd/strategy/multicast
Hila Ben Abrahama36f0d12016-02-08 18:03:47 -060029
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
Eric Newberry7745c1a2017-04-20 00:23:05 -070038echo "setting up faces..."
39
40nfdc face create udp4://$IP4_B1:6363 >> $testLogA
41nfdc face create udp4://$IP4_C1:6363 >> $testLogA
42nfdc face create udp4://$IP4_D1:6363 >> $testLogA
43
Hila Ben Abrahama36f0d12016-02-08 18:03:47 -060044echo "setting up routes..."
45
46# on A, add ndn:/ , nexthop=hostB, CHILD_INHERIT=yes, CAPTURE=no
Eric Newberry7745c1a2017-04-20 00:23:05 -070047nfdc route add ndn:/ udp4://$IP4_B1:6363 >> $testLogA
Hila Ben Abrahama36f0d12016-02-08 18:03:47 -060048
49# on A, add ndn:/ , nexthop=hostC, CHILD_INHERIT=no, CAPTURE=no
Eric Newberry7745c1a2017-04-20 00:23:05 -070050nfdc route add ndn:/ udp4://$IP4_C1:6363 no-inherit >> $testLogA
Hila Ben Abrahama36f0d12016-02-08 18:03:47 -060051
52# on A, add ndn:/A , nexthop=hostB, CHILD_INHERIT=yes, CAPTURE=no
Eric Newberry7745c1a2017-04-20 00:23:05 -070053nfdc route add ndn:/A udp4://$IP4_B1:6363 >> $testLogA
Hila Ben Abrahama36f0d12016-02-08 18:03:47 -060054
55# on A, add ndn:/A/B/C , nexthop=hostD, CHILD_INHERIT=yes, CAPTURE=no
Eric Newberry7745c1a2017-04-20 00:23:05 -070056nfdc route add ndn:/A/B/C udp4://$IP4_D1:6363 >> $testLogA
Hila Ben Abrahama36f0d12016-02-08 18:03:47 -060057
58# on A, add ndn:/D , nexthop=hostC, CHILD_INHERIT=yes, CAPTURE=yes
Eric Newberry7745c1a2017-04-20 00:23:05 -070059nfdc route add ndn:/D udp4://$IP4_C1:6363 capture >> $testLogA
Hila Ben Abrahama36f0d12016-02-08 18:03:47 -060060
61# on A, add ndn:/D , nexthop=hostD, CHILD_INHERIT=yes, CAPTURE=no
Eric Newberry7745c1a2017-04-20 00:23:05 -070062nfdc route add ndn:/D udp4://$IP4_D1:6363 >> $testLogA
Hila Ben Abrahama36f0d12016-02-08 18:03:47 -060063
64sleep 2
65
66
67# run traffic generator clients on A
68echo "running traffic generator client1..."
69ndn-traffic -c 20 -i 200 $workDir/NDNTrafficClient1.conf > $logDir/client1.log 2>&1
70
71echo "running traffic generator client2..."
72ndn-traffic -c 20 -i 200 $workDir/NDNTrafficClient2.conf > $logDir/client2.log 2>&1
73
74echo "running traffic generator client3..."
75ndn-traffic -c 20 -i 200 $workDir/NDNTrafficClient3.conf > $logDir/client3.log 2>&1
76
77echo "running traffic generator client4..."
78ndn-traffic -c 20 -i 200 $workDir/NDNTrafficClient4.conf > $logDir/client4.log 2>&1
79
80
81# stop traffic generator server on B,C,D and kill local nfd
82echo "killing ndn-traffic-server on B, C and D..."
83ssh $CTRL_B "sudo killall ndn-traffic-server; sudo killall nfd >> $testLogB 2>&1"
84ssh $CTRL_C "sudo killall ndn-traffic-server; sudo killall nfd >> $testLogC 2>&1"
85ssh $CTRL_D "sudo killall ndn-traffic-server; sudo killall nfd >> $testLogD 2>&1"
86sudo killall nfd 2>&1
87
88sleep 2
89
90# collect data from servers
91scp $CTRL_B:$logDir/serverB.log $logDir/serverB.log
92scp $CTRL_C:$logDir/serverC.log $logDir/serverC.log
93scp $CTRL_D:$logDir/serverD.log $logDir/serverD.log
94
95#### verify server numbers of server B ####
96echo "analyzing result of server B"
97received=$(grep -A 1 "Name=ndn:/A/P," $logDir/serverB.log | grep "Total Interests Received" |
98 cut -d= -f2 | cut -d' ' -f2)
99if [[ $received -lt 18 ]]
100then
101echo "FAIL: B received $received interests of ndn:/A/P out of the 20 sent by A. &\
102 At least 18 were supposed to arrive at B due to CHILD_INHERIT flag of /A towards B."
103exit 1
104fi
105
106received=$(grep -A 1 "Name=ndn:/A/B/C/Q," $logDir/serverB.log | grep "Total Interests Received" |
107 cut -d= -f2 | cut -d' ' -f2)
108if [[ $received -lt 18 ]]
109then
110echo "FAIL: B received $received interests of ndn:/A/B/C/Q out of the 20 sent by A. &\
111 At least 18 were supposed to arrive at B due to CHILD_INHERIT flag of /A towards B."
112exit 1
113fi
114
115received=$(grep -A 1 "Name=ndn:/D/R," $logDir/serverB.log | grep "Total Interests Received" |
116 cut -d= -f2 | cut -d' ' -f2)
117if [[ $received -ne 0 ]]
118then
119echo "FAIL: B received $received interests of ndn:/D/R out of 20 sent by A. &\
120 There is no available route for ndn:/D/R at A towards B so 0 interests were supposed to arrive at B."
121exit 1
122fi
123
124received=$(grep -A 1 "Name=ndn:/S," $logDir/serverB.log | grep "Total Interests Received" |
125 cut -d= -f2 | cut -d' ' -f2)
126if [[ $received -lt 18 ]]
127then
128echo "FAIL: B received $received interests of ndn:/S out of the 20 sent by A. &\
129 At least 18 were supposed to arrive at B due to CHILD_INHERIT flag of / towards B."
130exit 1
131fi
132
133#### verify server numbers of server C ####
134echo "analyzing result of server C"
135received=$(grep -A 1 "Name=ndn:/A/P," $logDir/serverC.log | grep "Total Interests Received" |
136 cut -d= -f2 | cut -d' ' -f2)
137if [[ $received -ne 0 ]]
138then
139echo "FAIL: C received $received interests of ndn:/A/P out of 20 sent by A. &\
140 There is no available route for ndn:/A/P at A towards C so 0 interests were supposed to arrive at C."
141exit 1
142fi
143
144received=$(grep -A 1 "Name=ndn:/A/B/C/Q," $logDir/serverC.log | grep "Total Interests Received" |
145 cut -d= -f2 | cut -d' ' -f2)
146if [[ $received -ne 0 ]]
147then
148echo "FAIL: C received $received interests of ndn:/A/B/C/Q out of 20 sent by A. &\
149 There is no available route for ndn:/A/B/C/Q at A towards C so 0 interests were supposed to arrive at C."
150
151exit 1
152fi
153
154received=$(grep -A 1 "Name=ndn:/D/R," $logDir/serverC.log | grep "Total Interests Received" |
155 cut -d= -f2 | cut -d' ' -f2)
156if [[ $received -lt 18 ]]
157then
158echo "FAIL: C received $received interests of ndn:/D/R out of the 20 sent by A. &\
159 At least 18 were supposed to arrive at C due to CHILD_INHERIT flag of /D towards C."
160
161exit 1
162fi
163
164received=$(grep -A 1 "Name=ndn:/S," $logDir/serverC.log | grep "Total Interests Received" |
165 cut -d= -f2 | cut -d' ' -f2)
166if [[ $received -lt 18 ]]
167then
168echo "FAIL: C received $received interests of ndn:/S out of the 20 sent by A. &\
169 Longest-prefix match of ndn:/S in A is ndn:/ and therefore at least 18 were supposed to arrive at C."
170
171exit 1
172fi
173
174#### verify server numbers of server D ####
175echo "analyzing result of server D"
176received=$(grep -A 1 "Name=ndn:/A/P," $logDir/serverD.log | grep "Total Interests Received" |
177 cut -d= -f2 | cut -d' ' -f2)
178if [[ $received -ne 0 ]]
179then
180echo "FAIL: D received $received interests of ndn:/A/P out of 20 sent by A. &\
181 There is no available route for ndn:/A/P at A towards D so 0 interests were supposed to arrive at D."
182
183exit 1
184fi
185
186received=$(grep -A 1 "Name=ndn:/A/B/C/Q," $logDir/serverD.log | grep "Total Interests Received" |
187 cut -d= -f2 | cut -d' ' -f2)
188if [[ $received -lt 18 ]]
189then
190echo "FAIL: D received $received interests of ndn:/A/B/C/Q out of the 20 sent by A. &\
191 At least 18 were supposed to arrive at D due to CHILD_INHERIT flag of /A/B/C towards D."
192exit 1
193fi
194
195received=$(grep -A 1 "Name=ndn:/D/R," $logDir/serverD.log | grep "Total Interests Received" |
196 cut -d= -f2 | cut -d' ' -f2)
197if [[ $received -lt 18 ]]
198then
199echo "FAIL: D received $received interests of ndn:/D/R out of the 20 sent by A. &\
200 At least 18 were supposed to arrive at D due to CHILD_INHERIT flag of /D towards D."
201exit 1
202fi
203
204received=$(grep -A 1 "Name=ndn:/S," $logDir/serverD.log | grep "Total Interests Received" |
205 cut -d= -f2 | cut -d' ' -f2)
206if [[ $received -ne 0 ]]
207then
208echo "FAIL: D received $received interests of ndn:/S out of 20 sent by A. &\
209 There is no available route for ndn:/S at A towards D so 0 interests were supposed to arrive at D."
210exit 1
211fi
212
213echo "Test passed successfully"
214exit 0