-- =========================================================================
-- Copyright (c) 2004-2023 New H3C Tech.  Co., Ltd.  All rights reserved.
--
-- Description: This file describes various common MIB objects implemented
-- by both Routers and Switches.
-- Reference: VRRP-MIB
-- Version: V1.3
-- History:
--      V1.0 2004-12-09
--        Initial version
--      V1.1 2021-07-19 updated by wangmeng
--        Add state change Trap
--      V1.2 2022-05-11 Add VRRPv3 error traps by zhengjun
--      V1.3 2023-02-10 Add VRRP MAC address configuration failure trap by zhengjun
-- =========================================================================
HH3C-VRRP-EXT-MIB DEFINITIONS ::= BEGIN

    IMPORTS
        MODULE-IDENTITY, OBJECT-TYPE,NOTIFICATION-TYPE, Integer32
            FROM SNMPv2-SMI

        DisplayString,RowStatus,MacAddress
            FROM SNMPv2-TC

        ifIndex, InterfaceIndex
            FROM IF-MIB

        vrrpOperVrId
            FROM VRRP-MIB

        hh3cCommon
            FROM HH3C-OID-MIB;


hh3cVrrpExt MODULE-IDENTITY
    LAST-UPDATED "202302101501Z"
    ORGANIZATION
        "New H3C Technologies Co., Ltd."
    CONTACT-INFO
        "No.466 Changhe Road, Binjiang District, Hangzhou, Zhejiang
         http://www.h3c.com
         Zip: 310052
         "
    DESCRIPTION
        "This MIB describes objects used for managing Virtual Router
        Redundancy Protocol (VRRP) routers."
    REVISION
        "202302101501Z"
    DESCRIPTION
        "Add the traps for configuring virtual MAC addresses for VRRP groups."
    REVISION
        "202205111505Z"
    DESCRIPTION
        "Add VRRPv3 error traps."
    REVISION
        "202107190000Z"
    DESCRIPTION
        "Add state change Trap."
    ::= { hh3cCommon 24 }


-- ===================================================================
--  Start of MIB objects
-- ===================================================================

hh3cVrrpExtMibObject      OBJECT IDENTIFIER ::= { hh3cVrrpExt 1 }

-- ===================================================================
--  VRRP EXT Table
-- ===================================================================

hh3cVrrpExtTable OBJECT-TYPE
    SYNTAX       SEQUENCE OF Hh3cVrrpExtEntry
    MAX-ACCESS   not-accessible
    STATUS       current
    DESCRIPTION
        "Table extends for a VRRP router which consists of a
        sequence (i.e., one or more conceptual rows) of
        hh3cVrrpExtEntry items."
    ::= { hh3cVrrpExtMibObject 1 }

hh3cVrrpExtEntry OBJECT-TYPE
    SYNTAX       Hh3cVrrpExtEntry
    MAX-ACCESS   not-accessible
    STATUS       current
    DESCRIPTION
        "An entry in the hh3cVrrpExtTable containing the status
        values of a virtual router."
    INDEX    { ifIndex, vrrpOperVrId, hh3cVrrpExtTrackInterface }
    ::= { hh3cVrrpExtTable 1 }

Hh3cVrrpExtEntry ::=
    SEQUENCE {
     hh3cVrrpExtTrackInterface
        Integer32,
     hh3cVrrpExtPriorityReduce
        Integer32,
     hh3cVrrpExtRowStatus
        RowStatus
}

hh3cVrrpExtTrackInterface OBJECT-TYPE
    SYNTAX Integer32 (0..2147483647)
    MAX-ACCESS not-accessible
    STATUS current
    DESCRIPTION
        "This value is the ifIndex that identifies which interface
        the virtual router tracked."
    ::= { hh3cVrrpExtEntry 1 }

hh3cVrrpExtPriorityReduce  OBJECT-TYPE
    SYNTAX       Integer32 (1..255)
    MAX-ACCESS   read-create
    STATUS       current
    DESCRIPTION
        "This value identifies how much priority of a virtual router
        will be reduced/increased when the interface tracked is down/up."
    DEFVAL { 10 }
    ::= { hh3cVrrpExtEntry 2 }

hh3cVrrpExtRowStatus OBJECT-TYPE
    SYNTAX       RowStatus
    MAX-ACCESS   read-create
    STATUS       current
    DESCRIPTION
        "The row status variable, used according to installation
        and removal conventions for conceptual rows. Setting this
        object to active(1) or createAndGo(4) results in the
        addition of the ifIndex tracked by a virtual router.
        Destroying the entry removes the tracked ifIndex from the
        virtual router. Other values is not supported now."
    ::= { hh3cVrrpExtEntry 3 }

-- trap --
hh3cVrrpExtTrap      OBJECT IDENTIFIER ::= { hh3cVrrpExt 2 }

hh3cVrrpTrapPrex OBJECT IDENTIFIER ::= { hh3cVrrpExtTrap 0 }

hh3cVrrpExtStateChange NOTIFICATION-TYPE
    OBJECTS
        {
            hh3cVrrpExtVrId,
            hh3cVrrpExtIpAddressType,
            hh3cVrrpExtIfIndex,
            hh3cVrrpExtIfDescr,
            hh3cVrrpExtOldState,
            hh3cVrrpExtNewState,
            hh3cVrrpExtStateChangeReason
        }
    STATUS       current
    DESCRIPTION
        "This trap indicates that the sending agent VRRP state has changed."
    ::= { hh3cVrrpTrapPrex 1 }

