#!/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.


def inv_hp_proliant_da_phydrv(info):
    map_types = {
        "1": "other",
        "2": "parallel SCSI",
        "3": "SATA",
        "4": "SAS",
    }

    node = inv_tree_list("hardware.storage.disks:")
    for cntlr_index, _index, bay, _status, _ref_hours, size, _condition, \
        bus_number, _smart_status, model, serial, ty, fw in info:

        node.append({
            "controller": cntlr_index,
            "bay": bay,
            "bus": bus_number,
            "size": int(size) * 1024**2,
            "model": model,
            "serial": serial,
            "type": map_types.get(ty, "unknown(%s)" % ty),
            "firmware": fw,
        })


inv_info['hp_proliant_da_phydrv'] = {
    'inv_function': inv_hp_proliant_da_phydrv,
}
