#! /pkg/bin/ksh
# ---------------------------------------------------------------------
# l2vpn_show_tech_general - Showtech Script that contains all the
#                           general commands used by the feature specific
#                           showtech scripts.
#
# February 2017, Mark Sains
#
# Copyright (c) 2017 by cisco Systems, Inc.
# All rights reserved.
#----------------------------------------------------------------------

. /pkg/bin/show_tech_main_fragment

# Password flag to indicate whether log will include pw or not


# Parse the arguments to the script.
default_parser_function "$@"


sys_exec[1]='show logging'
sys__ksh[1]='show_logging'
sys_exec[2]='show interface brief'
sys__ksh[2]='show_interface -a -o 0x2'
sys_exec[3]='show redundancy'
sys__ksh[3]='redcon_show'

sys_exec[4]='show version'
if [ "$platform" == "panini" ]; then
    sys__ksh[4]='ng_show_version'
else
    sys__ksh[4]='show_version'
fi
sys_exec[5]='show running'
sys__ksh[5]='nvgen -c -l 1 -t 1 -o 1'
sys_exec[6]='show install'
if [ "$platform" == "panini" ]; then
    sys__ksh[6]='sdr_instcmd show install active'
else
    sys__ksh[6]='instcmd show install active'
fi
sys_exec[7]=''
sys__ksh[7]=''


rp_exec[1]='show proc l2vpn_mgr location $location'
rp__ksh[1]='sysmgr_show -o -p l2vpn_mgr -n $fq_nodeid'
rp_exec[2]='show proc l2vpn_mgr waipc service detail'
rp__ksh[2]='waipc_show -e l2vpn_mgr -o 0x1 -d'
rp_exec[3]='show checkpoint dynamic process l2vpn_mgr'
rp__ksh[3]='chkpt_cli -p l2vpn_mgr'
rp_exec[4]=''
rp__ksh[4]=''


# Commands for All Nodes, in order of priority.
rplc_exec[1]='show process blocked location $location'
if [ "$platform" == "panini" ]; then
    rplc__ksh[1]='sh_proc_ng_blocked -l $fq_nodeid'
else
    rplc__ksh[1]='show_processes -b -n $fq_nodeid'
fi
rplc_exec[2]='show memory summary location $location'
if [ "$platform" == "panini" ]; then
    rplc__ksh[2]='show_memory_ng -n $fq_nodeid -s'
else
    rplc__ksh[2]='show_memory -n $fq_nodeid -s'
fi
rplc_exec[3]='show im trace errors location $location'
rplc__ksh[3]='im_show_trace -E '
rplc_exec[4]='show sysdb trace verification location $location'
rplc__ksh[4]='sysdb_show_ltrace -T vrfn -i $fq_nodeid'
rplc_exec[5]='show system statistics component l2vpn-gsp location $location'
rplc__ksh[5]='ship_show -c l2vpn-gsp'
rplc_exec[6]='show system statistics component l2fib location $location'
rplc__ksh[6]='ship_show -c l2fib'
rplc_exec[7]=''
rplc__ksh[7]=''


# 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() {
    case "$__cardtype" in
    "SYS")
        exec_commands sys           
        ;;

    "LC")
        # execute the command specific to a LC node
        exec_commands rplc
        ;;
   
    "RP")
        exec_commands rplc
        exec_commands rp
        ;;
    esac
}


# This function calls the display() function and sends the output to file if
# the file option has been set. 
. /pkg/bin/show_tech_file_fragment

