blob: 9970eb86a54a212394abff504814993c98ca4425 [file] [log] [blame]
Junxiao Shia59f2072014-04-27 20:52:25 -07001#!/usr/bin/env bash
2source ../multi-host.conf
3mkdir -p logs
4workdir=$(pwd)
5
6clean_up() {
7 r=$(killall nc 2>&1)
8 r=$(ssh $CTRL_B "sudo killall nfd" 2>&1)
9}
10
11# start NFD on B
Yi Huang53fa8712014-06-10 20:14:26 -070012ssh $CTRL_B "sudo nfd > $workdir/logs/nfd.log 2>&1 &\
Yi Huang53fa8712014-06-10 20:14:26 -070013 sleep 2"
Junxiao Shia59f2072014-04-27 20:52:25 -070014
15# start netcat on A
16nc -vul 6363 > $workdir/logs/netcat.log 2>&1 &
17sleep 1
18
19# add nexthop of ndn:/ and ndn:/localhost/test-out to hostA
20if ! status=$(ssh $CTRL_B "source $workdir/out-B.sh udp4://$IP4_A1" 2>&1)
21then
22 echo "Error message from host B:"
23 echo "$status"
24 clean_up
25 exit 4
26fi
27
Eric Newberryd4ed6222015-06-10 14:12:42 -070028# On B, use ndnpeek to request names that starts with ndn:/localhost
29r=$(ssh $CTRL_B "ndnpeek -p ndn:/localhost/test-out/B/c39b6fed4ce4464ea136062f80002c7c;\
30 ndnpeek -p ndn:/localhost/C/c39b6fed4ce4464ea136062f80002c7c;\
31 ndnpeek -p ndn:/ref-out/D/3b5fe3f184ff48adb3523180dee50555")
Junxiao Shia59f2072014-04-27 20:52:25 -070032sleep 2
33
34# stop netcat and examine netcat.log
35ssh $CTRL_B "sudo killall nfd"
36output=$(killall nc)
37sleep 1
38output=$(grep "c39b6fed4ce4464ea136062f80002c7c" $workdir/logs/netcat.log)
39if [[ -n $output ]]
40then
41 echo "FAIL: /localhost Interest reaches remote host."
42 clean_up
43 exit 7
44fi
45output=$(grep "3b5fe3f184ff48adb3523180dee50555" $workdir/logs/netcat.log)
46if [[ -z $output ]]
47then
48 echo "FAIL: non-/localhost Interest does not reach remote host."
49 clean_up
50 exit 9
51fi
52
53# clean up
54clean_up
55echo "localhost outgoing test PASSED"