-- *------------------------------------------------
-- * Firebrick BGP MIB
-- *
-- * April 2020, C Malton
-- *
-- * Copyright (c) 2020 by Andrews & Arnold
-- *------------------------------------------------

FIREBRICK-BGP-MIB DEFINITIONS ::= BEGIN

IMPORTS
    MODULE-IDENTITY,
    OBJECT-TYPE,
    enterprises,
    Integer32
        FROM SNMPv2-SMI
    DisplayString, TruthValue
        FROM SNMPv2-TC
    InetAddressType,
    InetAddress
        FROM INET-ADDRESS-MIB
    firebrickNewStyle
        FROM FIREBRICK-MIB
        ;

fbBgpMib MODULE-IDENTITY
    LAST-UPDATED "202304120000Z"
    ORGANIZATION "Andrews & Arnold Limited"
    CONTACT-INFO
        "Andrews & Arnold
        Unit 1&2, Enterprise Court
        Bracknell, Berkshire, RG12 1QS
        United Kingdom

        Tel: +44 3333 400 999
        Email: support@aa.net.uk"
    DESCRIPTION
        "Firebrick-specific structures for BGP"
    REVISION "202304120000Z"
    DESCRIPTION "Add max prefix limit info"
    REVISION "202304090000Z"
    DESCRIPTION "Add shutdown/preshutdown to enumeration for BGP state"
    REVISION "202303300000Z"
    DESCRIPTION "Enumeration for BGP state"
    REVISION "202207150000Z"
    DESCRIPTION "Additional validation"
    REVISION "202004060000Z"
    DESCRIPTION "Initial version of this MIB module"
    ::= { firebrickNewStyle 179 }

fbBgpPeerTable OBJECT-TYPE
    SYNTAX SEQUENCE OF FbBgpPeerEntry
    MAX-ACCESS not-accessible
    STATUS current
    DESCRIPTION
        "The list of BGP peers for this Firebrick"
    ::= { fbBgpMib 1 }

fbBgpPeerEntry OBJECT-TYPE
    SYNTAX FbBgpPeerEntry
    MAX-ACCESS not-accessible
    STATUS current
    DESCRIPTION
        "An entry in the BGP Peer Names Table"
    INDEX { fbBgpPeerAddressType, fbBgpPeerAddress }
    ::= { fbBgpPeerTable 1 }

FbBgpPeerState ::= TEXTUAL-CONVENTION
    STATUS current
    DESCRIPTION "The state of a BGP peer"
    SYNTAX INTEGER {
        idle(0),        -- Disabled or in error backoff state or inbound only peer
        active(1),      -- Attempting to connect
        openWait(2),    -- Awaiting open message (incoming)
        openSent(3),    -- Awaiting response to open, or for TCP to establish (outgoing)
        openConfirm(4), -- Awaiting confirmation of establishment
        established(5), -- Connection established
        closed(6),      -- Closing or awaiting cleanup
        preshutdown(7), -- Withdrawing everything and waiting for propagation
        shutdown(8)     -- Shutdown
    }

FbBgpPeerEntry ::= SEQUENCE {
    fbBgpPeerAddressType            InetAddressType,
    fbBgpPeerAddress                InetAddress,
    fbBgpPeerName                   DisplayString,
    fbBgpPeerState                  FbBgpPeerState,
    fbBgpPeerRemoteAS               Integer32,
    fbBgpPeerReceivedIpv4Prefixes   Integer32,
    fbBgpPeerSecondsSinceLastChange Integer32,
    fbBgpPeerReceivedIpv6Prefixes   Integer32,
    fbBgpPeerLocalAddressType       InetAddressType,
    fbBgpPeerLocalAddress           InetAddress,
    fbBgpPeerLocalAS                Integer32,
    fbBgpPeerExported               Integer32,
    fbBgpPeerTableId                Integer32,
    fbBgpPeerMaxPrefixes            Integer32,
    fbBgpPeerMaxPrefixesHit         TruthValue
}

fbBgpPeerAddressType OBJECT-TYPE
    SYNTAX InetAddressType
    MAX-ACCESS read-only
    STATUS current
    DESCRIPTION
        "The address type of fbBgpPeerAddressAddr."
    ::= { fbBgpPeerEntry 1 }

