#!/pkg/bin/ksh
#!/usr/bin/ksh
#
# Copyright (c) 2003-2017 by cisco Systems, Inc.
# All rights reserved.
#----------------------------------------------------------------------

# Find if the current location is active or standby RP.
# $1: process name (ex: te_control, rsvp)
# $2: location string (ex: 0/0/CPU0, 0/1/CPU0)
is_standby() {
    # We parse the output of show place prog command to extract the location of active and standby
    local output=""
    local string=$(placed_show -p $1 | grep -E "CPU.")
    local str
    for str in $string
    do
        output="$output "$(echo $str | grep -E "CPU.")
    done

    index=0
    for __location in $output; do
        nodes_with_trace[$index]=$__location
        index=$index+1
    done

    if [[ $2 = ${nodes_with_trace[1]} ]];then
        #true
        return 0
    else
        #false
        return 1
    fi
}

