blob: 5c3c149d213f2d038266f4cfce3f41ca64c4b65a [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
12ssh $CTRL_B "sudo nfd > $workdir/logs/nfd.log 2>&1 &"
13
14# start netcat on A
15nc -vul 6363 > $workdir/logs/netcat.log 2>&1 &
16sleep 1
17
18# add nexthop of ndn:/ and ndn:/localhost/test-out to hostA
19if ! status=$(ssh $CTRL_B "source $workdir/out-B.sh udp4://$IP4_A1" 2>&1)
20then
21 echo "Error message from host B:"
22 echo "$status"
23 clean_up
24 exit 4
25fi
26
27# On B, use ndn-tlv-peek to request names that starts with ndn:/localhost
28r=$(ssh $CTRL_B "ndn-tlv-peek -p ndn:/localhost/test-out/B/c39b6fed4ce4464ea136062f80002c7c;\
29 ndn-tlv-peek -p ndn:/localhost/C/c39b6fed4ce4464ea136062f80002c7c;\
30 ndn-tlv-peek -p ndn:/ref-out/D/3b5fe3f184ff48adb3523180dee50555")
31sleep 2
32
33# stop netcat and examine netcat.log
34ssh $CTRL_B "sudo killall nfd"
35output=$(killall nc)
36sleep 1
37output=$(grep "c39b6fed4ce4464ea136062f80002c7c" $workdir/logs/netcat.log)
38if [[ -n $output ]]
39then
40 echo "FAIL: /localhost Interest reaches remote host."
41 clean_up
42 exit 7
43fi
44output=$(grep "3b5fe3f184ff48adb3523180dee50555" $workdir/logs/netcat.log)
45if [[ -z $output ]]
46then
47 echo "FAIL: non-/localhost Interest does not reach remote host."
48 clean_up
49 exit 9
50fi
51
52# clean up
53clean_up
54echo "localhost outgoing test PASSED"