-
Notifications
You must be signed in to change notification settings - Fork 45
Description
Describe the bug
Attempt to add an ip-device in seeddb with a hostname/ip-address that does not exist.
To Reproduce
Steps to reproduce the behavior:
- Go to '/seeddb/netbox/add/'
- Click on 'Add new ip device'
- Fill in the form but use a non-existent ip-address or non-existent hostname in "Ip device"
- Click "Check Connectivity"
- Get the error-message "Error during SNMP-request" and the following exception in the logs:
[Tue Oct 31 10:34:15 2023] [ERROR] [pid=135 zen.pynetsnmp.netsnmp] b's: Unknown host (333.333.333.333:161)\n'
Internal Server Error: /seeddb/netbox/get-read-only-variables/
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/source/python/nav/web/seeddb/page/netbox/edit.py", line 153, in get_read_only_variables
response = get_snmp_read_only_variables(ip_address, profile)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/source/python/nav/web/seeddb/page/netbox/edit.py", line 183, in get_snmp_read_only_variables
result["type"] = get_type_id(ip_address, profile)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/source/python/nav/web/seeddb/page/netbox/edit.py", line 259, in get_type_id
netbox_type = snmp_type(
^^^^^^^^^^
File "/source/python/nav/web/seeddb/page/netbox/edit.py", line 268, in snmp_type
snmp = Snmp(ip_addr, snmp_ro, snmp_version)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/source/python/nav/Snmp/pynetsnmp.py", line 110, in __init__
self.handle.open()
File "/usr/local/lib/python3.11/site-packages/pynetsnmp/netsnmp.py", line 574, in open
raise SnmpError('snmp_open')
pynetsnmp.netsnmp.SnmpError: snmp_open[Tue Oct 31 10:34:15 2023] [ERROR] [pid=135 django.request] Internal Server Error: /seeddb/netbox/get-read-only-variables/
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/source/python/nav/web/seeddb/page/netbox/edit.py", line 153, in get_read_only_variables
response = get_snmp_read_only_variables(ip_address, profile)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/source/python/nav/web/seeddb/page/netbox/edit.py", line 183, in get_snmp_read_only_variables
result["type"] = get_type_id(ip_address, profile)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/source/python/nav/web/seeddb/page/netbox/edit.py", line 259, in get_type_id
netbox_type = snmp_type(
^^^^^^^^^^
File "/source/python/nav/web/seeddb/page/netbox/edit.py", line 268, in snmp_type
snmp = Snmp(ip_addr, snmp_ro, snmp_version)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/source/python/nav/Snmp/pynetsnmp.py", line 110, in __init__
self.handle.open()
File "/usr/local/lib/python3.11/site-packages/pynetsnmp/netsnmp.py", line 574, in open
raise SnmpError('snmp_open')
pynetsnmp.netsnmp.SnmpError: snmp_open[31/Oct/2023 10:34:15] "GET /seeddb/netbox/get-read-only-variables/?ip_address=333.333.333.333&profiles%5B%5D=1 HTTP/1.1" 500 88684
Expected behavior
I expect to get an error-message that something is wrong with the ip-address or hostname, that there is no exception in the logs, and that the attempt is not logged as a 500 Sever error in the access log.
Environment (please complete the following information):
- "docker compose up"
- debian bullseye
- Nav is latest master
Metadata
Metadata
Assignees
Labels
No labels