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