ELTEX-DHCP DEFINITIONS ::= BEGIN

-- Title:      ELTEX DHCP Extension Private
-- Version:    1.0
-- Date:       10-Nov-2020

IMPORTS
    MODULE-IDENTITY, OBJECT-TYPE, IpAddress,
                                  Counter32         FROM SNMPv2-SMI
    eltMesDhcp                                      FROM ELTEX-MES
    VlanList1, VlanList2, VlanList3, VlanList4      FROM RADLAN-BRIDGEMIBOBJECTS-MIB
    TEXTUAL-CONVENTION                              FROM SNMPv2-TC
    InterfaceIndexOrZero                            FROM IF-MIB
    rlDhcpRelayNextServerEntry,
    rlDhcpRelayInterfaceEntry                       FROM RADLAN-DHCP-MIB;

EltDhcpRelayPacketType ::= TEXTUAL-CONVENTION
   STATUS current
   DESCRIPTION    "Different types of packets may be received by DHCP relay."
   SYNTAX INTEGER {
      discover(1),
      offer(2),
      request(3),
      decline(4),
      ack(5),
      nak(6),
      release(7),
      inform(8)
}
--
-- DHCP Relay
--
eltMesDhcpRelay OBJECT IDENTIFIER ::= { eltMesDhcp 1 }

--
-- DHCP Relay server table
--
eltDhcpRelayNextServerTable OBJECT-TYPE
    SYNTAX      SEQUENCE OF EltDhcpRelayNextServerEntry
    MAX-ACCESS read-write
    STATUS current
    DESCRIPTION
        "The DHCP Relay Next Servers configuration Table."
    ::= { eltMesDhcpRelay 4 }

eltDhcpRelayNextServerEntry OBJECT-TYPE
    SYNTAX      EltDhcpRelayNextServerEntry
    MAX-ACCESS  read-write
    STATUS  current
    DESCRIPTION
        "The row definition for this table.
        Parameters of DHCP requests are relayed to the
        specified next server according to vlan interface."
    AUGMENTS    { rlDhcpRelayNextServerEntry }
    ::= { eltDhcpRelayNextServerTable 1 }

EltDhcpRelayNextServerEntry ::= SEQUENCE {
    eltDhcpRelayNextServerListVlanId1To1024      VlanList1,
    eltDhcpRelayNextServerListVlanId1025To2048   VlanList2,
    eltDhcpRelayNextServerListVlanId2049To3072   VlanList3,
    eltDhcpRelayNextServerListVlanId3073To4094   VlanList4
}

eltDhcpRelayNextServerListVlanId1To1024 OBJECT-TYPE
    SYNTAX  VlanList1
    MAX-ACCESS  read-write
    STATUS  current
    DESCRIPTION
       " DHCP relay server VlanId List 1."
    ::= { eltDhcpRelayNextServerEntry 1 }

eltDhcpRelayNextServerListVlanId1025To2048 OBJECT-TYPE
    SYNTAX  VlanList2
    MAX-ACCESS  read-write
    STATUS  current
    DESCRIPTION
       " DHCP relay server VlanId List 2."
    ::= { eltDhcpRelayNextServerEntry 2 }

eltDhcpRelayNextServerListVlanId2049To3072 OBJECT-TYPE
    SYNTAX  VlanList3
    MAX-ACCESS  read-write
    STATUS  current
    DESCRIPTION
       " DHCP relay server VlanId List 3."
    ::= { eltDhcpRelayNextServerEntry 3 }

eltDhcpRelayNextServerListVlanId3073To4094 OBJECT-TYPE
    SYNTAX  VlanList4
    MAX-ACCESS  read-write
    STATUS  current
    DESCRIPTION
       " DHCP relay server VlanId List 4."
    ::= { eltDhcpRelayNextServerEntry 4 }

--
-- DHCP Relay Interface Table
--

