blob: e658b01e8aea752838167722e62b7b5301cfcec8 [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
61# C: Register default route toward B
62ssh $CTRL_C "nfdc register / udp4://$IP4_B1"
63if [[ $? -ne 0 ]]
64then
65 echo "Failed to create default route on C toward B"
66 clean_up
67 exit 1
68fi
69
70# B: Register route /ucla toward A
71ssh $CTRL_B "nfdc register /ucla udp4://$IP4_A1"
72if [[ $? -ne 0 ]]
73then
74 echo "Failed to create route /ucla on B toward A"
75 clean_up
76 exit 1
77fi
78
79# A: Register route /ucla/cs toward D
80nfdc register /ucla/cs udp4://$IP4_D1
81if [[ $? -ne 0 ]]
82then
83 echo "Failed to create route /ucla/cs on A toward D"
84 clean_up
85 exit 1
86fi
87
88# C: Run ndn-traffic-server for /net/ndnsim/www serving "CCCCCCCC"
89echo "starting ndn-traffic-server on host C..."
90ssh $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"
93echo "starting ndn-traffic-server on host B..."
94ssh $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"
97echo "starting ndn-traffic-server on host A..."
98ndn-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"
101echo "starting ndn-traffic-server on host D..."
102ssh $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"
107echo "From C, sending Interest for /net/ndnsim/www/index.html w/ Link object {Name=/net/ndnsim, Delegations={{10,/telia/terabits}, {20,/ucla/cs}}}"
108ssh $CTRL_C "generate-link-object $workdir/link-object /net/ndnsim 10 /telia/terabits 20 /ucla/cs"
109output=$(ssh $CTRL_C "ndnpeek -p --link-file $workdir/link-object /net/ndnsim/www/index.html 2>&1")
110if [[ $output != "DDDDDDDD" ]]
111then
112 echo "Interest was not answered with Data containing payload 'DDDDDDDD'"
113 echo "Actual: $output"
114 clean_up
115 exit 2
116fi
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"
121echo "From C, sending Interest for /net/ndnsim/www/news.html w/ Link object {Name=/net/ndnsim, Delegations={{10,/telia/terabits}, {20,/waseda/cs}}}"
122ssh $CTRL_C "generate-link-object $workdir/link-object /net/ndnsim 10 /telia/terabits 20 /waseda/cs"
123output=$(ssh $CTRL_C "ndnpeek -p --link-file $workdir/link-object /net/ndnsim/www/news.html 2>&1")
124if [[ $output != "NoRoute" ]]
125then
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"
129fi
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"
134echo "From C, sending Interest for /net/ndnsim/www/contact.html w/ Link object {Name=/net/ndnsim, Delegations={{10, /arizona/cs/telecom}}}"
135ssh $CTRL_C "generate-link-object $workdir/link-object /net/ndnsim 10 /arizona/cs/telecom"
136output=$(ssh $CTRL_C "ndnpeek -p --link-file $workdir/link-object /net/ndnsim/www/contact.html 2>&1")
137if [[ $output != "BBBBBBBB" ]]
138then
139 echo "Interest was not answered with Data containing payload 'BBBBBBBB'"
140 echo "Actual: $output"
141 clean_up
142 exit 4
143fi
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"
148echo "From C, sending Interest for /net/ndnsim/www/about.html w/ Link object {Name=/net/ndnsim, Delegations={{10, /arizona/cs}}}"
149ssh $CTRL_C "generate-link-object $workdir/link-object /net/ndnsim 10 /arizona/cs"
150output=$(ssh $CTRL_C "ndnpeek -p --link-file $workdir/link-object /net/ndnsim/www/about.html 2>&1")
151if [[ $output != "CCCCCCCC" ]]
152then
153 echo "Interest was not answered with Data containing payload 'CCCCCCCC'"
154 echo "Actual: $output"
155 clean_up
156 exit 5
157fi
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"
162echo "From C, sending Interest for /net/ndnsim/www/info.html w/ Link object {Name=/net/ndnsim, Delegations={{10, /arizona}}}"
163ssh $CTRL_C "generate-link-object $workdir/link-object /net/ndnsim 10 /arizona"
164output=$(ssh $CTRL_C "ndnpeek -p --link-file $workdir/link-object /net/ndnsim/www/info.html 2>&1")
165if [[ $output != "CCCCCCCC" ]]
166then
167 echo "Interest was not answered with Data containing payload 'CCCCCCCC'"
168 echo "Actual: $output"
169 clean_up
170 exit 6
171fi
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"
176echo "From C, sending Interest for /net/ndnsim/www/logo.jpg w/ Link object {Name=/net/ndnsim, Delegations={{10, /arizona/cs/telecom/east}}}"
177ssh $CTRL_C "generate-link-object $workdir/link-object /net/ndnsim 10 /arizona/cs/telecom/east"
178output=$(ssh $CTRL_C "ndnpeek -p --link-file $workdir/link-object /net/ndnsim/www/logo.jpg 2>&1")
179if [[ $output != "NoRoute" ]]
180then
181 echo "Interest was not answered with Nack with reason 'NoRoute'"
182 echo "Actual: $output"
183 clean_up
184 exit 7
185fi
186
187clean_up
188echo "Mobility with Link Test PASSED"