diff --git a/agent_based/inv_cisco_wlc_ap_cdp_cache.py b/agent_based/inv_cisco_wlc_ap_cdp_cache.py index db114bec5f5705754278669c2b232238cf29107f..83d348e60475bd6f89df86966ca7a8828e912d07 100644 --- a/agent_based/inv_cisco_wlc_ap_cdp_cache.py +++ b/agent_based/inv_cisco_wlc_ap_cdp_cache.py @@ -15,15 +15,6 @@ # 2020-03-15: added support for CMK1.6x # 2021-07-10: rewritten vor CMK 2.0 -import re -import time -import binascii -from typing import List, NamedTuple - -from cmk.base.plugins.agent_based.agent_based_api.v1 import ( - OIDEnd, - OIDBytes, -) from cmk.base.plugins.agent_based.agent_based_api.v1 import ( register, SNMPTree, @@ -48,19 +39,19 @@ def _render_ip_address(bytestring): _cdp_duplex = { - 0: 'N/A', - 1: 'unknown', - 2: 'full duplex', - 3: 'half duplex', + '0': 'N/A', + '1': 'unknown', + '2': 'full duplex', + '3': 'half duplex', } _cdp_speed = { - 0: 'N/A', - 1: 'none', - 2: '10Mbps', - 3: '100Mbps', - 4: '1000Mbps', - 5: 'auto', + '0': 'N/A', + '1': 'none', + '2': '10Mbps', + '3': '100Mbps', + '4': '1000Mbps', + '5': 'auto', } _interface_displayhints = { @@ -111,8 +102,8 @@ def parse_cisco_wlc_ap_cdp_cache(string_table: StringTable): 'neighbour_address': neighaddress, 'neighbour_interface': neighinterface, 'neighbour_platform': platform, - 'duplex': _cdp_duplex.get(int(duplex)), - 'speed': _cdp_speed.get(int(speed)), + 'duplex': _cdp_duplex.get(duplex), + 'speed': _cdp_speed.get(speed), }) return neighbours diff --git a/inv_cisco_wlc_ap_cdp_cache.mkp b/inv_cisco_wlc_ap_cdp_cache.mkp index 66539c22be258b4b0231cfe7bed37e0a7cec3ade..767ec8c5b1c516627285302bfa18e2f80d50ab5e 100644 Binary files a/inv_cisco_wlc_ap_cdp_cache.mkp and b/inv_cisco_wlc_ap_cdp_cache.mkp differ diff --git a/web/plugins/views/inv_cisco_wlc_ap_cdp_cache.py b/web/plugins/views/inv_cisco_wlc_ap_cdp_cache.py index d589ff6b85ef3d5023594f7c5760f4e9e0fd1c29..a44412041f36a75bd72c64a52ccd3bfcdb12c31e 100644 --- a/web/plugins/views/inv_cisco_wlc_ap_cdp_cache.py +++ b/web/plugins/views/inv_cisco_wlc_ap_cdp_cache.py @@ -1,10 +1,10 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -import cmk.gui.utils from cmk.gui.plugins.views import ( inventory_displayhints, ) from cmk.gui.i18n import _ +from cmk.gui.plugins.views.inventory import declare_invtable_view inventory_displayhints.update({ '.networking.wlan.controller.ap_cdp_cache:': {'title': _('Access Points CDP Cache'), @@ -23,7 +23,5 @@ inventory_displayhints.update({ '.networking.wlan.controller.ap_cdp_cache:*.speed': {'title': _('Speed'), }, }) -from cmk.gui.plugins.views.inventory import declare_invtable_view - declare_invtable_view('invwlcapcdpcache', '.networking.wlan.controller.ap_cdp_cache:', _('WLC AP CDP cache'), _('WLC AP CDP Cache')) diff --git a/web/plugins/wato/inv_cisco_wlc_ap_cdp_cache.py b/web/plugins/wato/inv_cisco_wlc_ap_cdp_cache.py index 86fa35a66d2c02219f97bdc98f8e888ee4339f7d..78fce03e504dcf06a72acfe91aa9bea1a9212365 100644 --- a/web/plugins/wato/inv_cisco_wlc_ap_cdp_cache.py +++ b/web/plugins/wato/inv_cisco_wlc_ap_cdp_cache.py @@ -3,7 +3,6 @@ # # - from cmk.gui.i18n import _ from cmk.gui.plugins.wato import ( HostRulespec, @@ -20,13 +19,13 @@ from cmk.gui.plugins.wato.inventory import ( RulespecGroupInventory, ) +_removecolumns = [ + ('duplex', 'Duplex'), + ('speed', 'Speed'), +] -def _valuespec_inv_cisco_wlc_ap_cdp_cache(): - removecolumns = [ - ('duplex', 'Duplex'), - ('speed', 'Speed'), - ] +def _valuespec_inv_cisco_wlc_ap_cdp_cache(): return Dictionary( title=_('Cisco WLC AP CDP cache'), elements=[ @@ -47,7 +46,7 @@ def _valuespec_inv_cisco_wlc_ap_cdp_cache(): ListChoice( title=_('List of columns to remove'), help=_('information to remove from inventory'), - choices=removecolumns, + choices=_removecolumns, default_value=[], )), ('use_short_if_name',