Beispiel #1
0
class csqIfQosGroupStatsTable(metaclass=MIBMeta, prefix='.1.3.6.1.4.1.9.9.580.1.5.5'):
    """
    'csqIfQosGroupStatsTable' http://oidref.com/1.3.6.1.4.1.9.9.580.1.5.5
    """

    queue_updater = QueueStatUpdater()

    # csqIfQosGroupStatsTable = '1.3.6.1.4.1.9.9.580.1.5.5'
    # csqIfQosGroupStatsEntry = '1.3.6.1.4.1.9.9.580.1.5.5.1.4'

    queue_stat_request = \
        SubtreeMIBEntry('1.4', queue_updater, ValueType.COUNTER_64, queue_updater.handle_stat_request)
Beispiel #2
0
class PhysicalSensorTableMIB(metaclass=MIBMeta, prefix='.1.3.6.1.2.1.99.1.1'):
    """
    Sensor table.
    """

    updater = PhysicalSensorTableMIBUpdater()

    entPhySensorType = \
        SubtreeMIBEntry('1.1', updater, ValueType.INTEGER, updater.get_ent_physical_sensor_type)

    entPhySensorScale = \
        SubtreeMIBEntry('1.2', updater, ValueType.INTEGER, updater.get_ent_physical_sensor_scale)

    entPhySensorPrecision = \
        SubtreeMIBEntry('1.3', updater, ValueType.INTEGER, updater.get_ent_physical_sensor_precision)

    entPhySensorValue = \
        SubtreeMIBEntry('1.4', updater, ValueType.INTEGER, updater.get_ent_physical_sensor_value)

    entPhySensorStatus = \
        SubtreeMIBEntry('1.5', updater, ValueType.INTEGER, updater.get_ent_physical_sensor_oper_status)
Beispiel #3
0
    class LLDPLocPortTable(metaclass=MIBMeta, prefix='.1.0.8802.1.1.2.1.3.7'):
        """
        lldpLocPortTable OBJECT-TYPE
            SYNTAX      SEQUENCE OF LldpLocPortEntry
            MAX-ACCESS  not-accessible
            STATUS      current
            DESCRIPTION
              "This table contains one or more rows per port information
               associated with the local system known to this agent."
            ::= { lldpLocalSystemData 7 }

            LldpLocPortEntry ::= SEQUENCE {
                lldpLocPortNum                LldpPortNumber,
                lldpLocPortIdSubtype          LldpPortIdSubtype,
                lldpLocPortId                 LldpPortId,
                lldpLocPortDesc               SnmpAdminString
            }

        """
        port_updater = LocPortUpdater()

        # lldpLocPortEntry = '1'

        lldpLocPortNum = SubtreeMIBEntry('1.1', port_updater,
                                         ValueType.INTEGER,
                                         port_updater.local_port_num)

        # We're using locally assigned name, so according to textual convention, the subtype is 7
        lldpLocPortIdSubtype = SubtreeMIBEntry('1.2', port_updater,
                                               ValueType.INTEGER,
                                               port_updater.port_id_subtype)

        lldpLocPortId = SubtreeMIBEntry('1.3', port_updater,
                                        ValueType.OCTET_STRING,
                                        port_updater.local_port_id)

        lldpLocPortDesc = SubtreeMIBEntry('1.4', port_updater,
                                          ValueType.OCTET_STRING,
                                          port_updater.port_table_lookup,
                                          "description")
    class LLDPLocManAddrTable(metaclass=MIBMeta, prefix='.1.0.8802.1.1.2.1.3.8'):
        """
        lldpLocManAddrTable OBJECT-TYPE
        SYNTAX      SEQUENCE OF LldpLocManAddrEntry
        MAX-ACCESS  not-accessible
        STATUS      current
        DESCRIPTION
                "This table contains management address information on the
                local system known to this agent."
        ::= { lldpLocalSystemData 8 }
        """
        updater = LLDPLocManAddrUpdater()

        lldpLocManAddrSubtype = SubtreeMIBEntry('1.1', updater, ValueType.INTEGER,
                                                updater.lookup, updater.man_addr_subtype)

        lldpLocManAddr = SubtreeMIBEntry('1.2', updater, ValueType.OCTET_STRING,
                                         updater.lookup, updater.man_addr)

        lldpLocManAddrLen = SubtreeMIBEntry('1.3', updater, ValueType.INTEGER,
                                            updater.lookup, updater.man_addr_len)

        lldpLocManAddrIfSubtype = SubtreeMIBEntry('1.4', updater, ValueType.INTEGER,
                                                  updater.lookup, updater.man_addr_if_subtype)

        lldpLocManAddrIfId = SubtreeMIBEntry('1.5', updater, ValueType.INTEGER,
                                             updater.lookup, updater.man_addr_if_id)

        lldpLocManAddrOID = SubtreeMIBEntry('1.6', updater, ValueType.OBJECT_IDENTIFIER,
                                            updater.lookup, updater.man_addr_OID)
