-- iVN Endpoint MIB (Draft)

IVN-ENDPOINT-MIB DEFINITIONS ::= BEGIN

IMPORTS
    MODULE-IDENTITY, OBJECT-TYPE, Unsigned32, Integer32, TimeTicks
        FROM SNMPv2-SMI                 -- [RFC2578]
    DateAndTime, DisplayString, TruthValue
        FROM SNMPv2-TC                  -- [RFC2579]
    SnmpAdminString
        FROM SNMP-FRAMEWORK-MIB         -- [RFC3411]
    MODULE-COMPLIANCE, OBJECT-GROUP
        FROM SNMPv2-CONF                -- [RFC2580]
    iPhoiVNManagement
        FROM IPHOTONIX-SMI-MIB;

endpointMIB MODULE-IDENTITY
    LAST-UPDATED "201709260000Z"  -- September 26, 2017
    ORGANIZATION "iPhotonix"
    CONTACT-INFO
          "support@iphotonix.com"
    DESCRIPTION
        "The Endpoints module provides SNMP access to passively
         monitor any existing iVN endpoints."
    REVISION    "201709260000Z"  -- September 26, 2017
    DESCRIPTION
        "Initial version."
    ::= { iPhoiVNManagement 2 }

endpointObjects OBJECT IDENTIFIER ::= { endpointMIB 1 }

endpoints  OBJECT IDENTIFIER ::= { endpointObjects 1 }

endpointPorts  OBJECT IDENTIFIER ::= { endpointObjects 2 }


-- Endpoints Table --

endpointTableLastChanged  OBJECT-TYPE
   SYNTAX      TimeTicks
   MAX-ACCESS  read-only
   STATUS      current
   DESCRIPTION
      "The value of sysUpTime at the time the table was last updated."
   ::= { endpoints 1 }

endpointTable OBJECT-TYPE
   SYNTAX      SEQUENCE OF EndpointEntry
   MAX-ACCESS  not-accessible
   STATUS      current
   DESCRIPTION
       "A table of Endpoint entries"
   ::= { endpoints 2 }

endpointEntry OBJECT-TYPE
   SYNTAX      EndpointEntry
   MAX-ACCESS  not-accessible
   STATUS      current
   DESCRIPTION
       "Entries appear in this table when endpoints appear.  They
        are removed when the endpoint is removed."
   INDEX       { endpointIndex }
   ::= { endpointTable 1 }

EndpointEntry ::= SEQUENCE {
   endpointIndex                 Unsigned32,
   endpointDateAndTime           DateAndTime,
   endpointName                  SnmpAdminString,
   endpointBundleName            SnmpAdminString,
   endpointEnabled               TruthValue,
   endpointType                  INTEGER,
   endpointLostContact           DateAndTime,
   endpointLastRestartReason     SnmpAdminString,
   endpointWANLinkStatus         INTEGER,
   endpointDeviceBootTime        DateAndTime,
   endpointDeviceSerialNumber    DisplayString,

   endpointSoftwareVersion       DisplayString,
   endpointModelNumber           DisplayString,
   endpointConnectionType        INTEGER,
   endpointOpticalSignalTX       Integer32,
   endpointOpticalSignalRX       Integer32
   }

endpointIndex OBJECT-TYPE
   SYNTAX     Unsigned32 (1..4294967295)
   MAX-ACCESS not-accessible
   STATUS     current
   DESCRIPTION
       "A strictly monotonically increasing integer which
       acts as the index of entries within the endpoint
       list.  It wraps back to 1 after it reaches its
       maximum value."
   ::= { endpointEntry 1 }

endpointDateAndTime OBJECT-TYPE
   SYNTAX      DateAndTime
   MAX-ACCESS  read-only
   STATUS      current
   DESCRIPTION
       "The local date and time when the endpoint first appeared.

       Implementations MUST include the offset from UTC,
       if available.  Implementation in environments in which
       the UTC offset is not available is NOT RECOMMENDED."
   ::= { endpointEntry 2 }

