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;\ |
| 24 | sudo nfd &> $workdir/logs/nfd.log &" |
| 25 | sleep 1 |
| 26 | |
| 27 | echo "starting nfd on host C..." |
| 28 | ssh $CTRL_C "mkdir -p $workdir/logs;\ |
| 29 | sudo nfd &> $workdir/logs/nfd.log &" |
| 30 | sleep 1 |
| 31 | |
| 32 | # A: Create route for prefix ndn:/P toward B with cost 10 |
| 33 | nfdc register -c 10 ndn:/P udp4://$IP4_B1 |
| 34 | if [[ $? -ne 0 ]] |
| 35 | then |
| 36 | echo "Failed to create route for ndn:/P toward host B" |
| 37 | clean_up |
| 38 | exit 1 |
| 39 | fi |
| 40 | |
| 41 | # A: Create route for prefix ndn:/P toward C with cost 20 |
| 42 | nfdc register -c 20 ndn:/P udp4://$IP4_C1 |
| 43 | if [[ $? -ne 0 ]] |
| 44 | then |
| 45 | echo "Failed to create route for ndn:/P toward host C" |
| 46 | clean_up |
| 47 | exit 1 |
| 48 | fi |
| 49 | |
| 50 | # Get face IDs on A |
| 51 | faceB=$(nfdc face list | grep "udp4://$IP4_B1" | cut -d" " -f3 | cut -d"=" -f2) |
| 52 | faceC=$(nfdc face list | grep "udp4://$IP4_C1" | cut -d" " -f3 | cut -d"=" -f2) |
| 53 | |
| 54 | # B: Start ndn-traffic-server serving "BBBBBBBB" on ndn:/P |
| 55 | echo "starting ndn-traffic-server on host B..." |
| 56 | ssh $CTRL_B "ndn-traffic-server $workdir/NDNTrafficServer-B.conf > $workdir/logs/server.log 2>&1 &" |
| 57 | |
| 58 | # C: Start ndn-traffic-server serving "CCCCCCCC" on ndn:/P |
| 59 | echo "starting ndn-traffic-server on host C..." |
| 60 | ssh $CTRL_C "ndn-traffic-server $workdir/NDNTrafficServer-C.conf > $workdir/logs/server.log 2>&1 &" |
| 61 | |
| 62 | # A: Start consumer to enable local fields and express Interest for ndn:/P/1 w/o NextHopFaceId |
| 63 | # Expect Data w/ payload "BBBBBBBB" |
| 64 | echo "From A, sending Interest for ndn:/P/1 (LocalFields=enabled)..." |
| 65 | output=$(test-nexthopfaceid-consumer /P/1 t -1) |
| 66 | if [[ $output != "BBBBBBBB" ]]; then |
| 67 | echo "Interest ndn:/P/1 not answered with Data containing payload 'BBBBBBBB'" |
| 68 | clean_up |
| 69 | exit 2 |
| 70 | fi |
| 71 | |
| 72 | # A: Start consumer to enable local fields and express Interest for ndn:/P/2 w/ NextHopFaceId=faceB |
| 73 | # Expect Data w/ payload "BBBBBBBB" |
| 74 | echo "From A, sending Interest for ndn:/P/2 (LocalFields=enabled, NextHopFaceId=faceB)..." |
| 75 | output=$(test-nexthopfaceid-consumer /P/2 t $faceB) |
| 76 | if [[ $output != "BBBBBBBB" ]]; then |
| 77 | echo "Interest ndn:/P/2 not answered with Data containing payload 'BBBBBBBB'" |
| 78 | clean_up |
| 79 | exit 3 |
| 80 | fi |
| 81 | |
| 82 | # A: Start consumer to enable local fields and express Interest for ndn:/P/3 w/ NextHopFaceId=faceC |
| 83 | # Expect Data w/ payload "CCCCCCCC" |
| 84 | echo "From A, sending Interest for ndn:/P/3 (LocalFields=enabled, NextHopFaceId=faceC)..." |
| 85 | output=$(test-nexthopfaceid-consumer /P/3 t $faceC) |
| 86 | if [[ $output != "CCCCCCCC" ]]; then |
| 87 | echo "Interest ndn:/P/3 not answered with Data containing payload 'CCCCCCCC'" |
| 88 | clean_up |
| 89 | exit 4 |
| 90 | fi |
| 91 | |
| 92 | # A: Start consumer to enable local fields and express Interest for ndn:/P/4 w/ NextHopFaceId=null-face |
| 93 | # Expect either timeout or Nack |
| 94 | echo "From A, sending Interest for ndn:/P/4 (LocalFields=enabled, NextHopFaceId=null-face)..." |
| 95 | output=$(test-nexthopfaceid-consumer /P/4 t 0) |
| 96 | if [[ $output != "Timeout" && $output != "Nack" ]]; then |
| 97 | echo "Interest ndn:/P/4 was not answered with a Nack and did not time out" |
| 98 | clean_up |
| 99 | exit 5 |
| 100 | fi |
| 101 | |
| 102 | # A: Start consumer to disable local fields and express Interest for ndn:/P/5w/ NextHopFaceId=faceC |
| 103 | # Expect either timeout or Data w/ payload "BBBBBBBB" |
| 104 | echo "From A, sending Interest for ndn:/P/5 (LocalFields=disabled, NextHopFaceId=faceC)..." |
| 105 | output=$(test-nexthopfaceid-consumer /P/5 f $faceC) |
| 106 | if [[ $output != "Timeout" && $output != "BBBBBBBB" ]]; then |
| 107 | echo "Interest ndn:/P/5 was not answered with Data containing payload 'BBBBBBBB' and did not time out" |
| 108 | clean_up |
| 109 | exit 6 |
| 110 | fi |
| 111 | |
| 112 | clean_up |
| 113 | echo "NextHopFaceId Test PASSED" |