Beispiel #5
0
class cefcFruPowerStatusTable(metaclass=MIBMeta,
                              prefix='.1.3.6.1.4.1.9.9.117.1.1.2'):
    """
    'cefcFruPowerStatusTable' http://oidref.com/1.3.6.1.4.1.9.9.117.1.1.2
    """

    power_status_handler = PowerStatusHandler()

    # cefcFruPowerStatusTable = '1.3.6.1.4.1.9.9.117.1.1.2'
    # csqIfQosGroupStatsEntry = '1.3.6.1.4.1.9.9.117.1.1.2.1'

    psu_status = SubtreeMIBEntry('1.2', power_status_handler,
                                 ValueType.INTEGER,
                                 power_status_handler.get_psu_status)
Beispiel #6
0
class LLDPLocPortTable(metaclass=MIBMeta, prefix='.1.0.8802.1.1.2.1.3.7'):
    """
    'lldpLocPortTable'
    """
    lldp_updater = _lldp_updater

    # lldpLocPortEntry = '1'

    # lldpLocPortNum = '1.1'

    # lldpLocPortIdSubtype = '1.2'

    lldpLocPortId = SubtreeMIBEntry('1.3', lldp_updater,
                                    ValueType.OCTET_STRING,
                                    lldp_updater.local_port_id)
Beispiel #7
0
class PhysicalTableMIB(metaclass=MIBMeta, prefix='.1.3.6.1.2.1.47.1.1.1'):
    """
    Physical table
    """

    updater = PhysicalTableMIBUpdater()

    entPhysicalDescr = \
        SubtreeMIBEntry('1.2', updater, ValueType.OCTET_STRING, updater.get_phy_descr)

    entPhysicalVendorType = \
        SubtreeMIBEntry('1.3', updater, ValueType.OCTET_STRING, updater.get_phy_vendor_type)

    entPhysicalContainedIn = \
        SubtreeMIBEntry('1.4', updater, ValueType.INTEGER, updater.get_phy_contained_in)

    entPhysicalClass = \
        SubtreeMIBEntry('1.5', updater, ValueType.INTEGER, updater.get_phy_class)

    entPhysicalParentRelPos = \
        SubtreeMIBEntry('1.6', updater, ValueType.INTEGER, updater.get_phy_parent_relative_pos)

    entPhysicalName = \
        SubtreeMIBEntry('1.7', updater, ValueType.OCTET_STRING, updater.get_phy_name)

    entPhysicalHardwareVersion = \
        SubtreeMIBEntry('1.8', updater, ValueType.OCTET_STRING, updater.get_phy_hw_ver)

    entPhysicalFirmwareVersion = \
        SubtreeMIBEntry('1.9', updater, ValueType.OCTET_STRING, updater.get_phy_fw_ver)

    entPhysicalSoftwareRevision = \
        SubtreeMIBEntry('1.10', updater, ValueType.OCTET_STRING, updater.get_phy_sw_rev)

    entPhysicalSerialNumber = \
        SubtreeMIBEntry('1.11', updater, ValueType.OCTET_STRING, updater.get_phy_serial_num)

    entPhysicalMfgName = \
        SubtreeMIBEntry('1.12', updater, ValueType.OCTET_STRING, updater.get_phy_mfg_name)

    entPhysicalModelName = \
        SubtreeMIBEntry('1.13', updater, ValueType.OCTET_STRING, updater.get_phy_model_name)

    entPhysicalAlias = \
        SubtreeMIBEntry('1.14', updater, ValueType.OCTET_STRING, updater.get_phy_alias)

    entPhysicalAssetID = \
        SubtreeMIBEntry('1.15', updater, ValueType.OCTET_STRING, updater.get_phy_assert_id)

    entPhysicalIsFRU = \
        SubtreeMIBEntry('1.16', updater, ValueType.INTEGER, updater.is_fru)
