#!/bin/bash
# -----------------------------------------------------------------------------
# show_tech_envmon_pd                     
#                                      
# Copyright (c) 2017 by cisco Systems, Inc.
# All rights reserved.
#------------------------------------------------------------------------------

#
# Load the script provided by show-tech infra, which provides worker functions
#
source /opt/cisco/calvados/script/show_tech_main_fragment

#
# Parse the arguments to the script - card type and interface filter are the 
# only support options currently.  No need to use the default parser function,
# as this has been done by caller.
#
__cardtype="unspecified"
trace_only="0"
show_only="0"
not_sim="0"

while [ "$#" -gt "0" ]; do
    case "$1" in
        -T) trace_only="1"; shift 1;;
        -S) show_only="1"; shift 1;;
        -t) __cardtype="$2"; shift 2;;
        *) shift;;
    esac
done
if [ "$__cardtype" == "unspecified" ]; then
    __cardtype=`/opt/cisco/calvados/script/node_type`
fi

not_sim=`lspci | grep "Ethernet controller: Intel" | wc -l`

rp_show_exec[1]='dump envmon data structures '
rp_show__ksh[1]='/opt/cisco/calvados/bin/envmon_test_xrv9k -d'

#
# The display() function is the one that does all the work - called by us as 
# this is a worker script.
#
display() {
	
    print_main_heading "Platform Dependent envmon tech-support info"

    if [ "$__cardtype" = "SYS" ]; then
        if [ "$trace_only" = "0" ]; then
               exec_commands sys_show
        fi
    else
        case "$__cardtype" in
        "RP")
            exec_commands rp_show
            ;;
        esac
    fi
}

display
