--  *****************************************************************
--  DLINKPRIME-LBD-MIB.mib : Loopback Detection MIB
-- 
--  Copyright (c) 2014 D-Link Corporation, all rights reserved.
--   
--  *****************************************************************

    DLINKPRIME-LBD-MIB DEFINITIONS ::= BEGIN

    IMPORTS
        MODULE-IDENTITY,OBJECT-TYPE,OBJECT-IDENTITY,NOTIFICATION-TYPE     
                                        FROM SNMPv2-SMI
        DisplayString,TruthValue        FROM SNMPv2-TC
        MODULE-COMPLIANCE,OBJECT-GROUP,NOTIFICATION-GROUP
                                        FROM SNMPv2-CONF
        InterfaceIndex                  FROM IF-MIB
        VlanId                          FROM Q-BRIDGE-MIB
        dlinkPrimeCommon                FROM DLINK-ID-REC-MIB;


    dlinkPrimeLoopbackDetectMIB MODULE-IDENTITY
        LAST-UPDATED "201404260000Z"
        ORGANIZATION "D-Link Corp."
        CONTACT-INFO
            "        D-Link Corporation

             Postal: No. 289, Sinhu 3rd Rd., Neihu District,
                     Taipei City 114, Taiwan, R.O.C
             Tel:     +886-2-66000123
             E-mail: tsd@dlink.com.tw
            "
        DESCRIPTION
            "This MIB module defines objects for loopback detection."            
            
        REVISION "201404260000Z"
        DESCRIPTION 
            "This is the first version of the MIB file for 'loopback
            detection' functionality."    
        ::= { dlinkPrimeCommon 7 }

-- -----------------------------------------------------------------------------
    Dlink2kVlanList ::=
              OCTET STRING (SIZE (256))
          -- a string of octets containing one bit per VLAN for VLANs 1 
          -- to 2048

-- -----------------------------------------------------------------------------
    dpLbdNotifications    OBJECT IDENTIFIER ::= { dlinkPrimeLoopbackDetectMIB 0 }
    dpLbdObjects          OBJECT IDENTIFIER ::= { dlinkPrimeLoopbackDetectMIB 1 }
    dpLbdConformance      OBJECT IDENTIFIER ::= { dlinkPrimeLoopbackDetectMIB 2 }

    dpLbdCtrlGlobalEnabled    OBJECT-TYPE
        SYNTAX             TruthValue
        MAX-ACCESS         read-write
        STATUS             current
        DESCRIPTION
            "This object indicates whether the loopback detection is enabled
            globally.    
            "             
        ::= { dpLbdObjects 1 }
		
    dpLbdCtrlInterval    OBJECT-TYPE
        SYNTAX          INTEGER (1..32767)
        UNITS           "seconds"
        MAX-ACCESS      read-write
        STATUS          current
        DESCRIPTION
            "This object indicates the interval in seconds at which LBD
            packets are transmitted."
        ::= { dpLbdObjects 2 }	

    dpLbdCtrlRecover    OBJECT-TYPE
        SYNTAX          INTEGER (0|60..1000000)
        UNITS           "seconds"
        MAX-ACCESS      read-write
        STATUS          current
        DESCRIPTION
            "This object indicates the recover in seconds after which LBD
            interface shutdown."
        ::= { dpLbdObjects 3 }	

    dpLbdNotifyEnabled    OBJECT-TYPE
        SYNTAX          TruthValue
        MAX-ACCESS      read-write
        STATUS          current
        DESCRIPTION   
            "Set to 'true' to enable global SNMP notification for loopback detection feature.  
            Setting the object to 'false' will disable SNMP notifications."            
        ::= { dpLbdObjects 4}
                                     
    dpLbdIfCfgTable    OBJECT-TYPE
        SYNTAX        SEQUENCE OF DpLbdIfCfgEntry
        MAX-ACCESS    not-accessible
        STATUS        current
        DESCRIPTION            
            "A list of loopback detection information entries."            
        ::= { dpLbdObjects 5 }

    dpLbdIfCfgEntry    OBJECT-TYPE
        SYNTAX        DpLbdIfCfgEntry
        MAX-ACCESS    not-accessible       
        STATUS        current
        DESCRIPTION            
            "An entry indicates the setting of loopback detection on an
            interface."
        INDEX  { dpLbdIfCfgIndex }
        ::= { dpLbdIfCfgTable 1 }

    DpLbdIfCfgEntry ::= SEQUENCE {
        dpLbdIfCfgIndex      InterfaceIndex,            
        dpLbdIfCfgEnabled    TruthValue,
        dpLbdIfLoopStatus    INTEGER,
        dpLbdIfLoopVlans     DisplayString
    }

    dpLbdIfCfgIndex OBJECT-TYPE
        SYNTAX          InterfaceIndex
        MAX-ACCESS      not-accessible
        STATUS          current
        DESCRIPTION
            "This object indicates the ifIndex of the physical port or port
            channel."
        ::= { dpLbdIfCfgEntry 1 }

    dpLbdIfCfgEnabled OBJECT-TYPE
        SYNTAX      TruthValue        
        MAX-ACCESS  read-write
        STATUS          current
        DESCRIPTION
            "This object indicates whether the loopback detection is enabled on 
            the interface.    
            "             
        ::= { dpLbdIfCfgEntry 2 }

    dpLbdIfLoopStatus    OBJECT-TYPE
        SYNTAX        INTEGER {
            normal(1),
            loop(2)
        }
        MAX-ACCESS    read-only
        STATUS        current
        DESCRIPTION
            "This object indicates whether the interface loopback status."
        ::= { dpLbdIfCfgEntry 3 }

    dpLbdIfLoopVlans    OBJECT-TYPE
        SYNTAX        DisplayString
        MAX-ACCESS    read-only
        STATUS        current
        DESCRIPTION
            "This object indicates the VLAN list that has detected a loopback."
        ::= { dpLbdIfCfgEntry 4 }

