diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index dc1c4856..6a56f2db 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -12,4 +12,4 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: psf/black@24.4.2 \ No newline at end of file + - uses: psf/black@24.8.0 \ No newline at end of file diff --git a/.github/workflows/build_and_publish_to_test_pypi.yml b/.github/workflows/build_and_publish_to_test_pypi.yml index 09573786..5f2762d9 100644 --- a/.github/workflows/build_and_publish_to_test_pypi.yml +++ b/.github/workflows/build_and_publish_to_test_pypi.yml @@ -18,7 +18,7 @@ jobs: - name: Check for changes in setup.py/cfg id: changed-files - uses: tj-actions/changed-files@v44.5.6 + uses: tj-actions/changed-files@v44.5.7 with: files: | setup.py diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index d8702949..bfa797eb 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -18,7 +18,7 @@ jobs: - name: Check for changes in source code id: changed-files - uses: tj-actions/changed-files@v44.5.6 + uses: tj-actions/changed-files@v44.5.7 with: files: | ezsnmp/*.py diff --git a/.github/workflows/sphinx_build.yml b/.github/workflows/sphinx_build.yml index 1097ce08..017cfbb5 100644 --- a/.github/workflows/sphinx_build.yml +++ b/.github/workflows/sphinx_build.yml @@ -18,7 +18,7 @@ jobs: - name: Check for changes in source code id: changed-files - uses: tj-actions/changed-files@v44.5.6 + uses: tj-actions/changed-files@v44.5.7 with: files: | sphinx_docs_build/source/*.rst diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5e0908ed..2689940c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,7 +18,7 @@ jobs: - name: Check for changes in source code id: changed-files - uses: tj-actions/changed-files@v44.5.6 + uses: tj-actions/changed-files@v44.5.7 with: files: | ezsnmp/*.py @@ -34,7 +34,7 @@ jobs: needs: check-source-changes steps: - uses: actions/checkout@v4 - - uses: psf/black@24.4.2 + - uses: psf/black@24.8.0 build-and-test: runs-on: ${{ matrix.os }} diff --git a/docs/doctrees/compat.doctree b/docs/doctrees/compat.doctree index c06258c4..3c25e3ea 100644 Binary files a/docs/doctrees/compat.doctree and b/docs/doctrees/compat.doctree differ diff --git a/docs/doctrees/environment.pickle b/docs/doctrees/environment.pickle index e3827e15..f9273c04 100644 Binary files a/docs/doctrees/environment.pickle and b/docs/doctrees/environment.pickle differ diff --git a/docs/doctrees/exceptions.doctree b/docs/doctrees/exceptions.doctree index c0a5186b..eefe2d02 100644 Binary files a/docs/doctrees/exceptions.doctree and b/docs/doctrees/exceptions.doctree differ diff --git a/docs/doctrees/ez.doctree b/docs/doctrees/ez.doctree index 38342b84..a1a73403 100644 Binary files a/docs/doctrees/ez.doctree and b/docs/doctrees/ez.doctree differ diff --git a/docs/doctrees/helpers.doctree b/docs/doctrees/helpers.doctree index f430ae5b..5f494952 100644 Binary files a/docs/doctrees/helpers.doctree and b/docs/doctrees/helpers.doctree differ diff --git a/docs/doctrees/session.doctree b/docs/doctrees/session.doctree index 76385cba..6e748731 100644 Binary files a/docs/doctrees/session.doctree and b/docs/doctrees/session.doctree differ diff --git a/docs/doctrees/utils.doctree b/docs/doctrees/utils.doctree index 9d56b397..0c01d311 100644 Binary files a/docs/doctrees/utils.doctree and b/docs/doctrees/utils.doctree differ diff --git a/docs/doctrees/variables.doctree b/docs/doctrees/variables.doctree index 0e7d4be0..70bbeeae 100644 Binary files a/docs/doctrees/variables.doctree and b/docs/doctrees/variables.doctree differ diff --git a/docs/html/.buildinfo b/docs/html/.buildinfo index b413254b..2cbca9bb 100644 --- a/docs/html/.buildinfo +++ b/docs/html/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 2539665f2dc007a29c283562d04175b8 +config: 7fa8491b3869b1cfe74338e912e698fd tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/html/_static/documentation_options.js b/docs/html/_static/documentation_options.js index 2a5f4177..1315d5c2 100644 --- a/docs/html/_static/documentation_options.js +++ b/docs/html/_static/documentation_options.js @@ -1,5 +1,5 @@ const DOCUMENTATION_OPTIONS = { - VERSION: 'V1.0.0c2', + VERSION: 'V1.0.0c3', LANGUAGE: 'en', COLLAPSE_INDEX: false, BUILDER: 'html', diff --git a/docs/html/_static/searchtools.js b/docs/html/_static/searchtools.js index 92da3f8b..b08d58c9 100644 --- a/docs/html/_static/searchtools.js +++ b/docs/html/_static/searchtools.js @@ -178,7 +178,7 @@ const Search = { htmlToText: (htmlString, anchor) => { const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html'); - for (const removalQuery of [".headerlinks", "script", "style"]) { + for (const removalQuery of [".headerlink", "script", "style"]) { htmlElement.querySelectorAll(removalQuery).forEach((el) => { el.remove() }); } if (anchor) { @@ -328,13 +328,14 @@ const Search = { for (const [title, foundTitles] of Object.entries(allTitles)) { if (title.toLowerCase().trim().includes(queryLower) && (queryLower.length >= title.length/2)) { for (const [file, id] of foundTitles) { - let score = Math.round(100 * queryLower.length / title.length) + const score = Math.round(Scorer.title * queryLower.length / title.length); + const boost = titles[file] === title ? 1 : 0; // add a boost for document titles normalResults.push([ docNames[file], titles[file] !== title ? `${titles[file]} > ${title}` : title, id !== null ? "#" + id : "", null, - score, + score + boost, filenames[file], ]); } diff --git a/docs/html/compat.html b/docs/html/compat.html index 94dac330..1fd15037 100644 --- a/docs/html/compat.html +++ b/docs/html/compat.html @@ -4,7 +4,7 @@ - ezsnmp.compat module — Ez SNMP V1.0.0c2 documentation + ezsnmp.compat module — Ez SNMP V1.0.0c3 documentation @@ -15,7 +15,7 @@ - + diff --git a/docs/html/exceptions.html b/docs/html/exceptions.html index 88cb86c9..4a75e1a7 100644 --- a/docs/html/exceptions.html +++ b/docs/html/exceptions.html @@ -4,7 +4,7 @@ - ezsnmp.exceptions module — Ez SNMP V1.0.0c2 documentation + ezsnmp.exceptions module — Ez SNMP V1.0.0c3 documentation @@ -15,7 +15,7 @@ - + diff --git a/docs/html/ez.html b/docs/html/ez.html index c7965fa2..9bc1ee66 100644 --- a/docs/html/ez.html +++ b/docs/html/ez.html @@ -4,7 +4,7 @@ - ezsnmp.ez module — Ez SNMP V1.0.0c2 documentation + ezsnmp.ez module — Ez SNMP V1.0.0c3 documentation @@ -15,7 +15,7 @@ - + @@ -93,7 +93,7 @@

ezsnmp.ez module

-ezsnmp.ez.snmp_bulkwalk(oids='.1.3.6.1.2.1', non_repeaters=0, max_repetitions=10, **session_kargs)
+ezsnmp.ez.snmp_bulkwalk(oids: List[str | Tuple[str, str]] | str | Tuple[str, str] = '.1.3.6.1.2.1', non_repeaters=0, max_repetitions=10, **session_kargs) List[SNMPVariable]

Uses SNMP GETBULK operation using the prepared session to automatically retrieve multiple pieces of information in an OID

@@ -120,7 +120,9 @@
-ezsnmp.ez.snmp_get(oids, **session_kargs)
+ezsnmp.ez.snmp_get(oids: List[str | Tuple[str, str]]) List[SNMPVariable] +
+ezsnmp.ez.snmp_get(oids: str | Tuple[str, str]) SNMPVariable

Perform an SNMP GET operation to retrieve a particular piece of information.

@@ -136,12 +138,17 @@ all parameters in the Session class are supported

+
Returns:
+

an SNMPVariable object containing the value that was +retrieved or a list of objects when you send in a list of +OIDs

+
-ezsnmp.ez.snmp_get_bulk(oids, non_repeaters=0, max_repetitions=10, **session_kargs)
+ezsnmp.ez.snmp_get_bulk(oids: List[str | Tuple[str, str]] | str | Tuple[str, str], non_repeaters=0, max_repetitions=10, **session_kargs) List[SNMPVariable]

Performs a bulk SNMP GET operation to retrieve multiple pieces of information in a single packet.

@@ -162,12 +169,18 @@ all parameters in the Session class are supported

+
Returns:
+

a list of SNMPVariable objects containing the values that +were retrieved via SNMP

+
-ezsnmp.ez.snmp_get_next(oids, **session_kargs)
+ezsnmp.ez.snmp_get_next(self, oids: List[str | Tuple[str, str]]) List[SNMPVariable] +
+ezsnmp.ez.snmp_get_next(self, oids: str | Tuple[str, str]) SNMPVariable

Uses an SNMP GETNEXT operation to retrieve the next variable after the chosen item.

@@ -183,12 +196,17 @@ all parameters in the Session class are supported

+
Returns:
+

an SNMPVariable object containing the value that was +retrieved or a list of objects when you send in a list of +OIDs

+
-ezsnmp.ez.snmp_set(oid, value, type=None, **session_kargs)
+ezsnmp.ez.snmp_set(oid: str | Tuple[str, str], value: Any, type=None, **session_kargs) bool

Perform an SNMP SET operation to update a particular piece of information.

@@ -206,12 +224,15 @@ all parameters in the Session class are supported

+
Returns:
+

bool value indicated that if snmp_set was successed

+
-ezsnmp.ez.snmp_set_multiple(oid_values, **session_kargs)
+ezsnmp.ez.snmp_set_multiple(oid_values: List[Tuple[str, Any] | Tuple[str, Any, int]], **session_kargs) bool

Perform multiple SNMP SET operations to update various pieces of information at the same time.

@@ -224,12 +245,15 @@ all parameters in the Session class are supported

+
Returns:
+

bool value indicated that if snmp_set was successed

+
-ezsnmp.ez.snmp_walk(oids='.1.3.6.1.2.1', **session_kargs)
+ezsnmp.ez.snmp_walk(oids: List[str | Tuple[str, str]] | str | Tuple[str, str] = '.1.3.6.1.2.1', **session_kargs) List[SNMPVariable]

Uses SNMP GETNEXT operation to automatically retrieve multiple pieces of information in an OID for you.

@@ -245,6 +269,10 @@ all parameters in the Session class are supported

+
Returns:
+

a list of SNMPVariable objects containing the values that +were retrieved via SNMP

+
diff --git a/docs/html/genindex.html b/docs/html/genindex.html index d2721070..02e09ade 100644 --- a/docs/html/genindex.html +++ b/docs/html/genindex.html @@ -3,7 +3,7 @@ - Index — Ez SNMP V1.0.0c2 documentation + Index — Ez SNMP V1.0.0c3 documentation @@ -14,7 +14,7 @@ - + @@ -83,6 +83,7 @@

Index

| C | E | G + | I | M | N | S @@ -205,6 +206,14 @@

G

+

I

+ + +
+

M

    diff --git a/docs/html/helpers.html b/docs/html/helpers.html index c38c2d88..473737cf 100644 --- a/docs/html/helpers.html +++ b/docs/html/helpers.html @@ -4,7 +4,7 @@ - ezsnmp.helpers module — Ez SNMP V1.0.0c2 documentation + ezsnmp.helpers module — Ez SNMP V1.0.0c3 documentation @@ -15,7 +15,7 @@ - + diff --git a/docs/html/index.html b/docs/html/index.html index 2b03b414..020570c6 100644 --- a/docs/html/index.html +++ b/docs/html/index.html @@ -4,7 +4,7 @@ - Welcome to Ez SNMP’s documentation! — Ez SNMP V1.0.0c2 documentation + Welcome to Ez SNMP’s documentation! — Ez SNMP V1.0.0c3 documentation @@ -15,7 +15,7 @@ - + @@ -305,6 +305,7 @@

    Example Session Kargs
  • ezsnmp.utils module diff --git a/docs/html/modules.html b/docs/html/modules.html index ed551321..4f462909 100644 --- a/docs/html/modules.html +++ b/docs/html/modules.html @@ -4,7 +4,7 @@ - <no title> — Ez SNMP V1.0.0c2 documentation + <no title> — Ez SNMP V1.0.0c3 documentation @@ -15,7 +15,7 @@ - + @@ -134,6 +134,7 @@
  • ezsnmp.utils module diff --git a/docs/html/objects.inv b/docs/html/objects.inv index b43c2555..281ebbe7 100644 --- a/docs/html/objects.inv +++ b/docs/html/objects.inv @@ -2,7 +2,12 @@ # Project: Ez SNMP # Version: # The remainder of this file is compressed using zlib. -xڭV͎0+^ZH]Ķ=FN2 .v!F_OR'H'xoƓ&LN*$6H-dm}wh<0T)Gu3\,mqm0昽շ+d|5Ppv^p3ל}kflߢtb&y"aCCs,5D]BkT:Zk莹P S@!H݋PDX Z{8\k -/Њb]9 E¤+B'J] xUio1@6uv@USv%ca]4 υ4WWMõqSf0 F*%4^ he sPi '(wf>cڕP_t-C%z=Ȃ ^H' ˣA "W _CIGOY}܂G%9n\&M}W -%, -EjxMkRs[#;S\5fPFG-D?+2MePA r \[Sp2P4DXyHV:[,` (Xè! r0aDAa&Ht$qCU \ No newline at end of file +xڭr0<:LC!mހFITBv 8W] ͙TIl0Q[ += +06x10g, }H +: +wɮv桝Ebv7"8m[6W|MbXj5`^f]K{ۥb{@u~ (F8 W\s1_"l&(-]?a| `!149RCKiZqچ^C̅b +A^D"b5h=pm(\ءZ( 9La`V΀0銕ІExf!+ +z+`c)l nY 2 @ - Python Module Index — Ez SNMP V1.0.0c2 documentation + Python Module Index — Ez SNMP V1.0.0c3 documentation @@ -14,7 +14,7 @@ - + diff --git a/docs/html/search.html b/docs/html/search.html index b32c0539..27482c75 100644 --- a/docs/html/search.html +++ b/docs/html/search.html @@ -3,7 +3,7 @@ - Search — Ez SNMP V1.0.0c2 documentation + Search — Ez SNMP V1.0.0c3 documentation @@ -15,7 +15,7 @@ - + diff --git a/docs/html/searchindex.js b/docs/html/searchindex.js index 085833c3..0befd96a 100644 --- a/docs/html/searchindex.js +++ b/docs/html/searchindex.js @@ -1 +1 @@ -Search.setIndex({"alltitles": {"Contents:": [[4, null]], "Example Session Kargs": [[4, "example-session-kargs"]], "Indices and tables": [[4, "indices-and-tables"]], "Installation": [[4, "installation"]], "Quick Start": [[4, "quick-start"]], "Welcome to Ez SNMP\u2019s documentation!": [[4, "welcome-to-ez-snmp-s-documentation"]], "ezsnmp.compat module": [[0, "module-ezsnmp.compat"]], "ezsnmp.exceptions module": [[1, "module-ezsnmp.exceptions"]], "ezsnmp.ez module": [[2, "module-ezsnmp.ez"]], "ezsnmp.helpers module": [[3, "module-ezsnmp.helpers"]], "ezsnmp.session module": [[6, "module-ezsnmp.session"]], "ezsnmp.utils module": [[7, "module-ezsnmp.utils"]], "ezsnmp.variables module": [[8, "module-ezsnmp.variables"]]}, "docnames": ["compat", "exceptions", "ez", "helpers", "index", "modules", "session", "utils", "variables"], "envversion": {"sphinx": 61, "sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2}, "filenames": ["compat.rst", "exceptions.rst", "ez.rst", "helpers.rst", "index.rst", "modules.rst", "session.rst", "utils.rst", "variables.rst"], "indexentries": {"build_varlist() (in module ezsnmp.session)": [[6, "ezsnmp.session.build_varlist", false]], "bulkwalk() (ezsnmp.session.session method)": [[6, "ezsnmp.session.Session.bulkwalk", false]], "connect_hostname (ezsnmp.session.session property)": [[6, "ezsnmp.session.Session.connect_hostname", false]], "error_index (ezsnmp.session.session attribute)": [[6, "ezsnmp.session.Session.error_index", false]], "error_number (ezsnmp.session.session attribute)": [[6, "ezsnmp.session.Session.error_number", false]], "error_string (ezsnmp.session.session attribute)": [[6, "ezsnmp.session.Session.error_string", false]], "ezsnmp.compat": [[0, "module-ezsnmp.compat", false]], "ezsnmp.exceptions": [[1, "module-ezsnmp.exceptions", false]], "ezsnmp.ez": [[2, "module-ezsnmp.ez", false]], "ezsnmp.helpers": [[3, "module-ezsnmp.helpers", false]], "ezsnmp.session": [[6, "module-ezsnmp.session", false]], "ezsnmp.utils": [[7, "module-ezsnmp.utils", false]], "ezsnmp.variables": [[8, "module-ezsnmp.variables", false]], "ezsnmpconnectionerror": [[1, "ezsnmp.exceptions.EzSNMPConnectionError", false]], "ezsnmperror": [[1, "ezsnmp.exceptions.EzSNMPError", false]], "ezsnmpnosuchinstanceerror": [[1, "ezsnmp.exceptions.EzSNMPNoSuchInstanceError", false]], "ezsnmpnosuchnameerror": [[1, "ezsnmp.exceptions.EzSNMPNoSuchNameError", false]], "ezsnmpnosuchobjecterror": [[1, "ezsnmp.exceptions.EzSNMPNoSuchObjectError", false]], "ezsnmptimeouterror": [[1, "ezsnmp.exceptions.EzSNMPTimeoutError", false]], "ezsnmpundeterminedtypeerror": [[1, "ezsnmp.exceptions.EzSNMPUndeterminedTypeError", false]], "ezsnmpunknownobjectiderror": [[1, "ezsnmp.exceptions.EzSNMPUnknownObjectIDError", false]], "get() (ezsnmp.session.session method)": [[6, "ezsnmp.session.Session.get", false]], "get_bulk() (ezsnmp.session.session method)": [[6, "ezsnmp.session.Session.get_bulk", false]], "get_next() (ezsnmp.session.session method)": [[6, "ezsnmp.session.Session.get_next", false]], "module": [[0, "module-ezsnmp.compat", false], [1, "module-ezsnmp.exceptions", false], [2, "module-ezsnmp.ez", false], [3, "module-ezsnmp.helpers", false], [6, "module-ezsnmp.session", false], [7, "module-ezsnmp.utils", false], [8, "module-ezsnmp.variables", false]], "normalize_oid() (in module ezsnmp.helpers)": [[3, "ezsnmp.helpers.normalize_oid", false]], "sess_ptr (ezsnmp.session.session attribute)": [[6, "ezsnmp.session.Session.sess_ptr", false]], "session (class in ezsnmp.session)": [[6, "ezsnmp.session.Session", false]], "set() (ezsnmp.session.session method)": [[6, "ezsnmp.session.Session.set", false]], "set_multiple() (ezsnmp.session.session method)": [[6, "ezsnmp.session.Session.set_multiple", false]], "snmp_bulkwalk() (in module ezsnmp.ez)": [[2, "ezsnmp.ez.snmp_bulkwalk", false]], "snmp_get() (in module ezsnmp.ez)": [[2, "ezsnmp.ez.snmp_get", false]], "snmp_get_bulk() (in module ezsnmp.ez)": [[2, "ezsnmp.ez.snmp_get_bulk", false]], "snmp_get_next() (in module ezsnmp.ez)": [[2, "ezsnmp.ez.snmp_get_next", false]], "snmp_set() (in module ezsnmp.ez)": [[2, "ezsnmp.ez.snmp_set", false]], "snmp_set_multiple() (in module ezsnmp.ez)": [[2, "ezsnmp.ez.snmp_set_multiple", false]], "snmp_walk() (in module ezsnmp.ez)": [[2, "ezsnmp.ez.snmp_walk", false]], "snmpvariable (class in ezsnmp.variables)": [[8, "ezsnmp.variables.SNMPVariable", false]], "snmpvariablelist (class in ezsnmp.variables)": [[8, "ezsnmp.variables.SNMPVariableList", false]], "strip_non_printable() (in module ezsnmp.utils)": [[7, "ezsnmp.utils.strip_non_printable", false]], "timeout_microseconds (ezsnmp.session.session property)": [[6, "ezsnmp.session.Session.timeout_microseconds", false]], "tostr() (in module ezsnmp.utils)": [[7, "ezsnmp.utils.tostr", false]], "ub() (in module ezsnmp.compat)": [[0, "ezsnmp.compat.ub", false]], "update_session() (ezsnmp.session.session method)": [[6, "ezsnmp.session.Session.update_session", false]], "urepr() (in module ezsnmp.compat)": [[0, "ezsnmp.compat.urepr", false]], "validate_results() (in module ezsnmp.session)": [[6, "ezsnmp.session.validate_results", false]], "varbinds (ezsnmp.variables.snmpvariablelist property)": [[8, "ezsnmp.variables.SNMPVariableList.varbinds", false]], "walk() (ezsnmp.session.session method)": [[6, "ezsnmp.session.Session.walk", false]]}, "objects": {"ezsnmp": [[0, 0, 0, "-", "compat"], [1, 0, 0, "-", "exceptions"], [2, 0, 0, "-", "ez"], [3, 0, 0, "-", "helpers"], [6, 0, 0, "-", "session"], [7, 0, 0, "-", "utils"], [8, 0, 0, "-", "variables"]], "ezsnmp.compat": [[0, 1, 1, "", "ub"], [0, 1, 1, "", "urepr"]], "ezsnmp.exceptions": [[1, 2, 1, "", "EzSNMPConnectionError"], [1, 2, 1, "", "EzSNMPError"], [1, 2, 1, "", "EzSNMPNoSuchInstanceError"], [1, 2, 1, "", "EzSNMPNoSuchNameError"], [1, 2, 1, "", "EzSNMPNoSuchObjectError"], [1, 2, 1, "", "EzSNMPTimeoutError"], [1, 2, 1, "", "EzSNMPUndeterminedTypeError"], [1, 2, 1, "", "EzSNMPUnknownObjectIDError"]], "ezsnmp.ez": [[2, 1, 1, "", "snmp_bulkwalk"], [2, 1, 1, "", "snmp_get"], [2, 1, 1, "", "snmp_get_bulk"], [2, 1, 1, "", "snmp_get_next"], [2, 1, 1, "", "snmp_set"], [2, 1, 1, "", "snmp_set_multiple"], [2, 1, 1, "", "snmp_walk"]], "ezsnmp.helpers": [[3, 1, 1, "", "normalize_oid"]], "ezsnmp.session": [[6, 3, 1, "", "Session"], [6, 1, 1, "", "build_varlist"], [6, 1, 1, "", "validate_results"]], "ezsnmp.session.Session": [[6, 4, 1, "", "bulkwalk"], [6, 5, 1, "", "connect_hostname"], [6, 6, 1, "", "error_index"], [6, 6, 1, "", "error_number"], [6, 6, 1, "", "error_string"], [6, 4, 1, "", "get"], [6, 4, 1, "", "get_bulk"], [6, 4, 1, "", "get_next"], [6, 6, 1, "", "sess_ptr"], [6, 4, 1, "", "set"], [6, 4, 1, "", "set_multiple"], [6, 5, 1, "", "timeout_microseconds"], [6, 4, 1, "", "update_session"], [6, 4, 1, "", "walk"]], "ezsnmp.utils": [[7, 1, 1, "", "strip_non_printable"], [7, 1, 1, "", "tostr"]], "ezsnmp.variables": [[8, 3, 1, "", "SNMPVariable"], [8, 3, 1, "", "SNMPVariableList"]], "ezsnmp.variables.SNMPVariableList": [[8, 5, 1, "", "varbinds"]]}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "function", "Python function"], "2": ["py", "exception", "Python exception"], "3": ["py", "class", "Python class"], "4": ["py", "method", "Python method"], "5": ["py", "property", "Python property"], "6": ["py", "attribute", "Python attribute"]}, "objtypes": {"0": "py:module", "1": "py:function", "2": "py:exception", "3": "py:class", "4": "py:method", "5": "py:property", "6": "py:attribute"}, "terms": {"": [0, 6], "0": [2, 4, 6], "1": [2, 4, 6], "10": [2, 6], "11161": 4, "161": 6, "2": [2, 4, 6], "2c": 6, "3": [2, 4, 6], "5": 4, "509": 6, "6": [2, 4, 6], "9": 4, "A": 6, "And": 4, "For": 4, "If": [4, 6], "On": 4, "The": [1, 4], "There": 4, "abort_on_nonexist": 6, "accept": 6, "access": 6, "actual": 6, "ad": 6, "add": 7, "address": 6, "ae": 4, "after": [2, 6], "agent": 6, "all": [1, 2, 4, 6], "allow": 6, "alreadi": 6, "also": [4, 6], "an": [1, 2, 3, 4, 6, 7, 8], "ani": [6, 7], "anyth": 6, "appli": [1, 6], "appropri": 6, "apt": 4, "ar": [2, 4, 6, 7], "argument": 2, "assign": 6, "assoc": 6, "attribut": [4, 6], "auth_pass": 4, "auth_password": [4, 6], "auth_protocol": [4, 6], "auth_second": 4, "auth_with_privaci": 6, "auth_without_privaci": [4, 6], "authent": 6, "authnopriv": 4, "authpriv": 4, "automat": [2, 6], "base": [1, 6, 8], "been": [4, 6], "befor": 6, "begin": 7, "being": [6, 8], "best_guess": 6, "between": 6, "binari": [4, 7], "bind": [6, 8], "boolean": 6, "boot": 6, "both": 6, "brew": 4, "build": 4, "build_varlist": [4, 5, 6], "bulk": [2, 6], "bulkwalk": [5, 6], "byte": 7, "c": [6, 8], "ca": 6, "cach": 6, "call": 6, "can": 4, "cannot": 1, "canon": 6, "case": [6, 8], "caus": 6, "cento": 4, "cert": 6, "certain": 6, "certif": 6, "chang": 6, "charact": 7, "chosen": [2, 6], "cibuildwheel": 4, "class": [2, 6, 8], "commun": [4, 6], "compat": [4, 5], "compatiabil": 4, "compil": 4, "configur": 6, "connect": 1, "connect_hostnam": [5, 6], "construct": 2, "contact": 4, "contain": [2, 6, 7, 8], "context": 6, "context_engine_id": 6, "control": 6, "conveni": 6, "convent": 6, "convert": [6, 7], "cool": 4, "correctli": [3, 4], "counter": 6, "cours": 4, "cover": 1, "creat": [4, 6], "current": [2, 6, 7], "data": [4, 6, 8], "data_typ": 8, "de": 4, "debian": 4, "decim": 6, "default": 6, "defin": 6, "definit": 3, "descript": 4, "detail": 4, "determin": 1, "dev": 4, "devel": 4, "disabl": 6, "distro": 4, "do": 4, "doe": 6, "doesn": [1, 4], "dot": 6, "download": 4, "dtl": 6, "e": [2, 6], "each": [2, 4, 6], "easi": 1, "either": 6, "emit": 6, "enabl": 6, "engin": 6, "engine_boot": 6, "engine_tim": 6, "ensur": [3, 4], "entir": [2, 6], "enumer": 6, "eol": 4, "equival": 6, "error": 6, "error_index": [5, 6], "error_numb": [5, 6], "error_str": [5, 6], "exampl": 6, "except": [4, 5, 6], "exist": [1, 6], "expect": [2, 6], "experiment": [2, 6], "explicitli": [2, 6], "express": 6, "extend": 4, "ez": 5, "ezsnmp": [4, 5], "ezsnmpconnectionerror": [1, 4, 5], "ezsnmperror": [1, 4, 5], "ezsnmpnosuchinstanceerror": [1, 4, 5], "ezsnmpnosuchnameerror": [1, 4, 5], "ezsnmpnosuchobjecterror": [1, 4, 5], "ezsnmptimeouterror": [1, 4, 5], "ezsnmpundeterminedtypeerror": [1, 4, 5], "ezsnmpunknownobjectiderror": [1, 4, 5], "fail": 6, "failur": 6, "fals": 6, "featur": 6, "field": 6, "file": 6, "fingerprint": 6, "first": [2, 4, 6], "follow": 4, "fonud": 7, "forc": 4, "form": 1, "format": [4, 6], "found": [6, 8], "from": [1, 4, 6], "fulli": 4, "function": [6, 7], "further": 8, "g": [2, 6], "gcc": 4, "gener": 6, "get": [2, 4, 5, 6], "get_bulk": [5, 6], "get_next": [5, 6], "getbulk": [2, 6], "getnext": [2, 6], "given": [3, 6], "grab": 4, "ha": [4, 6], "have": [1, 4, 6], "helper": [4, 5], "highli": 6, "hold": 6, "host": 1, "hostnam": [4, 6], "how": 6, "http": [4, 8], "i": [1, 2, 3, 4, 6, 8], "ib": 6, "id": 6, "ident": 6, "identifi": 6, "import": 4, "increment": 6, "index": [1, 2, 3, 4, 6, 8], "indic": [1, 6, 7], "individu": [4, 6], "inform": [2, 4, 6, 8], "initi": 6, "initial_md5_a": 4, "initial_md5_d": 4, "initial_md5_no_priv": 4, "instanc": [1, 2, 6, 8], "instead": 6, "instruct": 4, "int": 4, "integ": [4, 6], "intend": [4, 6], "interact": 6, "interfac": [4, 6, 8], "intern": [6, 8], "invalid": 1, "ip": 6, "ir": 6, "isn": 4, "issu": 4, "item": [2, 4, 6], "iter": 8, "its": [2, 4, 6], "just": [4, 6], "keyword": [2, 6], "kwarg": 6, "lab": 4, "last": 6, "let": 6, "level": 6, "libperl": 4, "librari": [4, 6], "libsnmp": 4, "like": 4, "linux": 4, "list": [2, 6, 8], "ll": 4, "local": 6, "local_port": 6, "localhost": [4, 6], "locat": 4, "longer": 6, "lookup": 6, "maco": 4, "mai": [1, 2, 4, 6], "make": [4, 6], "manag": [4, 6], "mani": 4, "manipul": [6, 8], "manual": 6, "match": 6, "max_repetit": [2, 6], "md5": [4, 6], "messag": 6, "method": 6, "mi": 6, "mib": [2, 4, 6], "modul": [4, 5], "more": 6, "most": [4, 6], "multipl": [2, 4, 6], "must": [2, 6], "my": 4, "name": [1, 2, 4, 6], "necessari": 6, "need": [4, 6], "net": [1, 4, 6, 8], "new": 6, "newer": 4, "next": [2, 6], "no_auth_or_privaci": 6, "non": [4, 6, 7], "non_repeat": [2, 6], "none": [2, 3, 6, 7, 8], "nonexist": 1, "normal": [3, 4], "normalize_oid": [3, 4, 5], "nosuch": 6, "nosuchinst": 8, "nosuchobject": 8, "note": [4, 6], "number": [2, 6, 7], "numer": [2, 4, 6], "o": 4, "object": [1, 2, 4, 6, 8], "occasion": 4, "off": 4, "oid": [1, 2, 3, 4, 6, 8], "oid_index": [3, 4, 8], "oid_valu": [2, 6], "onc": 6, "one": [4, 6], "onli": [1, 2, 6], "oper": [2, 4, 6], "option": 6, "org": [4, 8], "other": 4, "our": [4, 6], "our_ident": 6, "out": 1, "overrid": 6, "overridden": 6, "packag": 4, "packet": [2, 6], "page": 4, "pain": 6, "paramet": [2, 3, 6, 7, 8], "pars": [2, 6], "particular": [1, 2, 6], "pass": [2, 6], "passphras": 6, "pdu": 6, "perfect": 4, "perform": [2, 4, 6], "php": 8, "piec": [2, 4, 6, 8], "pip": 4, "place": 4, "plan": 4, "pleas": [4, 8], "plu": 6, "port": 6, "possibl": [4, 6], "prefer": 6, "prepar": [2, 6], "primarili": 4, "print": 4, "printabl": 7, "priv_pass": 4, "priv_second": 4, "privaci": 6, "privacy_password": [4, 6], "privacy_protocol": [4, 6], "probe": 6, "problem": 1, "process": 6, "project": 4, "proper": 6, "properti": [6, 8], "protocol": 6, "provid": 4, "public": [4, 6], "pypi": 4, "python": 4, "python3": 4, "queri": 6, "r": 6, "rais": [1, 6], "random": 6, "re": [4, 6], "read": 6, "readonli": 6, "readwrit": 6, "realli": 6, "recommend": 6, "regular": [4, 6], "reinstal": 4, "relat": 4, "remot": [1, 6], "remote_port": [4, 6], "remotehost": 6, "remov": [6, 7], "repair": 6, "repeat": [2, 6], "repres": [2, 6, 8], "request": [1, 4, 6], "resent": 6, "respect": 8, "result": 6, "retreiv": 8, "retri": 6, "retriev": [2, 4, 6], "retry_no_such": 6, "return": [2, 4, 6, 7], "rhel": 4, "run": [4, 6], "same": 2, "search": 4, "second": [2, 6], "secondary_sha_a": 4, "secondary_sha_no_priv": 4, "secur": 6, "security_engine_id": 6, "security_level": [4, 6], "security_usernam": [4, 6], "see": 8, "send": 6, "sent": 2, "server": 6, "sess_ptr": [5, 6], "sess_v1_arg": 4, "sess_v2_arg": 4, "sess_v3_md5_aes_arg": 4, "sess_v3_md5_des_arg": 4, "sess_v3_md5_no_priv_arg": 4, "sess_v3_sha_aes_arg": 4, "sess_v3_sha_no_priv_arg": 4, "session": [2, 5], "session_karg": 2, "set": [1, 2, 3, 4, 5, 6, 8], "set_multipl": [5, 6], "setup": 6, "sever": 4, "sha": [4, 6], "ship": 4, "should": [2, 6], "simpl": 4, "sinc": 6, "singl": [2, 4, 6], "slight": 8, "snmp": [1, 2, 6, 8], "snmp_bulkwalk": [2, 4, 5], "snmp_err": 6, "snmp_err_index": 6, "snmp_get": [2, 4, 5], "snmp_get_bulk": [2, 4, 5], "snmp_get_next": [2, 4, 5], "snmp_set": [2, 4, 5], "snmp_set_multipl": [2, 4, 5], "snmp_type": [2, 4, 6, 8], "snmp_walk": [2, 4, 5], "snmpcmd": 6, "snmpset": 8, "snmpv1": 1, "snmpvariabl": [2, 4, 5, 6, 8], "snmpvariablelist": [4, 5, 8], "so": 4, "some": 1, "someth": [4, 6], "sourc": 4, "specif": 4, "specifi": 4, "sprint_valu": 6, "statu": 6, "str": 4, "string": [2, 4, 6, 7], "strip": 7, "strip_non_print": [4, 5, 7], "structur": 6, "stuff": 4, "success": 6, "sudo": 4, "suitabl": 4, "suppli": [2, 6], "support": [2, 4, 7], "synchron": 6, "syscontact": 4, "sysdescr": [2, 4, 6], "sysloc": 4, "system": [4, 6], "system_item": 4, "t": [1, 4], "tag": 6, "test": 4, "than": 4, "thei": 6, "their_hostnam": 6, "their_ident": 6, "thi": [2, 4, 6, 7], "time": [1, 2, 6], "timeout": 6, "timeout_microsecond": [5, 6], "tl": 6, "too": 4, "tostr": [4, 5, 7], "total": 6, "transpar": 6, "true": 6, "trust": 6, "trust_cert": 6, "try": 4, "tupl": [2, 4, 6], "tut": 8, "two": 4, "type": [1, 2, 4, 6, 8], "typic": 6, "ub": [0, 4, 5], "ubuntu": 4, "udp": 6, "undef": 6, "underli": 6, "understand": 6, "unicod": 7, "untransl": 6, "updat": [2, 4], "update_sess": [5, 6], "upgrad": 4, "urepr": [0, 4, 5], "us": [2, 4, 6, 8], "usag": 6, "use_enum": 6, "use_long_nam": 6, "use_numer": 6, "use_sprint_valu": 6, "util": [4, 5], "v": 6, "v1": 6, "v2": 6, "v3": 6, "val": 8, "valid": 6, "validate_result": [4, 5, 6], "valu": [1, 2, 4, 6, 7, 8], "varbind": [5, 8], "variabl": [2, 4, 5, 6, 7], "variat": 8, "variou": 2, "varlist": 6, "ve": 6, "version": [4, 6], "via": [2, 4, 6, 8], "w": 6, "wa": 6, "wai": 4, "walk": [4, 5, 6], "want": 4, "warn": 6, "we": [4, 6], "were": [2, 6], "when": [1, 2, 4, 6, 7], "where": [4, 6], "wherebi": [2, 6], "whether": 6, "which": [1, 2, 4, 6, 8], "while": 6, "whoop": 6, "wiki": 8, "wish": [2, 4, 6, 7], "without": 4, "would": 6, "wrong": 6, "www": 8, "x": [4, 6], "y": 4, "you": [2, 4, 6, 7], "your": [4, 6], "yum": 4}, "titles": ["ezsnmp.compat module", "ezsnmp.exceptions module", "ezsnmp.ez module", "ezsnmp.helpers module", "Welcome to Ez SNMP\u2019s documentation!", "<no title>", "ezsnmp.session module", "ezsnmp.utils module", "ezsnmp.variables module"], "titleterms": {"": 4, "compat": 0, "content": 4, "document": 4, "exampl": 4, "except": 1, "ez": [2, 4], "ezsnmp": [0, 1, 2, 3, 6, 7, 8], "helper": 3, "indic": 4, "instal": 4, "karg": 4, "modul": [0, 1, 2, 3, 6, 7, 8], "quick": 4, "session": [4, 6], "snmp": 4, "start": 4, "tabl": 4, "util": 7, "variabl": 8, "welcom": 4}}) \ No newline at end of file +Search.setIndex({"alltitles": {"Contents:": [[4, null]], "Example Session Kargs": [[4, "example-session-kargs"]], "Indices and tables": [[4, "indices-and-tables"]], "Installation": [[4, "installation"]], "Quick Start": [[4, "quick-start"]], "Welcome to Ez SNMP\u2019s documentation!": [[4, null]], "ezsnmp.compat module": [[0, null]], "ezsnmp.exceptions module": [[1, null]], "ezsnmp.ez module": [[2, null]], "ezsnmp.helpers module": [[3, null]], "ezsnmp.session module": [[6, null]], "ezsnmp.utils module": [[7, null]], "ezsnmp.variables module": [[8, null]]}, "docnames": ["compat", "exceptions", "ez", "helpers", "index", "modules", "session", "utils", "variables"], "envversion": {"sphinx": 62, "sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2}, "filenames": ["compat.rst", "exceptions.rst", "ez.rst", "helpers.rst", "index.rst", "modules.rst", "session.rst", "utils.rst", "variables.rst"], "indexentries": {"build_varlist() (in module ezsnmp.session)": [[6, "ezsnmp.session.build_varlist", false]], "bulkwalk() (ezsnmp.session.session method)": [[6, "ezsnmp.session.Session.bulkwalk", false]], "connect_hostname (ezsnmp.session.session property)": [[6, "ezsnmp.session.Session.connect_hostname", false]], "error_index (ezsnmp.session.session attribute)": [[6, "ezsnmp.session.Session.error_index", false]], "error_number (ezsnmp.session.session attribute)": [[6, "ezsnmp.session.Session.error_number", false]], "error_string (ezsnmp.session.session attribute)": [[6, "ezsnmp.session.Session.error_string", false]], "ezsnmp.compat": [[0, "module-ezsnmp.compat", false]], "ezsnmp.exceptions": [[1, "module-ezsnmp.exceptions", false]], "ezsnmp.ez": [[2, "module-ezsnmp.ez", false]], "ezsnmp.helpers": [[3, "module-ezsnmp.helpers", false]], "ezsnmp.session": [[6, "module-ezsnmp.session", false]], "ezsnmp.utils": [[7, "module-ezsnmp.utils", false]], "ezsnmp.variables": [[8, "module-ezsnmp.variables", false]], "ezsnmpconnectionerror": [[1, "ezsnmp.exceptions.EzSNMPConnectionError", false]], "ezsnmperror": [[1, "ezsnmp.exceptions.EzSNMPError", false]], "ezsnmpnosuchinstanceerror": [[1, "ezsnmp.exceptions.EzSNMPNoSuchInstanceError", false]], "ezsnmpnosuchnameerror": [[1, "ezsnmp.exceptions.EzSNMPNoSuchNameError", false]], "ezsnmpnosuchobjecterror": [[1, "ezsnmp.exceptions.EzSNMPNoSuchObjectError", false]], "ezsnmptimeouterror": [[1, "ezsnmp.exceptions.EzSNMPTimeoutError", false]], "ezsnmpundeterminedtypeerror": [[1, "ezsnmp.exceptions.EzSNMPUndeterminedTypeError", false]], "ezsnmpunknownobjectiderror": [[1, "ezsnmp.exceptions.EzSNMPUnknownObjectIDError", false]], "get() (ezsnmp.session.session method)": [[6, "ezsnmp.session.Session.get", false]], "get_bulk() (ezsnmp.session.session method)": [[6, "ezsnmp.session.Session.get_bulk", false]], "get_next() (ezsnmp.session.session method)": [[6, "ezsnmp.session.Session.get_next", false]], "is_hostname_ipv6() (in module ezsnmp.utils)": [[7, "ezsnmp.utils.is_hostname_ipv6", false]], "module": [[0, "module-ezsnmp.compat", false], [1, "module-ezsnmp.exceptions", false], [2, "module-ezsnmp.ez", false], [3, "module-ezsnmp.helpers", false], [6, "module-ezsnmp.session", false], [7, "module-ezsnmp.utils", false], [8, "module-ezsnmp.variables", false]], "normalize_oid() (in module ezsnmp.helpers)": [[3, "ezsnmp.helpers.normalize_oid", false]], "sess_ptr (ezsnmp.session.session attribute)": [[6, "ezsnmp.session.Session.sess_ptr", false]], "session (class in ezsnmp.session)": [[6, "ezsnmp.session.Session", false]], "set() (ezsnmp.session.session method)": [[6, "ezsnmp.session.Session.set", false]], "set_multiple() (ezsnmp.session.session method)": [[6, "ezsnmp.session.Session.set_multiple", false]], "snmp_bulkwalk() (in module ezsnmp.ez)": [[2, "ezsnmp.ez.snmp_bulkwalk", false]], "snmp_get() (in module ezsnmp.ez)": [[2, "ezsnmp.ez.snmp_get", false]], "snmp_get_bulk() (in module ezsnmp.ez)": [[2, "ezsnmp.ez.snmp_get_bulk", false]], "snmp_get_next() (in module ezsnmp.ez)": [[2, "ezsnmp.ez.snmp_get_next", false]], "snmp_set() (in module ezsnmp.ez)": [[2, "ezsnmp.ez.snmp_set", false]], "snmp_set_multiple() (in module ezsnmp.ez)": [[2, "ezsnmp.ez.snmp_set_multiple", false]], "snmp_walk() (in module ezsnmp.ez)": [[2, "ezsnmp.ez.snmp_walk", false]], "snmpvariable (class in ezsnmp.variables)": [[8, "ezsnmp.variables.SNMPVariable", false]], "snmpvariablelist (class in ezsnmp.variables)": [[8, "ezsnmp.variables.SNMPVariableList", false]], "strip_non_printable() (in module ezsnmp.utils)": [[7, "ezsnmp.utils.strip_non_printable", false]], "timeout_microseconds (ezsnmp.session.session property)": [[6, "ezsnmp.session.Session.timeout_microseconds", false]], "tostr() (in module ezsnmp.utils)": [[7, "ezsnmp.utils.tostr", false]], "ub() (in module ezsnmp.compat)": [[0, "ezsnmp.compat.ub", false]], "update_session() (ezsnmp.session.session method)": [[6, "ezsnmp.session.Session.update_session", false]], "urepr() (in module ezsnmp.compat)": [[0, "ezsnmp.compat.urepr", false]], "validate_results() (in module ezsnmp.session)": [[6, "ezsnmp.session.validate_results", false]], "varbinds (ezsnmp.variables.snmpvariablelist property)": [[8, "ezsnmp.variables.SNMPVariableList.varbinds", false]], "walk() (ezsnmp.session.session method)": [[6, "ezsnmp.session.Session.walk", false]]}, "objects": {"ezsnmp": [[0, 0, 0, "-", "compat"], [1, 0, 0, "-", "exceptions"], [2, 0, 0, "-", "ez"], [3, 0, 0, "-", "helpers"], [6, 0, 0, "-", "session"], [7, 0, 0, "-", "utils"], [8, 0, 0, "-", "variables"]], "ezsnmp.compat": [[0, 1, 1, "", "ub"], [0, 1, 1, "", "urepr"]], "ezsnmp.exceptions": [[1, 2, 1, "", "EzSNMPConnectionError"], [1, 2, 1, "", "EzSNMPError"], [1, 2, 1, "", "EzSNMPNoSuchInstanceError"], [1, 2, 1, "", "EzSNMPNoSuchNameError"], [1, 2, 1, "", "EzSNMPNoSuchObjectError"], [1, 2, 1, "", "EzSNMPTimeoutError"], [1, 2, 1, "", "EzSNMPUndeterminedTypeError"], [1, 2, 1, "", "EzSNMPUnknownObjectIDError"]], "ezsnmp.ez": [[2, 1, 1, "", "snmp_bulkwalk"], [2, 1, 1, "", "snmp_get"], [2, 1, 1, "", "snmp_get_bulk"], [2, 1, 1, "", "snmp_get_next"], [2, 1, 1, "", "snmp_set"], [2, 1, 1, "", "snmp_set_multiple"], [2, 1, 1, "", "snmp_walk"]], "ezsnmp.helpers": [[3, 1, 1, "", "normalize_oid"]], "ezsnmp.session": [[6, 3, 1, "", "Session"], [6, 1, 1, "", "build_varlist"], [6, 1, 1, "", "validate_results"]], "ezsnmp.session.Session": [[6, 4, 1, "", "bulkwalk"], [6, 5, 1, "", "connect_hostname"], [6, 6, 1, "", "error_index"], [6, 6, 1, "", "error_number"], [6, 6, 1, "", "error_string"], [6, 4, 1, "", "get"], [6, 4, 1, "", "get_bulk"], [6, 4, 1, "", "get_next"], [6, 6, 1, "", "sess_ptr"], [6, 4, 1, "", "set"], [6, 4, 1, "", "set_multiple"], [6, 5, 1, "", "timeout_microseconds"], [6, 4, 1, "", "update_session"], [6, 4, 1, "", "walk"]], "ezsnmp.utils": [[7, 1, 1, "", "is_hostname_ipv6"], [7, 1, 1, "", "strip_non_printable"], [7, 1, 1, "", "tostr"]], "ezsnmp.variables": [[8, 3, 1, "", "SNMPVariable"], [8, 3, 1, "", "SNMPVariableList"]], "ezsnmp.variables.SNMPVariableList": [[8, 5, 1, "", "varbinds"]]}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "function", "Python function"], "2": ["py", "exception", "Python exception"], "3": ["py", "class", "Python class"], "4": ["py", "method", "Python method"], "5": ["py", "property", "Python property"], "6": ["py", "attribute", "Python attribute"]}, "objtypes": {"0": "py:module", "1": "py:function", "2": "py:exception", "3": "py:class", "4": "py:method", "5": "py:property", "6": "py:attribute"}, "terms": {"": [0, 6], "0": [2, 4, 6], "1": [2, 4, 6], "10": [2, 6], "11161": 4, "161": 6, "2": [2, 4, 6], "2c": 6, "3": [2, 4, 6], "5": 4, "509": 6, "6": [2, 4, 6], "9": 4, "A": 6, "And": 4, "For": 4, "If": [4, 6], "On": 4, "The": [1, 4], "There": 4, "abort_on_nonexist": 6, "accept": 6, "access": 6, "actual": 6, "ad": 6, "add": 7, "address": 6, "ae": [4, 6], "after": [2, 6], "agent": 6, "all": [1, 2, 4, 6], "allow": 6, "alreadi": 6, "also": [4, 6], "an": [1, 2, 3, 4, 6, 7, 8], "ani": [2, 6, 7], "anyth": 6, "appli": [1, 6], "appropri": 6, "apt": 4, "ar": [2, 4, 6, 7], "argument": 2, "assign": 6, "assoc": 6, "attribut": [4, 6], "auth_pass": 4, "auth_password": [4, 6], "auth_protocol": [4, 6], "auth_second": 4, "auth_with_privaci": 6, "auth_without_privaci": [4, 6], "authent": 6, "authnopriv": 4, "authpriv": 4, "automat": [2, 6], "base": [1, 6, 8], "been": [4, 6], "befor": 6, "begin": 7, "being": [6, 8], "best_guess": 6, "between": 6, "binari": [4, 7], "bind": [6, 8], "bool": [2, 6], "boolean": 6, "boot": 6, "both": 6, "brew": 4, "build": 4, "build_varlist": [4, 5, 6], "bulk": [2, 6], "bulkwalk": [5, 6], "byte": 7, "c": [6, 8], "ca": 6, "cach": 6, "call": 6, "can": 4, "cannot": 1, "canon": 6, "case": [6, 8], "caus": 6, "cento": 4, "cert": 6, "certain": 6, "certif": 6, "chang": 6, "charact": 7, "chosen": [2, 6], "cibuildwheel": 4, "class": [2, 6, 8], "commun": [4, 6], "compat": [4, 5], "compatiabil": 4, "compil": 4, "configur": 6, "connect": 1, "connect_hostnam": [5, 6], "construct": 2, "contact": 4, "contain": [2, 6, 7, 8], "context": 6, "context_engine_id": 6, "control": 6, "conveni": 6, "convent": 6, "convert": [6, 7], "cool": 4, "correctli": [3, 4], "counter": 6, "cours": 4, "cover": 1, "creat": [4, 6], "current": [2, 6, 7], "data": [4, 6, 8], "data_typ": 8, "de": [4, 6], "debian": 4, "decim": 6, "default": 6, "defin": 6, "definit": 3, "descript": 4, "detail": 4, "determin": 1, "dev": 4, "devel": 4, "disabl": 6, "distro": 4, "do": 4, "doe": 6, "doesn": [1, 4], "dot": 6, "download": 4, "dtl": 6, "e": [2, 6], "each": [2, 4, 6], "easi": 1, "either": 6, "emit": 6, "enabl": 6, "engin": 6, "engine_boot": 6, "engine_tim": 6, "ensur": [3, 4], "entir": [2, 6], "enumer": 6, "eol": 4, "equival": 6, "error": 6, "error_index": [5, 6], "error_numb": [5, 6], "error_str": [5, 6], "etc": 6, "exampl": 6, "except": [4, 5, 6], "exist": [1, 6], "expect": [2, 6], "experiment": [2, 6], "explicitli": [2, 6], "express": 6, "extend": 4, "ez": 5, "ezsnmp": [4, 5], "ezsnmpconnectionerror": [1, 4, 5], "ezsnmperror": [1, 4, 5], "ezsnmpnosuchinstanceerror": [1, 4, 5], "ezsnmpnosuchnameerror": [1, 4, 5], "ezsnmpnosuchobjecterror": [1, 4, 5], "ezsnmptimeouterror": [1, 4, 5], "ezsnmpundeterminedtypeerror": [1, 4, 5], "ezsnmpunknownobjectiderror": [1, 4, 5], "fail": 6, "failur": 6, "fals": 6, "featur": 6, "field": 6, "file": 6, "fingerprint": 6, "first": [2, 4, 6], "follow": 4, "fonud": 7, "forc": 4, "form": 1, "format": [4, 6], "found": [6, 8], "from": [1, 4, 6], "fulli": 4, "function": [6, 7], "further": 8, "g": [2, 6], "gcc": 4, "gener": 6, "get": [2, 4, 5, 6], "get_bulk": [5, 6], "get_next": [5, 6], "getbulk": [2, 6], "getnext": [2, 6], "given": [3, 6], "grab": 4, "ha": [4, 6], "have": [1, 4, 6], "helper": [4, 5], "highli": 6, "hold": 6, "host": 1, "hostnam": [4, 6, 7], "how": 6, "http": [4, 8], "i": [1, 2, 3, 4, 6, 8], "ib": 6, "id": 6, "ident": 6, "identifi": 6, "import": 4, "increment": 6, "index": [1, 2, 3, 4, 6, 8], "indic": [1, 2, 6, 7], "individu": [4, 6], "inform": [2, 4, 6, 8], "initi": 6, "initial_md5_a": 4, "initial_md5_d": 4, "initial_md5_no_priv": 4, "instanc": [1, 2, 6, 8], "instead": 6, "instruct": 4, "int": [2, 4, 6], "integ": [4, 6], "intend": [4, 6], "interact": 6, "interfac": [4, 6, 8], "intern": [6, 8], "invalid": 1, "ip": 6, "ir": 6, "is_hostname_ipv6": [4, 5, 7], "isn": 4, "issu": 4, "item": [2, 4, 6], "iter": 8, "its": [2, 4, 6], "just": [4, 6], "keyword": [2, 6], "kwarg": 6, "lab": 4, "last": 6, "let": 6, "level": 6, "libperl": 4, "librari": [4, 6], "libsnmp": 4, "like": 4, "linux": 4, "list": [2, 6, 8], "liter": 6, "ll": 4, "local": 6, "local_port": 6, "localhost": [4, 6], "locat": 4, "longer": 6, "lookup": 6, "maco": 4, "mai": [1, 2, 4, 6], "make": [4, 6], "manag": [4, 6], "mani": 4, "manipul": [6, 8], "manual": 6, "match": 6, "max_repetit": [2, 6], "md5": [4, 6], "messag": 6, "method": 6, "mi": 6, "mib": [2, 4, 6], "modul": [4, 5], "more": 6, "most": [4, 6], "multipl": [2, 4, 6], "must": [2, 6], "my": 4, "name": [1, 2, 4, 6], "necessari": 6, "need": [4, 6], "net": [1, 4, 6, 8], "new": 6, "newer": 4, "next": [2, 6], "no_auth_or_privaci": 6, "non": [4, 6, 7], "non_repeat": [2, 6], "none": [2, 3, 6, 7, 8], "nonexist": 1, "normal": [3, 4], "normalize_oid": [3, 4, 5], "nosuch": 6, "nosuchinst": 8, "nosuchobject": 8, "note": [4, 6], "number": [2, 6, 7], "numer": [2, 4, 6], "o": 4, "object": [1, 2, 4, 6, 8], "occasion": 4, "off": 4, "oid": [1, 2, 3, 4, 6, 8], "oid_index": [3, 4, 8], "oid_valu": [2, 6], "onc": 6, "one": [4, 6], "onli": [1, 2, 6], "oper": [2, 4, 6], "option": 6, "org": [4, 8], "other": 4, "our": [4, 6], "our_ident": 6, "out": 1, "overrid": 6, "overridden": 6, "packag": 4, "packet": [2, 6], "page": 4, "pain": 6, "paramet": [2, 3, 6, 7, 8], "pars": [2, 6], "particular": [1, 2, 6], "pass": [2, 6], "passphras": 6, "pdu": 6, "perfect": 4, "perform": [2, 4, 6], "php": 8, "piec": [2, 4, 6, 8], "pip": 4, "place": 4, "plan": 4, "pleas": [4, 8], "plu": 6, "port": 6, "possibl": [4, 6], "prefer": 6, "prepar": [2, 6], "primarili": 4, "print": 4, "printabl": 7, "priv_pass": 4, "priv_second": 4, "privaci": 6, "privacy_password": [4, 6], "privacy_protocol": [4, 6], "probe": 6, "problem": 1, "process": 6, "project": 4, "proper": 6, "properti": [6, 8], "protocol": 6, "provid": 4, "public": [4, 6], "pypi": 4, "python": 4, "python3": 4, "queri": 6, "r": 6, "rais": [1, 6], "random": 6, "re": [4, 6], "read": 6, "readonli": 6, "readwrit": 6, "realli": 6, "recommend": 6, "regular": [4, 6], "reinstal": 4, "relat": 4, "remot": [1, 6], "remote_port": [4, 6], "remotehost": 6, "remov": [6, 7], "repair": 6, "repeat": [2, 6], "repres": [2, 6, 8], "request": [1, 4, 6], "resent": 6, "respect": 8, "result": 6, "retreiv": 8, "retri": 6, "retriev": [2, 4, 6], "retry_no_such": 6, "return": [2, 4, 6, 7], "rhel": 4, "run": [4, 6], "same": 2, "search": 4, "second": [2, 6], "secondary_sha_a": 4, "secondary_sha_no_priv": 4, "secur": 6, "security_engine_id": 6, "security_level": [4, 6], "security_usernam": [4, 6], "see": 8, "self": 2, "send": [2, 6], "sent": 2, "server": 6, "sess_ptr": [5, 6], "sess_v1_arg": 4, "sess_v2_arg": 4, "sess_v3_md5_aes_arg": 4, "sess_v3_md5_des_arg": 4, "sess_v3_md5_no_priv_arg": 4, "sess_v3_sha_aes_arg": 4, "sess_v3_sha_no_priv_arg": 4, "session": [2, 5], "session_karg": 2, "set": [1, 2, 3, 4, 5, 6, 8], "set_multipl": [5, 6], "setup": 6, "sever": 4, "sha": [4, 6], "ship": 4, "should": [2, 6], "simpl": 4, "sinc": 6, "singl": [2, 4, 6], "slight": 8, "snmp": [1, 2, 6, 8], "snmp_bulkwalk": [2, 4, 5], "snmp_err": 6, "snmp_err_index": 6, "snmp_get": [2, 4, 5], "snmp_get_bulk": [2, 4, 5], "snmp_get_next": [2, 4, 5], "snmp_set": [2, 4, 5], "snmp_set_multipl": [2, 4, 5], "snmp_type": [2, 4, 6, 8], "snmp_walk": [2, 4, 5], "snmpcmd": 6, "snmpset": 8, "snmpv1": 1, "snmpvariabl": [2, 4, 5, 6, 8], "snmpvariablelist": [4, 5, 8], "so": 4, "some": 1, "someth": [4, 6], "sourc": 4, "specif": 4, "specifi": 4, "sprint_valu": 6, "statu": 6, "str": [2, 4, 6], "string": [2, 4, 6, 7], "strip": 7, "strip_non_print": [4, 5, 7], "structur": 6, "stuff": 4, "success": [2, 6], "sudo": 4, "suitabl": 4, "suppli": [2, 6], "support": [2, 4, 7], "synchron": 6, "syscontact": 4, "sysdescr": [2, 4, 6], "sysloc": 4, "system": [4, 6], "system_item": 4, "t": [1, 4], "tag": 6, "test": 4, "than": 4, "thei": 6, "their_hostnam": 6, "their_ident": 6, "thi": [2, 4, 6, 7], "time": [1, 2, 6], "timeout": 6, "timeout_microsecond": [5, 6], "tl": 6, "too": 4, "tostr": [4, 5, 7], "total": 6, "transpar": 6, "true": 6, "trust": 6, "trust_cert": 6, "try": 4, "tupl": [2, 4, 6], "tut": 8, "two": 4, "type": [1, 2, 4, 6, 8], "typic": 6, "ub": [0, 4, 5], "ubuntu": 4, "udp": 6, "undef": 6, "underli": 6, "understand": 6, "unicod": 7, "untransl": 6, "updat": [2, 4], "update_sess": [5, 6], "upgrad": 4, "urepr": [0, 4, 5], "us": [2, 4, 6, 8], "usag": 6, "use_enum": 6, "use_long_nam": 6, "use_numer": 6, "use_sprint_valu": 6, "util": [4, 5], "v": 6, "v1": 6, "v2": 6, "v3": 6, "val": 8, "valid": 6, "validate_result": [4, 5, 6], "valu": [1, 2, 4, 6, 7, 8], "varbind": [5, 8], "variabl": [2, 4, 5, 6, 7], "variat": 8, "variou": 2, "varlist": 6, "ve": 6, "version": [4, 6], "via": [2, 4, 6, 8], "w": 6, "wa": [2, 6], "wai": 4, "walk": [4, 5, 6], "want": 4, "warn": 6, "we": [4, 6], "were": [2, 6], "when": [1, 2, 4, 6, 7], "where": [4, 6], "wherebi": [2, 6], "whether": 6, "which": [1, 2, 4, 6, 8], "while": 6, "whoop": 6, "wiki": 8, "wish": [2, 4, 6, 7], "without": 4, "would": 6, "wrong": 6, "www": 8, "x": [4, 6], "y": 4, "you": [2, 4, 6, 7], "your": [4, 6], "yum": 4}, "titles": ["ezsnmp.compat module", "ezsnmp.exceptions module", "ezsnmp.ez module", "ezsnmp.helpers module", "Welcome to Ez SNMP\u2019s documentation!", "<no title>", "ezsnmp.session module", "ezsnmp.utils module", "ezsnmp.variables module"], "titleterms": {"": 4, "compat": 0, "content": 4, "document": 4, "exampl": 4, "except": 1, "ez": [2, 4], "ezsnmp": [0, 1, 2, 3, 6, 7, 8], "helper": 3, "indic": 4, "instal": 4, "karg": 4, "modul": [0, 1, 2, 3, 6, 7, 8], "quick": 4, "session": [4, 6], "snmp": 4, "start": 4, "tabl": 4, "util": 7, "variabl": 8, "welcom": 4}}) \ No newline at end of file diff --git a/docs/html/session.html b/docs/html/session.html index 79b3f775..5fa666eb 100644 --- a/docs/html/session.html +++ b/docs/html/session.html @@ -4,7 +4,7 @@ - ezsnmp.session module — Ez SNMP V1.0.0c2 documentation + ezsnmp.session module — Ez SNMP V1.0.0c3 documentation @@ -15,7 +15,7 @@ - + @@ -105,7 +105,7 @@

    ezsnmp.session module

    -class ezsnmp.session.Session(hostname='localhost', version=3, community='public', timeout=1, retries=3, remote_port=0, local_port=0, security_level='no_auth_or_privacy', security_username='initial', privacy_protocol='DEFAULT', privacy_password='', auth_protocol='DEFAULT', auth_password='', context_engine_id='', security_engine_id='', context='', engine_boots=0, engine_time=0, our_identity='', their_identity='', their_hostname='', trust_cert='', use_long_names=False, use_numeric=False, use_sprint_value=False, use_enums=False, best_guess=0, retry_no_such=False, abort_on_nonexistent=False)
    +class ezsnmp.session.Session(hostname: str = 'localhost', version: Literal[1, 2, 3] = 3, community: str = 'public', timeout: int = 1, retries: int = 3, remote_port: int = 0, local_port: int = 0, security_level: Literal['no_auth_or_privacy', 'auth_without_privacy', 'auth_with_privacy'] = 'no_auth_or_privacy', security_username: str = 'initial', privacy_protocol: str = 'DEFAULT', privacy_password: str = '', auth_protocol: str = 'DEFAULT', auth_password: str = '', context_engine_id: str = '', security_engine_id: str = '', context: str = '', engine_boots: int = 0, engine_time: int = 0, our_identity: str = '', their_identity: str = '', their_hostname: str = '', trust_cert: str = '', use_long_names: bool = False, use_numeric: bool = False, use_sprint_value: bool = False, use_enums: bool = False, best_guess: Literal[0, 1, 2] = 0, retry_no_such: bool = False, abort_on_nonexistent: bool = False)

    Bases: object

    A Net-SNMP session which may be setup once and then used to query and manipulate SNMP data.

    @@ -131,7 +131,7 @@
  • security_level – security level (no_auth_or_privacy, auth_without_privacy or auth_with_privacy) (v3)

  • security_username – security name (v3)

  • -
  • privacy_protocol – privacy protocol (v3)

  • +
  • privacy_protocol – privacy protocol (v3) i.e AES, DES, etc

  • privacy_password – privacy passphrase (v3)

  • auth_protocol – authentication protocol (MD5 or SHA) (v3)

  • auth_password – authentication passphrase (v3)

  • @@ -195,7 +195,7 @@
    -bulkwalk(oids='.1.3.6.1.2.1', non_repeaters=0, max_repetitions=10)
    +bulkwalk(oids: List[str | Tuple[str, str]] | str | Tuple[str, str] = '.1.3.6.1.2.1', non_repeaters: int = 0, max_repetitions: int = 10) List[SNMPVariable]

    Uses SNMP GETBULK operation using the prepared session to automatically retrieve multiple pieces of information in an OID

    @@ -215,7 +215,7 @@
    -property connect_hostname
    +property connect_hostname: str
    @@ -238,7 +238,9 @@
    -get(oids)
    +get(oids: List[str | Tuple[str, str]]) List[SNMPVariable] +
    +get(oids: str | Tuple[str, str]) SNMPVariable

    Perform an SNMP GET operation using the prepared session to retrieve a particular piece of information.

    @@ -259,7 +261,7 @@
    -get_bulk(oids, non_repeaters=0, max_repetitions=10)
    +get_bulk(oids: List[str | Tuple[str, str]] | str | Tuple[str, str], non_repeaters: int = 0, max_repetitions: int = 10) List[SNMPVariable]

    Performs a bulk SNMP GET operation using the prepared session to retrieve multiple pieces of information in a single packet.

    @@ -286,7 +288,9 @@
    -get_next(oids)
    +get_next(oids: List[str | Tuple[str, str]]) List[SNMPVariable] +
    +get_next(oids: str | Tuple[str, str]) SNMPVariable

    Uses an SNMP GETNEXT operation using the prepared session to retrieve the next variable after the chosen item.

    @@ -313,7 +317,7 @@
    -set(oid, value, snmp_type=None)
    +set(oid: str | Tuple[str, str], value: Any, snmp_type=None) bool

    Perform an SNMP SET operation using the prepared session.

    Parameters:
    @@ -335,7 +339,7 @@
    -set_multiple(oid_values)
    +set_multiple(oid_values: List[Tuple[str, Any] | Tuple[str, Any, int]]) bool

    Perform an SNMP SET operation on multiple OIDs with multiple values using the prepared session.

    @@ -352,12 +356,12 @@
    -property timeout_microseconds
    +property timeout_microseconds: int
    -update_session(**kwargs)
    +update_session(**kwargs: Any) None

    (Re)creates the underlying Net-SNMP session object.

    While it is recommended to create a new Session instance instead, this method has been added for your convenience in case you really need it @@ -381,7 +385,7 @@

    -walk(oids='.1.3.6.1.2.1')
    +walk(oids: List[str | Tuple[str, str]] | str | Tuple[str, str] = '.1.3.6.1.2.1') List[SNMPVariable]

    Uses SNMP GETNEXT operation using the prepared session to automatically retrieve multiple pieces of information in an OID.

    @@ -403,7 +407,7 @@
    -ezsnmp.session.build_varlist(oids)
    +ezsnmp.session.build_varlist(oids: List[str | Tuple[str, str]] | str | Tuple[str, str]) Tuple[List[SNMPVariable], bool]

    Prepare the variable binding list which will be used by the C interface.

    @@ -421,7 +425,7 @@
    -ezsnmp.session.validate_results(varlist)
    +ezsnmp.session.validate_results(varlist: List[SNMPVariable]) None

    Validates a list of SNMPVariable objects and raises any appropriate exceptions where necessary.

    @@ -429,6 +433,9 @@

    varlist – a variable list containing SNMPVariable objects to be processed

    +
    Returns:
    +

    +
    diff --git a/docs/html/utils.html b/docs/html/utils.html index deef8ef9..3f8fbcf7 100644 --- a/docs/html/utils.html +++ b/docs/html/utils.html @@ -4,7 +4,7 @@ - ezsnmp.utils module — Ez SNMP V1.0.0c2 documentation + ezsnmp.utils module — Ez SNMP V1.0.0c3 documentation @@ -15,7 +15,7 @@ - + @@ -52,6 +52,7 @@
  • ezsnmp.helpers module
  • ezsnmp.session module
  • ezsnmp.utils module @@ -86,6 +87,11 @@

    ezsnmp.utils module

    +
    +
    +ezsnmp.utils.is_hostname_ipv6(hostname)
    +
    +
    ezsnmp.utils.strip_non_printable(value)
    diff --git a/docs/html/variables.html b/docs/html/variables.html index fd22409a..8ecac924 100644 --- a/docs/html/variables.html +++ b/docs/html/variables.html @@ -4,7 +4,7 @@ - ezsnmp.variables module — Ez SNMP V1.0.0c2 documentation + ezsnmp.variables module — Ez SNMP V1.0.0c3 documentation @@ -15,7 +15,7 @@ - + diff --git a/ezsnmp/compat.py b/ezsnmp/compat.py index 50fe5d3c..28b7e2fb 100644 --- a/ezsnmp/compat.py +++ b/ezsnmp/compat.py @@ -1,27 +1,10 @@ -import sys +unicode = None +text_type = str -PY3 = sys.version_info[0] == 3 -if PY3: # Clear Flake8 warnings - unicode = None +def ub(s): + return s -if PY3: - text_type = str - def ub(s): - return s - - def urepr(s): - return repr(s) - -else: - text_type = unicode - - def ub(s): - return s.decode("latin-1") - - def urepr(s): - if isinstance(s, unicode): - return repr(s)[1:] - else: - return repr(s) +def urepr(s): + return repr(s) diff --git a/ezsnmp/ez.py b/ezsnmp/ez.py index f5e3d7d1..b4e15f5e 100644 --- a/ezsnmp/ez.py +++ b/ezsnmp/ez.py @@ -1,9 +1,23 @@ from __future__ import unicode_literals, absolute_import +from typing import Union, List, Tuple, Any, overload + from .session import Session +from .variables import SNMPVariable + + +@overload +def snmp_get(oids: List[Union[str, Tuple[str, str]]]) -> List[SNMPVariable]: ... + +@overload +def snmp_get(oids: Union[str, Tuple[str, str]]) -> SNMPVariable: ... -def snmp_get(oids, **session_kargs): + +def snmp_get( + oids: Union[List[Union[str, Tuple[str, str]]], Union[str, Tuple[str, str]]], + **session_kargs, +) -> Union[SNMPVariable, List[SNMPVariable]]: """ Perform an SNMP GET operation to retrieve a particular piece of information. @@ -16,6 +30,9 @@ def snmp_get(oids, **session_kargs): :param session_kargs: keyword arguments which will be sent used when constructing the session for this operation; all parameters in the Session class are supported + :return: an SNMPVariable object containing the value that was + retrieved or a list of objects when you send in a list of + OIDs """ session = Session(**session_kargs) @@ -24,7 +41,9 @@ def snmp_get(oids, **session_kargs): return retval -def snmp_set(oid, value, type=None, **session_kargs): +def snmp_set( + oid: Union[str, Tuple[str, str]], value: Any, type=None, **session_kargs +) -> bool: """ Perform an SNMP SET operation to update a particular piece of information. @@ -39,6 +58,7 @@ def snmp_set(oid, value, type=None, **session_kargs): :param session_kargs: keyword arguments which will be sent used when constructing the session for this operation; all parameters in the Session class are supported + :return: bool value indicated that if snmp_set was successed """ session = Session(**session_kargs) @@ -47,7 +67,9 @@ def snmp_set(oid, value, type=None, **session_kargs): return retval -def snmp_set_multiple(oid_values, **session_kargs): +def snmp_set_multiple( + oid_values: List[Union[Tuple[str, Any], Tuple[str, Any, int]]], **session_kargs +) -> bool: """ Perform multiple SNMP SET operations to update various pieces of information at the same time. @@ -57,6 +79,7 @@ def snmp_set_multiple(oid_values, **session_kargs): :param session_kargs: keyword arguments which will be sent used when constructing the session for this operation; all parameters in the Session class are supported + :return: bool value indicated that if snmp_set was successed """ session = Session(**session_kargs) @@ -65,7 +88,20 @@ def snmp_set_multiple(oid_values, **session_kargs): return retval -def snmp_get_next(oids, **session_kargs): +@overload +def snmp_get_next( + self, oids: List[Union[str, Tuple[str, str]]] +) -> List[SNMPVariable]: ... + + +@overload +def snmp_get_next(self, oids: Union[str, Tuple[str, str]]) -> SNMPVariable: ... + + +def snmp_get_next( + oids: Union[List[Union[str, Tuple[str, str]]], Union[str, Tuple[str, str]]], + **session_kargs, +) -> Union[List[SNMPVariable], SNMPVariable]: """ Uses an SNMP GETNEXT operation to retrieve the next variable after the chosen item. @@ -78,6 +114,9 @@ def snmp_get_next(oids, **session_kargs): :param session_kargs: keyword arguments which will be sent used when constructing the session for this operation; all parameters in the Session class are supported + :return: an SNMPVariable object containing the value that was + retrieved or a list of objects when you send in a list of + OIDs """ session = Session(**session_kargs) @@ -86,7 +125,12 @@ def snmp_get_next(oids, **session_kargs): return retval -def snmp_get_bulk(oids, non_repeaters=0, max_repetitions=10, **session_kargs): +def snmp_get_bulk( + oids: Union[List[Union[str, Tuple[str, str]]], Union[str, Tuple[str, str]]], + non_repeaters=0, + max_repetitions=10, + **session_kargs, +) -> List[SNMPVariable]: """ Performs a bulk SNMP GET operation to retrieve multiple pieces of information in a single packet. @@ -104,6 +148,8 @@ def snmp_get_bulk(oids, non_repeaters=0, max_repetitions=10, **session_kargs): :param session_kargs: keyword arguments which will be sent used when constructing the session for this operation; all parameters in the Session class are supported + :return: a list of SNMPVariable objects containing the values that + were retrieved via SNMP """ session = Session(**session_kargs) @@ -112,7 +158,12 @@ def snmp_get_bulk(oids, non_repeaters=0, max_repetitions=10, **session_kargs): return retval -def snmp_walk(oids=".1.3.6.1.2.1", **session_kargs): +def snmp_walk( + oids: Union[ + List[Union[str, Tuple[str, str]]], Union[str, Tuple[str, str]] + ] = ".1.3.6.1.2.1", + **session_kargs, +) -> List[SNMPVariable]: """ Uses SNMP GETNEXT operation to automatically retrieve multiple pieces of information in an OID for you. @@ -125,6 +176,8 @@ def snmp_walk(oids=".1.3.6.1.2.1", **session_kargs): :param session_kargs: keyword arguments which will be sent used when constructing the session for this operation; all parameters in the Session class are supported + :return: a list of SNMPVariable objects containing the values that + were retrieved via SNMP """ session = Session(**session_kargs) @@ -134,8 +187,13 @@ def snmp_walk(oids=".1.3.6.1.2.1", **session_kargs): def snmp_bulkwalk( - oids=".1.3.6.1.2.1", non_repeaters=0, max_repetitions=10, **session_kargs -): + oids: Union[ + List[Union[str, Tuple[str, str]]], Union[str, Tuple[str, str]] + ] = ".1.3.6.1.2.1", + non_repeaters=0, + max_repetitions=10, + **session_kargs, +) -> List[SNMPVariable]: """ Uses SNMP GETBULK operation using the prepared session to automatically retrieve multiple pieces of information in an OID diff --git a/ezsnmp/helpers.py b/ezsnmp/helpers.py index 0c32d617..2f749082 100644 --- a/ezsnmp/helpers.py +++ b/ezsnmp/helpers.py @@ -3,6 +3,8 @@ import re # This regular expression is used to extract the index from an OID +# We attempt to extract the index from an OID (e.g. sysDescr.0 +# or .iso.org.dod.internet.mgmt.mib-2.system.sysContact.0) OID_INDEX_RE = re.compile( r"""( \.?\d+(?:\.\d+)* # numeric OID @@ -16,6 +18,10 @@ re.VERBOSE, ) +# This regular expression takes something like 'SNMPv2::mib-2.17.7.1.4.3.1.2.300' +# and splits it into 'SNMPv2::mib-2' and '17.7.1.4.3.1.2.300' +OID_INDEX_RE2 = re.compile(r"^([^\.]+::[^\.]+)\.(.*)$") + def normalize_oid(oid, oid_index=None): """ @@ -27,10 +33,17 @@ def normalize_oid(oid, oid_index=None): # Determine the OID index from the OID if not specified if oid_index is None and oid is not None: - # We attempt to extract the index from an OID (e.g. sysDescr.0 - # or .iso.org.dod.internet.mgmt.mib-2.system.sysContact.0) - match = OID_INDEX_RE.match(oid) - if match: - oid, oid_index = match.group(1, 2) + first_match = OID_INDEX_RE.match(oid) + second_match = OID_INDEX_RE2.match(oid) + + if second_match: + oid, oid_index = second_match.group(1, 2) + + elif first_match: + oid, oid_index = first_match.group(1, 2) + + elif oid == ".": + oid = "." + oid_index = "" return oid, oid_index diff --git a/ezsnmp/session.py b/ezsnmp/session.py index d82885d8..d81be585 100644 --- a/ezsnmp/session.py +++ b/ezsnmp/session.py @@ -2,6 +2,7 @@ import os import re +from typing import Union, List, overload, Any, Tuple, Literal from warnings import warn # Don't attempt to import the C interface if building docs on RTD @@ -29,7 +30,9 @@ } -def build_varlist(oids): +def build_varlist( + oids: Union[List[Union[str, Tuple[str, str]]], Union[str, Tuple[str, str]]], +) -> Tuple[List[SNMPVariable], bool]: """ Prepare the variable binding list which will be used by the C interface. @@ -63,13 +66,14 @@ def build_varlist(oids): return varlist, is_list -def validate_results(varlist): +def validate_results(varlist: List[SNMPVariable]) -> None: """ Validates a list of SNMPVariable objects and raises any appropriate exceptions where necessary. :param varlist: a variable list containing SNMPVariable objects to be processed + :return: """ for variable in varlist: @@ -173,35 +177,37 @@ class Session(object): def __init__( self, - hostname="localhost", - version=3, - community="public", - timeout=1, - retries=3, - remote_port=0, - local_port=0, - security_level="no_auth_or_privacy", - security_username="initial", - privacy_protocol="DEFAULT", - privacy_password="", - auth_protocol="DEFAULT", - auth_password="", - context_engine_id="", - security_engine_id="", - context="", - engine_boots=0, - engine_time=0, - our_identity="", - their_identity="", - their_hostname="", - trust_cert="", - use_long_names=False, - use_numeric=False, - use_sprint_value=False, - use_enums=False, - best_guess=0, - retry_no_such=False, - abort_on_nonexistent=False, + hostname: str = "localhost", + version: Literal[1, 2, 3] = 3, + community: str = "public", + timeout: int = 1, + retries: int = 3, + remote_port: int = 0, + local_port: int = 0, + security_level: Literal[ + "no_auth_or_privacy", "auth_without_privacy", "auth_with_privacy" + ] = "no_auth_or_privacy", + security_username: str = "initial", + privacy_protocol: str = "DEFAULT", + privacy_password: str = "", + auth_protocol: str = "DEFAULT", + auth_password: str = "", + context_engine_id: str = "", + security_engine_id: str = "", + context: str = "", + engine_boots: int = 0, + engine_time: int = 0, + our_identity: str = "", + their_identity: str = "", + their_hostname: str = "", + trust_cert: str = "", + use_long_names: bool = False, + use_numeric: bool = False, + use_sprint_value: bool = False, + use_enums: bool = False, + best_guess: Literal[0, 1, 2] = 0, + retry_no_such: bool = False, + abort_on_nonexistent: bool = False, ): # Validate and extract the remote port connection_string = re.match( @@ -278,7 +284,7 @@ def __exit__(self, exc_type, exc_value, exc_traceback): del self.sess_ptr @property - def connect_hostname(self): + def connect_hostname(self) -> str: def format_hostname(hostname): return "[{}]".format(hostname) if is_hostname_ipv6(hostname) else hostname @@ -288,11 +294,20 @@ def format_hostname(hostname): return self.hostname @property - def timeout_microseconds(self): + def timeout_microseconds(self) -> int: # Calculate our timeout in microseconds return int(self.timeout * 1000000) - def get(self, oids): + @overload + def get(self, oids: List[Union[str, Tuple[str, str]]]) -> List[SNMPVariable]: ... + + @overload + def get(self, oids: Union[str, Tuple[str, str]]) -> SNMPVariable: ... + + def get( + self, + oids: Union[List[Union[str, Tuple[str, str]]], Union[str, Tuple[str, str]]], + ) -> Union[List[SNMPVariable], SNMPVariable]: """ Perform an SNMP GET operation using the prepared session to retrieve a particular piece of information. @@ -320,7 +335,7 @@ def get(self, oids): # Return a list or single item depending on what was passed in return list(varlist) if is_list else varlist[0] - def set(self, oid, value, snmp_type=None): + def set(self, oid: Union[str, Tuple[str, str]], value: Any, snmp_type=None) -> bool: """ Perform an SNMP SET operation using the prepared session. @@ -347,7 +362,9 @@ def set(self, oid, value, snmp_type=None): success = interface.set(self, varlist) return bool(success) - def set_multiple(self, oid_values): + def set_multiple( + self, oid_values: List[Union[Tuple[str, Any], Tuple[str, Any, int]]] + ) -> bool: """ Perform an SNMP SET operation on multiple OIDs with multiple values using the prepared session. @@ -379,7 +396,18 @@ def set_multiple(self, oid_values): success = interface.set(self, varlist) return bool(success) - def get_next(self, oids): + @overload + def get_next( + self, oids: List[Union[str, Tuple[str, str]]] + ) -> List[SNMPVariable]: ... + + @overload + def get_next(self, oids: Union[str, Tuple[str, str]]) -> SNMPVariable: ... + + def get_next( + self, + oids: Union[List[Union[str, Tuple[str, str]]], Union[str, Tuple[str, str]]], + ) -> Union[List[SNMPVariable], SNMPVariable]: """ Uses an SNMP GETNEXT operation using the prepared session to retrieve the next variable after the chosen item. @@ -407,7 +435,12 @@ def get_next(self, oids): # Return a list or single item depending on what was passed in return list(varlist) if is_list else varlist[0] - def get_bulk(self, oids, non_repeaters=0, max_repetitions=10): + def get_bulk( + self, + oids: Union[List[Union[str, Tuple[str, str]]], Union[str, Tuple[str, str]]], + non_repeaters: int = 0, + max_repetitions: int = 10, + ) -> List[SNMPVariable]: """ Performs a bulk SNMP GET operation using the prepared session to retrieve multiple pieces of information in a single packet. @@ -443,7 +476,12 @@ def get_bulk(self, oids, non_repeaters=0, max_repetitions=10): # Return a list of variables return varlist - def walk(self, oids=".1.3.6.1.2.1"): + def walk( + self, + oids: Union[ + List[Union[str, Tuple[str, str]]], Union[str, Tuple[str, str]] + ] = ".1.3.6.1.2.1", + ) -> List[SNMPVariable]: """ Uses SNMP GETNEXT operation using the prepared session to automatically retrieve multiple pieces of information in an OID. @@ -470,7 +508,14 @@ def walk(self, oids=".1.3.6.1.2.1"): # Return a list of variables return list(varlist) - def bulkwalk(self, oids=".1.3.6.1.2.1", non_repeaters=0, max_repetitions=10): + def bulkwalk( + self, + oids: Union[ + List[Union[str, Tuple[str, str]]], Union[str, Tuple[str, str]] + ] = ".1.3.6.1.2.1", + non_repeaters: int = 0, + max_repetitions: int = 10, + ) -> List[SNMPVariable]: """ Uses SNMP GETBULK operation using the prepared session to automatically retrieve multiple pieces of information in an OID @@ -500,7 +545,7 @@ def bulkwalk(self, oids=".1.3.6.1.2.1", non_repeaters=0, max_repetitions=10): # Return a list of variables return varlist - def update_session(self, **kwargs): + def update_session(self, **kwargs: Any) -> None: """ (Re)creates the underlying Net-SNMP session object. diff --git a/requirements.txt b/requirements.txt index 79658c3d..9516721c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,10 @@ atomicwrites==1.4.1 attrs==23.2.0 -black==24.4.2 +black==24.8.0 click== 8.1.7 colorama==0.4.6 -coverage==7.6.0 -flake8==7.1.0 +coverage==7.6.1 +flake8==7.1.1 iniconfig==2.0.0 mccabe==0.7.0 mypy-extensions==1.0.0 @@ -13,7 +13,7 @@ pathspec==0.12.1 platformdirs==4.2.2 pluggy==1.5.0 py==1.11.0 -pycodestyle==2.12.0 +pycodestyle==2.12.1 pyflakes==3.2.0 pyparsing==3.1.2 pytest==8.3.2 @@ -24,6 +24,6 @@ tomli==2.0.1 setuptools==72.1.0 urllib3==2.2.2 build==1.2.1 -cibuildwheel==2.19.2 +cibuildwheel==2.20.0 pip==24.2 wheel==0.43.0 \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index ea8be849..15adb824 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = ezsnmp -version = 1.0.0c2 +version = 1.0.0c3 description = A blazingly fast and Pythonic SNMP library based on the official Net-SNMP bindings. author = Carlos Santos author_email = dose.lucky.sake@cloak.id diff --git a/sphinx_docs_build/source/conf.py b/sphinx_docs_build/source/conf.py index 446daeac..8459db34 100644 --- a/sphinx_docs_build/source/conf.py +++ b/sphinx_docs_build/source/conf.py @@ -24,7 +24,7 @@ author = "carlkidcrypto" # The full version, including alpha/beta/rc tags -release = "V1.0.0c2" +release = "V1.0.0c3" # -- General configuration --------------------------------------------------- diff --git a/tests/test_helpers.py b/tests/test_helpers.py index 070fd1b3..9ba15edd 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -3,12 +3,42 @@ from ezsnmp.helpers import normalize_oid +def test_normalize_oid_just_iso(): + oid, oid_index = normalize_oid("oid") + assert oid == "oid" + assert oid_index == "" + + +def test_normalize_oid_just_period(): + oid, oid_index = normalize_oid(".") + assert oid == "." + assert oid_index == "" + + def test_normalize_oid_regular(): oid, oid_index = normalize_oid("sysContact.0") assert oid == "sysContact" assert oid_index == "0" +def test_normalize_oid_regular_2(): + oid, oid_index = normalize_oid("SNMPv2::mib-2.17.7.1.4.3.1.2.300") + assert oid == "SNMPv2::mib-2" + assert oid_index == "17.7.1.4.3.1.2.300" + + +def test_normalize_oid_regular_3(): + oid, oid_index = normalize_oid("nsCacheTimeout.1.3.6.1.2.1.2") + assert oid == "nsCacheTimeout" + assert oid_index == "1.3.6.1.2.1.2" + + +def test_normalize_oid_regular_4(): + oid, oid_index = normalize_oid("iso.3.6.1.2.1.31.1.1.1.1.5035") + assert oid == "iso" + assert oid_index == "3.6.1.2.1.31.1.1.1.1.5035" + + def test_normalize_oid_numeric(): oid, oid_index = normalize_oid(".1.3.6.1.2.1.1.1.0") assert oid == ".1.3.6.1.2.1.1.1.0" diff --git a/tests/test_session.py b/tests/test_session.py index 98b0cedc..92ab8576 100644 --- a/tests/test_session.py +++ b/tests/test_session.py @@ -1,9 +1,11 @@ from __future__ import unicode_literals import platform +import random import re - import pytest +from time import sleep + from ezsnmp.exceptions import ( EzSNMPError, EzSNMPConnectionError, @@ -428,6 +430,9 @@ def test_session_bulkwalk(sess): def test_session_walk_all(sess): + # Introduce some radom sleep to prevent us DDoSing our own snmp test server. + sleep(random.uniform(0.1, 0.500)) + # OID 1.3.6.1.6.3.16.1.5.2.1.6.6.95.110.111.110.101.95.1.2 # or SNMP-VIEW-BASED-ACM-MIB::vacmViewTreeFamilyStatus."_none_".1.2 # appears to return a noSuchName error when using v1, but not with v2c.