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