-- ----------------------------------------------------------------------------       
    dpLbdVlanCtrlObjects OBJECT-IDENTITY
        STATUS          current
        DESCRIPTION
            "This identifier defines a subtree under which a set of objects are 
            defined to enable loopback detection on specific VLANs. That is, 
            LBD Control packet will be sent out for the VLAN that the port has
            the membership and within the specified VLAN list (the correspondig
            bit is '1'). 
            When enabled VLAN ID list is empty, that is both dpLbdVlanCrlFirst2K
            and dpLbdVlanCrlSecond2K are zero lenth string, LBD Control packet 
            is sent out for all VLANs that the port has the membership."                        
        ::= { dpLbdObjects 6 }
                    
    dpLbdVlanCrlFirst2K  OBJECT-TYPE
        SYNTAX          Dlink2kVlanList
        MAX-ACCESS      read-write
        STATUS          current
        DESCRIPTION
            "This object specifies the loopback detection enabled VLAN in a 
            string of octets containing one bit per VLAN for VLANs 1 to 2048. 
            If the bit is set to '1', then the VLAN is enabled for loopback
            detection."         
        ::= { dpLbdVlanCtrlObjects 1 }
    
    dpLbdVlanCrlSecond2K OBJECT-TYPE
        SYNTAX          Dlink2kVlanList
        MAX-ACCESS      read-write
        STATUS          current
        DESCRIPTION
             "This object specifies the loopback detection enabled VLAN in a 
            string of octets containing one bit per VLAN for VLANs 2049 to 4095. 
            If the bit is set to '1', then the VLAN is enabled for loopback
            detection."     
        ::= { dpLbdVlanCtrlObjects 2 }

-- -----------------------------------------------------------------------------
	
    dpLbdActMode    OBJECT-TYPE
        SYNTAX      INTEGER {           
            shutdown(1),
            none(2)
        }
        MAX-ACCESS  read-write
        STATUS      current
        DESCRIPTION
            "This object indicates the loopback detection action mode.                      
            shundown(1) - When loop has been detected, the port will be shut down (disabled) 
            in port-based mode, the traffic will be block on specific VLAN in VLAN-based mode. 
            This is the default value.
            none(2) - When loop has been detected, the port will NOT be disabled in 
            port-based mode, the traffic will NOT be block on specific VLAN in 
            VLAN-based mode. Just send log and trap."             
        ::= { dpLbdObjects 7 }

-- -----------------------------------------------------------------------------
    dpLbdNotifyInfo    OBJECT-IDENTITY 
        STATUS        current
        DESCRIPTION
            "This identifier is a group for variable bindings for traps."
        ::= { dpLbdObjects 8 }

    dpLbdNotifyInfoIfIndex    OBJECT-TYPE
        SYNTAX        InterfaceIndex
        MAX-ACCESS    accessible-for-notify
        STATUS        current
        DESCRIPTION
            "This object indicates the interface id that has detected a loopback."
        ::= { dpLbdNotifyInfo 1 }

    dpLbdNotifyInfoVlanId    OBJECT-TYPE
        SYNTAX        VlanId
        MAX-ACCESS    accessible-for-notify
        STATUS        current
        DESCRIPTION
            "This object indicates the vlan id that has detected a loopback."
        ::= { dpLbdNotifyInfo 2 }

-- -----------------------------------------------------------------------------

    dpLbdCtrlMode    OBJECT-TYPE
        SYNTAX      INTEGER {           
            portBased(1),
            vlanBased(2)
        }
        MAX-ACCESS  read-write
        STATUS      current
        DESCRIPTION
            "This object indicates the loopback detection mode.                      
            portBased(1) - The loopback detection works in port-based mode.
            vlanBased(2) - The loopback detection works in vlan-based mode."             
        ::= { dpLbdObjects 9 }

