blob: 93c5b9418de7bfb7d974d326ab5cb65d27f25287 [file] [log] [blame]
Yi Huang3d230672014-04-26 04:25:24 -07001#!/usr/bin/env bash
2source ../multi-host.conf
3a_ipaddr=$IP4_A1
4b_ipaddr=$IP4_B1
5c_ipaddr=$IP4_C1
6strategy=$1
Eric Newberry6fc88222015-06-19 10:43:24 -07007logprefix=$2
Yi Huang3d230672014-04-26 04:25:24 -07008echo "host A IP address $a_ipaddr"
9echo "host B IP address $b_ipaddr"
10echo "host C IP address $c_ipaddr"
11echo "Strategy: $strategy"
12mkdir -p logs
13workdir=$(pwd)
14
15clean_up() {
16 echo "cleaning up..."
17 r=$(sudo killall nfd 2>&1)
18 r=$(ssh $b_ipaddr "sudo killall nfd 2>&1" 2>&1)
19 r=$(ssh $c_ipaddr "sudo killall nfd 2>&1" 2>&1)
20}
Hila Ben Abrahamd5033e92015-01-15 20:30:55 -060021# generate nfd.conf: disable multicast faces
22cp /usr/local/etc/ndn/nfd.conf $workdir/nfd.conf
23ssh $CTRL_B "sed 's/mcast yes/mcast no/' /usr/local/etc/ndn/nfd.conf > $workdir/nfd.conf"
24ssh $CTRL_C "sed 's/mcast yes/mcast no/' /usr/local/etc/ndn/nfd.conf > $workdir/nfd.conf"
Yi Huang3d230672014-04-26 04:25:24 -070025
26# get keys
27echo "getting keys..."
28cp -r /usr/local/etc/ndn/keys $workdir/
29ssh $CTRL_B "cp -r /usr/local/etc/ndn/keys $workdir/"
30ssh $CTRL_C "cp -r /usr/local/etc/ndn/keys $workdir/"
31
32# start NFD on three nodes and set nexthop to create loop
33echo "start NFD on three nodes and set nexthop to create loop..."
34ssh $CTRL_B "mkdir -p $workdir/logs;\
Eric Newberry6fc88222015-06-19 10:43:24 -070035 sudo nfd --config $workdir/nfd.conf &> $workdir/logs/${logprefix}_nfd.log &\
Yi Huang53fa8712014-06-10 20:14:26 -070036 sleep 2"
Yi Huang3d230672014-04-26 04:25:24 -070037ssh $CTRL_C "mkdir -p $workdir/logs;\
Eric Newberry6fc88222015-06-19 10:43:24 -070038 sudo nfd --config $workdir/nfd.conf &> $workdir/logs/${logprefix}_nfd.log &\
Yi Huang53fa8712014-06-10 20:14:26 -070039 sleep 2"
Eric Newberry6fc88222015-06-19 10:43:24 -070040sudo nfd --config $workdir/nfd.conf &> $workdir/logs/${logprefix}_nfd.log &
Yi Huang3d230672014-04-26 04:25:24 -070041sleep 5
42ssh $CTRL_B "$workdir/add-nexthop.sh $c_ipaddr $strategy"
43ssh $CTRL_C "$workdir/add-nexthop.sh $a_ipaddr $strategy"
44$workdir/add-nexthop.sh $b_ipaddr $strategy
45
46# use ndn-traffic client to send 100 interests
47echo "using ndn-traffic client to send 100 interests..."
Eric Newberry6fc88222015-06-19 10:43:24 -070048ndn-traffic -c 100 -i 200 NDNTrafficClient.conf > $workdir/logs/${logprefix}_client.log 2>&1
Yi Huang3d230672014-04-26 04:25:24 -070049
50# collect nfd-status from B and C
51echo "collecting nfd-status from B and C..."
Eric Newberry6fc88222015-06-19 10:43:24 -070052ssh $CTRL_B "nfd-status -f > $workdir/logs/${logprefix}_nfd-status-B.log 2>&1"
53scp $CTRL_B:$workdir/logs/${logprefix}_nfd-status-B.log $workdir/logs/${logprefix}_nfd-status-B.log
54ssh $CTRL_C "nfd-status -f > $workdir/logs/${logprefix}_nfd-status-C.log 2>&1"
55scp $CTRL_C:$workdir/logs/${logprefix}_nfd-status-C.log $workdir/logs/${logprefix}_nfd-status-C.log
56nfd-status -f > $workdir/logs/${logprefix}_nfd-status-A.log 2>&1
Yi Huang3d230672014-04-26 04:25:24 -070057
58# analyze results
59echo "analyzing results..."
60for host in {A..C}
61do
62 echo "Host $host:"
Eric Newberry6fc88222015-06-19 10:43:24 -070063 cat $workdir/logs/${logprefix}_nfd-status-$host.log | grep udp4 | while read line
Yi Huang3d230672014-04-26 04:25:24 -070064 do
65 ini=$(echo "$line" | grep -Po "in={.*?i" | sed 's/in={//g' | sed 's/i//g')
66 outi=$(echo "$line" | grep -Po "out={.*?i" | sed 's/out={//g' | sed 's/i//g')
67 echo " $ini in, $outi out"
68 if [[ $ini -gt 200 ]]
69 then
70 echo "FAIL: counter for incoming interest on host $host is greater than 200"
71 echo "$line"
72 clean_up
73 exit 1
74 fi
75 if [[ $outi -gt 200 ]]
76 then
77 echo "FAIL: counter for outgoing interest on host $host is greater than 200"
78 echo "$line"
79 clean_up
80 exit 2
81 fi
82 done
83done
84
85# clean up
86clean_up
87echo "Interest Loop Test PASSED"