metadata:
  device:
    fields:
      ospf_router_id:
        symbol:
          OID: 1.3.6.1.2.1.14.1.1.0
          name: ospfRouterId
        consumers: [topology]

metrics:
  - MIB: OSPF-MIB
    table:
      OID: 1.3.6.1.2.1.14.10
      name: ospfNbrTable
    symbols:
      - OID: 1.3.6.1.2.1.14.10.1.6
        name: ospfNbrState
        chart_meta:
          description: The state of the relationship with this neighbor
          family: 'Network/Routing/OSPF/Neighbor/State/Status'
          unit: "{status}"
        mapping:
          1: down
          2: attempt
          3: init
          4: twoWay
          5: exchangeStart
          6: exchange
          7: loading
          8: full
      - OID: 1.3.6.1.2.1.14.10.1.7
        name: ospfNbrEvents
        chart_meta:
          description: The number of times this neighbor relationship has changed state or an error has occurred
          family: 'Network/Routing/OSPF/Neighbor/Event/Count'
          unit: "{event}/s"
      - OID: 1.3.6.1.2.1.14.10.1.8
        name: ospfNbrLsRetransQLen
        chart_meta:
          description: The current length of the retransmission queue
          family: 'Network/Routing/OSPF/Neighbor/Queue/RetransmitLength'
          unit: "{message}"
    metric_tags:
      - tag: neighbor_id
        symbol:
          OID: 1.3.6.1.2.1.14.10.1.3
          name: ospfNbrRtrId
      - tag: neighbor_ip
        symbol:
          OID: 1.3.6.1.2.1.14.10.1.1
          name: ospfNbrIpAddr

  - MIB: OSPF-MIB
    table:
      OID: 1.3.6.1.2.1.14.11
      name: ospfVirtNbrTable
    symbols:
      - OID: 1.3.6.1.2.1.14.11.1.5
        name: ospfVirtNbrState
        chart_meta:
          description: The state of the virtual neighbor relationship
          family: 'Network/Routing/OSPF/VirtualNeighbor/State/Status'
          unit: "{status}"
        mapping:
          1: down
          2: attempt
          3: init
          4: two_way
          5: exchange_start
          6: exchange
          7: loading
          8: full
      - OID: 1.3.6.1.2.1.14.11.1.6
        name: ospfVirtNbrEvents
        chart_meta:
          description: The number of times this virtual link has changed its state or an error has occurred
          family: 'Network/Routing/OSPF/VirtualNeighbor/Event/Count'
          unit: "{change}/s"
      - OID: 1.3.6.1.2.1.14.11.1.7
        name: ospfVirtNbrLsRetransQLen
        chart_meta:
          description: The current length of the retransmission queue
          family: 'Network/Routing/OSPF/VirtualNeighbor/Queue/RetransmitLength'
          unit: "{message}"
    metric_tags:
      - tag: neighbor_id
        symbol:
          OID: 1.3.6.1.2.1.14.11.1.2
          name: ospfVirtNbrRtrId
      - tag: neighbor_ip
        symbol:
          OID: 1.3.6.1.2.1.14.11.1.3
          name: ospfVirtNbrIpAddr

  - MIB: OSPF-MIB
    table:
      OID: 1.3.6.1.2.1.14.7
      name: ospfIfTable
    symbols:
      - OID: 1.3.6.1.2.1.14.7.1.12
        name: ospfIfState
        chart_meta:
          description: The OSPF Interface State
          family: 'Network/Routing/OSPF/Interface/State/Status'
          unit: "{status}"
        mapping:
          1: down
          2: loopback
          3: waiting
          4: point_to_point
          5: designated_router
          6: backup_designated_router
          7: other_designated_router
      - OID: 1.3.6.1.2.1.14.7.1.21
        name: ospfIfLsaCount
        chart_meta:
          description: The total number of link-local link state advertisements in this interface's link-local link state database
          family: 'Network/Routing/OSPF/Interface/LinkStateAdvertisement/Count'
          unit: "{advertisement}/s"
    metric_tags:
      - symbol:
          OID: 1.3.6.1.2.1.14.7.1.1
          name: ospfIfIpAddress
        tag: ospf_ip_addr
      - symbol:
          OID: 1.3.6.1.2.1.14.10.1.3
          name: ospfNbrRtrId
        table: ospfNbrTable
        MIB: OSPF-MIB
        tag: neighbor_id

  - MIB: OSPF-MIB
    table:
      OID: 1.3.6.1.2.1.14.9
      name: ospfVirtIfTable
    symbols:
      - OID: 1.3.6.1.2.1.14.9.1.7
        name: ospfVirtIfState
        chart_meta:
          description: OSPF virtual interface states
          family: 'Network/Routing/OSPF/VirtualInterface/State/Status'
          unit: "{status}"
        mapping:
          1: down
          4: point_to_point
      - OID: 1.3.6.1.2.1.14.9.1.12
        name: ospfVirtIfLsaCount
        chart_meta:
          description: The total number of link-local link state advertisements in this virtual interface's link-local link state database
          family: 'Network/Routing/OSPF/VirtualInterface/LinkStateAdvertisement/Count'
          unit: "{advertisement}/s"
    metric_tags:
      - tag: neighbor_id
        MIB: OSPF-MIB
        table: ospfVirtNbrTable
        symbol:
          OID: 1.3.6.1.2.1.14.11.1.2
          name: ospfVirtNbrRtrId

topology:
  - kind: ospf_neighbor
    MIB: OSPF-MIB
    table:
      OID: 1.3.6.1.2.1.14.10
      name: ospfNbrTable
    symbols:
      # Use neighbor state as the required row anchor while keeping the public
      # topology fact in metric tags below.
      - OID: 1.3.6.1.2.1.14.10.1.6
        name: ospf_neighbor
    metric_tags:
      - tag: ospf_neighbor_ip
        symbol:
          OID: 1.3.6.1.2.1.14.10.1.1
          name: ospfNbrIpAddr
      - tag: ospf_neighbor_addressless_index
        symbol:
          OID: 1.3.6.1.2.1.14.10.1.2
          name: ospfNbrAddressLessIndex
      - tag: ospf_neighbor_router_id
        symbol:
          OID: 1.3.6.1.2.1.14.10.1.3
          name: ospfNbrRtrId
      - tag: ospf_neighbor_state
        symbol:
          OID: 1.3.6.1.2.1.14.10.1.6
          name: ospfNbrState
        mapping:
          1: down
          2: attempt
          3: init
          4: twoWay
          5: exchangeStart
          6: exchange
          7: loading
          8: full
