#!/pkg/bin/ksh
#-----------------------------------------------------------------------------
# svii_show_tech_fragment_fast - show tech-support fragment
#
# October 2009, Raghav Kaushik
#
# Copyright (c) 2009-2010, 2018 by cisco Systems, Inc.
# All rights reserved.
#-----------------------------------------------------------------------------

# ------------------------------------------------------------------------
#
# Note that this is *not* a fully-fledged "show tech-support" command. 
#
# Instead, it is a fragment for use by other show tech programs, such as
# "show tech-support service firewall". Each of these should include 
#
#     . /pkg/bin/svii_show_tech_fragment
#
# at the point where they wish to include the SVI commands. Note that it is
# assumed that the following commands will be executed by the caller, not this
# fragment:
#
#     show platform
#     show redundancy
#     show context
#     show running-config
#     show config failed
#     show config failed startup
#     show configuration commit history 20
#     show version
#     show processes pidin location all
#     show services redundancy detail
#
#
# that is relevant for their service.
#
# ------------------------------------------------------------------------

# ------------------------------------------------------------------------
# 
# Firstly define commands that are run once. As it happens, these are also
# the customer-visible non-cisco-support task id commands too.
#
# ------------------------------------------------------------------------

#
# Display the global state of the router
#

#
# Show the overall interface state.
#
svii_sys_exec[1]='show services role detail'
svii_sys__ksh[1]='srd_show -A -D'
svii_sys_exec[2]='show services redundancy internal'
svii_sys__ksh[2]='sdir_show -I'
svii_sys_exec[3]='show services interfaces'
svii_sys__ksh[3]='svii_show'
svii_sys_exec[4]='show services db manager'
svii_sys__ksh[4]='svii_mgr_show -a -d'
svii_sys_exec[5]='show services role trace server'
svii_sys__ksh[5]='srd_show_trace'
svii_sys_exec[6]='show services redundancy trace verbose'
svii_sys__ksh[6]='sdir_show_ltrace -A -C'
svii_sys_exec[7]='show services interfaces trace manager all'
svii_sys__ksh[7]='svii_show_ltrace -B -XYZ'
svii_sys_exec[8]=''
svii_sys__ksh[8]=''

#
# Commands to be run on all nodes
#
svii_all_exec[1]='show services db ea location $location'
svii_all__ksh[1]='svii_ea_show -a -h $fq_nodeid -d'
svii_all_exec[2]='show services db adjacency interfaces location $location'
svii_all__ksh[2]='svii_adj_show -I -h $fq_nodeid'
svii_all_exec[3]='show services db adjacency services location $location'
svii_all__ksh[3]='svii_adj_show -S -h $fq_nodeid'
svii_all_exec[4]='show services interfaces trace ea all location $location'
svii_all__ksh[4]='svii_show_ltrace -C -XYZ'
svii_all_exec[5]='show services interfaces trace adjacencies all location $location'
svii_all__ksh[5]='svii_show_ltrace -D -XYZ'
svii_all_exec[6]=''
svii_all__ksh[6]=''

#
# Commands to be run on RP node only
#
svii_rp_exec[1]='show services role trace agent location $location'
svii_rp__ksh[1]='srd_agent_show_trace'
svii_rp_exec[2]=''
svii_rp__ksh[2]=''

# ------------------------------------------------------------------------
# 
# Now just run the global commands once, and the local commands once for 
# every node unless requested otherwise.
#
# ------------------------------------------------------------------------

#
# Preamble.
#
print_main_heading "show tech-support service svi fragment"

#
# Display the output
#
    if [ "$__cardtype" == "SYS" ]; then
        exec_commands svii_sys
    else
        case $__cardtype in
        "DRP" | "RP")
            exec_commands svii_rp
        ;;
        esac
      exec_commands svii_all
    fi

#
# Done.
#
print_main_heading "show tech-support service svi fragment complete"

