#! /pkg/bin/ksh
# ----------------------------------------------------------------------
# show_tech_ipt -- Tunnel-template (Biscuit) show tech-support script
#
# Feb 2008, Han Xu
#
# Copyright (c) 2008-2009, 2014 by cisco Systems, Inc.
# All rights reserved.
#-----------------------------------------------------------------------

# 
# This script runs all the show commands required for the Tunnel-template 
# show tech-support command. 
# 
# Options:
#          Currently only the standard tech-support options are supported. 
#          If more options are added, add description here.
# 

# ******************************************************************
#  Main heading required by show tech-support
# ******************************************************************
. /pkg/bin/show_tech_main_fragment

# ******************************************************************
# Parse the arguments to the script.
# Usage: 
#        show_tech_ipt [-f <file>]
# ******************************************************************

while [ "$#" -gt "0" ]; do
  case "$1" in
     *)  default_parser_function "$@"; shift $#;;
  esac
done

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

# ******************************************************************
#  Command set for command level one: Detailed output w event traces
# ******************************************************************
cmd_index=0

command_level1[$cmd_index]='show running-config tunnel-template'
cmd_index=$((cmd_index + 1))

command_level1[$cmd_index]='show tunnel-template'
cmd_index=$((cmd_index + 1))

command_level1[$cmd_index]='show tunnel-ip trace ma all'
cmd_index=$((cmd_index + 1))

command_level1[$cmd_index]='show tunnel-ip trace ea all location all'
cmd_index=$((cmd_index + 1))

command_level1[$cmd_index]='show processes ip_tunnel_ma'
cmd_index=$((cmd_index + 1))

command_level1[$cmd_index]='run ipt_bis_show -i'
cmd_index=$((cmd_index + 1))

command_level1[$cmd_index]='run ipt_bis_show -a -d'
cmd_index=$((cmd_index + 1))

command_level1[$cmd_index]='show install which component tunnel-gre'
cmd_index=$((cmd_index + 1))

command_level1[$cmd_index]='show version'
cmd_index=$((cmd_index + 1))

command_level1[$cmd_index]=''

#
# 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()
# ******************************************************************
display() {
    # Print the output heading 
    print_main_heading "show tech-support tunnel-template"

    # Execute commands
    run_commands _level1

    # Print the closing heading
    print_main_heading "show tech-support tunnel-template 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
