#!/pkg/bin/ksh
# ---------------------------------------------------------------------
# show_tech_telemetry_model_driven -Model Driven Telemetry tech-support show command
#
# May 2016, Sowmya Sampath
#
# Copyright (c) 2015-2016, 2018-2019 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

# ***********************************************************
#  Show commands to be run by the show tech-support commands
# ***********************************************************

#############################################################
# All show commands that run once per RP

# MDT commands
rp_exec[1]='show telemetry model-driven trace all'
rp__ksh[1]='mdt_trace_show -T all'

rp_exec[2]='show telemetry model-driven subscription'
rp__ksh[2]='mdt_show -a All__'

rp_exec[3]='show telemetry model-driven internal subscription'
rp__ksh[3]='mdt_show -i -a All__'

rp_exec[4]='show telemetry model-driven destination'
rp__ksh[4]='mdt_show -d All__'

rp_exec[5]='show telemetry model-driven sensor-group'
rp__ksh[5]='mdt_show -s All__'

rp_exec[6]='show telemetry model-driven bte ucode-server trace all'
rp__ksh[6]='show_mdt_bte_ucode_server_trace -b errors events'

rp_exec[7]='show telemetry model-driven bte trace'
rp__ksh[7]='bte4mdt_trace_decode'

rp_exec[8]='show grpc trace all'
rp__ksh[8]='yfed_show_trace -T ems/errors -T ems/events -T ems/info -T yfed/errors-ems -T yfed/events-ems -T yfed/info-ems -T ems-yfw/processor.trace -T ems-yfw/map.trace -T ems-yfw/calvados.trace -T ems-yfw/qt.trace -T ems-yfw/me.trace -T ems-yfw/bk.trace'


display() {
    print_main_heading "show tech-support telemetry model-driven"
    case "$__cardtype" in
	"RP")
	    exec_commands rp
	    ;;
	"DRP")
	    exec_commands rp
	    ;;
	esac
    print_main_heading "show tech-support telemetry model-driven complete"
}

# Run the appropriate function depending on the node specified and if a
# file is specified write the output to that file.
. /pkg/bin/show_tech_file_fragment