-- -----------------------------------------------------------------------------
-- MIB Notifications statements
-- -----------------------------------------------------------------------------
    dpLbdLoopOccurred    NOTIFICATION-TYPE
        OBJECTS    {
            dpLbdNotifyInfoIfIndex
        }
        STATUS        current
        DESCRIPTION
            "This trap is sent when an interface loop occurs."
        ::= { dpLbdNotifications 1 }

    dpLbdLoopRecovery    NOTIFICATION-TYPE
        OBJECTS    {
            dpLbdNotifyInfoIfIndex
        }
        STATUS        current
        DESCRIPTION
            "This trap is sent when an interface loop recovery."
        ::= { dpLbdNotifications 2 }

    dpLbdVlanLoopOccurred    NOTIFICATION-TYPE
        OBJECTS    {
            dpLbdNotifyInfoIfIndex,
            dpLbdNotifyInfoVlanId
        }
        STATUS        current
        DESCRIPTION
            "This trap is sent when an interface with a VID loop occurs."
        ::= { dpLbdNotifications 3 }

    dpLbdVlanLoopRecovery    NOTIFICATION-TYPE
        OBJECTS    {
            dpLbdNotifyInfoIfIndex,
            dpLbdNotifyInfoVlanId
        }
        STATUS        current
        DESCRIPTION
            "This trap is sent when an interface with a VID loop recovery."
        ::= { dpLbdNotifications 4 }

-- -----------------------------------------------------------------------------
-- MIB Conformance statements
-- -----------------------------------------------------------------------------
    dpLbdMIBCompliances  OBJECT IDENTIFIER
        ::= { dpLbdConformance 1 }

    dpLbdMIBGroups  OBJECT IDENTIFIER
        ::= { dpLbdConformance 2 } 
    
    dpLbdMIBCompliance MODULE-COMPLIANCE
        STATUS          current
        DESCRIPTION
            "The compliance statement for entities which implement the 
            DLINKPRIME-LBD-MIB."
        MODULE          -- this module
        MANDATORY-GROUPS    {   
            dpLbdCfgGroup,
            dpLbdIfCfgGroup
        }

        GROUP dpLbdCtrlModeGroup
        DESCRIPTION
            "This group is mandatory if vlan-based mode is supported."  
                                 
        GROUP dpLbdVlanCtrlGroup
        DESCRIPTION
            "This group is mandatory if vlan-based mode is supported."                   
                        
        ::= { dpLbdMIBCompliances 1 }
-- -----------------------------------------------------------------------------        
    dpLbdCfgGroup OBJECT-GROUP
        OBJECTS { 
            dpLbdCtrlInterval, 
            dpLbdCtrlGlobalEnabled,
            dpLbdActMode,
            dpLbdNotifyEnabled,
            dpLbdNotifyInfoIfIndex,
            dpLbdNotifyInfoVlanId
        }
        STATUS current
        DESCRIPTION 
            "A collection of objects providing management of the loopback 
            detection feature."
        ::= { dpLbdMIBGroups 1 }

    dpLbdIfCfgGroup 	OBJECT-GROUP
        OBJECTS { 
            dpLbdIfCfgEnabled,
            dpLbdIfLoopStatus,
            dpLbdIfLoopVlans
        }
        STATUS current
        DESCRIPTION
            "A collection of objects providing the per-interface control of
            loopback detection."
        ::= { dpLbdMIBGroups 2 }	

    dpLbdCtrlModeGroup 	OBJECT-GROUP
        OBJECTS { 
            dpLbdCtrlMode
        }
        STATUS current
        DESCRIPTION
            "A collection of objects providing the mode of loopback detection."
        ::= { dpLbdMIBGroups 3 }			
			
    dpLbdVlanCtrlGroup OBJECT-GROUP
        OBJECTS { 
            dpLbdVlanCrlFirst2K, 
            dpLbdVlanCrlSecond2K 			
        }
        STATUS current
        DESCRIPTION 
            "A collection of objects providing the VLAN list of loopback
            detection."
        ::= { dpLbdMIBGroups 4 }

    dpLbdNotificationGroup    NOTIFICATION-GROUP
        NOTIFICATIONS    {
            dpLbdLoopOccurred,
            dpLbdLoopRecovery,
            dpLbdVlanLoopOccurred,
            dpLbdVlanLoopRecovery
        }
        STATUS current
        DESCRIPTION
            "A collection of notifications used for monitoring the hosts under the 
            control of loopback detection."
        ::= { dpLbdMIBGroups 5 }
   
END
