Open ktbyers opened 1 year ago
Relevant change that broke this:
CC: @kacem-expereo
Need better testing for snmp_autodetect (would this have been caught in my standard release process)?
Sorry about this, indeed i actually never use hostnames when using netmiko and didn't think about it at all. I can replace ipaddress library with socket library which will help to figure out if it's using ipv4 or ipv6 and at the same time resolve the hostname. In the case where one host has both ipv4 and ipv6 we'd pass the hostname to cmdgen.UdpTransportTarget (so ipv4) as it would have been done before i break it.
Let me know if this is acceptable!
Draft : https://github.com/kacem-expereo/netmiko/tree/%233144
If it looks fine, I will manually test it against ipv4 only ipv6 only fqdn, then ipv4+ipv6 fqdn. Should I also find out how to test it automatically ?
Kindly,
@kacem-expereo Do you want to do a PR on this?
@ktbyers sure, i will proceed with some testing on my side and move forward with a PR :)
It's done @ktbyers ,sorry for the delay! waiting for your comments Kindly,
Traceback (most recent call last): File "/home/kbyers/netmiko_course/class10/collateral/snmp_detect.py", line 9, in
my_snmp = SNMPDetect(
File "/home/kbyers/VENV/py3_venv/src/netmiko/netmiko/snmp_autodetect.py", line 248, in init
if ipaddress.ip_address(self.hostname).version == 6:
File "/usr/local/lib/python3.9/ipaddress.py", line 53, in ip_address
raise ValueError('%r does not appear to be an IPv4 or IPv6 address' %
ValueError: 'cisco1.lasthop.io' does not appear to be an IPv4 or IPv6 address
ipaddress.ip_address does not support a hostname here.