#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2019 tribe29 GmbH - License: GNU General Public License v2
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
# conditions defined in the file COPYING, which is part of this source code package.

# .1.3.6.1.4.1.1966.21.1.1.1.1.2.1.2.1.1 1 --> PERLE-MCR-MGT-MIB::mcrPsmuIndex.1.a
# .1.3.6.1.4.1.1966.21.1.1.1.1.2.1.2.1.2 2 --> PERLE-MCR-MGT-MIB::mcrPsmuIndex.1.b
# .1.3.6.1.4.1.1966.21.1.1.1.1.2.1.3.1.1 MCR-ACPWR --> PERLE-MCR-MGT-MIB::mcrPsmuModelName.1.a
# .1.3.6.1.4.1.1966.21.1.1.1.1.2.1.3.1.2 MCR-ACPWR --> PERLE-MCR-MGT-MIB::mcrPsmuModelName.1.b
# .1.3.6.1.4.1.1966.21.1.1.1.1.2.1.5.1.1 104-101015T10175 --> PERLE-MCR-MGT-MIB::mcrPsmuPsuSerialNumber.1.a
# .1.3.6.1.4.1.1966.21.1.1.1.1.2.1.5.1.2 104-101015T10177 --> PERLE-MCR-MGT-MIB::mcrPsmuPsuSerialNumber.1.b
# .1.3.6.1.4.1.1966.21.1.1.1.1.2.1.9.1.1 1 --> PERLE-MCR-MGT-MIB::mcrPsmuPsuStatus.1.a
# .1.3.6.1.4.1.1966.21.1.1.1.1.2.1.9.1.2 1 --> PERLE-MCR-MGT-MIB::mcrPsmuPsuStatus.1.b
# .1.3.6.1.4.1.1966.21.1.1.1.1.2.1.10.1.1 12.05 --> PERLE-MCR-MGT-MIB::mcrPsmuPsuVoltage.1.a
# .1.3.6.1.4.1.1966.21.1.1.1.1.2.1.10.1.2 12.05 --> PERLE-MCR-MGT-MIB::mcrPsmuPsuVoltage.1.b
# .1.3.6.1.4.1.1966.21.1.1.1.1.2.1.11.1.1 6.75 --> PERLE-MCR-MGT-MIB::mcrPsmuPsuPowerUsage.1.a
# .1.3.6.1.4.1.1966.21.1.1.1.1.2.1.11.1.2 6.75 --> PERLE-MCR-MGT-MIB::mcrPsmuPsuPowerUsage.1.b
# .1.3.6.1.4.1.1966.21.1.1.1.1.2.1.12.1.1 1 --> PERLE-MCR-MGT-MIB::mcrPsmuFanStatus.1.a
# .1.3.6.1.4.1.1966.21.1.1.1.1.2.1.12.1.2 1 --> PERLE-MCR-MGT-MIB::mcrPsmuFanStatus.1.b


def inv_perle_psmu(parsed):
    node = inv_tree_list("hardware.components.psus:")
    for psu_index, data in parsed.items():
        node.append({
            "index": psu_index,
            "description": data["descr"],
            "model": data["model"],
            "serial": data["serial"]
        })


inv_info['perle_psmu'] = {
    'inv_function': inv_perle_psmu,
}
