#!/pkg/bin/ksh
#
# Created by Hoe Trinh, July 2009
#
# Viking platform-dependent "show tech-support" commands.
#
# Copyright (c) 2010, 2015-2016 by cisco Systems, Inc. 
# All rights reserved.
#----------------------------------------------------------------------

. /pkg/bin/show_tech_main_fragment

# List each set of show commands to be run. Each set must finish with an empty
# string. Note that it is important to use single quotes rather than double 
# quotes for the strings containing your commands; showtech infra expects the command
# exactly the way it was entered.
# Use "\" ahead of any special character (eg. |) used in the command line.

__cardtype="unspecified"
arg_string=""
showtech_argv=""
showtech_argc="0"

while [ "$#" -gt "0" ]; do
    case "$1" in
        -t) __cardtype="$2"; shift 2;;
        *) showtech_argv="$showtech_argv $1"; (( showtech_argc+=1 )); shift 1;;
    esac
done

if [ "$__cardtype" == "unspecified" ]; then
    __cardtype=`node_type`
fi

# Commands for all nodes
rplc_exec[1]='show controllers np counters all location $location' 
rplc__ksh[1]='prm_np_show counters -s $fq_nodeid'

rplc_exec[2]='show controllers np struct 15 detail all all location $location'
rplc__ksh[2]='prm_np_show struct -u 0x0f -s $fq_nodeid'

rplc_exec[3]='show controllers np struct 37 detail all all location $location'
rplc__ksh[3]='prm_np_show struct -u 0x25 -s $fq_nodeid'

# Cisco support
rplc_exec[4]='show monitor-session platform trace all location $location'
rplc__ksh[4]='vkg_span_show_ltrace -i $fq_nodeid -E -R'

rplc_exec[5]='show ethernet hardware all location $location'
rplc__ksh[5]='vkg_ether_ea_show -a -L $fq_nodeid'

rplc_exec[6]=''
rplc__ksh[6]=''

# A function called display() must be provided that calls the functions to 
# run the required show commands. The display() function is called in 
# /pkg/bin/show_tech_comp_file_frag

display() {
    # Execute commands
    print_main_heading "span_show_tech_platform"
    case "$__cardtype" in
    "RP")
        exec_commands rplc
        ;;
    "LC")
        exec_commands rplc
        ;;
    esac
}

. /pkg/bin/show_tech_file_fragment