endpointName    OBJECT-TYPE
   SYNTAX      SnmpAdminString
   MAX-ACCESS  read-only
   STATUS      current
   DESCRIPTION
      "Endpoint name."
  ::= { endpointEntry 3 }

endpointBundleName    OBJECT-TYPE
   SYNTAX      SnmpAdminString
   MAX-ACCESS  read-only
   STATUS      current
   DESCRIPTION
      "Bundle name containing this endpoint"
  ::= { endpointEntry 4 }

endpointEnabled    OBJECT-TYPE
   SYNTAX      TruthValue
   MAX-ACCESS  read-only
   STATUS      current
   DESCRIPTION
      "Endpoint is enabled"
  ::= { endpointEntry 5 }

endpointType    OBJECT-TYPE
   SYNTAX      INTEGER { unknown(1), remote(2), innetwork(3) }
   MAX-ACCESS  read-only
   STATUS      current
   DESCRIPTION
      "Endpoint type (Unknown/Remote/InNetwork)."
  ::= { endpointEntry 6 }

endpointLostContact    OBJECT-TYPE
   SYNTAX      DateAndTime
   MAX-ACCESS  read-only
   STATUS      current
   DESCRIPTION
      "Time when contact was lost with the endpoint (or null).

       Implementations MUST include the offset from UTC,
       if available.  Implementation in environments in which
       the UTC offset is not available is NOT RECOMMENDED."
  ::= { endpointEntry 7 }

endpointLastRestartReason    OBJECT-TYPE
   SYNTAX      SnmpAdminString
   MAX-ACCESS  read-only
   STATUS      current
   DESCRIPTION
      "Endpoint last restart reason."
  ::= { endpointEntry 8 }

endpointWANLinkStatus    OBJECT-TYPE
   SYNTAX      INTEGER { unknown(1), up(2), down(3) }
   MAX-ACCESS  read-only
   STATUS      current
   DESCRIPTION
      "Endpoint WAN link status (unknown/up/down)"
  ::= { endpointEntry 9 }

endpointDeviceBootTime    OBJECT-TYPE
   SYNTAX      DateAndTime
   MAX-ACCESS  read-only
   STATUS      current
   DESCRIPTION
      "Endpoint device boot time.

       Implementations MUST include the offset from UTC,
       if available.  Implementation in environments in which
       the UTC offset is not available is NOT RECOMMENDED."
  ::= { endpointEntry 10 }

endpointDeviceSerialNumber    OBJECT-TYPE
   SYNTAX      DisplayString
   MAX-ACCESS  read-only
   STATUS      current
   DESCRIPTION
      "Device serial number"
  ::= { endpointEntry 11 }

endpointSoftwareVersion    OBJECT-TYPE
   SYNTAX      DisplayString
   MAX-ACCESS  read-only
   STATUS      current
   DESCRIPTION
      "Device software version"
  ::= { endpointEntry 12 }

endpointModelNumber    OBJECT-TYPE
   SYNTAX      DisplayString
   MAX-ACCESS  read-only
   STATUS      current
   DESCRIPTION
      "Device model number"
  ::= { endpointEntry 13 }

endpointConnectionType    OBJECT-TYPE
   SYNTAX      INTEGER { unknown(1), gpon(2), activeethernet(3) }
   MAX-ACCESS  read-only
   STATUS      current
   DESCRIPTION
      "Endpoint WAN connection type."
  ::= { endpointEntry 14 }

endpointOpticalSignalTX  OBJECT-TYPE
   SYNTAX     Integer32 (-2147483648..2147483647)
   MAX-ACCESS read-only
   STATUS     current
   DESCRIPTION
       "Optical transmit signal power (dbmW).  This is only applicable
        for optical connection types."

   ::= { endpointEntry 15 }

endpointOpticalSignalRX  OBJECT-TYPE
   SYNTAX     Integer32 (-2147483648..2147483647)
   MAX-ACCESS read-only
   STATUS     current
   DESCRIPTION
       "Optical receive signal power (dbmW).  This is only applicable
        for optical connection types."
   ::= { endpointEntry 16 }


