#!/usr/bin/env bash
NUM_OF_PINGS=10

# clean up - kill nfd
clean_up() {
  r=$(ssh $CTRL_B "sudo killall nfd" 2>&1)
  r=$(sudo killall nfd 2>&1)
}

start_nfd() {
  # start nfd on localhost
  sudo nfd &> $workdir/logs/nfd.log &

  # start nfd on hostB
  ssh $CTRL_B "mkdir -p $workdir/logs ; sudo nfd &> $workdir/logs/nfd.log &\
    sleep 2"
  sleep 2
}


check_nfd_status_counters() {
  faceId=$1
  faceUri=$2
  counterType=$3
  threshold=$4

  # wait for the refreshed output of nfd-status
  sleep 2

  outCounter=$(nfd-status | grep -iF 'faceid='$faceId' remote='$faceUri | grep -Po $counterType={[0-9]+ | sed 's/'$counterType'={//')


  if [[ $outCounter -lt $threshold ]]; then
    if [[ "out" = $counterType ]]; then
      echo "nfd-status: out counter of face=$faceId is less than $threshold " >> $testLog
      echo "nfd-status is:" >> $testLog
      nfd-status >> $testLog
      clean_up
    fi
    exit 2

  fi

}

# check for the existence of the face
# param list: $1 - face Id
#             $2 - face Uri
check_nfd_status_face_existence() {
  faceId=$1
  faceUri=$2

  # wait for the refreshed output of nfd-status
  sleep 2

  # check for the existence of the face
  # First, get the face line
  # Second, extract the face id attached to the fetched line
  face=$(nfd-status | grep -iF remote=$faceUri | grep -Po faceid=\[0-9\]+ | sed 's/faceid=//')

  if [[ "none" != $faceId ]]; then
    if [[ $face != $faceId ]]; then
      echo "nfd-status: Failed to find face $faceId of $faceUri" >> $testLog
      echo "nfd-status is:" >> $testLog
      nfd-status >> $testLog
      echo "-1"
    else
      echo $face
    fi
  else
    echo $face
  fi

}


# This function checks for the existence of a face and a fib entry
# including nexthop records
# param list: $1 - face Id
#             $2 - face Uri
#             $3 - prefix
#             $4 - cost
check_nfd_status_correctness() {
  faceId=$1
  faceUri=$2
  prefix=$3
  cost=$4

  face=$(check_nfd_status_face_existence $faceId $faceUri)
  if [[ "-1" = $face ]]; then
    clean_up
    exit 2
  fi

  # wait for the refreshed output of nfd-status
  sleep 2

  # check the existence of prefix FIB entry
  fibEntry=$(nfd-status | grep $prefix)
  if [[ -z "$fibEntry" ]]; then
    echo "nfd-status: Failed to find $prefix in FIB table" >> $testLog
    echo "nfd-status is:" >> $testLog
    nfd-status >> $testLog
    clean_up
    exit 2
  fi

  # check the correctness of cost on nexthop records
  fibEntryCost=$(echo $fibEntry | grep -Po 'faceid='$faceId'.\(cost=[0-9]+\)' | sed 's/faceid='$faceId' //' | sed 's/(cost=//' | sed 's/)//')

  if [[ $cost != $fibEntryCost ]]; then
    echo "nfd-status: nexthop records are incorrect, expected cost is $cost, cost in records $fibEntryCost" >> $testLog
    echo "nfd-status is:" >> $testLog
    nfd-status >> $testLog
    clean_up
    exit 2
  fi
}
