| #!/usr/bin/env bash |
| source ../multi-host.conf |
| mkdir -p logs/in |
| workdir=$(pwd) |
| |
| clean_up() { |
| rm -f $HOME/.ndn/client.conf |
| killall socat |
| rm -f /tmp/localhost-test-B.sock |
| ssh $CTRL_B "killall ndn-traffic-server;\ |
| sudo killall nfd" |
| } |
| |
| # start nfd and ndn-traffic-server on hostB |
| ssh $CTRL_B "mkdir -p $workdir/logs/in;\ |
| sudo nfd &> $workdir/logs/in/nfd.log &\ |
| sleep 2;\ |
| ndn-traffic-server $workdir/NDNTrafficServer.conf &> $workdir/logs/in/server.log &" |
| sleep 2 |
| |
| # set up socat on A |
| socat -v UNIX-LISTEN:/tmp/localhost-test-B.sock,fork TCP:$IP4_B1:6363 &> logs/in/socat.log & |
| echo "transport=unix:///tmp/localhost-test-B.sock" > $HOME/.ndn/client.conf |
| sleep 1 |
| |
| # send interest |
| response=$(ndnpeek -p ndn:/localhost/test-in/A 2>&1) |
| if [[ -n $response ]] |
| then |
| echo "FAIL: Expected no data come back for ndn:/localhost/test-in/A, Actual: '$response'" |
| clean_up |
| exit 2 |
| fi |
| |
| # copy back the server log |
| ssh $CTRL_B "killall ndn-traffic-server" |
| scp $CTRL_B:$workdir/logs/in/server.log $workdir/logs/in |
| |
| # analyze server log |
| output=$(grep "Total Interests Received" $workdir/logs/in/server.log | head -1 | cut -d= -f2 | cut -d' ' -f2) |
| if [[ $output != 0?(.+(0)) ]] |
| then |
| echo "Expected no Interests received on host B. Actual: $output" |
| echo "For more information, please examine the log at \"$(pwd)/logs/in\"" |
| clean_up |
| exit 3 |
| fi |
| |
| clean_up |
| |
| echo "localhost incoming test PASSED" |