blob: 756ffd751e2214ff311fe50fa1924fff79d70431 [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() {
Yi Huang53fa8712014-06-10 20:14:26 -07007 r=$(rm $HOME/.ndn/client.conf 2>&1)
Junxiao Shia59f2072014-04-27 20:52:25 -07008 r=$(killall socat 2>&1)
9 r=$(ssh $CTRL_B "killall ndn-traffic-server;\
10 sudo killall nfd" 2>&1)
11}
12
13# start nfd and ndn-traffic-server on hostB
14ssh $CTRL_B "mkdir -p $workdir/logs;\
15 sudo nfd &> $workdir/logs/nfd.log &\
16 sleep 2;\
Yi Huang53fa8712014-06-10 20:14:26 -070017 nrd &> $workdir/logs/nrd.log &\
18 sleep 2;\
Junxiao Shia59f2072014-04-27 20:52:25 -070019 ndn-traffic-server $workdir/NDNTrafficServer.conf &> $workdir/logs/server.log &"
20sleep 2
21
22# set up socat on A
Junxiao Shia59f2072014-04-27 20:52:25 -070023socat -v UNIX-LISTEN:/tmp/localhost-test-B.sock,fork TCP:$IP4_B1:6363 &> logs/socat.log &
Hila Ben Abrahamd5033e92015-01-15 20:30:55 -060024echo "transport=unix:///tmp/localhost-test-B.sock" > $HOME/.ndn/client.conf
Junxiao Shia59f2072014-04-27 20:52:25 -070025sleep 1
26
27# send interest
28response=$(ndn-tlv-peek -p ndn:/localhost/test-in/A 2>&1)
29if [[ ! -z $response ]]
30then
31 echo "FAIL: Expected no data come back for ndn:/localhost/test-in/A, Actual: '$response'"
32 clean_up
33 exit 2
34fi
35
36# copy back the server log
37ssh $CTRL_B "killall ndn-traffic-server"
38scp $CTRL_B:$workdir/logs/server.log $workdir/logs/
39
40# analyze server log
41output=$(grep "Total Interests Received" $workdir/logs/server.log | head -1 | cut -d= -f2 | cut -d' ' -f2)
Eric Newberryafb5c5f2015-06-09 08:57:58 -070042if [[ $output != 0?(.+(0)) ]]
Junxiao Shia59f2072014-04-27 20:52:25 -070043then
44 echo "Expected no Interests received on host B. Actual: $output"
45 echo "For more information, please examine the log at \"$(pwd)/logs\""
46 clean_up
47 exit 3
48fi
49
50clean_up
51
52echo "localhost incoming test PASSED"