#!/pkg/bin/ksh
# ---------------------------------------------------------------------
# show_tech_smartlic_fast - show commands for show tech-support 
#                                smartlic spawned by show_tech_fast
#
# May 2015, Sreejith Sreekumaran
#
# Copyright (c) 2015-2017 by cisco Systems, Inc.
# All rights reserved.
# --------------------------------------------------------------------

. /pkg/bin/show_tech_main_fragment

__cardtype="unspecified"

# Parse the arguments to the script.
while [ "$#" -gt "0" ]; do
    case "$1" in
        -t) __cardtype="$2"; shift 2;;
        *)  default_parser_function "$@"; shift $#;;
    esac
done

if [ "$__filename" = "unspecified" ]; then
    echo "show_tech_smartlic_fast: output file not specified"
    exit
fi

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

# ***********************************************************
#  Show commands to be run by the show tech-support commands
#  running config helps in seeing the configuration of the 
#  sytem.
#  call-home related logs help in debugging any transport layer issues
#  when talking back to the CSSM/Satellite
#  show logging helps in seeing all the syslogs generated
#  install active helps in understanding all the active 
#  packages on the box 
# ***********************************************************

# Commands that run on once per system
sys_exec[1]="show running-config"
sys__ksh[1]='nvgen -c -l 1 -t 1 -i1 -o 1'
sys_exec[2]="show install active"
sys__ksh[2]='sdr_instcmd show install active'
sys_exec[3]="show redundancy"
sys__ksh[3]='redcon_show'
sys_exec[4]="show logging"
sys__ksh[4]='show_logging'
sys_exec[5]="show call-home detail"
sys__ksh[5]='show_callhome -C -t 1'
sys_exec[6]="show call-home trace all"
sys__ksh[6]='call_home_show_ltrace -A'
sys_exec[7]="show call-home smart-licensing"
sys__ksh[7]='show_callhome -L -t 0'
sys_exec[8]="show call-home smart-licensing statistics"
sys__ksh[8]='show_callhome -L -t 1'
sys_exec[9]="show processes call_home detail"
sys__ksh[9]='sysmgr_show -o -p call_home -D'
sys_exec[10]="show xos errors"
sys__ksh[10]='show_xos_command gen_error_traces'
sys__ksh[11]=''

# Exec Plane Commands
admin_exec[1]="show license udi"
admin__ksh[1]='smartliccmd show license smart udi'
admin_exec[2]="show license techsupport"
admin__ksh[2]='smartliccmd show license smart techsupport'
admin_exec[3]="show license trace smartlic"
admin__ksh[3]='smartlic_show_smartlic_ltrace'
admin_exec[4]="show license trace client location all"
admin__ksh[4]='smartliclib_show_ltrace -i all'
admin_exec[5]="show license trace all"
admin__ksh[5]='smartlic_show_all_ltrace'
admin_exec[6]="sh diag details"
admin__ksh[6]='show_diag -t'
admin_exec[7]="sh license platform detail"
admin__ksh[7]='plat_sl_show detail'
admin_exec[8]="sh license platform summary"
admin__ksh[8]='plat_sl_show summary'
admin_exec[9]="sh license platform trace all"
admin__ksh[9]='plat_sl_ltrace_show -I -E -D'
admin__ksh[10]=''

display() {
    print_main_heading "show tech-support smartlic"

    if [ "$__cardtype" == "SYS" ]; then
        exec_commands sys
        exec_commands admin
    fi

    print_main_heading "show tech-support smartlic complete"
}

# Run the appropriate function depending on the node specified and if a
# file is specified write the output to that file. We need to redirect
# stderr to stdout when writing to a file because some of the show
# commands output to stderr instead of stdout
. /pkg/bin/show_tech_file_fragment
