| source ../multi-host.conf |
| sudo nfd &> $workdir/logs/nfd.log & |
| result=$(nfdc face create udp4://$nextHop) |
| result=$(nfdc route add $name udp4://$nextHop expires $(($expirationPeriod * 1000)) | grep -o 'nexthop=[0-9]*' | sed s/'nexthop='//) |
| is_expiration_period_correct() { |
| expirationPeriod=$(nfdc route list | grep -iF ''$name'' | grep 'nexthop='$nextHop'' |\ |
| grep -o 'expires=[0-9]*' | sed 's/'expires='//') |
| if [[ "$expirationPeriod" -lt $lowerBound || "$expirationPeriod" -gt $upperBound ]]; then |
| echo $name "has an expiration period of $expirationPeriod seconds which is not between the expected $lowerBound-$upperBound seconds" |
| echo $name "has a correct expiration period between $lowerBound and $upperBound seconds" |
| expect_entry_does_not_exist() { |
| count=$(nfdc route list | grep -c '$name ') |
| if [[ $count -gt 0 ]]; then |
| echo $name "exists past its expected expiration period." |
| echo $name "has expired successfully" |
| expect_route_does_not_exist() { |
| count=$(nfdc route list | grep -iF ''$name'' | grep -c 'nexthop='$nexthop'') |
| if [[ $count -gt 0 ]]; then |
| echo "Route for $name with nexthop=$nexthop exists past its expected expiration period." |
| echo "Route for $name with nexthop=$nexthop has expired successfully" |
| echo -e "Sleeping for $1 seconds...\n" |