| #!/bin/bash |
| source ../multi-host.conf |
| |
| clean_up() { |
| r=$(sudo killall ndn-traffic-server 2>&1) |
| r=$(sudo killall ndn-traffic 2>&1) |
| r=$(sudo killall nfd 2>&1) |
| } |
| |
| # A: Start NFD |
| workdir=$(pwd) |
| echo "Starting nfd on A..." |
| mkdir -p $workdir/logs; sudo nfd &> $workdir/logs/nfd.log & |
| sleep 1 |
| |
| # A: Start instances of ndn-traffic-server |
| echo "Starting Traffic Server 1 (Prefix=/, FreshnessPeriod=10ms, Data=Z)..." |
| ndn-traffic-server $workdir/test-traffic-server-1.conf &> $workdir/logs/server-1.log & |
| sleep 0.1 |
| echo "Starting Traffic Server 2 (Prefix=/A, FreshnessPeriod=10ms, Data=A)..." |
| ndn-traffic-server $workdir/test-traffic-server-2.conf &> $workdir/logs/server-2.log & |
| sleep 0.1 |
| echo "Starting Traffic Server 3 (Prefix=/A/B/C, FreshnessPeriod=10ms, Data=C)..." |
| ndn-traffic-server $workdir/test-traffic-server-3.conf &> $workdir/logs/server-3.log & |
| sleep 0.1 |
| echo "Starting Traffic Server 4 (Prefix=/D/E, FreshnessPeriod=10ms, Data=E)..." |
| ndn-traffic-server $workdir/test-traffic-server-4.conf &> $workdir/logs/server-4.log & |
| sleep 0.1 |
| |
| # A: Request /F with MustBeFresh=true. Fail if unanswered or if received content is not "Z". |
| echo "Starting Traffic Client 1 (Prefix=/F, MustBeFresh=true, ExpectedContent=Z)..." |
| ndn-traffic -c 1 $workdir/test-traffic-client-1.conf &> $workdir/logs/client-1.log |
| outcode=$? |
| if [[ $outcode -ne 0 ]]; then |
| echo "Received non-zero exit code from Traffic Client 1. Actual: $outcode" |
| clean_up |
| exit 1 |
| fi |
| echo "Traffic Client 1 received Data with Content=Z" |
| |
| # Sleep for 100ms |
| sleep 0.1 |
| |
| # A: Request /A with MustBeFresh=true. Fail if unanswered or if received content is not "A" |
| echo "Starting Traffic Client 2 (Prefix=/A, MustBeFresh=true, ExpectedContent=A)..." |
| ndn-traffic -c 1 $workdir/test-traffic-client-2.conf &> $workdir/logs/client-2.log |
| outcode=$? |
| if [[ $outcode -ne 0 ]]; then |
| echo "Received non-zero exit code from Traffic Client 2. Actual: $outcode" |
| clean_up |
| exit 1 |
| fi |
| echo "Traffic Client 2 received Data with Content=A" |
| |
| # Sleep for 100ms |
| sleep 0.1 |
| |
| # A: Request /a with MustBeFresh=true. Fail if unanswered or if received content is not "Z". |
| echo "Starting Traffic Client 3 (Prefix=/a, MustBeFresh=true, ExpectedContent=Z)..." |
| ndn-traffic -c 1 $workdir/test-traffic-client-3.conf &> $workdir/logs/client-3.log |
| outcode=$? |
| if [[ $outcode -ne 0 ]]; then |
| echo "Received non-zero exit code from Traffic Client 3. Actual: $outcode" |
| clean_up |
| exit 1 |
| fi |
| echo "Traffic Client 3 received Data with Content=Z" |
| |
| # Sleep for 100ms |
| sleep 0.1 |
| |
| # A: Request /A/B with MustBeFresh=true. Fail if unanswered or if received content is not "A". |
| echo "Starting Traffic Client 4 (Prefix=/A/B, MustBeFresh=true, ExpectedContent=A)..." |
| ndn-traffic -c 1 $workdir/test-traffic-client-4.conf &> $workdir/logs/client-4.log |
| outcode=$? |
| if [[ $outcode -ne 0 ]]; then |
| echo "Received non-zero exit code from Traffic Client 4. Actual: $outcode" |
| clean_up |
| exit 1 |
| fi |
| echo "Traffic Client 4 received Data with Content=A" |
| |
| # Sleep for 100ms |
| sleep 0.1 |
| |
| # A: Request /A/B/G with MustBeFresh=true. Fail if unanswered or if received content is not "A". |
| echo "Starting Traffic Client 5 (Prefix=/A/B/G, MustBeFresh=true, ExpectedContent=A)..." |
| ndn-traffic -c 1 $workdir/test-traffic-client-5.conf &> $workdir/logs/client-5.log |
| outcode=$? |
| if [[ $outcode -ne 0 ]]; then |
| echo "Received non-zero exit code from Traffic Client 5. Actual: $outcode" |
| clean_up |
| exit 1 |
| fi |
| echo "Traffic Client 5 received Data with Content=A" |
| |
| # Sleep for 100ms |
| sleep 0.1 |
| |
| # A: Request /A/B/C with MustBeFresh=true. Fail if unanswered or if received content is not "C". |
| echo "Starting Traffic Client 6 (Prefix=/A/B/C, MustBeFresh=true, ExpectedContent=C)..." |
| ndn-traffic -c 1 $workdir/test-traffic-client-6.conf &> $workdir/logs/client-6.log |
| outcode=$? |
| if [[ $outcode -ne 0 ]]; then |
| echo "Received non-zero exit code from Traffic Client 6. Actual: $outcode" |
| clean_up |
| exit 1 |
| fi |
| echo "Traffic Client 6 received Data with Content=C" |
| |
| # Sleep for 100ms |
| sleep 0.1 |
| |
| # A: Request /A/B/C/P/Q/R/S/T/U/V/W/X/Y/Z with MustBeFresh=true. Fail if unanswered or if received |
| # content is not "C". |
| echo "Starting Traffic Client 7 (Prefix=/A/B/C/P/Q/R/S/T/U/V/W/X/Y/Z, MustBeFresh=true, ExpectedContent=C)..." |
| ndn-traffic -c 1 $workdir/test-traffic-client-7.conf &> $workdir/logs/client-7.log |
| outcode=$? |
| if [[ $outcode -ne 0 ]]; then |
| echo "Received non-zero exit code from Traffic Client 7. Actual: $outcode" |
| clean_up |
| exit 1 |
| fi |
| echo "Traffic Client 7 received Data with Content=C" |
| |
| clean_up |