Beispiel #8
0
class IpMib(metaclass=MIBMeta, prefix='.1.3.6.1.2.1.4'):
    arp_updater = ArpUpdater()

    ipNetToMediaPhysAddress = \
        SubtreeMIBEntry('22.1.2', arp_updater, ValueType.OCTET_STRING, arp_updater.arp_dest)
Beispiel #9
0
class LLDPRemTable(metaclass=MIBMeta, prefix='.1.0.8802.1.1.2.1.4.1'):
    """
    lldpRemTable OBJECT-TYPE
    SYNTAX      SEQUENCE OF LldpRemEntry
    MAX-ACCESS  not-accessible
    STATUS      current
    DESCRIPTION
            "This table contains one or more rows per physical network
            connection known to this agent.  The agent may wish to ensure
            that only one lldpRemEntry is present for each local port,
            or it may choose to maintain multiple lldpRemEntries for
            the same local port.

            The following procedure may be used to retrieve remote
            systems information updates from an LLDP agent:

               1. NMS polls all tables associated with remote systems
                  and keeps a local copy of the information retrieved.
                  NMS polls periodically the values of the following
                  objects:
                     a. lldpStatsRemTablesInserts
                     b. lldpStatsRemTablesDeletes
                     c. lldpStatsRemTablesDrops
                     d. lldpStatsRemTablesAgeouts
                     e. lldpStatsRxPortAgeoutsTotal for all ports.

               2. LLDP agent updates remote systems MIB objects, and
                  sends out notifications to a list of notification
                  destinations.

               3. NMS receives the notifications and compares the new
                  values of objects listed in step 1.

                  Periodically, NMS should poll the object
                  lldpStatsRemTablesLastChangeTime to find out if anything
                  has changed since the last poll.  if something has
                  changed, NMS will poll the objects listed in step 1 to
                  figure out what kind of changes occurred in the tables.

                  if value of lldpStatsRemTablesInserts has changed,
                  then NMS will walk all tables by employing TimeFilter
                  with the last-polled time value.  This request will
                  return new objects or objects whose values are updated
                  since the last poll.

                  if value of lldpStatsRemTablesAgeouts has changed,
                  then NMS will walk the lldpStatsRxPortAgeoutsTotal and
                  compare the new values with previously recorded ones.
                  For ports whose lldpStatsRxPortAgeoutsTotal value is
                  greater than the recorded value, NMS will have to
                  retrieve objects associated with those ports from
                  table(s) without employing a TimeFilter (which is
                  performed by specifying 0 for the TimeFilter.)

                  lldpStatsRemTablesDeletes and lldpStatsRemTablesDrops
                  objects are provided for informational purposes."
    ::= { lldpRemoteSystemsData 1 }

    lldpRemEntry OBJECT-TYPE
    SYNTAX      LldpRemEntry
    MAX-ACCESS  not-accessible
    STATUS      current
    DESCRIPTION
            "Information about a particular physical network connection.
            Entries may be created and deleted in this table by the agent,
            if a physical topology discovery process is active."
    INDEX   {
           lldpRemTimeMark,
           lldpRemLocalPortNum,
           lldpRemIndex
    }
    ::= { lldpRemTable 1 }

    LldpRemEntry ::= SEQUENCE {
          lldpRemTimeMark           TimeFilter,
          lldpRemLocalPortNum       LldpPortNumber,
          lldpRemIndex              Integer32,
          lldpRemChassisIdSubtype   LldpChassisIdSubtype,
          lldpRemChassisId          LldpChassisId,
          lldpRemPortIdSubtype      LldpPortIdSubtype,
          lldpRemPortId             LldpPortId,
          lldpRemPortDesc           SnmpAdminString,
          lldpRemSysName            SnmpAdminString,
          lldpRemSysDesc            SnmpAdminString,
          lldpRemSysCapSupported    LldpSystemCapabilitiesMap,
          lldpRemSysCapEnabled      LldpSystemCapabilitiesMap
    }
    """
    lldp_updater = _lldp_updater

    lldpRemTimeMark = \
        SubtreeMIBEntry('1.1', lldp_updater, ValueType.TIME_TICKS, lldp_updater.lldp_table_lookup_integer,
                           LLDPRemoteTables(1))

    # TODO: Impl.
    # lldpRemLocalPortNum = \
    #     ContextualMIBEntry('1.2', if_range, ValueType.INTEGER, lldp_updater.lldp_subtype_id,
    #                        LLDPRemoteTables(2))
    # TODO: Impl.
    # lldpRemIndex = \
    #     ContextualMIBEntry('1.3', if_range, ValueType.INTEGER, lldp_updater.lldp_subtype_id,
    #                        LLDPRemoteTables(3))

    lldpRemChassisIdSubtype = \
        SubtreeMIBEntry('1.4', lldp_updater, ValueType.INTEGER, lldp_updater.lldp_table_lookup_integer,
                           LLDPRemoteTables(4))

    lldpRemChassisId = \
        SubtreeMIBEntry('1.5', lldp_updater, ValueType.OCTET_STRING, lldp_updater.lldp_table_lookup,
                           LLDPRemoteTables(5))

    lldpRemPortIdSubtype = \
        SubtreeMIBEntry('1.6', lldp_updater, ValueType.INTEGER, lldp_updater.lldp_table_lookup_integer,
                           LLDPRemoteTables(6))

    lldpRemPortId = \
        SubtreeMIBEntry('1.7', lldp_updater, ValueType.OCTET_STRING, lldp_updater.lldp_table_lookup,
                           LLDPRemoteTables(7))

    lldpRemPortDesc = \
        SubtreeMIBEntry('1.8', lldp_updater, ValueType.OCTET_STRING, lldp_updater.lldp_table_lookup,
                           LLDPRemoteTables(8))

    lldpRemSysName = \
        SubtreeMIBEntry('1.9', lldp_updater, ValueType.OCTET_STRING, lldp_updater.lldp_table_lookup,
                           LLDPRemoteTables(9))

    lldpRemSysDesc = \
        SubtreeMIBEntry('1.10', lldp_updater, ValueType.OCTET_STRING, lldp_updater.lldp_table_lookup,
                           LLDPRemoteTables(10))
