| #!/bin/bash |
| source ../multi-host.conf |
| |
| clean_up() { |
| r=$(sudo killall ndnpingserver 2>&1) |
| r=$(sudo killall ndnping 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 ndnpingserver |
| echo "Starting ndnpingserver on A..." |
| ndnpingserver -p5 /test/ndnping &> $workdir/logs/ndnpingserver.log & |
| serverpid=$! |
| sleep 1 |
| |
| # A: Run ndnping |
| echo "Running ndnping on A..." |
| ndnping -c5 /test/ndnping |
| exitcode=$? |
| sleep 1 |
| |
| # An exit code of zero indicates the number of received Data packets equals the number of sent Interests |
| if [[ $exitcode -ne 0 ]]; then |
| echo "Received non-zero exit code from ndnping - actual: $exitcode" |
| clean_up |
| exit 1 |
| fi |
| |
| # Verify that ndnpingserver has exited |
| # ps -p returns 1 if no matching process is found |
| ps -p $serverpid > /dev/null |
| if [[ $? -ne 1 ]]; then |
| echo "ndnpingserver did not exit" |
| clean_up |
| exit 2 |
| fi |
| |
| clean_up |
| |
| nReceivedInterests=$(grep -c "interest received" $workdir/logs/ndnpingserver.log) |
| if [[ $nReceivedInterests -ne 5 ]]; then |
| echo "ndnpingserver did not receive 5 Interests - actual: $nReceivedInterests" |
| clean_up |
| exit 3 |
| fi |