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