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

Using async pysnp getCmd #3472

Closed
wants to merge 2 commits into from
Closed

Conversation

Tonygratta
Copy link
Contributor

Bugfix #3469 The sync pysnmp API has been deprecated and removed since version 6.2.0. This commit replaces sync getCmd with async getCmd pysnmp method.

Tonygratta and others added 2 commits August 6, 2024 23:21
The sync pysnmp API has been deprecated and removed since version 6.2.0. This commit replaces sync getCmd with async getCmd pysnmp method.
@ktbyers
Copy link
Owner

ktbyers commented Aug 7, 2024

@Tonygratta I didn't realize this had been moved to an async solution. This won't work for Netmiko which is entirely synchronous.

@ktbyers
Copy link
Owner

ktbyers commented Aug 7, 2024

Let me look at this some more...

@ktbyers
Copy link
Owner

ktbyers commented Aug 7, 2024

I think we need to make this backwards compatible i.e. try to use the old solution first and then only try the new solution if the old doesn't work.

I say this as the new solution is very new and they changed the code meaningfully (i.e. they converted over to an async solution).

Let me know if you want to take a first pass on this, if not, I will do it.

@ktbyers
Copy link
Owner

ktbyers commented Aug 7, 2024

Pattern should probably be to detect old solution/new solution here:

try:
    from pysnmp.entity.rfc3413.oneliner import cmdgen
    SNMP_MODE = "legacy"
except ImportError:
    from pysnmp.hlapi.asyncio import cmdgen
    SNMP_MODE = "async"
except ImportError:
    raise ImportError("pysnmp not installed; please install it: 'pip install pysnmp'")

Something like that and then use that SNMP_MODE flag to pick/use the right code.

We also need to anticipate people might need the older version of SNMP for quite some time (especially since the new SNMP is not-backwards compatible).

@ktbyers
Copy link
Owner

ktbyers commented Aug 7, 2024

FYI, I started working on this.

@ktbyers
Copy link
Owner

ktbyers commented Aug 7, 2024

Superseded by:

#3473

@ktbyers ktbyers closed this Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants