#!/pkg/bin/ksh
#
# Created by Ken Blanc, January 2008.
#
# Copyright (c) 2010-2012, 2015-2017, 2019 by cisco Systems, Inc. 
# All rights reserved.
#----------------------------------------------------------------------

# This script fragment contains the code for the following functions
# - print_main_heading
# - print_command_heading
# - run_single_command
# - run_commands
# - run_single_command_on_all_nodes
# - run_commands_on_all_nodes
# - default_parser_function
. /pkg/bin/show_tech_main_fragment

# Parse the arguments to the script.
# None needed for mldsn snooping at this time.


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

sys_show_exec[1]='show version'                                                  
if [[ "$platform" == "panini" ]]; then                                           
    sys_show__ksh[1]='ng_show_version'                                           
else                                                                             
    sys_show__ksh[1]='show_version'                                              
fi 
sys_show_exec[2]='show running-config'
sys_show__ksh[2]='nvgen -c -l 1 -t 1 -o 1'
sys_show_exec[3]='show mld snooping summary statistics debug'
sys_show__ksh[3]='mldsn_show -S -y -t'
sys_show_exec[4]='show mld snooping bridge-domain detail statistics debug'   
sys_show__ksh[4]='mldsn_show -B -d -y -t'   
sys_show_exec[5]='show mld snooping group debug '
sys_show__ksh[5]='mldsn_show -G -t'
sys_show_exec[6]='show mld snooping port detail statistics debug'
sys_show__ksh[6]='mldsn_show -I -d -y -t'
sys_show_exec[7]='show mld snooping profile detail debug'
sys_show__ksh[7]='mldsn_show -P -d -t'
sys_show_exec[8]='show mld snooping profile references debug'
sys_show__ksh[8]='mldsn_show -P -r -t'
sys_show_exec[9]='show mld snooping profile summary debug'
sys_show__ksh[9]='mldsn_show -P -x'
sys_show_exec[10]='show mld snooping trace error'
sys_show__ksh[10]='mldsn_show_ltrace -E'
sys_show_exec[11]='show mld snooping trace event'
sys_show__ksh[11]='mldsn_show_ltrace -N '
sys_show_exec[12]='show mld snooping trace all'
sys_show__ksh[12]='mldsn_show_ltrace -A'
sys_show_exec[13]='show mld snooping redundancy iccp'
sys_show__ksh[13]='mldsn_show -R -u'
sys_show_exec[14]='show mld snooping redundancy iccp debug'
sys_show__ksh[14]='mldsn_show -R -u -t'
sys_show_exec[15]='show mld snooping redundancy iccp show-debug'
sys_show__ksh[15]='mldsn_show -R -u -s'
sys_show_exec[16]='show mld snooping redundancy iccp statistics'
sys_show__ksh[16]='mldsn_show -R -u -y'
sys_show_exec[17]='show mld snooping redundancy iccp group'
sys_show__ksh[17]='mldsn_show -R -u -i'
sys_show_exec[18]='show mld snooping redundancy iccp group port'
sys_show__ksh[18]='mldsn_show -R -u -i -x'
sys_show_exec[19]='show mld snooping redundancy iccp group port detail statistics'
sys_show__ksh[19]='mldsn_show -R -u -i -d -x -y'
sys_show_exec[20]='show platform'
if [[ "$platform" == "panini" ]]; then                                           
    sys_show__ksh[20]='show_platform_sysdb'
else
    sys_show__ksh[20]='show_platform'
fi
sys_show_exec[21]=''
sys_show__ksh[21]=''


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

# 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 the output heading 
    print_main_heading "show tech-support mld snooping"
     
    # Execute commands
    exec_commands sys_show

    # Print the closing heading. 
    print_main_heading "show tech-support mld snooping complete"
}

# 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