eltDhcpRelayInterfaceTable OBJECT-TYPE
    SYNTAX      SEQUENCE OF EltDhcpRelayInterfaceEntry
    MAX-ACCESS  read-write
    STATUS  current
    DESCRIPTION
        "The enabled DHCP Relay Interface Table."
    ::= { eltMesDhcpRelay 5 }

eltDhcpRelayInterfaceEntry OBJECT-TYPE
    SYNTAX      EltDhcpRelayInterfaceEntry
    MAX-ACCESS  read-write
    STATUS  current
    DESCRIPTION
        "The row definition for this table.  The user can add entry when DHCP relay is enabled on Interface."
    AUGMENTS    { rlDhcpRelayInterfaceEntry }
    ::= { eltDhcpRelayInterfaceTable 1 }

EltDhcpRelayInterfaceEntry ::= SEQUENCE {
    eltDhcpRelayInterfaceGatewayAddr    IpAddress
}

eltDhcpRelayInterfaceGatewayAddr OBJECT-TYPE
    SYNTAX      IpAddress
    MAX-ACCESS  read-write
    STATUS  current
    DESCRIPTION
       "Gateway ip address per interface."
    DEFVAL {'00000000'H}
    ::= { eltDhcpRelayInterfaceEntry 1 }

--
-- DHCP Relay Statistics
--

eltDhcpRelayStats OBJECT IDENTIFIER ::= { eltMesDhcpRelay 6 }

--
-- DHCP Relay packets type statistic Table
--

eltDhcpRelayStatsPacketsTable OBJECT-TYPE
    SYNTAX           SEQUENCE OF EltDhcpRelayStatsPacketsEntry
    MAX-ACCESS       not-accessible
    STATUS           current
    DESCRIPTION
        "DHCP Relay packet statistics table"
    ::= { eltDhcpRelayStats 1 }
    
eltDhcpRelayStatsPacketsEntry OBJECT-TYPE
    SYNTAX      EltDhcpRelayStatsPacketsEntry
    MAX-ACCESS  not-accessible
    STATUS      current
    DESCRIPTION
        "An entry in the DHCP Relay packet statistics table"
    INDEX { eltDhcpRelayStatsPacketsIfIndex, eltDhcpRelayStatsPacketsType }
    ::= { eltDhcpRelayStatsPacketsTable 1 }
    
EltDhcpRelayStatsPacketsEntry ::= SEQUENCE {
    eltDhcpRelayStatsPacketsIfIndex      InterfaceIndexOrZero,
    eltDhcpRelayStatsPacketsType         EltDhcpRelayPacketType,
    eltDhcpRelayStatsPacketsReceived     Counter32,
    eltDhcpRelayStatsPacketsRelayed      Counter32,
    eltDhcpRelayStatsPacketsDropped      Counter32
}

eltDhcpRelayStatsPacketsIfIndex OBJECT-TYPE
    SYNTAX                          InterfaceIndexOrZero
    MAX-ACCESS                      not-accessible
    STATUS                          current
    DESCRIPTION
        "Interface index."
    ::= { eltDhcpRelayStatsPacketsEntry 1 }

eltDhcpRelayStatsPacketsType OBJECT-TYPE
    SYNTAX                          EltDhcpRelayPacketType
    MAX-ACCESS                      not-accessible
    STATUS                          current
    DESCRIPTION
        "Type of DHCP packet: 1=DISCOVER, 2=OFFER, 3=REQUEST, 4=DECLINE, 5=ACK, 6=NAK, 7=RELEASE, 8=INFORM."
    ::= { eltDhcpRelayStatsPacketsEntry 2 }

eltDhcpRelayStatsPacketsReceived OBJECT-TYPE
    SYNTAX                   Counter32
    MAX-ACCESS               read-only
    STATUS                   current
    DESCRIPTION
        "The number of packets with eltDhcpRelayStatsPacketsType received on the interface.
         For a valid entry: Received = Relayed + Dropped."
    ::= { eltDhcpRelayStatsPacketsEntry 3 }
    
