Junxiao Shi | a59f207 | 2014-04-27 20:52:25 -0700 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | source ../multi-host.conf |
Eric Newberry | 6fc8822 | 2015-06-19 10:43:24 -0700 | [diff] [blame] | 3 | mkdir -p logs/in |
Junxiao Shi | a59f207 | 2014-04-27 20:52:25 -0700 | [diff] [blame] | 4 | workdir=$(pwd) |
| 5 | |
| 6 | clean_up() { |
Eric Newberry | 19a6c5a | 2015-07-05 11:19:49 -0700 | [diff] [blame] | 7 | rm -f $HOME/.ndn/client.conf |
| 8 | killall socat |
| 9 | rm -f /tmp/localhost-test-B.sock |
| 10 | ssh $CTRL_B "killall ndn-traffic-server;\ |
| 11 | sudo killall nfd" |
Junxiao Shi | a59f207 | 2014-04-27 20:52:25 -0700 | [diff] [blame] | 12 | } |
| 13 | |
| 14 | # start nfd and ndn-traffic-server on hostB |
Eric Newberry | 6fc8822 | 2015-06-19 10:43:24 -0700 | [diff] [blame] | 15 | ssh $CTRL_B "mkdir -p $workdir/logs/in;\ |
| 16 | sudo nfd &> $workdir/logs/in/nfd.log &\ |
Junxiao Shi | a59f207 | 2014-04-27 20:52:25 -0700 | [diff] [blame] | 17 | sleep 2;\ |
Eric Newberry | 6fc8822 | 2015-06-19 10:43:24 -0700 | [diff] [blame] | 18 | ndn-traffic-server $workdir/NDNTrafficServer.conf &> $workdir/logs/in/server.log &" |
Junxiao Shi | a59f207 | 2014-04-27 20:52:25 -0700 | [diff] [blame] | 19 | sleep 2 |
| 20 | |
| 21 | # set up socat on A |
Eric Newberry | 6fc8822 | 2015-06-19 10:43:24 -0700 | [diff] [blame] | 22 | socat -v UNIX-LISTEN:/tmp/localhost-test-B.sock,fork TCP:$IP4_B1:6363 &> logs/in/socat.log & |
Hila Ben Abraham | d5033e9 | 2015-01-15 20:30:55 -0600 | [diff] [blame] | 23 | echo "transport=unix:///tmp/localhost-test-B.sock" > $HOME/.ndn/client.conf |
Junxiao Shi | a59f207 | 2014-04-27 20:52:25 -0700 | [diff] [blame] | 24 | sleep 1 |
| 25 | |
| 26 | # send interest |
Eric Newberry | d4ed622 | 2015-06-10 14:12:42 -0700 | [diff] [blame] | 27 | response=$(ndnpeek -p ndn:/localhost/test-in/A 2>&1) |
Eric Newberry | 19a6c5a | 2015-07-05 11:19:49 -0700 | [diff] [blame] | 28 | if [[ -n $response ]] |
Junxiao Shi | a59f207 | 2014-04-27 20:52:25 -0700 | [diff] [blame] | 29 | then |
| 30 | echo "FAIL: Expected no data come back for ndn:/localhost/test-in/A, Actual: '$response'" |
| 31 | clean_up |
| 32 | exit 2 |
| 33 | fi |
| 34 | |
| 35 | # copy back the server log |
| 36 | ssh $CTRL_B "killall ndn-traffic-server" |
Eric Newberry | 6fc8822 | 2015-06-19 10:43:24 -0700 | [diff] [blame] | 37 | scp $CTRL_B:$workdir/logs/in/server.log $workdir/logs/in |
Junxiao Shi | a59f207 | 2014-04-27 20:52:25 -0700 | [diff] [blame] | 38 | |
| 39 | # analyze server log |
Eric Newberry | 6fc8822 | 2015-06-19 10:43:24 -0700 | [diff] [blame] | 40 | output=$(grep "Total Interests Received" $workdir/logs/in/server.log | head -1 | cut -d= -f2 | cut -d' ' -f2) |
Eric Newberry | afb5c5f | 2015-06-09 08:57:58 -0700 | [diff] [blame] | 41 | if [[ $output != 0?(.+(0)) ]] |
Junxiao Shi | a59f207 | 2014-04-27 20:52:25 -0700 | [diff] [blame] | 42 | then |
| 43 | echo "Expected no Interests received on host B. Actual: $output" |
Eric Newberry | 6fc8822 | 2015-06-19 10:43:24 -0700 | [diff] [blame] | 44 | echo "For more information, please examine the log at \"$(pwd)/logs/in\"" |
Junxiao Shi | a59f207 | 2014-04-27 20:52:25 -0700 | [diff] [blame] | 45 | clean_up |
| 46 | exit 3 |
| 47 | fi |
| 48 | |
| 49 | clean_up |
| 50 | |
| 51 | echo "localhost incoming test PASSED" |