Beispiel #10
0
class CiscoBgp4MIB(metaclass=MIBMeta, prefix='.1.3.6.1.4.1.9.9.187'):
    bgpsession_updater = BgpSessionUpdater()

    cbgpPeer2State = SubtreeMIBEntry('1.2.5.1.3', bgpsession_updater,
                                     ValueType.INTEGER,
                                     bgpsession_updater.sessionstatus)
class InterfacesMIB(metaclass=MIBMeta, prefix='.1.3.6.1.2.1.2'):
    """
    'interfaces' https://tools.ietf.org/html/rfc1213#section-3.5
    """

    if_updater = InterfacesUpdater()

    # (subtree, value_type, callable_, *args, handler=None)
    ifNumber = MIBEntry('1', ValueType.INTEGER, if_updater.get_if_number)

    # ifTable ::= { interfaces 2 }
    # ifEntry ::= { ifTable 1 }

    ifIndex = \
        SubtreeMIBEntry('2.1.1', if_updater, ValueType.INTEGER, if_updater.if_index)

    ifDescr = \
        SubtreeMIBEntry('2.1.2', if_updater, ValueType.OCTET_STRING, if_updater.interface_description)

    # FIXME: Placeholder
    # ethernetCsmacd(6), -- for all ethernet-like interfaces,
    #                    -- regardless of speed, as per RFC3635
    ifType = \
        SubtreeMIBEntry('2.1.3', if_updater, ValueType.INTEGER, lambda sub_id: 6)

    ifMtu = \
        SubtreeMIBEntry('2.1.4', if_updater, ValueType.INTEGER, if_updater.get_mtu)

    # FIXME Placeholder.
    #   "If the bandwidth of the interface is greater
    #   than the maximum value reportable by this object,
    #   then this object should report its maximum value
    #   (4.294,967,295) and ifHighSpeed must be used to
    #   report the interface's speed."
    ifSpeed = \
        SubtreeMIBEntry('2.1.5', if_updater, ValueType.GAUGE_32, lambda sub_id: 4294967295)

    # FIXME Placeholder.
    ifPhysAddress = \
        SubtreeMIBEntry('2.1.6', if_updater, ValueType.OCTET_STRING, lambda sub_id: '')

    ifAdminStatus = \
        SubtreeMIBEntry('2.1.7', if_updater, ValueType.INTEGER, if_updater.get_admin_status)

    ifOperStatus = \
        SubtreeMIBEntry('2.1.8', if_updater, ValueType.INTEGER, if_updater.get_oper_status)

    # FIXME Placeholder.
    ifLastChange = \
        SubtreeMIBEntry('2.1.9', if_updater, ValueType.TIME_TICKS, lambda sub_id: 0)

    ifInOctets = \
        SubtreeMIBEntry('2.1.10', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(10))

    ifInUcastPkts = \
        SubtreeMIBEntry('2.1.11', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(11))

    ifInNUcastPkts = \
        SubtreeMIBEntry('2.1.12', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(12))

    ifInDiscards = \
        SubtreeMIBEntry('2.1.13', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(13))

    ifInErrors = \
        SubtreeMIBEntry('2.1.14', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(14))

    ifInUnknownProtos = \
        SubtreeMIBEntry('2.1.15', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(15))

    ifOutOctets = \
        SubtreeMIBEntry('2.1.16', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(16))

    ifOutUcastPkts = \
        SubtreeMIBEntry('2.1.17', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(17))

    ifOutNUcastPkts = \
        SubtreeMIBEntry('2.1.18', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(18))

    ifOutDiscards = \
        SubtreeMIBEntry('2.1.19', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(19))

    ifOutErrors = \
        SubtreeMIBEntry('2.1.20', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(20))

    ifOutQLen = \
        SubtreeMIBEntry('2.1.21', if_updater, ValueType.GAUGE_32, if_updater.get_counter,
                           DbTables(21))

    # FIXME Placeholder
    ifSpecific = \
        SubtreeMIBEntry('2.1.22', if_updater, ValueType.OBJECT_IDENTIFIER, lambda sub_id: ObjectIdentifier.null_oid())
