Yi Huang | 4a4566b | 2014-04-26 23:59:48 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | source ../multi-host.conf |
| 3 | if [[ $1 = "udp" ]] |
| 4 | then |
| 5 | a_ipaddr=$IP4_A1 |
| 6 | else |
| 7 | a_ipaddr=$(ip addr show to $IP4_A1 | head -1 | cut -d: -f2 | cut -d' ' -f2) |
| 8 | fi |
| 9 | mkdir -p logs |
| 10 | workdir=$(pwd) |
| 11 | |
| 12 | clean_up() { |
| 13 | r=$(ssh $CTRL_B "sudo killall nfd" 2>&1) |
| 14 | r=$(ssh $CTRL_C "sudo killall nfd" 2>&1) |
| 15 | r=$(sudo killall nfd 2>&1) |
| 16 | } |
| 17 | |
| 18 | # start nfd and ndn-traffic-server on B and C |
| 19 | ssh $CTRL_B "mkdir -p $workdir/logs;\ |
| 20 | sudo nfd &> $workdir/logs/nfd.log &\ |
| 21 | sleep 3;\ |
Yi Huang | 53fa871 | 2014-06-10 20:14:26 -0700 | [diff] [blame] | 22 | nrd &> $workdir/logs/nrd.log &\ |
| 23 | sleep 3;\ |
Yi Huang | 4a4566b | 2014-04-26 23:59:48 -0700 | [diff] [blame] | 24 | ndn-traffic-server $workdir/NDNTrafficServerB.conf &> $workdir/logs/server.log &" |
| 25 | ssh $CTRL_C "mkdir -p $workdir/logs;\ |
| 26 | sudo nfd &> $workdir/logs/nfd.log &\ |
| 27 | sleep 3;\ |
Yi Huang | 53fa871 | 2014-06-10 20:14:26 -0700 | [diff] [blame] | 28 | nrd &> $workdir/logs/nrd.log &\ |
| 29 | sleep 3;\ |
Yi Huang | 4a4566b | 2014-04-26 23:59:48 -0700 | [diff] [blame] | 30 | ndn-traffic-server $workdir/NDNTrafficServerC.conf &> $workdir/logs/server.log &" |
| 31 | |
| 32 | # start nfd and add nexthop of ndn:/test-mcast to UDP multicast face |
| 33 | sudo nfd &> $workdir/logs/nfd.log & |
| 34 | sleep 3 |
Yi Huang | 53fa871 | 2014-06-10 20:14:26 -0700 | [diff] [blame] | 35 | nrd &> $workdir/logs/nrd.log & |
| 36 | sleep 3 |
Yi Huang | 4a4566b | 2014-04-26 23:59:48 -0700 | [diff] [blame] | 37 | faceid=$(nfd-status -f | grep $a_ipaddr | grep -Po 'faceid=.*? ' | sed 's/faceid=//' | sed 's/ //') |
| 38 | nfdc add-nexthop ndn:/test-mcast $faceid |
| 39 | |
Eric Newberry | d4ed622 | 2015-06-10 14:12:42 -0700 | [diff] [blame^] | 40 | # use ndnpeek to test multicast feature |
| 41 | response=$(ndnpeek -p ndn:/test-mcast/B/1) |
Yi Huang | 4a4566b | 2014-04-26 23:59:48 -0700 | [diff] [blame] | 42 | if [[ $response != 'BBBBBBBB' ]] |
| 43 | then |
| 44 | echo "FAIL: Expected data for ndn:/test-mcast/B/1 is: 'BBBBBBBB', Actual: '$response'" |
| 45 | clean_up |
| 46 | exit 1 |
| 47 | fi |
Eric Newberry | d4ed622 | 2015-06-10 14:12:42 -0700 | [diff] [blame^] | 48 | response=$(ndnpeek -p ndn:/test-mcast/C/1) |
Yi Huang | 4a4566b | 2014-04-26 23:59:48 -0700 | [diff] [blame] | 49 | if [[ $response != 'CCCCCCCC' ]] |
| 50 | then |
| 51 | echo "FAIL: Expected data for ndn:/test-mcast/C/1 is: 'CCCCCCCC', Actual: '$response'" |
| 52 | clean_up |
| 53 | exit 2 |
| 54 | fi |
Eric Newberry | d4ed622 | 2015-06-10 14:12:42 -0700 | [diff] [blame^] | 55 | response=$(ndnpeek -p ndn:/test-mcast/Z/1) |
Yi Huang | 4a4566b | 2014-04-26 23:59:48 -0700 | [diff] [blame] | 56 | if [[ ( $response != 'ZZZZZZZB' ) && ( $response != 'ZZZZZZZC' ) ]] |
| 57 | then |
| 58 | echo "FAIL: Expected data for ndn:/test-mcast/Z/1 is: 'ZZZZZZZB' or 'ZZZZZZZC', Actual: '$response'" |
| 59 | clean_up |
| 60 | exit 3 |
| 61 | fi |
| 62 | |
| 63 | # kill ndn-traffic-server on host B |
| 64 | ssh $CTRL_B "sudo killall ndn-traffic-server" |
| 65 | |
Eric Newberry | d4ed622 | 2015-06-10 14:12:42 -0700 | [diff] [blame^] | 66 | # use ndnpeek to request ndn:/testmcast/Z/2 |
| 67 | response=$(ndnpeek -p ndn:/test-mcast/Z/2) |
Yi Huang | 4a4566b | 2014-04-26 23:59:48 -0700 | [diff] [blame] | 68 | if [[ $response != 'ZZZZZZZC' ]] |
| 69 | then |
| 70 | echo "FAIL: Expected data for ndn:/test-mcast/Z/2 is: 'ZZZZZZZC', Actual: '$response'" |
| 71 | clean_up |
| 72 | exit 4 |
| 73 | fi |
| 74 | |
| 75 | # clean up |
| 76 | clean_up |
| 77 | echo "Multicast Test PASSED" |