#! /pkg/bin/ksh
# ---------------------------------------------------------------------
# l2vpn_show_tech_pwhe - PWHE l2vpn showtech script
#
# February 2017, Mark Sains
#
# Copyright (c) 2017-2020 by cisco Systems, Inc.
# All rights reserved.
#----------------------------------------------------------------------


. /pkg/bin/show_tech_main_fragment

# Password flag to indicate whether log will include pw or not


# Parse the arguments to the script.
default_parser_function "$@"


sys_exec[1]='show l2vpn ma pwhe private'
sys__ksh[1]='show_pwhe_ma -p 0x1'
sys_exec[2]='show l2vpn ma pwhe peer private'
sys__ksh[2]='show_pwhe_ma -p 0x4'
sys_exec[3]='show system statistics component ma'
sys__ksh[3]='ship_show -c ma'
sys_exec[4]='show system statistics component ma errors'
sys__ksh[4]='ship_show -c ma -e'
sys_exec[5]='show l2vpn ma pwhe summary private'
sys__ksh[5]='show_pwhe_ma -p 0x2'
sys_exec[6]='show l2vpn ma pwhe port-db private'
sys__ksh[6]='show_pwhe_ma -p 0x3'
sys_exec[7]=''
sys__ksh[7]=''

rp_exec[1]='show l2vpn ma pwhe trace location $location'
rp__ksh[1]='vif_ma_show_ltrace -i $fq_nodeid pwhe-ma'
rp_exec[2]='show proc pwhe_ma txgroup peer all detail location $location'
rp__ksh[2]='txlib_show -N $fq_nodeid -E pwhe_ma -P -d -a'
rp_exec[3]='show l2vpn ma pwhe api-statistics all detail location $location'
rp__ksh[3]='pwhe_ma_api_stats_cmd all -S -N $fq_nodeid'
rp_exec[4]='show proc pwhe_ma location $location'
rp__ksh[4]='sysmgr_show -o -p pwhe_ma -n $fq_nodeid'
rp_exec[5]=''
rp__ksh[5]=''

lc_exec[1]='show l2vpn ea pwhe trace location $location'
lc__ksh[1]='pwhe_ea_show_ltrace -i $fq_nodeid pwhe_ea'
lc_exec[2]='show l2vpn ea pwhe idb private location $location'
lc__ksh[2]='pwhe_ea_show -n $fq_nodeid -p'
lc_exec[3]=''
lc__ksh[3]=''


display() {
    case "$__cardtype" in
    "SYS")
        exec_commands sys
        ;;

    "LC")
        exec_commands lc
        ;;

    "RP")
        exec_commands rp
        if [ "$location" == "" ]; then
            define_rack_nodes
            my_exec_commands_rack_nodes rack
        fi
        ;;

    esac
}

# 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