fbBgpPeerAddress OBJECT-TYPE
    SYNTAX InetAddress (SIZE (4..20))
    MAX-ACCESS read-only
    STATUS current
    DESCRIPTION
        "The internet address for the peer. The type of the address is 
         determined by the value of the fbBgpPeerAddressType object."
    ::= { fbBgpPeerEntry 2 }

fbBgpPeerName OBJECT-TYPE
    SYNTAX  DisplayString
    MAX-ACCESS  read-only
    STATUS  current
    DESCRIPTION
        "The name of the BGP Peer"
    ::= { fbBgpPeerEntry 3 }

fbBgpPeerState OBJECT-TYPE
    SYNTAX  FbBgpPeerState
    MAX-ACCESS  read-only
    STATUS  current
    DESCRIPTION
        "The current state of the BGP Peer"
    ::= { fbBgpPeerEntry 4 }

fbBgpPeerRemoteAS OBJECT-TYPE
    SYNTAX  Integer32
    MAX-ACCESS  read-only
    STATUS  current
    DESCRIPTION
        "The remote AS of the BGP Peer"
    ::= { fbBgpPeerEntry 5 }

fbBgpPeerReceivedIpv4Prefixes OBJECT-TYPE
    SYNTAX  Integer32
    MAX-ACCESS  read-only
    STATUS  current
    DESCRIPTION
        "The number of IPv4 prefixes received from the BGP Peer"
    ::= { fbBgpPeerEntry 6 }

fbBgpPeerSecondsSinceLastChange OBJECT-TYPE
    SYNTAX  Integer32
    MAX-ACCESS  read-only
    STATUS  current
    DESCRIPTION
        "The number of seconds since the last state change for the BGP Peer"
    ::= { fbBgpPeerEntry 7 }

fbBgpPeerReceivedIpv6Prefixes OBJECT-TYPE
    SYNTAX  Integer32
    MAX-ACCESS  read-only
    STATUS  current
    DESCRIPTION
        "The number of IPv6 prefixes received from the BGP Peer"
    ::= { fbBgpPeerEntry 8 }

fbBgpPeerExported OBJECT-TYPE
    SYNTAX  Integer32
    MAX-ACCESS  read-only
    STATUS  current
    DESCRIPTION
        "The number of prefixes exported to the BGP Peer"
    ::= { fbBgpPeerEntry 9 }

fbBgpPeerLocalAddressType OBJECT-TYPE
    SYNTAX InetAddressType
    MAX-ACCESS read-only
    STATUS current
    DESCRIPTION
        "The address type of fbBgpPeerLocalAddress."
    ::= { fbBgpPeerEntry 10 }

fbBgpPeerLocalAddress OBJECT-TYPE
    SYNTAX InetAddress (SIZE (4..20))
    MAX-ACCESS read-only
    STATUS current
    DESCRIPTION
        "The local internet address used for this peer.
         The type of the address is determined by the 
         value of the fbBgpPeerAddressType object."
    ::= { fbBgpPeerEntry 11 }

fbBgpPeerLocalAS OBJECT-TYPE
    SYNTAX  Integer32
    MAX-ACCESS  read-only
    STATUS  current
    DESCRIPTION
        "The local AS number for the BGP Peer"
    ::= { fbBgpPeerEntry 12 }

fbBgpPeerTableId OBJECT-TYPE
    SYNTAX  Integer32
    MAX-ACCESS  read-only
    STATUS  current
    DESCRIPTION
        "The routing table number for this BGP Peer."
    ::= { fbBgpPeerEntry 13 }

fbBgpPeerMaxPrefixes OBJECT-TYPE
    SYNTAX  Integer32
    MAX-ACCESS  read-only
    STATUS  current
    DESCRIPTION
        "Max prefixes accepted from this peer."
    ::= { fbBgpPeerEntry 14 }

fbBgpPeerMaxPrefixesHit OBJECT-TYPE
    SYNTAX  TruthValue
    MAX-ACCESS  read-only
    STATUS  current
    DESCRIPTION
        "Prefix limit was hit, so prefixes from this peer have been dropped."
    ::= { fbBgpPeerEntry 15 }

END
