#!/pkg/bin/ksh
#
# DNX SPAN  "show tech-support" commands.
#
# Copyright (c) 2021 by cisco Systems, Inc.
# All rights reserved.
#----------------------------------------------------------------------

# main infra
. /pkg/bin/show_tech_main_fragment

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

_cardtype="unspecified"
arg_string=""
showtech_argv=""
showtech_argc="0"

while [ "$#" -gt "0" ]; do
    case "$1" in
        -t) __cardtype="$2"; shift 2;;
        *) showtech_argv="$showtech_argv $1"; (( showtech_argc+=1 )); shift 1;;
    esac
done

if [ "$__cardtype" == "unspecified" ]; then
    __cardtype=`node_type`
fi

# Commands for lc
lc_exec[1]='show monitor-session trace platform errors events location $location'
lc__ksh[1]='dnx_span_show_ltrace -ER'

lc_exec[2]='show ofa objects spansession location $location'
lc__ksh[2]='dpa_spansession_show_client -b'

lc_exec[3]=''
lc__ksh[3]=''

# 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() {
    # Execute commands
    print_main_heading "span_show_tech_platform"
    case "$__cardtype" in
    "RP" | "DRP")
        ;;
    "LC")
        exec_commands lc
        ;;
    esac
}

. /pkg/bin/show_tech_file_fragment
