Eric Newberry | a990778 | 2016-11-30 13:37:14 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | source ../multi-host.conf |
| 3 | echo "host B IP address $IP4_B1" |
| 4 | echo "host C IP address $IP4_C1" |
| 5 | |
| 6 | clean_up() { |
| 7 | r=$(ssh $CTRL_B "sudo killall ndn-traffic-server" 2>&1) |
| 8 | r=$(ssh $CTRL_B "sudo killall nfd" 2>&1) |
| 9 | r=$(ssh $CTRL_C "sudo killall ndn-traffic-server" 2>&1) |
| 10 | r=$(ssh $CTRL_C "sudo killall nfd" 2>&1) |
| 11 | r=$(sudo killall nfd 2>&1) |
| 12 | } |
| 13 | |
| 14 | mkdir -p logs |
| 15 | |
| 16 | # Start NFD on hosts A, B, and C |
| 17 | workdir=$(pwd) |
| 18 | echo "starting nfd on host A..." |
| 19 | sudo nfd > $workdir/logs/nfd.log 2>&1 & |
| 20 | sleep 1 |
| 21 | |
| 22 | echo "starting nfd on host B..." |
| 23 | ssh $CTRL_B "mkdir -p $workdir/logs;\ |
Eric Newberry | 7745c1a | 2017-04-20 00:23:05 -0700 | [diff] [blame^] | 24 | sudo nfd &> $workdir/logs/nfd.log &" |
Eric Newberry | a990778 | 2016-11-30 13:37:14 -0700 | [diff] [blame] | 25 | sleep 1 |
| 26 | |
| 27 | echo "starting nfd on host C..." |
| 28 | ssh $CTRL_C "mkdir -p $workdir/logs;\ |
Eric Newberry | 7745c1a | 2017-04-20 00:23:05 -0700 | [diff] [blame^] | 29 | sudo nfd &> $workdir/logs/nfd.log &" |
Eric Newberry | a990778 | 2016-11-30 13:37:14 -0700 | [diff] [blame] | 30 | sleep 1 |
| 31 | |
Eric Newberry | 7745c1a | 2017-04-20 00:23:05 -0700 | [diff] [blame^] | 32 | # Create faces |
| 33 | nfdc face create udp4://$IP4_B1 |
| 34 | nfdc face create udp4://$IP4_C1 |
| 35 | |
| 36 | # A: Create route for prefix /P toward B with cost 10 |
| 37 | nfdc route add /P udp4://$IP4_B1 cost 10 |
Eric Newberry | a990778 | 2016-11-30 13:37:14 -0700 | [diff] [blame] | 38 | if [[ $? -ne 0 ]] |
| 39 | then |
Eric Newberry | 7745c1a | 2017-04-20 00:23:05 -0700 | [diff] [blame^] | 40 | echo "Failed to create route for /P toward host B" |
| 41 | clean_up |
| 42 | exit 1 |
Eric Newberry | a990778 | 2016-11-30 13:37:14 -0700 | [diff] [blame] | 43 | fi |
| 44 | |
Eric Newberry | 7745c1a | 2017-04-20 00:23:05 -0700 | [diff] [blame^] | 45 | # A: Create route for prefix /P toward C with cost 20 |
| 46 | nfdc route add /P udp4://$IP4_C1 cost 20 |
Eric Newberry | a990778 | 2016-11-30 13:37:14 -0700 | [diff] [blame] | 47 | if [[ $? -ne 0 ]] |
| 48 | then |
Eric Newberry | 7745c1a | 2017-04-20 00:23:05 -0700 | [diff] [blame^] | 49 | echo "Failed to create route for /P toward host C" |
| 50 | clean_up |
| 51 | exit 1 |
Eric Newberry | a990778 | 2016-11-30 13:37:14 -0700 | [diff] [blame] | 52 | fi |
| 53 | |
| 54 | # Get face IDs on A |
Eric Newberry | 7745c1a | 2017-04-20 00:23:05 -0700 | [diff] [blame^] | 55 | faceB=$(nfdc face list | grep "udp4://$IP4_B1" | cut -d" " -f1 | cut -d"=" -f2) |
| 56 | faceC=$(nfdc face list | grep "udp4://$IP4_C1" | cut -d" " -f1 | cut -d"=" -f2) |
Eric Newberry | a990778 | 2016-11-30 13:37:14 -0700 | [diff] [blame] | 57 | |
Eric Newberry | 7745c1a | 2017-04-20 00:23:05 -0700 | [diff] [blame^] | 58 | # B: Start ndn-traffic-server serving "BBBBBBBB" on /P |
Eric Newberry | a990778 | 2016-11-30 13:37:14 -0700 | [diff] [blame] | 59 | echo "starting ndn-traffic-server on host B..." |
| 60 | ssh $CTRL_B "ndn-traffic-server $workdir/NDNTrafficServer-B.conf > $workdir/logs/server.log 2>&1 &" |
| 61 | |
Eric Newberry | 7745c1a | 2017-04-20 00:23:05 -0700 | [diff] [blame^] | 62 | # C: Start ndn-traffic-server serving "CCCCCCCC" on /P |
Eric Newberry | a990778 | 2016-11-30 13:37:14 -0700 | [diff] [blame] | 63 | echo "starting ndn-traffic-server on host C..." |
| 64 | ssh $CTRL_C "ndn-traffic-server $workdir/NDNTrafficServer-C.conf > $workdir/logs/server.log 2>&1 &" |
| 65 | |
Eric Newberry | 7745c1a | 2017-04-20 00:23:05 -0700 | [diff] [blame^] | 66 | # A: Start consumer to enable local fields and express Interest for /P/1 w/o NextHopFaceId |
Eric Newberry | a990778 | 2016-11-30 13:37:14 -0700 | [diff] [blame] | 67 | # Expect Data w/ payload "BBBBBBBB" |
Eric Newberry | 7745c1a | 2017-04-20 00:23:05 -0700 | [diff] [blame^] | 68 | echo "From A, sending Interest for /P/1 (LocalFields=enabled)..." |
Eric Newberry | a990778 | 2016-11-30 13:37:14 -0700 | [diff] [blame] | 69 | output=$(test-nexthopfaceid-consumer /P/1 t -1) |
| 70 | if [[ $output != "BBBBBBBB" ]]; then |
Eric Newberry | 7745c1a | 2017-04-20 00:23:05 -0700 | [diff] [blame^] | 71 | echo "Interest /P/1 not answered with Data containing payload 'BBBBBBBB'" |
| 72 | echo "Actual: $output" |
Eric Newberry | a990778 | 2016-11-30 13:37:14 -0700 | [diff] [blame] | 73 | clean_up |
| 74 | exit 2 |
| 75 | fi |
| 76 | |
Eric Newberry | 7745c1a | 2017-04-20 00:23:05 -0700 | [diff] [blame^] | 77 | # A: Start consumer to enable local fields and express Interest for /P/2 w/ NextHopFaceId=faceB |
Eric Newberry | a990778 | 2016-11-30 13:37:14 -0700 | [diff] [blame] | 78 | # Expect Data w/ payload "BBBBBBBB" |
Eric Newberry | 7745c1a | 2017-04-20 00:23:05 -0700 | [diff] [blame^] | 79 | echo "From A, sending Interest for /P/2 (LocalFields=enabled, NextHopFaceId=faceB)..." |
Eric Newberry | a990778 | 2016-11-30 13:37:14 -0700 | [diff] [blame] | 80 | output=$(test-nexthopfaceid-consumer /P/2 t $faceB) |
| 81 | if [[ $output != "BBBBBBBB" ]]; then |
Eric Newberry | 7745c1a | 2017-04-20 00:23:05 -0700 | [diff] [blame^] | 82 | echo "Interest /P/2 not answered with Data containing payload 'BBBBBBBB'" |
| 83 | echo "Actual: $output" |
Eric Newberry | a990778 | 2016-11-30 13:37:14 -0700 | [diff] [blame] | 84 | clean_up |
| 85 | exit 3 |
| 86 | fi |
| 87 | |
Eric Newberry | 7745c1a | 2017-04-20 00:23:05 -0700 | [diff] [blame^] | 88 | # A: Start consumer to enable local fields and express Interest for /P/3 w/ NextHopFaceId=faceC |
Eric Newberry | a990778 | 2016-11-30 13:37:14 -0700 | [diff] [blame] | 89 | # Expect Data w/ payload "CCCCCCCC" |
Eric Newberry | 7745c1a | 2017-04-20 00:23:05 -0700 | [diff] [blame^] | 90 | echo "From A, sending Interest for /P/3 (LocalFields=enabled, NextHopFaceId=faceC)..." |
Eric Newberry | a990778 | 2016-11-30 13:37:14 -0700 | [diff] [blame] | 91 | output=$(test-nexthopfaceid-consumer /P/3 t $faceC) |
| 92 | if [[ $output != "CCCCCCCC" ]]; then |
Eric Newberry | 7745c1a | 2017-04-20 00:23:05 -0700 | [diff] [blame^] | 93 | echo "Interest /P/3 not answered with Data containing payload 'CCCCCCCC'" |
| 94 | echo "Actual: $output" |
Eric Newberry | a990778 | 2016-11-30 13:37:14 -0700 | [diff] [blame] | 95 | clean_up |
| 96 | exit 4 |
| 97 | fi |
| 98 | |
Eric Newberry | 7745c1a | 2017-04-20 00:23:05 -0700 | [diff] [blame^] | 99 | # A: Start consumer to enable local fields and express Interest for /P/4 w/ NextHopFaceId=null-face |
Eric Newberry | a990778 | 2016-11-30 13:37:14 -0700 | [diff] [blame] | 100 | # Expect either timeout or Nack |
Eric Newberry | 7745c1a | 2017-04-20 00:23:05 -0700 | [diff] [blame^] | 101 | echo "From A, sending Interest for /P/4 (LocalFields=enabled, NextHopFaceId=null-face)..." |
Eric Newberry | a990778 | 2016-11-30 13:37:14 -0700 | [diff] [blame] | 102 | output=$(test-nexthopfaceid-consumer /P/4 t 0) |
| 103 | if [[ $output != "Timeout" && $output != "Nack" ]]; then |
Eric Newberry | 7745c1a | 2017-04-20 00:23:05 -0700 | [diff] [blame^] | 104 | echo "Interest /P/4 was not answered with a Nack and did not time out" |
| 105 | echo "Actual: $output" |
Eric Newberry | a990778 | 2016-11-30 13:37:14 -0700 | [diff] [blame] | 106 | clean_up |
| 107 | exit 5 |
| 108 | fi |
| 109 | |
Eric Newberry | 7745c1a | 2017-04-20 00:23:05 -0700 | [diff] [blame^] | 110 | # A: Start consumer to disable local fields and express Interest for /P/5w/ NextHopFaceId=faceC |
Eric Newberry | a990778 | 2016-11-30 13:37:14 -0700 | [diff] [blame] | 111 | # Expect either timeout or Data w/ payload "BBBBBBBB" |
Eric Newberry | 7745c1a | 2017-04-20 00:23:05 -0700 | [diff] [blame^] | 112 | echo "From A, sending Interest for /P/5 (LocalFields=disabled, NextHopFaceId=faceC)..." |
Eric Newberry | a990778 | 2016-11-30 13:37:14 -0700 | [diff] [blame] | 113 | output=$(test-nexthopfaceid-consumer /P/5 f $faceC) |
| 114 | if [[ $output != "Timeout" && $output != "BBBBBBBB" ]]; then |
Eric Newberry | 7745c1a | 2017-04-20 00:23:05 -0700 | [diff] [blame^] | 115 | echo "Interest /P/5 was not answered with Data containing payload 'BBBBBBBB' and did not time out" |
| 116 | echo "Actual: $output" |
Eric Newberry | a990778 | 2016-11-30 13:37:14 -0700 | [diff] [blame] | 117 | clean_up |
| 118 | exit 6 |
| 119 | fi |
| 120 | |
| 121 | clean_up |
| 122 | echo "NextHopFaceId Test PASSED" |