eltDhcpRelayStatsPacketsRelayed OBJECT-TYPE
    SYNTAX                   Counter32
    MAX-ACCESS               read-only
    STATUS                   current
    DESCRIPTION
        "The number of packets with eltDhcpRelayStatsPacketsType successfully relayed
         further by the agent."
    ::= { eltDhcpRelayStatsPacketsEntry 4 }
    
eltDhcpRelayStatsPacketsDropped OBJECT-TYPE
    SYNTAX                   Counter32
    MAX-ACCESS               read-only
    STATUS                   current
    DESCRIPTION
        "The number of packets with eltDhcpRelayStatsPacketsType dropped on the interface.
         This count SHOULD include all drops, regardless of the reason."
    ::= { eltDhcpRelayStatsPacketsEntry 5 }

--
-- DHCP Relay drop reasons statistic Table
--

eltDhcpRelayStatsDropReasonsTable OBJECT-TYPE
    SYNTAX        SEQUENCE OF EltDhcpRelayStatsDropReasonsEntry
    MAX-ACCESS    not-accessible
    STATUS        current
    DESCRIPTION
        "DHCP Relay drop reasons table. This table provides a
         detailed breakdown of why packets were dropped, per interface."
    ::= { eltDhcpRelayStats 2 }
    
eltDhcpRelayStatsDropReasonsEntry OBJECT-TYPE
    SYNTAX      EltDhcpRelayStatsDropReasonsEntry
    MAX-ACCESS  not-accessible
    STATUS      current
    DESCRIPTION
        "An entry in the DHCP Relay drop reasons table, containing
         counters for different drop reasons on a specific interface."
    INDEX { eltDhcpRelayStatsDropIfIndex }
    ::= { eltDhcpRelayStatsDropReasonsTable 1 }
    
EltDhcpRelayStatsDropReasonsEntry ::= SEQUENCE {
    eltDhcpRelayStatsDropIfIndex           InterfaceIndexOrZero,
    eltDhcpRelayStatsDropRelayInactive     Counter32,
    eltDhcpRelayStatsDropSameL2            Counter32,
    eltDhcpRelayStatsDropMyGiaddr          Counter32,
    eltDhcpRelayStatsDropMaxHops           Counter32,
    eltDhcpRelayStatsDropNullGiaddr        Counter32,
    eltDhcpRelayStatsDropForeignGiaddr     Counter32,
    eltDhcpRelayStatsDropIllegalBroadcast  Counter32,
    eltDhcpRelayStatsDropNoOutputInterface Counter32,
    eltDhcpRelayStatsDropWrongMode         Counter32,
    eltDhcpRelayStatsDropOpt82Failed       Counter32,
    eltDhcpRelayStatsDropOther             Counter32
}

eltDhcpRelayStatsDropIfIndex OBJECT-TYPE
    SYNTAX                          InterfaceIndexOrZero
    MAX-ACCESS                      not-accessible
    STATUS                          current
    DESCRIPTION
        "Interface index."
    ::= { eltDhcpRelayStatsDropReasonsEntry 1 }

eltDhcpRelayStatsDropRelayInactive OBJECT-TYPE
    SYNTAX      Counter32
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION
        "Count of packets dropped because DHCP Relay functionality
         is not active on the receiving interface (both directions)."
    ::= { eltDhcpRelayStatsDropReasonsEntry 2 }
    
eltDhcpRelayStatsDropSameL2 OBJECT-TYPE
    SYNTAX      Counter32
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION
        "Number of DHCP packets dropped because the target DHCP
         server is on the same L2 segment as the client.
         No relaying is needed (Client->Server)."
    ::= { eltDhcpRelayStatsDropReasonsEntry 3 }
    
eltDhcpRelayStatsDropMyGiaddr OBJECT-TYPE
    SYNTAX      Counter32
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION
        "Count of DHCP request packets dropped because the packet
         already contains the IP address of this relay agent in
         the 'giaddr' field (Client->Server)."
    ::= { eltDhcpRelayStatsDropReasonsEntry 4 }    
    
