#!/pkg/bin/ksh
#
# Created by Frank Peraza, February 2012
#
# Viking platform-dependent "show tech-support satellite" commands.
# (Based on l2vpn_show_tech_platform)
# Copyright (c) 2007-2012 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 [ "$__cardtype" == "unspecified" ]; then
    __cardtype=`node_type`
fi

# 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.


# Commands for all nodes
AllNodes_exec[1]=''
AllNodes__ksh[1]=''

# the following set are commands that only need to be executed on a LC
AllNodes_LC_exec[1]='show nv satellite trace internal hard all'
AllNodes_LC__ksh[1]='show_vkg_icpe_ea_ltrace -A'
AllNodes_LC_exec[2]=''
AllNodes_LC__ksh[2]=''

# The following are regularly cisco-support commands.

# this first set are command that can only be executed on the RP 
RP_exec[1]=''
RP__ksh[1]=''

# 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() {
    print_main_heading "show tech-support satellite platform"

    # Execute commands
    case "$__cardtype" in
    "LC")
        # execute the command only on a LC node
        exec_commands AllNodes_LC
        exec_commands AllNodes
        ;;
    
    "RP")
        exec_commands RP
        exec_commands AllNodes
        ;;
    esac

    print_main_heading "show tech-support satellite platform complete"
}

. /pkg/bin/show_tech_file_fragment
