Skip to content
Snippets Groups Projects
Commit 622beba6 authored by Erik Reid's avatar Erik Reid
Browse files

de-camelcased some var names

parent 87d24110
No related branches found
No related tags found
No related merge requests found
......@@ -72,13 +72,13 @@ def walk(agent_hostname, community, base_oid): # pragma: no cover
:return:
"""
mibBuilder = builder.MibBuilder()
mib_builder = builder.MibBuilder()
# mibViewController = view.MibViewController(mibBuilder)
compiler.addMibCompiler(
mibBuilder,
mib_builder,
sources=['http://mibs.snmplabs.com/asn1/@mib@'])
# Pre-load MIB modules we expect to work with
mibBuilder.loadModules(
mib_builder.loadModules(
'SNMPv2-MIB',
'SNMP-COMMUNITY-MIB',
'RFC1213-MIB')
......@@ -86,10 +86,10 @@ def walk(agent_hostname, community, base_oid): # pragma: no cover
logger.debug("walking %s: %s" % (agent_hostname, base_oid))
try:
for (engineErrorIndication,
pduErrorIndication,
errorIndex,
varBinds) in nextCmd(
for (engine_error_indication,
pdu_error_indication,
error_index,
var_binds) in nextCmd(
SnmpEngine(),
CommunityData(community),
UdpTransportTarget((agent_hostname, 161)),
......@@ -101,17 +101,17 @@ def walk(agent_hostname, community, base_oid): # pragma: no cover
# cf. http://snmplabs.com/
# pysnmp/examples/hlapi/asyncore/sync/contents.html
if engineErrorIndication:
if engine_error_indication:
raise SNMPWalkError(
f'snmp response engine error indication: '
f'{str(engineErrorIndication)} - {agent_hostname}')
if pduErrorIndication:
f'{str(engine_error_indication)} - {agent_hostname}')
if pdu_error_indication:
raise SNMPWalkError(
'snmp response pdu error %r at %r' % (
pduErrorIndication,
errorIndex
and varBinds[int(errorIndex) - 1][0] or '?'))
if errorIndex != 0:
pdu_error_indication,
error_index
and var_binds[int(error_index) - 1][0] or '?'))
if error_index != 0:
raise SNMPWalkError(
'sanity failure: errorIndex != 0, '
'but no error indication')
......@@ -120,7 +120,7 @@ def walk(agent_hostname, community, base_oid): # pragma: no cover
# rfc1902.ObjectType(rfc1902.ObjectIdentity(x[0]),x[1])
# .resolveWithMib(mibViewController)
# for x in varBinds]
for oid, val in varBinds:
for oid, val in var_binds:
result = {
"oid": _canonify_oid(oid),
"value": _cast_snmp_value(val)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment