Hila Ben Abraham | 4c850f8 | 2014-06-22 20:24:34 -0500 | [diff] [blame^] | 1 | #!/usr/bin/env bash |
| 2 | source ../multi-host.conf |
| 3 | workdir=$(pwd) |
| 4 | mkdir -p $workdir/logs |
| 5 | testCase=$1 |
| 6 | testLog=$workdir/logs/hub_discovery.log |
| 7 | |
| 8 | # clean up - kill nfd |
| 9 | clean_up() { |
| 10 | r=$(sudo killall nfd 2>&1) |
| 11 | sleep 2 |
| 12 | |
| 13 | } |
| 14 | |
| 15 | echo "TEST STARTED" > $testLog |
| 16 | |
| 17 | # start nfd on localhost |
| 18 | sudo nfd &> $workdir/logs/nfd.log & |
| 19 | sleep 2 |
| 20 | |
| 21 | # start nrd on localhost |
| 22 | nrd &> $workdir/logs/nrd.log & |
| 23 | sleep 2 |
| 24 | |
| 25 | ndn-autoconfig-server udp4://10.63.18.1 & |
| 26 | |
| 27 | # set record for _ndn._udp.autoconfig-test.named-data.net => 10.63.18.2 |
| 28 | # set record for _ndn._udp.autoconfig-test.tmp._homehub._autoconf.named-data.net => 10.63.18.3 |
| 29 | sudo cp autoconfig-test.named-data.net.db /etc/bind/ |
| 30 | sudo cp named-data.net.db /etc/bind |
| 31 | |
| 32 | # configure local dns server |
| 33 | sudo cp named.conf.local /etc/bind |
| 34 | sudo service bind9 restart |
| 35 | |
| 36 | sleep 2 |
| 37 | |
| 38 | ssh $IP4_B1 "$workdir/test-B-stage1.sh $workdir" |
| 39 | if [[ $? -ne 0 ]]; then |
| 40 | echo "Stage 1: multicast discovery failed on node B" >> $testLog |
| 41 | clean_up |
| 42 | exit 1 |
| 43 | fi |
| 44 | |
| 45 | ssh $IP4_D1 "$workdir/test-D-stage2.sh $workdir" |
| 46 | if [[ $? -ne 0 ]]; then |
| 47 | echo "Stage 2: DNS query with default suffix failed on node D" >> $testLog |
| 48 | clean_up |
| 49 | exit 1 |
| 50 | fi |
| 51 | |
| 52 | ssh $IP4_D1 "$workdir/test-D-stage3.sh $workdir" |
| 53 | if [[ $? -ne 0 ]]; then |
| 54 | echo "Stage 3: find home router failed on node D" >> $testLog |
| 55 | clean_up |
| 56 | exit 1 |
| 57 | fi |
| 58 | |
| 59 | clean_up |
| 60 | exit 0 |