blob: c26a0aca1299a30388eedd86f9e2cf60f2026812 [file] [log] [blame]
Junxiao Shia59f2072014-04-27 20:52:25 -07001#!/usr/bin/env bash
2source ../multi-host.conf
Eric Newberry6fc88222015-06-19 10:43:24 -07003mkdir -p logs/out
Junxiao Shia59f2072014-04-27 20:52:25 -07004workdir=$(pwd)
5
6clean_up() {
7 r=$(killall nc 2>&1)
8 r=$(ssh $CTRL_B "sudo killall nfd" 2>&1)
9}
10
Eric Newberry6fc88222015-06-19 10:43:24 -070011ssh $CTRL_B "mkdir -p $workdir/logs/out"
12
Junxiao Shia59f2072014-04-27 20:52:25 -070013# start NFD on B
Eric Newberry6fc88222015-06-19 10:43:24 -070014ssh $CTRL_B "sudo nfd > $workdir/logs/out/nfd.log 2>&1 &\
Yi Huang53fa8712014-06-10 20:14:26 -070015 sleep 2"
Junxiao Shia59f2072014-04-27 20:52:25 -070016
17# start netcat on A
Eric Newberry6fc88222015-06-19 10:43:24 -070018nc -vul 6363 > $workdir/logs/out/netcat.log 2>&1 &
Junxiao Shia59f2072014-04-27 20:52:25 -070019sleep 1
20
Eric Newberry7745c1a2017-04-20 00:23:05 -070021# add route to hostA for ndn:/ and ndn:/localhost/test-out
Junxiao Shia59f2072014-04-27 20:52:25 -070022if ! status=$(ssh $CTRL_B "source $workdir/out-B.sh udp4://$IP4_A1" 2>&1)
23then
24 echo "Error message from host B:"
25 echo "$status"
26 clean_up
27 exit 4
28fi
29
Eric Newberryd4ed6222015-06-10 14:12:42 -070030# On B, use ndnpeek to request names that starts with ndn:/localhost
31r=$(ssh $CTRL_B "ndnpeek -p ndn:/localhost/test-out/B/c39b6fed4ce4464ea136062f80002c7c;\
32 ndnpeek -p ndn:/localhost/C/c39b6fed4ce4464ea136062f80002c7c;\
33 ndnpeek -p ndn:/ref-out/D/3b5fe3f184ff48adb3523180dee50555")
Junxiao Shia59f2072014-04-27 20:52:25 -070034sleep 2
35
36# stop netcat and examine netcat.log
37ssh $CTRL_B "sudo killall nfd"
38output=$(killall nc)
39sleep 1
Eric Newberry6fc88222015-06-19 10:43:24 -070040output=$(grep "c39b6fed4ce4464ea136062f80002c7c" $workdir/logs/out/netcat.log)
Junxiao Shia59f2072014-04-27 20:52:25 -070041if [[ -n $output ]]
42then
43 echo "FAIL: /localhost Interest reaches remote host."
44 clean_up
45 exit 7
46fi
Eric Newberry6fc88222015-06-19 10:43:24 -070047output=$(grep "3b5fe3f184ff48adb3523180dee50555" $workdir/logs/out/netcat.log)
Junxiao Shia59f2072014-04-27 20:52:25 -070048if [[ -z $output ]]
49then
50 echo "FAIL: non-/localhost Interest does not reach remote host."
51 clean_up
52 exit 9
53fi
54
55# clean up
56clean_up
57echo "localhost outgoing test PASSED"