No IPv6 support
If you try to use an IPv6 as hostname (such as udp6:[2801:84d:0:ab250::32:5060]), you get a
ValueError: too many values to unpack (expected 2)
as the Session object mistankely tries to unpack the ':' as the specification of a remote port.
As a quick fix I wrote two functions to detect remote ports and extract them:
def has_remote_port(hostname):
if hostname.startswith('udp6:['):
return ']:' in hostname
return ':' in hostname
def extract_remote_port(hostname):
if ']:' in hostname:
hostname, remote_port = hostname.split(']:')
hostname = hostname + ']'
else:
hostname, remote_port = hostname.split(':')
return (hostname, int(remote_port))
And use them in the Session object constructor:
if has_remote_port(hostname):
if remote_port:
raise ValueError(
'a remote port was specified yet the hostname appears '
'to have a port defined too'
)
else:
hostname, remote_port = extract_remote_port(hostname)
Any ETA on this? Still an issue, can't poll devices using IPv6 address.
Development for this library is currently at a standstill. I do not have the time to work on it. I’m hoping someone else can pick it up and continue to work on bugs
Hey guys, do we have any updates on this issue?
Nobody has volunteered to maintain the project. No development has been done.
yeah, I see last commit was about 2 years ago .. to be frank, that's so sad that such a great library has no maintainers :(
To bypass validation on IPv6, we use this approach to work around the issue
from easysnmp import Session
session = Session(community='public', version=2, timeout=2, retries=1, use_numeric=True, use_sprint_value=True)
update hostname
session.update_session(hostname="2001:0578:0030:71c2:9552:5bd0:08d1:1f8e")
You may retrieve an individual OID using an SNMP GET
sysDescr = session.get('sysDescr.0')
print(sysDescr)