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 | |
Hila Ben Abraham | 4c850f8 | 2014-06-22 20:24:34 -0500 | [diff] [blame] | 21 | ndn-autoconfig-server udp4://10.63.18.1 & |
| 22 | |
| 23 | # set record for _ndn._udp.autoconfig-test.named-data.net => 10.63.18.2 |
| 24 | # set record for _ndn._udp.autoconfig-test.tmp._homehub._autoconf.named-data.net => 10.63.18.3 |
| 25 | sudo cp autoconfig-test.named-data.net.db /etc/bind/ |
| 26 | sudo cp named-data.net.db /etc/bind |
| 27 | |
| 28 | # configure local dns server |
| 29 | sudo cp named.conf.local /etc/bind |
| 30 | sudo service bind9 restart |
| 31 | |
| 32 | sleep 2 |
| 33 | |
Hila Ben Abraham | d5033e9 | 2015-01-15 20:30:55 -0600 | [diff] [blame] | 34 | ssh $CTRL_B "$workdir/test-B-stage1.sh $workdir" |
Hila Ben Abraham | 4c850f8 | 2014-06-22 20:24:34 -0500 | [diff] [blame] | 35 | if [[ $? -ne 0 ]]; then |
| 36 | echo "Stage 1: multicast discovery failed on node B" >> $testLog |
| 37 | clean_up |
| 38 | exit 1 |
| 39 | fi |
| 40 | |
Hila Ben Abraham | d5033e9 | 2015-01-15 20:30:55 -0600 | [diff] [blame] | 41 | ssh $CTRL_D "$workdir/test-D-stage2.sh $workdir" |
Hila Ben Abraham | 4c850f8 | 2014-06-22 20:24:34 -0500 | [diff] [blame] | 42 | if [[ $? -ne 0 ]]; then |
| 43 | echo "Stage 2: DNS query with default suffix failed on node D" >> $testLog |
| 44 | clean_up |
| 45 | exit 1 |
| 46 | fi |
| 47 | |
Hila Ben Abraham | d5033e9 | 2015-01-15 20:30:55 -0600 | [diff] [blame] | 48 | ssh $CTRL_D "$workdir/test-D-stage3.sh $workdir" |
Hila Ben Abraham | 4c850f8 | 2014-06-22 20:24:34 -0500 | [diff] [blame] | 49 | if [[ $? -ne 0 ]]; then |
| 50 | echo "Stage 3: find home router failed on node D" >> $testLog |
| 51 | clean_up |
| 52 | exit 1 |
| 53 | fi |
| 54 | |
| 55 | clean_up |
| 56 | exit 0 |