Beispiel #12
0
class InterfaceMIBObjects(metaclass=MIBMeta, prefix='.1.3.6.1.2.1.31.1'):
    """
    'ifMIBObjects' https://tools.ietf.org/html/rfc2863#section-6
    """
    if_updater = InterfaceMIBUpdater()

    # ifXTable = '1'
    # ifXEntry = '1.1'

    ifName = \
        SubtreeMIBEntry('1.1.1', if_updater, ValueType.OCTET_STRING, if_updater.interface_name)

    ifInMulticastPkts = \
        SubtreeMIBEntry('1.1.2', if_updater, ValueType.COUNTER_32, if_updater.get_counter32,
                           DbTables32(2))

    ifInBroadcastPkts = \
        SubtreeMIBEntry('1.1.3', if_updater, ValueType.COUNTER_32, if_updater.get_counter32,
                           DbTables32(3))

    ifOutMulticastPkts = \
        SubtreeMIBEntry('1.1.4', if_updater, ValueType.COUNTER_32, if_updater.get_counter32,
                           DbTables32(4))

    ifOutBroadcastPkts = \
        SubtreeMIBEntry('1.1.5', if_updater, ValueType.COUNTER_32, if_updater.get_counter32,
                           DbTables32(5))

    ifHCInOctets = \
        SubtreeMIBEntry('1.1.6', if_updater, ValueType.COUNTER_64, if_updater.get_counter64,
                           DbTables64(6))

    ifHCInUcastPkts = \
        SubtreeMIBEntry('1.1.7', if_updater, ValueType.COUNTER_64, if_updater.get_counter64,
                           DbTables64(7))

    ifHCInMulticastPkts = \
        SubtreeMIBEntry('1.1.8', if_updater, ValueType.COUNTER_64, if_updater.get_counter64,
                           DbTables64(8))

    ifHCInBroadcastPkts = \
        SubtreeMIBEntry('1.1.9', if_updater, ValueType.COUNTER_64, if_updater.get_counter64,
                           DbTables64(9))

    ifHCOutOctets = \
        SubtreeMIBEntry('1.1.10', if_updater, ValueType.COUNTER_64, if_updater.get_counter64,
                           DbTables64(10))

    ifHCOutUcastPkts = \
        SubtreeMIBEntry('1.1.11', if_updater, ValueType.COUNTER_64, if_updater.get_counter64,
                           DbTables64(11))

    ifHCOutMulticastPkts = \
        SubtreeMIBEntry('1.1.12', if_updater, ValueType.COUNTER_64, if_updater.get_counter64,
                           DbTables64(12))

    ifHCOutBroadcastPkts = \
        SubtreeMIBEntry('1.1.13', if_updater, ValueType.COUNTER_64, if_updater.get_counter64,
                           DbTables64(13))

    """
    ifLinkUpDownTrapEnable  OBJECT-TYPE
        SYNTAX      INTEGER { enabled(1), disabled(2) }
        MAX-ACCESS  read-write
        STATUS      current
        DESCRIPTION
                "Indicates whether linkUp/linkDown traps should be generated
                for this interface.

                By default, this object should have the value enabled(1) for
                interfaces which do not operate on 'top' of any other
                interface (as defined in the ifStackTable), and disabled(2)
                otherwise."
    """  # FIXME: Placeholder (original impl reported 0)
    ifLinkUpDownTrapEnable = SubtreeMIBEntry('1.1.14', if_updater, ValueType.INTEGER, lambda sub_id: 2)

    ifHighSpeed = SubtreeMIBEntry('1.1.15', if_updater, ValueType.GAUGE_32, if_updater.get_high_speed)

    """
    ifPromiscuousMode  OBJECT-TYPE
        SYNTAX      TruthValue
        MAX-ACCESS  read-write
        STATUS      current
        DESCRIPTION
                "This object has a value of false(2) if this interface only
                accepts packets/frames that are addressed to this station.
                This object has a value of true(1) when the station accepts
                all packets/frames transmitted on the media.  The value
                true(1) is only legal on certain types of media.  If legal,
                setting this object to a value of true(1) may require the
                interface to be reset before becoming effective.

                The value of ifPromiscuousMode does not affect the reception
                of broadcast and multicast packets/frames by the interface."
    """  # FIXME: Placeholder
    ifPromiscuousMode = SubtreeMIBEntry('1.1.16', if_updater, ValueType.INTEGER, lambda sub_id: 1)

    """
    ifConnectorPresent   OBJECT-TYPE
        SYNTAX      TruthValue
        MAX-ACCESS  read-only
        STATUS      current
        DESCRIPTION
                "This object has the value 'true(1)' if the interface
                sublayer has a physical connector and the value 'false(2)'
                otherwise."
    """  # FIXME: Placeholder
    ifConnectorPresent = SubtreeMIBEntry('1.1.17', if_updater, ValueType.INTEGER, lambda sub_id: 1)

    ifAlias = SubtreeMIBEntry('1.1.18', if_updater, ValueType.OCTET_STRING, if_updater.interface_alias)

    """
    ifCounterDiscontinuityTime OBJECT-TYPE
    SYNTAX      TimeStamp
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION
            "The value of sysUpTime on the most recent occasion at which
            any one or more of this interface's counters suffered a
            discontinuity.  The relevant counters are the specific
            instances associated with this interface of any Counter32 or
            Counter64 object contained in the ifTable or ifXTable.  If
            no such discontinuities have occurred since the last re-
            initialization of the local management subsystem, then this
            object contains a zero value."
    """  # FIXME: Placeholder
    ifCounterDiscontinuityTime = SubtreeMIBEntry('1.1.19', if_updater, ValueType.TIME_TICKS, lambda sub_id: 0)
