Module: check_mk
Branch: master
Commit: 02881844acb11965c846aad8be94adf822458d66
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=02881844acb119…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Feb 25 14:03:44 2019 +0100
Replaced is_snmpv2c_host with is_snmpv2or3_without_bulkwalk_host
Change-Id: Ieccc32e5a11459d63abd15feecc134351386f5d2
---
cmk_base/automations/check_mk.py | 8 ++++----
cmk_base/classic_snmp.py | 2 +-
cmk_base/config.py | 5 ++---
cmk_base/data_sources/snmp.py | 5 +++--
cmk_base/snmp.py | 2 +-
cmk_base/snmp_utils.py | 2 +-
tests/integration/cmk_base/snmp/test_snmp.py | 8 ++++----
tests/unit/cmk_base/snmp/test_classic_snmp.py | 14 +++++++-------
8 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/cmk_base/automations/check_mk.py b/cmk_base/automations/check_mk.py
index dada8f0..815514e 100644
--- a/cmk_base/automations/check_mk.py
+++ b/cmk_base/automations/check_mk.py
@@ -1213,13 +1213,13 @@ class AutomationDiagHost(Automation):
# SNMP versions
if test in ['snmpv2', 'snmpv3']:
is_bulkwalk_host = True
- is_snmpv2c_host = False
+ is_snmpv2or3_without_bulkwalk_host = False
elif test == 'snmpv2_nobulk':
is_bulkwalk_host = False
- is_snmpv2c_host = True
+ is_snmpv2or3_without_bulkwalk_host = True
elif test == 'snmpv1':
is_bulkwalk_host = False
- is_snmpv2c_host = False
+ is_snmpv2or3_without_bulkwalk_host = False
else:
return 1, "SNMP command not implemented"
@@ -1232,7 +1232,7 @@ class AutomationDiagHost(Automation):
credentials=credentials,
port=config.snmp_port_of(hostname),
is_bulkwalk_host=is_bulkwalk_host,
- is_snmpv2c_host=is_snmpv2c_host,
+
is_snmpv2or3_without_bulkwalk_host=is_snmpv2or3_without_bulkwalk_host,
bulk_walk_size_of=config.bulk_walk_size_of(hostname),
timing={
'timeout': snmp_timeout,
diff --git a/cmk_base/classic_snmp.py b/cmk_base/classic_snmp.py
index 644e1a3..eed8d95 100644
--- a/cmk_base/classic_snmp.py
+++ b/cmk_base/classic_snmp.py
@@ -231,7 +231,7 @@ def _snmp_base_command(what, host_config, context_name):
else:
if what == 'walk':
command = ['snmpwalk']
- if host_config.is_snmpv2c_host:
+ if host_config.is_snmpv2or3_without_bulkwalk_host:
options.append('-v2c')
else:
options.append('-v1')
diff --git a/cmk_base/config.py b/cmk_base/config.py
index 295ba61..1b82a6f 100644
--- a/cmk_base/config.py
+++ b/cmk_base/config.py
@@ -1064,9 +1064,8 @@ def bulk_walk_size_of(hostname):
return bulk_sizes[0]
-def is_snmpv2c_host(hostname):
- return is_bulkwalk_host(hostname) or \
- in_binary_hostlist(hostname, snmpv2c_hosts)
+def is_snmpv2or3_without_bulkwalk_host(hostname):
+ return in_binary_hostlist(hostname, snmpv2c_hosts)
def is_usewalk_host(hostname):
diff --git a/cmk_base/data_sources/snmp.py b/cmk_base/data_sources/snmp.py
index 4cf84a0..d406c0b 100644
--- a/cmk_base/data_sources/snmp.py
+++ b/cmk_base/data_sources/snmp.py
@@ -64,7 +64,8 @@ class SNMPDataSource(DataSource):
self._credentials = config.snmp_credentials_of(self._hostname)
self._port = config.snmp_port_of(self._hostname)
self._is_bulkwalk_host = config.is_bulkwalk_host(self._hostname)
- self._is_snmpv2c_host = config.is_snmpv2c_host(self._hostname)
+ self._is_snmpv2or3_without_bulkwalk_host =
config.is_snmpv2or3_without_bulkwalk_host(
+ self._hostname)
def id(self):
return "snmp"
@@ -83,7 +84,7 @@ class SNMPDataSource(DataSource):
credentials=self._credentials,
port=self._port,
is_bulkwalk_host=self._is_bulkwalk_host,
- is_snmpv2c_host=self._is_snmpv2c_host,
+ is_snmpv2or3_without_bulkwalk_host=self._is_snmpv2or3_without_bulkwalk_host,
bulk_walk_size_of=config.bulk_walk_size_of(self._hostname),
timing=config.snmp_timing_of(self._hostname),
oid_range_limits=config.oid_range_limits_of(self._hostname),
diff --git a/cmk_base/snmp.py b/cmk_base/snmp.py
index f482791..f0341ee 100644
--- a/cmk_base/snmp.py
+++ b/cmk_base/snmp.py
@@ -150,7 +150,7 @@ def create_snmp_host_config(hostname):
credentials=config.snmp_credentials_of(hostname),
port=config.snmp_port_of(hostname),
is_bulkwalk_host=config.is_bulkwalk_host(hostname),
- is_snmpv2c_host=config.is_snmpv2c_host(hostname),
+
is_snmpv2or3_without_bulkwalk_host=config.is_snmpv2or3_without_bulkwalk_host(hostname),
bulk_walk_size_of=config.bulk_walk_size_of(hostname),
timing=config.snmp_timing_of(hostname),
oid_range_limits=config.oid_range_limits_of(hostname),
diff --git a/cmk_base/snmp_utils.py b/cmk_base/snmp_utils.py
index 84bb921..a2a963b 100644
--- a/cmk_base/snmp_utils.py
+++ b/cmk_base/snmp_utils.py
@@ -84,7 +84,7 @@ SNMPHostConfig = NamedTuple(
("credentials", SNMPCredentials),
("port", int),
("is_bulkwalk_host", bool),
- ("is_snmpv2c_host", bool),
+ ("is_snmpv2or3_without_bulkwalk_host", bool),
("bulk_walk_size_of", int),
# TODO: Cleanup to named tuple
("timing", dict),
diff --git a/tests/integration/cmk_base/snmp/test_snmp.py
b/tests/integration/cmk_base/snmp/test_snmp.py
index e57e549..54708a4 100644
--- a/tests/integration/cmk_base/snmp/test_snmp.py
+++ b/tests/integration/cmk_base/snmp/test_snmp.py
@@ -74,7 +74,7 @@ def snmpsim(site, request, tmp_path_factory):
port=1337,
# TODO: Use SNMPv2 over v1 for the moment
is_bulkwalk_host=False,
- is_snmpv2c_host=True,
+ is_snmpv2or3_without_bulkwalk_host=True,
bulk_walk_size_of=10,
timing={},
oid_range_limits=[],
@@ -147,7 +147,7 @@ def test_get_single_oid_ipv6(snmpsim, backend):
credentials="public",
port=1337,
is_bulkwalk_host=False,
- is_snmpv2c_host=True,
+ is_snmpv2or3_without_bulkwalk_host=True,
bulk_walk_size_of=10,
timing={},
oid_range_limits=[],
@@ -167,7 +167,7 @@ def test_get_single_oid_snmpv3(snmpsim, backend):
credentials=('authNoPriv', 'md5', 'authOnlyUser',
'authOnlyUser'),
port=1337,
is_bulkwalk_host=False,
- is_snmpv2c_host=True,
+ is_snmpv2or3_without_bulkwalk_host=True,
bulk_walk_size_of=10,
timing={},
oid_range_limits=[],
@@ -272,7 +272,7 @@ def test_get_single_oid_not_resolvable(snmpsim, backend):
credentials="public",
port=1337,
is_bulkwalk_host=True,
- is_snmpv2c_host=True,
+ is_snmpv2or3_without_bulkwalk_host=True,
bulk_walk_size_of=10,
timing={},
oid_range_limits=[],
diff --git a/tests/unit/cmk_base/snmp/test_classic_snmp.py
b/tests/unit/cmk_base/snmp/test_classic_snmp.py
index 1df1b91..0b2ee12 100644
--- a/tests/unit/cmk_base/snmp/test_classic_snmp.py
+++ b/tests/unit/cmk_base/snmp/test_classic_snmp.py
@@ -16,7 +16,7 @@ def test_snmp_port_spec(port, expected):
credentials="public",
port=port,
is_bulkwalk_host=False,
- is_snmpv2c_host=False,
+ is_snmpv2or3_without_bulkwalk_host=False,
bulk_walk_size_of=10,
timing={},
oid_range_limits=[],
@@ -36,7 +36,7 @@ def test_snmp_proto_spec(monkeypatch, is_ipv6, expected):
credentials="public",
port=161,
is_bulkwalk_host=False,
- is_snmpv2c_host=False,
+ is_snmpv2or3_without_bulkwalk_host=False,
bulk_walk_size_of=10,
timing={},
oid_range_limits=[],
@@ -59,7 +59,7 @@ SNMPSettings = collections.namedtuple("SNMPSettings", [
credentials="public",
port=161,
is_bulkwalk_host=True,
- is_snmpv2c_host=True,
+ is_snmpv2or3_without_bulkwalk_host=True,
bulk_walk_size_of=10,
timing={
"timeout": 2,
@@ -80,7 +80,7 @@ SNMPSettings = collections.namedtuple("SNMPSettings", [
credentials="public",
port=161,
is_bulkwalk_host=False,
- is_snmpv2c_host=False,
+ is_snmpv2or3_without_bulkwalk_host=False,
bulk_walk_size_of=5,
timing={
"timeout": 5,
@@ -101,7 +101,7 @@ SNMPSettings = collections.namedtuple("SNMPSettings", [
credentials=("authNoPriv", "abc", "md5",
"abc"),
port=161,
is_bulkwalk_host=False,
- is_snmpv2c_host=False,
+ is_snmpv2or3_without_bulkwalk_host=False,
bulk_walk_size_of=5,
timing={
"timeout": 5,
@@ -122,7 +122,7 @@ SNMPSettings = collections.namedtuple("SNMPSettings", [
credentials=('noAuthNoPriv', 'secname'),
port=161,
is_bulkwalk_host=False,
- is_snmpv2c_host=False,
+ is_snmpv2or3_without_bulkwalk_host=False,
bulk_walk_size_of=5,
timing={
"timeout": 5,
@@ -143,7 +143,7 @@ SNMPSettings = collections.namedtuple("SNMPSettings", [
credentials=('authPriv', 'md5', 'secname',
'auhtpassword', 'DES', 'privacybla'),
port=161,
is_bulkwalk_host=False,
- is_snmpv2c_host=False,
+ is_snmpv2or3_without_bulkwalk_host=False,
bulk_walk_size_of=5,
timing={
"timeout": 5,