hh3cVrrpExtV3ProtoError NOTIFICATION-TYPE
    OBJECTS
        {
            hh3cVrrpExtVrId,
            hh3cVrrpExtIpAddressType,
            hh3cVrrpExtIfIndex,
            hh3cVrrpExtIfDescr
        }
    STATUS       current
    DESCRIPTION
        "This trap indicates that the VRRP received a protocol error packet."
    ::= { hh3cVrrpTrapPrex 2 }

hh3cVrrpExtAddVirtualMacFailed NOTIFICATION-TYPE
    OBJECTS
        {
            hh3cVrrpExtVrId,
            hh3cVrrpExtIpAddressType,
            hh3cVrrpExtIfIndex,
            hh3cVrrpExtIfDescr,
            hh3cVrrpExtIfLipAddr,
            hh3cVrrpExtVirtualMac
        }
    STATUS       current
    DESCRIPTION
        "This trap indicates failure to add a virtual MAC address for a VRRP group."
    ::= { hh3cVrrpTrapPrex 3 }

-- All objects used for trap only are defined here.
hh3cVrrpExtTrapOjbects OBJECT IDENTIFIER ::= { hh3cVrrpExtTrap 1 }

hh3cVrrpExtVrId OBJECT-TYPE
    SYNTAX Integer32 (1..255)
    MAX-ACCESS accessible-for-notify
    STATUS current
    DESCRIPTION
        "This object contains the Virtual Router Identifier (VRID)."
    ::= { hh3cVrrpExtTrapOjbects 1 }

hh3cVrrpExtIpAddressType OBJECT-TYPE
    SYNTAX       INTEGER {
        ipv4(1),
        ipv6(2)
    }
    MAX-ACCESS   accessible-for-notify
    STATUS       current
    DESCRIPTION
        "IP address type of VRRP.
         ipv4: IPv4 type.
         ipv6: IPv6 type."
    ::= { hh3cVrrpExtTrapOjbects 2 }

hh3cVrrpExtIfIndex OBJECT-TYPE
    SYNTAX InterfaceIndex
    MAX-ACCESS accessible-for-notify
    STATUS current
    DESCRIPTION
        "This value is the ifIndex that identifies the interface configured for
         the virtual router."
    ::= { hh3cVrrpExtTrapOjbects 3 }

hh3cVrrpExtIfDescr OBJECT-TYPE
    SYNTAX      DisplayString (SIZE(0..255))
    MAX-ACCESS accessible-for-notify
    STATUS current
    DESCRIPTION
        "This value is the interface decription that identifies the interface
        configured for the virtual router."
    ::= { hh3cVrrpExtTrapOjbects 4 }

hh3cVrrpExtOldState OBJECT-TYPE
    SYNTAX       INTEGER {
     initialize(1),
     backup(2),
     master(3)
    }
    MAX-ACCESS   accessible-for-notify
    STATUS       current

    DESCRIPTION
        "The current state of the virtual router. This object has
        three defined values:

        - `initialize', which indicates that the
         virtual router is waiting for a startup event.

        - `backup', which indicates the virtual router is
         monitoring the availability of the master router.

        - `master', which indicates that the virtual router
         is forwarding packets for IP addresses that are
         associated with this router."
    ::= { hh3cVrrpExtTrapOjbects 5 }

hh3cVrrpExtNewState OBJECT-TYPE
    SYNTAX       INTEGER {
         initialize(1),
         backup(2),
         master(3)
    }
    MAX-ACCESS   accessible-for-notify
    STATUS       current

    DESCRIPTION
        "The current state of the virtual router. This object has
        three defined values:

        - `initialize', which indicates that the
         virtual router is waiting for a startup event.

        - `backup', which indicates the virtual router is
         monitoring the availability of the master router.

        - `master', which indicates that the virtual router
         is forwarding packets for IP addresses that are
         associated with this router."
    ::= { hh3cVrrpExtTrapOjbects 6 }

hh3cVrrpExtStateChangeReason OBJECT-TYPE
    SYNTAX Integer32 (0..12)
    MAX-ACCESS accessible-for-notify
    STATUS current
    DESCRIPTION
        "Reason why VRRP state changed,
         0: other reason.
         1: Timer expired.
         2: Adding virtual MAC address failed.
         3: Interface event received.
         4: IP address deleted.
         5: The status of the tracked object changed.
         6: VRRP packet received.
         7: Current device has changed to IP address owner.
         8: Insufficient hardware resources.
         9: Master-down-timer expired.
         10: Zero priority packet received.
         11: Preempt.
         12: Master group drove."
    ::= { hh3cVrrpExtTrapOjbects 7 }

hh3cVrrpExtIfLipAddr OBJECT-TYPE
    SYNTAX Integer32 (0..65535)
    MAX-ACCESS accessible-for-notify
    STATUS current
    DESCRIPTION
        "This value is the interface index of the node that identifies
         the interface configured for the virtual router."
    ::= { hh3cVrrpExtTrapOjbects 8 }

hh3cVrrpExtVirtualMac OBJECT-TYPE
    SYNTAX MacAddress
    MAX-ACCESS accessible-for-notify
    STATUS current
    DESCRIPTION
        "This value is the MAC address that identifies the interface
         configured for the virtual router."
    ::= { hh3cVrrpExtTrapOjbects 9 }
END