-- The Endpoint Ports table is subordinate to Endpoint table
--
-- SNMP does not support tables within tables so a subordinate table
-- is emulated via an index comprised of endpoint and endpoint port.
--
-- https://stackoverflow.com/questions/2510211/snmp-asn-1-mib-definitions-referencing-a-table-within-a-table

endpointPortTable OBJECT-TYPE
    SYNTAX       SEQUENCE OF EndpointPortEntry
    MAX-ACCESS   not-accessible
    STATUS       current
    DESCRIPTION  "A table of Endpoint Port entries"
    ::= { endpointPorts 1 }

endpointPortEntry OBJECT-TYPE
    SYNTAX       EndpointPortEntry
    MAX-ACCESS   not-accessible
    STATUS       current
    DESCRIPTION  "Entry in Endpoint Port table"
    INDEX        { endpointIndex,
                   endpointPortIndex }
    ::= { endpointPortTable 1 }

EndpointPortEntry ::= SEQUENCE {
    endpointPortIndex           Unsigned32,
    endpointPortStatus          INTEGER,
    endpointPortName            SnmpAdminString,
    endpointPortPOEPowerUsage   Unsigned32
    }

endpointPortIndex OBJECT-TYPE
   SYNTAX     Unsigned32 (1..4294967295)
   MAX-ACCESS not-accessible
   STATUS     current
   DESCRIPTION
       "A strictly monotonically increasing integer which
       acts as the index of entries within the endpoint
       port list.  It wraps back to 1 after it reaches its
       maximum value."
   ::= { endpointPortEntry 1 }

endpointPortStatus    OBJECT-TYPE
   SYNTAX      INTEGER { unknown(1), up(2), down(3) }
   MAX-ACCESS  read-only
   STATUS      current
   DESCRIPTION
      "Port status (up/down)"
  ::= { endpointPortEntry 2 }

endpointPortName    OBJECT-TYPE
   SYNTAX      SnmpAdminString
   MAX-ACCESS  read-only
   STATUS      current
   DESCRIPTION
      "Port name/description"
  ::= { endpointPortEntry 3 }

endpointPortPOEPowerUsage    OBJECT-TYPE
   SYNTAX      Unsigned32
   MAX-ACCESS  read-only
   STATUS      current
   DESCRIPTION
      "Port Power Over Ethernet (POE) usage (in units of 0.1 Watts)"
  ::= { endpointPortEntry 4 }

-- Conformance

endpointConformance OBJECT IDENTIFIER ::= { endpointMIB 2 }

endpointCompliances OBJECT IDENTIFIER ::= { endpointConformance 1 }

endpointCompliance MODULE-COMPLIANCE
      STATUS  current
      DESCRIPTION
          "The compliance statement for systems supporting
          the Endpoint MIB."
      MODULE -- this module
          MANDATORY-GROUPS {
          endpointObjectGroup,
          endpointPortObjectGroup
          }
   ::= { endpointCompliances 1 }

endpointGroups OBJECT IDENTIFIER ::= { endpointConformance 2 }

endpointObjectGroup OBJECT-GROUP
    OBJECTS {
        endpointTableLastChanged,
        endpointDateAndTime,
        endpointName,
        endpointBundleName,
        endpointEnabled,
        endpointType,
        endpointLostContact,
        endpointLastRestartReason,
        endpointWANLinkStatus,
        endpointDeviceBootTime,
        endpointDeviceSerialNumber,
        endpointSoftwareVersion,
        endpointModelNumber,
        endpointConnectionType,
        endpointOpticalSignalTX,
        endpointOpticalSignalRX
        }
        STATUS   current
        DESCRIPTION
            "Endpoint list object group."
        ::= { endpointGroups 1}

endpointPortObjectGroup OBJECT-GROUP
    OBJECTS {
        endpointPortStatus,
        endpointPortName,
        endpointPortPOEPowerUsage
        }
        STATUS   current
        DESCRIPTION
            "Endpoint port list object group."
        ::= { endpointGroups 2}

END
