blob: 7babc24c9503f254bc6802708e27b4a1db7e57cc [file] [log] [blame]
#!/usr/bin/env bash
source ../multi-host.conf
mkdir -p logs
workdir=$(pwd)
clean_up() {
r=$(rm $HOME/.ndn/client.conf 2>&1)
r=$(killall socat 2>&1)
r=$(ssh $CTRL_B "killall ndn-traffic-server;\
sudo killall nfd" 2>&1)
}
# start nfd and ndn-traffic-server on hostB
ssh $CTRL_B "mkdir -p $workdir/logs;\
sudo nfd &> $workdir/logs/nfd.log &\
sleep 2;\
ndn-traffic-server $workdir/NDNTrafficServer.conf &> $workdir/logs/server.log &"
sleep 2
# set up socat on A
socat -v UNIX-LISTEN:/tmp/localhost-test-B.sock,fork TCP:$IP4_B1:6363 &> logs/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 [[ ! -z $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/server.log $workdir/logs/
# analyze server log
output=$(grep "Total Interests Received" $workdir/logs/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\""
clean_up
exit 3
fi
clean_up
echo "localhost incoming test PASSED"