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

link_priorities = {
    "0": "Primary",
    "1": "Backup",
    "2": "On-demand",
}


def inv_snmp_checkpoint_tunnels(info):
    node = inv_tree_list("networking.tunnels:")
    index = 0
    for peerip, sourceip, peername, tunnelinterface, linkpriority in info[0]:
        index += 1
        node.append({
            "index": index,
            "peerip": peerip,
            "sourceip": sourceip,
            "peername": peername,
            "tunnel_interface": tunnelinterface,
            "link_priority": link_priorities[linkpriority],
        })


inv_info['checkpoint_inv_tunnels'] = {
    'inv_function': inv_snmp_checkpoint_tunnels,
}
