#!/usr/bin/env bash
defaultIdentity=
repoDir="test-repo"
repoConf="$repoDir/test.conf"
repoDataPrefix='ndn:/Z'
repoHost='localhost'
repoPort='9527'
nfdConf='host.nfd.conf'
systemNfdConf='/usr/local/etc/ndn/nfd.conf'
testLog='host.test.log'
nfdLog='host.nfd.log'

LOG() {
    echo "[A] $1"
    echo "[A] $1" >>$testLog
}

kill_process() {
    # $1: name of process
    if [[ $# -lt 1 ]]; then
        echo "require name of process"
        exit 1
    fi

    if pgrep -x $1 > /dev/null; then
        sudo -b killall -w "$1" >>$testLog 2>&1
    fi
}

delete_identity() {
    # $1: name of identity
    identity=$1 && identity=${identity#ndn:}
    if [[ $(ndnsec-list | grep -c "$identity$") -gt 0 ]]; then
        LOG " deleting identity $1"
        ndnsec-delete $identity >>$testLog 2>&1
    else
        LOG " identity $identity does not exist"
    fi
}

clean_up() {
    LOG "Killing processeses"
    kill_process "ndn-repo-ng"
    kill_process "nfd"
    kill_process "ndnpingserver"

    LOG "Deleting repo data"
    [[ -d $repoDir ]] && rm -rf $repoDir

    LOG "Deleting identities"
    delete_identity ndn:/Z
    delete_identity ndn:/Z/A
    delete_identity ndn:/Z/A/rib
    delete_identity ndn:/Z/A/B/C
    delete_identity ndn:/Z/A/B/C/D/E/rib
    delete_identity ndn:/Z/F

    if [[ -n "$defaultIdentity" ]]; then
        if [[ $(ndnsec-list | grep -c "$defaultIdentity$") -gt 0 ]]; then
            ndnsec-set-default $defaultIdentity
        fi
    else
        r=$(ndnsec-list)
        if [[ -n "$r" ]]; then
            r=`echo "$r" | tr "\n" "-"`
            r=${r%%-*} && r=${r#*/} && r="/$r"
            ndnsec-set-default $r
        fi
    fi
}

create_identity() {
    # $1: creating identity
    # $2: signing identity
    if [[ $# -gt 1 ]]; then
        ndnsec-key-gen -n $1 > tmp.req
        ndnsec-cert-gen -N "tmp" -s $2 -r tmp.req > tmp.cert; rm tmp.req
        ndnsec-cert-install tmp.cert >>$testLog 2>&1
        [[ -f tmp.cert ]] && rm tmp.cert
    elif [[ $# -gt 0 ]]; then
        ndnsec-key-gen -n $1 | ndnsec-cert-install - >>$testLog 2>&1
    else
        echo "require input identity"
        exit 1
    fi
}

publish_default_cert() {
    # $1: name of identity
    if [[ $# -lt 1 ]]; then
        echo "require identity to publish cert"
        exit 1
    fi

    if [[ "$1"x = "${1#${repoDataPrefix}}"x ]]; then
        echo "can not publish $1 under $repoDataPrefix"
        exit 1
    fi

    ndnsec-cert-dump -r -H $repoHost -P $repoPort -i $1
}

start_repo() {
    LOG "create repo dir config file for repo"
    [[ -d $repoDir ]] || mkdir -p $repoDir

    echo "" > $repoConf # create repo conf file

    infoedit -f $repoConf -s repo.data.prefix -v $repoDataPrefix
    infoedit -f $repoConf -s repo.command.prefix -v ""
    infoedit -f $repoConf -s repo.storage.method -v sqlite
    infoedit -f $repoConf -s repo.storage.path -v $repoDir
    infoedit -f $repoConf -s repo.storage.max-packets -v 100
    infoedit -f $repoConf -s repo.tcp_bulk_insert.host -v $repoHost
    infoedit -f $repoConf -s repo.tcp_bulk_insert.port -v $repoPort
    infoedit -f $repoConf -s repo.validator.trust-anchor.type -v any

    kill_process ndn-repo-ng
    LOG "start repo-ng"
    nohup ndn-repo-ng -c $repoConf >>$testLog 2>&1 &
}

start_nfd() {
    LOG "create nfd conf file with remote_register section specified for test"
    [[ ! -f $systemNfdConf ]] && LOG "can not find nfd config file" && exit 1

    cp $systemNfdConf $nfdConf
    infoedit -f $nfdConf -s rib.remote_register.cost -v 15
    infoedit -f $nfdConf -s rib.remote_register.timeout -v 10000
    infoedit -f $nfdConf -s rib.remote_register.retry -v 0
    infoedit -f $nfdConf -s rib.remote_register.refresh_interval -v 15

    kill_process nfd
    LOG "start NFD"
    sudo nohup nfd --config $nfdConf >>$nfdLog 2>&1 &
}

prepare_for_test() {
    echo "Start test log on end host" >$testLog
    echo "Start nfd log on end host" >$nfdLog

    start_nfd && sleep 2

    start_repo && sleep 2

    defaultIdentity=$(ndnsec-get-default)

    # create identities and publish their certificates
    LOG "create identity /Z/A and publish its cert"
    create_identity ndn:/Z/A
    publish_default_cert ndn:/Z/A

    LOG "create identity /Z/A/nrd and publish its cert"
    create_identity ndn:/Z/A/rib ndn:/Z/A
    publish_default_cert ndn:/Z/A/rib

    LOG "create identity /Z/A/B/C and publish its cert"
    create_identity ndn:/Z/A/B/C ndn:/Z/A
    publish_default_cert ndn:/Z/A/B/C

    LOG "create identity /Z/A/B/C/D/E/nrd and publish its cert"
    create_identity ndn:/Z/A/B/C/D/E/rib ndn:/Z/A/B/C
    publish_default_cert ndn:/Z/A/B/C/D/E/rib

    LOG "create identity /Z/F and publish its cert"
    create_identity ndn:/Z/F ndn:/Z
    publish_default_cert ndn:/Z/F
}

generate_anchor() {
    certFile='remote-register.hub.anchor.cert'
    ndnsec-export -o $certFile $1 >>$testLog 2>&1
    cert=$(cat $certFile) && rm $certFile
    echo $cert
}

while getopts "a:cp" arg
    do
        case $arg in
             a)
                 generate_anchor $OPTARG
                 ;;
             c)
                 clean_up
                 ;;
             p)
                 prepare_for_test
                 ;;
             ?)
                 echo "unknown argument"
        exit 1
        ;;
        esac
done
