extends:
  - _system-base.yaml
  - _std-if-mib.yaml

selector:
  - sysobjectid:
      include:
        - 1.3.6.1.4.1.42229.1.2 # Groove GX Series

metadata:
  device:
    fields:
      vendor:
        value: "Infinera"

# https://mibbrowser.online/mibdb_search.php?mib=CORIANT-GROOVE-MIB
# https://github.com/librenms/librenms/blob/master/mibs/infinera/CORIANT-GROOVE-MIB

metrics:
  - MIB: CORIANT-GROOVE-MIB
    symbol:
      OID: 1.3.6.1.4.1.42229.1.2.2.2.2.0
      name: coriant.groove.systemPowerConsumptionCurrent
      chart_meta:
        description: Current power consumption of the system
        family: 'System/Power/Usage'
        unit: "W"

  - MIB: CORIANT-GROOVE-MIB
    table:
      OID: 1.3.6.1.4.1.42229.1.2.3.1.1
      name: shelfTable
    symbols:
      - OID: 1.3.6.1.4.1.42229.1.2.3.1.1.1.3
        name: coriant.groove.shelfInletTemperature  # Type CoriantTypesTemperature is a string that represents a float in Celcius e.g. 23.8
        extract_value: '(\d+)'
        chart_meta:
          description: Shelf inlet temperature
          family: 'Hardware/Shelf/Temperature/Inlet'
          unit: "Cel"
      - OID: 1.3.6.1.4.1.42229.1.2.3.1.1.1.4
        name: coriant.groove.shelfOutletTemperature  # Type CoriantTypesTemperature is a string that represents a float in Celcius e.g. 23.8
        extract_value: '(\d+)'
        chart_meta:
          description: Shelf outlet temperature
          family: 'Hardware/Shelf/Temperature/Outlet'
          unit: "Cel"
      - OID: 1.3.6.1.4.1.42229.1.2.3.1.1.1.5
        name: coriant.groove.shelfAdminStatus
        chart_meta:
          description: The administrative state specifies the permission to use or prohibition against using the resource
          family: 'Hardware/Shelf/Admin/Status'
          unit: "{status}"
        mapping:
          1: up
          2: down
      - OID: 1.3.6.1.4.1.42229.1.2.3.1.1.1.6
        name: coriant.groove.shelfOperStatus
        chart_meta:
          description: The operational state specifies whether or not a resource is able to provide service
          family: 'Hardware/Shelf/Operational/Status'
          unit: "{status}"
        mapping:
          1: up
          2: down
    # TODO: bits handling (https://github.com/librenms/librenms/blob/f30d292aa3601bbaf79c053037d9b74a1a2055aa/mibs/infinera/CORIANT-GROOVE-MIB#L2468)
    #      - OID: 1.3.6.1.4.1.42229.1.2.3.1.1.1.7
    #        name: coriant.groove.shelfAvailStatus
    #        chart_meta:
    #          description: Provided to qualify the operational, usage and/or administrative status attributes
    #          unit: "{status}"
    #        mapping:
    #          0: none
    #          1: failed
    #          2: mismatch
    #          3: lowerLayerDown
    #          4: notPresent
    #          5: shutdown
    #          6: degraded
    #          7: idle
    #          8: busy
    #          9: hibernation
    #          10: inTest
    #          11: loopback
    #          12: softwareUpgrade
    #          13: initializing
    #          14: unknown
    #          15: incomplete
    #          16: laserSafetyShutoff
    #          17: measuring
    #          18: firmwareLoading
    #          19: connected
    #          20: communicationFailed
    metric_tags:
      - tag: coriant_groove_shelf_id
        symbol:
          OID: 1.3.6.1.4.1.42229.1.2.3.1.1.1.1
          name: coriant.groove.shelfId
      - tag: coriant_groove_shelf_location
        symbol:
          OID: 1.3.6.1.4.1.42229.1.2.3.1.1.1.2
          name: coriant.groove.shelfLocation
      - tag: coriant_groove_shelf_alias_name
        symbol:
          OID: 1.3.6.1.4.1.42229.1.2.3.1.1.1.8
          name: coriant.groove.shelfAliasName

  - MIB: CORIANT-GROOVE-MIB
    table:
      OID: 1.3.6.1.4.1.42229.1.2.3.3.1
      name: cardTable
    symbols:
      - OID: 1.3.6.1.4.1.42229.1.2.3.3.1.1.7
        name: coriant.groove.cardFanSpeedRate
        chart_meta:
          description: The fan speed of percentage
          family: 'Hardware/Card/Fan/Speed'
          unit: "%"
      - OID: 1.3.6.1.4.1.42229.1.2.3.3.1.1.9
        name: coriant.groove.cardTemperature  # Type CoriantTypesTemperature is a string that represents a float in Celcius e.g. 23.8
        extract_value: '(\d+)'
        chart_meta:
          description: Temperature at the monitoring point
          family: 'Hardware/Card/Temperature/Value'
          unit: "Cel"
      - OID: 1.3.6.1.4.1.42229.1.2.3.3.1.1.3
        name: coriant.groove.cardAdminStatus
        chart_meta:
          description: The administrative state specifies the permission to use or prohibition against using the resource
          family: 'Hardware/Card/Admin/Status'
          unit: "{status}"
        mapping:
          1: up
          2: down
      - OID: 1.3.6.1.4.1.42229.1.2.3.3.1.1.4
        name: coriant.groove.cardOperStatus
        chart_meta:
          description: The operational state specifies whether or not a resource is able to provide service
          family: 'Hardware/Card/Operational/Status'
          unit: "{status}"
        mapping:
          1: up
          2: down
      - OID: 1.3.6.1.4.1.42229.1.2.3.3.1.1.10
        name: coriant.groove.cardMode
        chart_meta:
          description: The card mode
          family: 'Hardware/Card/Mode/Status'
          unit: "{status}"
        mapping:
          0: notApplicable
          1: normal
          2: regen
          3: mixFunction
          4: greyMuxponder
    # TODO: bits handling
    #      - OID: 1.3.6.1.4.1.42229.1.2.3.3.1.1.5
    #        name: coriant.groove.cardAvailStatus
    #        chart_meta:
    #          unit: "{status}"
    #        mapping:
    #          0: none
    #          1: failed
    #          2: mismatch
    #          3: lowerLayerDown
    #          4: notPresent
    #          5: shutdown
    #          6: degraded
    #          7: idle
    #          8: busy
    #          9: hibernation
    #          10: inTest
    #          11: loopback
    #          12: softwareUpgrade
    #          13: initializing
    #          14: unknown
    #          15: incomplete
    #          16: laserSafetyShutoff
    #          17: measuring
    #          18: firmwareLoading
    #          19: connected
    #          20: communicationFailed
    metric_tags:
      - tag: coriant_groove_card_required_type
        symbol:
          OID: 1.3.6.1.4.1.42229.1.2.3.3.1.1.1
          name: coriant.groove.cardRequiredType
        mapping:
          11: fan
          12: psu
          13: chm1
          14: chm2
          16: xtm2
          17: chm1g
          18: chm1lh
          19: chm2lh
          20: utm2
          100: occ2
          101: omd96
          102: paoscofp2
          103: pabaofp2
          104: pairofp2
          105: palrofp2
          106: paerofp2
          107: bahofp2
          109: omd48_s
          110: omd48_o
          111: tdcmofp2
          112: bauofp2
          113: paulrofp2
          114: omd8b1ofp2
          115: omd8b2ofp2
          116: opsofp2
          117: otdrofp2
          118: ocmofp2
          119: opsptofp2
          120: chm2t
          121: frcu
          122: cad8ofp2
          123: cad8eofp2
          124: omd64
          125: ws04sofp2
          126: cad16aofp2
          127: baxofp2
          128: rd09sm
          129: omd48e
          130: dge2m2ofp2
          131: pbmtpp
          200: vir_sim
      - tag: coriant_groove_card_equipment_name
        symbol:
          OID: 1.3.6.1.4.1.42229.1.2.3.3.1.1.2
          name: coriant.groove.cardEquipmentName
      - tag: coriant_groove_card_alias_name
        symbol:
          OID: 1.3.6.1.4.1.42229.1.2.3.3.1.1.6
          name: coriant.groove.cardAliasName

  - MIB: CORIANT-GROOVE-MIB
    table:
      OID: 1.3.6.1.4.1.42229.1.2.3.6.1
      name: portTable
    symbols:
      - OID: 1.3.6.1.4.1.42229.1.2.3.6.1.1.4
        name: coriant.groove.portRxOpticalPower  # Type CoriantTypesOpticalPower is a string that represents a float in dBm unit e.g. -14.5
        extract_value: '(-?\d+)'
        chart_meta:
          description: Received optical power
          family: 'Network/Optical/Port/Power/Rx'
          unit: "dBm"
      - OID: 1.3.6.1.4.1.42229.1.2.3.6.1.1.5
        name: coriant.groove.portTxOpticalPower  # Type CoriantTypesOpticalPower is a string that represents a float in dBm unit e.g. -14.5
        extract_value: '(-?d+)'
        chart_meta:
          description: Transmitted optical power
          family: 'Network/Optical/Port/Power/Tx'
          unit: "dBm"
    metric_tags:
      - tag: coriant_groove_port_name
        symbol:
          OID: 1.3.6.1.4.1.42229.1.2.3.6.1.1.16
          name: coriant.groove.portName
      - tag: coriant_groove_port_alias_name
        symbol:
          OID: 1.3.6.1.4.1.42229.1.2.3.6.1.1.22
          name: coriant.groove.portAliasName
      - tag: _coriant_groove_port_service_label
        symbol:
          OID: 1.3.6.1.4.1.42229.1.2.3.6.1.1.23
          name: coriant.groove.portServiceLabel
      - tag: _coriant_groove_port_connected_to
        symbol:
          OID: 1.3.6.1.4.1.42229.1.2.3.6.1.1.24
          name: coriant.groove.portConnectedTo

  - MIB: CORIANT-GROOVE-MIB
    table:
      OID: 1.3.6.1.4.1.42229.1.2.4.1.19.1
      name: ochOsTable
    symbols:
      - OID: 1.3.6.1.4.1.42229.1.2.4.1.19.1.1.23
        name: coriant.groove.ochOsCD
        chart_meta:
          description: Value of Chromatic Dispersion
          family: 'Network/Optical/Channel/ChromaticDispersion'
          unit: "ps/nm"
      - OID: 1.3.6.1.4.1.42229.1.2.4.1.19.1.1.24
        name: coriant.groove.ochOsOSNR  # Type CoriantTypesOpticalDB is a string that represents a float in dB unit e.g. 33.5
        extract_value: '(\d+)'
        chart_meta:
          description: Current value of OSNR
          family: 'Network/Optical/Channel/OSNR'
          unit: "dB"
      - OID: 1.3.6.1.4.1.42229.1.2.4.1.19.1.1.15
        name: coriant.groove.ochOsAdminStatus
        chart_meta:
          description: The administrative state specifies the permission to use or prohibition against using the resource
          family: 'Network/Optical/Channel/Admin/Status'
          unit: "{status}"
        mapping:
          1: up
          2: down
      - OID: 1.3.6.1.4.1.42229.1.2.4.1.19.1.1.16
        name: coriant.groove.ochOsOperStatus
        chart_meta:
          description: The operational state specifies whether or not a resource is able to provide service
          family: 'Network/Optical/Channel/Operational/Status'
          unit: "{status}"
        mapping:
          1: up
          2: down
    metric_tags:
      - tag: coriant_groove_och_os_alias_name
        symbol:
          OID: 1.3.6.1.4.1.42229.1.2.4.1.19.1.1.18
          name: coriant.groove.ochOsAliasName
      - tag: coriant_groove_och_os_service_label
        symbol:
          OID: 1.3.6.1.4.1.42229.1.2.4.1.19.1.1.21
          name: coriant.groove.ochOsServiceLabel
