#!/pkg/bin/ksh
#
# Created by Mark Tooker, June 2006.
#
# Copyright (c) 2006-2017 by cisco Systems, Inc. 
# All rights reserved.
#----------------------------------------------------------------------

#### Please read this before changing #### 
# Why l2vpn uses executable not CLI?
# As per CSCsq49178, in order to speed up for large scale,
# it is believed that for parallel processing of show tech content, 
# CLI doesn't work as it needs to wait until the previous CLI to complete


# This script fragment contains the code for the following functions
# - print_main_heading
# - print_command_heading
# - run_single_command
# - run_commands
# - run_single_command_on_all_nodes
# - run_commands_on_all_nodes
# - default_parser_function
. /pkg/bin/show_tech_main_fragment

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

all="TRUE"
# Parse the arguments to the script.
while [ "$#" -gt "0" ]; do
    case "$1" in
    -infra) infra="TRUE"; all=""; shift 1;;
    -l2fib) l2fib="TRUE"; all=""; shift 1;;
    -evpn) evpn="TRUE"; all=""; shift 1;;
    -pwhe) pwhe="TRUE"; all=""; shift 1;;
    -bgp) bgp="TRUE"; all=""; shift 1;;   
    -l2rib) l2rib="TRUE"; all=""; shift 1;;
    -arp) arp="TRUE"; all=""; shift 1;;
    *) default_parser_function "$@"; shift $#;;
    esac
done

enable_techs "" /pkg/bin/l2vpn_show_tech_general

if [ "$all" == "TRUE" ] || [ "$infra" == "TRUE" ]; then
    enable_techs "" /pkg/bin/l2vpn_show_tech_infra
fi

if [ "$all" == "TRUE" ] || [ "$l2fib" == "TRUE" ]; then
    enable_techs "" /pkg/bin/l2vpn_show_tech_l2fib
fi

if [ "$all" == "TRUE" ] || [ "$evpn" == "TRUE" ]; then
    enable_techs "" /pkg/bin/l2vpn_show_tech_evpn
fi

if [ "$all" == "TRUE" ] || [ "$pwhe" == "TRUE" ]; then
    enable_techs "" /pkg/bin/l2vpn_show_tech_pwhe
fi

if [ "$all" == "TRUE" ] || [ "$bgp" == "TRUE" ]; then
    enable_techs "" /pkg/bin/l2vpn_show_tech_bgp
fi

if [ "$all" == "TRUE" ] || [ "$arp" == "TRUE" ]; then
    enable_techs "" /pkg/bin/l2vpn_show_tech_arp
fi

if [ "$all" == "TRUE" ] || [ "$l2rib" == "TRUE" ]; then
    enable_techs "" /pkg/bin/l2vpn_show_tech_l2rib
fi

# 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

