Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SeedDB writeable profile connectivity verification to support SNMPv3 #2727

Closed
Tracked by #1177
lunkwill42 opened this issue Nov 10, 2023 · 0 comments · Fixed by #2730
Closed
Tracked by #1177

Update SeedDB writeable profile connectivity verification to support SNMPv3 #2727

lunkwill42 opened this issue Nov 10, 2023 · 0 comments · Fixed by #2730
Assignees

Comments

@lunkwill42
Copy link
Member

lunkwill42 commented Nov 10, 2023

The SeedDB connectivity tests have their own mode for testing that an SNMP profile marked as writeable will actually allow a write command. This was not updated in #2704 as we did not yet have an SNMP entity that was configured with a write-enabled user.

This is mostly about updating this function:

def snmp_write_test(ip, profile):
"""Test that snmp write works"""
testresult = {
'error_message': '',
'custom_error': '',
'status': False,
'syslocation': '',
}
syslocation = '1.3.6.1.2.1.1.6.0'
value = ''
try:
snmp = Snmp(
ip,
profile.configuration.get("community"),
profile.configuration.get("version"),
)
value = safestring(snmp.get(syslocation))
snmp.set(syslocation, 's', value.encode('utf-8'))
except SnmpError as error:
testresult['error_message'] = error.args
testresult['status'] = False
except UnicodeDecodeError as error:
testresult['custom_error'] = 'UnicodeDecodeError'
testresult['error_message'] = error.args
testresult['status'] = False
else:
testresult['status'] = True
testresult['syslocation'] = value
return testresult

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant