Add hub discovery test scenario
Change-Id: I6b99fab75cbd2d615f0a72560ee8fae0ea1a378e
refs: #1444
diff --git a/test_hub_discovery/hub-discovery-test.sh b/test_hub_discovery/hub-discovery-test.sh
new file mode 100755
index 0000000..5d50070
--- /dev/null
+++ b/test_hub_discovery/hub-discovery-test.sh
@@ -0,0 +1,60 @@
+#!/usr/bin/env bash
+source ../multi-host.conf
+workdir=$(pwd)
+mkdir -p $workdir/logs
+testCase=$1
+testLog=$workdir/logs/hub_discovery.log
+
+# clean up - kill nfd
+clean_up() {
+ r=$(sudo killall nfd 2>&1)
+ sleep 2
+
+}
+
+echo "TEST STARTED" > $testLog
+
+# start nfd on localhost
+sudo nfd &> $workdir/logs/nfd.log &
+sleep 2
+
+# start nrd on localhost
+nrd &> $workdir/logs/nrd.log &
+sleep 2
+
+ndn-autoconfig-server udp4://10.63.18.1 &
+
+# set record for _ndn._udp.autoconfig-test.named-data.net => 10.63.18.2
+# set record for _ndn._udp.autoconfig-test.tmp._homehub._autoconf.named-data.net => 10.63.18.3
+sudo cp autoconfig-test.named-data.net.db /etc/bind/
+sudo cp named-data.net.db /etc/bind
+
+# configure local dns server
+sudo cp named.conf.local /etc/bind
+sudo service bind9 restart
+
+sleep 2
+
+ssh $IP4_B1 "$workdir/test-B-stage1.sh $workdir"
+if [[ $? -ne 0 ]]; then
+ echo "Stage 1: multicast discovery failed on node B" >> $testLog
+ clean_up
+ exit 1
+fi
+
+ssh $IP4_D1 "$workdir/test-D-stage2.sh $workdir"
+if [[ $? -ne 0 ]]; then
+ echo "Stage 2: DNS query with default suffix failed on node D" >> $testLog
+ clean_up
+exit 1
+fi
+
+ssh $IP4_D1 "$workdir/test-D-stage3.sh $workdir"
+if [[ $? -ne 0 ]]; then
+ echo "Stage 3: find home router failed on node D" >> $testLog
+ clean_up
+exit 1
+fi
+
+clean_up
+exit 0