Migration Guide: V1.X.X to V2.X.X¶
This guide outlines the changes required to migrate from V1.X.X to V2.X.X.
Major Changes¶
The
Sessionclass has been refactored to use string parameters instead of mixed typesMany parameters have been removed or renamed for clarity
Default values have been modified for several parameters
Parameter Changes¶
Renamed Parameters¶
remote_port→port_numberprivacy_password→privacy_passphraseauth_password→auth_passphraseuse_numeric→print_oids_numericallyuse_long_names→print_full_oidsuse_enums→print_enums_numerically
Removed Parameters¶
The following parameters have been removed in V2.X.X and will be reintroduced in future releases, as we focus on stabilizing core functionality:
local_portengine_bootsengine_timeour_identitytheir_identitytheir_hostnametrust_certuse_sprint_valuebest_guessretry_no_suchabort_on_nonexistent
Parameter Value Changes¶
In V2.X.X, all parameters have updated acceptable values to align with the requirements of the underlying net-snmp applications. For example:
security_level: In V1.X.X, this parameter accepted values like auth_with_privacy. In
V2.X.X, the possible values are now noAuthNoPriv, authNoPriv, and authPriv, as
required by net-snmp tools like snmpwalk.
For more details on the acceptable values for security_level and other parameters, refer to the
official net-snmp documentation: Net-SNMP Command Line Applications.
Parameter Mapping Table¶
The following table maps EzSnmp parameter names to their corresponding net-snmp parameter options:
EzSnmp Parameter |
Net-SNMP Parameter Option |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Migration Example¶
Old code (V1.X.X):
session = Session(
hostname="example.com",
version=3,
remote_port=161,
timeout=1,
use_numeric=True
)
New code (V2.X.X):
session = Session(
hostname="example.com",
version="3",
port_number="161",
timeout="1",
print_oids_numerically=True
)
or
session = Session(
hostname="example.com",
version=3,
port_number=161,
timeout=1,
print_oids_numerically=True
)