#!/bin/bash
####################################################################
#
#      File: S41install-emon-lc
#      Name: Charles Lo
#
#      Description:
#      Load EMON LC KLM
#
# Copyright (c) 2015-2016 by cisco Systems, Inc.
# All rights reserved.
#
#####################################################################

. /etc/init.d/mod_ins/module-load-functions

boot_debug "Executing $0 [S41install-emon-lc]"

case $1 in
    start)
        MY_CARD_IDX="$(get_cmdline_card_index)"
        # FIX-ME: after 36 macsec LC is add in KLM, remove this from here
        # Mimic MACSEC36 as MACSEC18 as there is nothing special
        # to be done for MACSEC36 on EMON
        if [ $MY_CARD_IDX -eq 27018 ]; then
            MY_CARD_IDX=27013
        fi 
        insmod /lib/modules/klm_kfsmutils.o
        insmod /lib/modules/klm_emon_lc.o card_index=$MY_CARD_IDX dbg_no_reload=0 debug_enable=0
        echo "Insmod EMON LC: Card Index: $(get_cmdline_card_index)"
    ;;

    stop)
        boot_debug "Stopping klm_emon_lc"
        rmmod klm_emon_lc
    ;;
esac