Beispiel #13
0
class InterfacesMIB(metaclass=MIBMeta, prefix='.1.3.6.1.2.1.2'):
    """
    'interfaces' https://tools.ietf.org/html/rfc1213#section-3.5
    """

    if_updater = InterfacesUpdater()

    # (subtree, value_type, callable_, *args, handler=None)
    ifNumber = MIBEntry('1', ValueType.INTEGER, if_updater.get_if_number)

    # ifTable ::= { interfaces 2 }
    # ifEntry ::= { ifTable 1 }

    ifIndex = \
        SubtreeMIBEntry('2.1.1', if_updater, ValueType.INTEGER, if_updater.if_index)

    ifDescr = \
        SubtreeMIBEntry('2.1.2', if_updater, ValueType.OCTET_STRING, if_updater.interface_description)

    ifType = \
        SubtreeMIBEntry('2.1.3', if_updater, ValueType.INTEGER, if_updater.get_if_type)

    ifMtu = \
        SubtreeMIBEntry('2.1.4', if_updater, ValueType.INTEGER, if_updater.get_mtu)

    ifSpeed = \
        SubtreeMIBEntry('2.1.5', if_updater, ValueType.GAUGE_32, if_updater.get_speed_bps)

    # FIXME Placeholder.
    ifPhysAddress = \
        SubtreeMIBEntry('2.1.6', if_updater, ValueType.OCTET_STRING, lambda sub_id: '')

    ifAdminStatus = \
        SubtreeMIBEntry('2.1.7', if_updater, ValueType.INTEGER, if_updater.get_admin_status)

    ifOperStatus = \
        SubtreeMIBEntry('2.1.8', if_updater, ValueType.INTEGER, if_updater.get_oper_status)

    # FIXME Placeholder.
    ifLastChange = \
        SubtreeMIBEntry('2.1.9', if_updater, ValueType.TIME_TICKS, lambda sub_id: 0)

    ifInOctets = \
        SubtreeMIBEntry('2.1.10', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(10))

    ifInUcastPkts = \
        SubtreeMIBEntry('2.1.11', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(11))

    ifInNUcastPkts = \
        SubtreeMIBEntry('2.1.12', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(12))

    ifInDiscards = \
        SubtreeMIBEntry('2.1.13', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(13))

    ifInErrors = \
        SubtreeMIBEntry('2.1.14', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(14))

    ifInUnknownProtos = \
        SubtreeMIBEntry('2.1.15', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(15))

    ifOutOctets = \
        SubtreeMIBEntry('2.1.16', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(16))

    ifOutUcastPkts = \
        SubtreeMIBEntry('2.1.17', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(17))

    ifOutNUcastPkts = \
        SubtreeMIBEntry('2.1.18', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(18))

    ifOutDiscards = \
        SubtreeMIBEntry('2.1.19', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(19))

    ifOutErrors = \
        SubtreeMIBEntry('2.1.20', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(20))

    ifOutQLen = \
        SubtreeMIBEntry('2.1.21', if_updater, ValueType.GAUGE_32, if_updater.get_counter,
                           DbTables(21))

    # FIXME Placeholder
    ifSpecific = \
        SubtreeMIBEntry('2.1.22', if_updater, ValueType.OBJECT_IDENTIFIER, lambda sub_id: ObjectIdentifier.null_oid())