eltDhcpRelayStatsDropMaxHops OBJECT-TYPE
    SYNTAX      Counter32
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION
        "Count of DHCP request packets dropped because the packet
         has been relayed through too many agents (hops),
         exceeding the configured maximum limit (Client->Server)."
    ::= { eltDhcpRelayStatsDropReasonsEntry 5 }
    
eltDhcpRelayStatsDropNullGiaddr OBJECT-TYPE
    SYNTAX      Counter32
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION
        "Count of DHCP reply packets dropped because the relay
         agent cannot identify which network segment to forward
         the reply to (the 'giaddr' (gateway IP address) field is 
         zero) (Server->Client)."
    ::= { eltDhcpRelayStatsDropReasonsEntry 6 }
    
eltDhcpRelayStatsDropForeignGiaddr OBJECT-TYPE
    SYNTAX      Counter32
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION
        "Count of DHCP request packets dropped because the
         'giaddr' field contains an IP address not owned
         by this relay agent, indicating a misconfigured
         loop or rogue relay (Client->Server)."
    ::= { eltDhcpRelayStatsDropReasonsEntry 7 }
    

eltDhcpRelayStatsDropIllegalBroadcast OBJECT-TYPE
    SYNTAX      Counter32
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION
        "Count of DHCP reply packets dropped because the assigned
         client address ('yiaddr') contains an invalid or
         unsupported broadcast address format (Server->Client)."
    ::= { eltDhcpRelayStatsDropReasonsEntry 8 }
    
eltDhcpRelayStatsDropNoOutputInterface OBJECT-TYPE
    SYNTAX      Counter32
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION
        "Count of packets dropped because the relay agent could
         not resolve an egress interface for forwarding.
         Common causes: invalid giaddr, failed VLAN mapping,
         or missing routing information (Both directions)."
    ::= { eltDhcpRelayStatsDropReasonsEntry 9 }
    
eltDhcpRelayStatsDropWrongMode OBJECT-TYPE
    SYNTAX      Counter32
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION
        "Count of packets dropped due to the interface not
         configured in IP mode, and the absence of Option 82
         in the packet (Server->Client)."
    ::= { eltDhcpRelayStatsDropReasonsEntry 10 }
    
eltDhcpRelayStatsDropOpt82Failed OBJECT-TYPE
    SYNTAX      Counter32
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION
        "Count of packets dropped due to a critical failure
         in processing DHCP Option 82 (Relay Agent Information)
         (Both directions)."
    ::= { eltDhcpRelayStatsDropReasonsEntry 11 }

eltDhcpRelayStatsDropOther OBJECT-TYPE
    SYNTAX      Counter32
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION
        "Count of packets dropped for other miscellaneous reasons,
         such as malformed DHCP headers, invalid interface states,
         or internal system errors (Both directions)."
    ::= { eltDhcpRelayStatsDropReasonsEntry 12 }

--
-- DHCP Relay clear statistic Table
--

eltDhcpRelayClearStatistics OBJECT-TYPE
    SYNTAX      InterfaceIndexOrZero
    MAX-ACCESS  read-write
    STATUS      current
    DESCRIPTION 
        "Write an interface index to clear DHCP Relay statistics
         and drop reasons statistics for that specific interface.
         Write 0 to clear DHCP Relay statistics and drop reasons
         statistics for all interfaces."
    DEFVAL       { 0 }
    ::= { eltMesDhcpRelay 7 }

-- 
-- DHCP Route
-- 

eltDhcpRouteType OBJECT-TYPE
    SYNTAX INTEGER  {
        none(0),
        connected(1),
        static(2)
    }
    MAX-ACCESS      read-write
    STATUS          current
    DESCRIPTION
        "The type of route with which it's added to route table"
    DEFVAL { none }
    ::= { eltMesDhcp 3 }

END

