| #!/usr/bin/env bash |
| source ../multi-host.conf |
| mkdir -p logs/out |
| workdir=$(pwd) |
| |
| clean_up() { |
| r=$(killall nc 2>&1) |
| r=$(ssh $CTRL_B "sudo killall nfd" 2>&1) |
| } |
| |
| ssh $CTRL_B "mkdir -p $workdir/logs/out" |
| |
| # start NFD on B |
| ssh $CTRL_B "sudo nfd > $workdir/logs/out/nfd.log 2>&1 &\ |
| sleep 2" |
| |
| # start netcat on A |
| nc -vul 6363 > $workdir/logs/out/netcat.log 2>&1 & |
| sleep 1 |
| |
| # add route to hostA for ndn:/ and ndn:/localhost/test-out |
| if ! status=$(ssh $CTRL_B "source $workdir/out-B.sh udp4://$IP4_A1" 2>&1) |
| then |
| echo "Error message from host B:" |
| echo "$status" |
| clean_up |
| exit 4 |
| fi |
| |
| # On B, use ndnpeek to request names that starts with ndn:/localhost |
| r=$(ssh $CTRL_B "ndnpeek -p ndn:/localhost/test-out/B/c39b6fed4ce4464ea136062f80002c7c;\ |
| ndnpeek -p ndn:/localhost/C/c39b6fed4ce4464ea136062f80002c7c;\ |
| ndnpeek -p ndn:/ref-out/D/3b5fe3f184ff48adb3523180dee50555") |
| sleep 2 |
| |
| # stop netcat and examine netcat.log |
| ssh $CTRL_B "sudo killall nfd" |
| output=$(killall nc) |
| sleep 1 |
| output=$(grep "c39b6fed4ce4464ea136062f80002c7c" $workdir/logs/out/netcat.log) |
| if [[ -n $output ]] |
| then |
| echo "FAIL: /localhost Interest reaches remote host." |
| clean_up |
| exit 7 |
| fi |
| output=$(grep "3b5fe3f184ff48adb3523180dee50555" $workdir/logs/out/netcat.log) |
| if [[ -z $output ]] |
| then |
| echo "FAIL: non-/localhost Interest does not reach remote host." |
| clean_up |
| exit 9 |
| fi |
| |
| # clean up |
| clean_up |
| echo "localhost outgoing test PASSED" |