diff options
author | Ilya Etingof <etingof@gmail.com> | 2018-08-12 17:22:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-12 17:22:58 +0200 |
commit | ac0b956d006a4b7b32780e852740b56ecd826c7e (patch) | |
tree | 4576911add0e18525991109acdb2a91bc4b2fde8 /docs/source/examples/hlapi/v1arch | |
parent | 488ec26798a4493ee0fc45e730f88f1365f56df7 (diff) | |
download | pysnmp-git-ac0b956d006a4b7b32780e852740b56ecd826c7e.tar.gz |
Add `hlapi.v1arch` API (#186)
* Add `hlapi.v1arch` API
Introduce new sub-package `pysnmp.hlapi.v1arch` which
wraps otherwise very detailed packet-level SNMP
messaging into a handful of convenience functions.
As a side effect, the `pysnmp.hlapi.*` sub-packages
moved under `pysnmp.hlapi.v3arch` though `pysnmp.hlapi`
still exposes `pysnmp.hlappi.v3arch.*` symbols to
retain some degree of backward compatibility.
The signature of the hlapi `.sendNotification()` call
has changed to accept `*varBinds` instead of a sequence
of `varBinds`. The rationale is to unify this method
call with similar methods of CommandGenerator.
* Add v1arch docs and reshuffle hlapi docs
Diffstat (limited to 'docs/source/examples/hlapi/v1arch')
22 files changed, 821 insertions, 0 deletions
diff --git a/docs/source/examples/hlapi/v1arch/asyncore/agent/ntforg/advanced-topics.rst b/docs/source/examples/hlapi/v1arch/asyncore/agent/ntforg/advanced-topics.rst new file mode 100644 index 00000000..a1dec24c --- /dev/null +++ b/docs/source/examples/hlapi/v1arch/asyncore/agent/ntforg/advanced-topics.rst @@ -0,0 +1,7 @@ +.. toctree:: + :maxdepth: 2 + +Advanced Notification Originator +-------------------------------- + +See also: :doc:`library reference </docs/api-reference>`. diff --git a/docs/source/examples/hlapi/v1arch/asyncore/agent/ntforg/common-notifications.rst b/docs/source/examples/hlapi/v1arch/asyncore/agent/ntforg/common-notifications.rst new file mode 100644 index 00000000..3bfbde3a --- /dev/null +++ b/docs/source/examples/hlapi/v1arch/asyncore/agent/ntforg/common-notifications.rst @@ -0,0 +1,49 @@ +.. toctree:: + :maxdepth: 2 + +Common notifications +-------------------- + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py>` script. + + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-inform.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-inform.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-inform.py>` script. + + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/generic-v1-trap.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/generic-v1-trap.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/generic-v1-trap.py>` script. + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/generic-v2c-trap.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/generic-v2c-trap.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/generic-v2c-trap.py>` script. + +See also: :doc:`library reference </docs/api-reference>`. diff --git a/docs/source/examples/hlapi/v1arch/asyncore/agent/ntforg/evaluating-notification-type.rst b/docs/source/examples/hlapi/v1arch/asyncore/agent/ntforg/evaluating-notification-type.rst new file mode 100644 index 00000000..b3b14adf --- /dev/null +++ b/docs/source/examples/hlapi/v1arch/asyncore/agent/ntforg/evaluating-notification-type.rst @@ -0,0 +1,18 @@ +.. toctree:: + :maxdepth: 2 + +Evaluating NOTIFICATION-TYPE +---------------------------- + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py>` script. + + +See also: :doc:`library reference </docs/api-reference>`. diff --git a/docs/source/examples/hlapi/v1arch/asyncore/contents.rst b/docs/source/examples/hlapi/v1arch/asyncore/contents.rst new file mode 100644 index 00000000..5f1e16d9 --- /dev/null +++ b/docs/source/examples/hlapi/v1arch/asyncore/contents.rst @@ -0,0 +1,60 @@ + +Asynchronous SNMP (asyncore, v1arch) +==================================== + +Applications build around :mod:`asyncore` get CPU time on :mod:`socket` +events being watched for by :mod:`select` dispatcher. User code +lives mostly in isolated functions (or any callable objects). + +As it is with any asynchronous I/O system, `asyncore` lets you run +many SNMP queries in parallel and/or sequentially, interleave SNMP +queries with other I/O operations for as long as they are managed +within the same event loop. + +The :mod:`pysnmp.hlapi.v1arch.asyncore` package implements `asyncore` +binding to pysnmp's `v1arch` services. + +In most examples approximate analogues of well known Net-SNMP snmp* tools +command line options are shown. That may help those readers who, by chance +are familiar with Net-SNMP tools, better understanding what example code doe + +Here's a quick example on a simple SNMP GET by high-level API: + +.. include:: /../../examples/hlapi/v1arch/asyncore/manager/cmdgen/v2c-get.py + :start-after: options: + :end-before: Functionally + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/manager/cmdgen/v2c-get.py + :start-after: """# + :language: python + +.. toctree:: + + /examples/hlapi/v1arch/asyncore/manager/cmdgen/snmp-versions + /examples/hlapi/v1arch/asyncore/manager/cmdgen/modifying-variables + /examples/hlapi/v1arch/asyncore/manager/cmdgen/walking-operations + /examples/hlapi/v1arch/asyncore/manager/cmdgen/table-operations + /examples/hlapi/v1arch/asyncore/manager/cmdgen/mib-tweaks + /examples/hlapi/v1arch/asyncore/manager/cmdgen/transport-tweaks + /examples/hlapi/v1arch/asyncore/manager/cmdgen/advanced-topics + +The following code sends SNMP TRAP: + + .. include:: /../../examples/hlapi/v1arch/asyncore/agent/ntforg/generic-v1-trap.py + :start-after: options: + :end-before: Functionally + + .. literalinclude:: /../../examples/hlapi/v1arch/asyncore/agent/ntforg/generic-v1-trap.py + :start-after: """# + :language: python + +More examples on Notification Originator API usage follow. + +.. toctree:: + + /examples/hlapi/v1arch/asyncore/agent/ntforg/common-notifications + /examples/hlapi/v1arch/asyncore/agent/ntforg/evaluating-notification-type + /examples/hlapi/v1arch/asyncore/agent/ntforg/advanced-topics + +More sophisticated SNMP operations can still be performed with +PySNMP via its Native API to Standard SNMP Applications. diff --git a/docs/source/examples/hlapi/v1arch/asyncore/manager/cmdgen/advanced-topics.rst b/docs/source/examples/hlapi/v1arch/asyncore/manager/cmdgen/advanced-topics.rst new file mode 100644 index 00000000..aec0b85b --- /dev/null +++ b/docs/source/examples/hlapi/v1arch/asyncore/manager/cmdgen/advanced-topics.rst @@ -0,0 +1,39 @@ +.. toctree:: + :maxdepth: 2 + +Advanced Command Generator +-------------------------- + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/getbulk-limit-number-of-packets.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/getbulk-limit-number-of-packets.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/getbulk-limit-number-of-packets.py>` script. + + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/multiple-get-calls.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/multiple-get-calls.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/multiple-get-calls.py>` script. + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/query-agents-from-multuple-threads-over-ipv4-and-ipv6.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/query-agents-from-multuple-threads-over-ipv4-and-ipv6.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/query-agents-from-multuple-threads-over-ipv4-and-ipv6.py>` script. + + +See also: :doc:`library reference </docs/api-reference>`. diff --git a/docs/source/examples/hlapi/v1arch/asyncore/manager/cmdgen/mib-tweaks.rst b/docs/source/examples/hlapi/v1arch/asyncore/manager/cmdgen/mib-tweaks.rst new file mode 100644 index 00000000..3bc98656 --- /dev/null +++ b/docs/source/examples/hlapi/v1arch/asyncore/manager/cmdgen/mib-tweaks.rst @@ -0,0 +1,48 @@ +.. toctree:: + :maxdepth: 2 + +MIB tweaks +---------- + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/enable-mib-lookup.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/enable-mib-lookup.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/enable-mib-lookup.py>` script. + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/preload-pysnmp-mibs.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/preload-pysnmp-mibs.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/preload-pysnmp-mibs.py>` script. + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-asn1-mib-search-path.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-asn1-mib-search-path.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-asn1-mib-search-path.py>` script. + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-pysnmp-mibs-search-path.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-pysnmp-mibs-search-path.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-pysnmp-mibs-search-path.py>` script. + + +See also: :doc:`library reference </docs/api-reference>`. diff --git a/docs/source/examples/hlapi/v1arch/asyncore/manager/cmdgen/modifying-variables.rst b/docs/source/examples/hlapi/v1arch/asyncore/manager/cmdgen/modifying-variables.rst new file mode 100644 index 00000000..b6aa9add --- /dev/null +++ b/docs/source/examples/hlapi/v1arch/asyncore/manager/cmdgen/modifying-variables.rst @@ -0,0 +1,30 @@ + +.. toctree:: + :maxdepth: 2 + +Modifying variables +------------------- + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py>` script. + + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/set-multiple-scalar-values.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/set-multiple-scalar-values.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/set-multiple-scalar-values.py>` script. + + +See also: :doc:`library-reference </docs/api-reference>`. diff --git a/docs/source/examples/hlapi/v1arch/asyncore/manager/cmdgen/snmp-versions.rst b/docs/source/examples/hlapi/v1arch/asyncore/manager/cmdgen/snmp-versions.rst new file mode 100644 index 00000000..9f9c0ec5 --- /dev/null +++ b/docs/source/examples/hlapi/v1arch/asyncore/manager/cmdgen/snmp-versions.rst @@ -0,0 +1,30 @@ +.. toctree:: + :maxdepth: 2 + +Various SNMP versions +---------------------- + +.. include:: /../../examples/hlapi/v1arch/asyncore/manager/cmdgen/v2c-get.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/manager/cmdgen/v2c-get.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/manager/cmdgen/v2c-get.py>` script. + +.. comment + + .. include:: /../../examples/hlapi/v1arch/asyncore/manager/cmdgen/pull-whole-mib.py + :start-after: """ + :end-before: """# + + .. literalinclude:: /../../examples/hlapi/v1arch/asyncore/manager/cmdgen/pull-whole-mib.py + :start-after: """# + :language: python + + :download:`Download</../../examples/hlapi/v1arch/asyncore/manager/cmdgen/pull-whole-mib.py>` script. + + +See also: :doc:`library reference </docs/api-reference>`. diff --git a/docs/source/examples/hlapi/v1arch/asyncore/manager/cmdgen/table-operations.rst b/docs/source/examples/hlapi/v1arch/asyncore/manager/cmdgen/table-operations.rst new file mode 100644 index 00000000..ede8a8ed --- /dev/null +++ b/docs/source/examples/hlapi/v1arch/asyncore/manager/cmdgen/table-operations.rst @@ -0,0 +1,50 @@ +.. toctree:: + :maxdepth: 2 + +Table operations +---------------- + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/get-table-object-by-index.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/get-table-object-by-index.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/get-table-object-by-index.py>` script. + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/get-table-object-by-multiple-indices.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/get-table-object-by-multiple-indices.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/get-table-object-by-multiple-indices.py>` script. + + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/getbulk-fetch-scalar-and-table-variables-over-ipv6.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/getbulk-fetch-scalar-and-table-variables-over-ipv6.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/getbulk-fetch-scalar-and-table-variables-over-ipv6.py>` script. + + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/pull-whole-snmp-table.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/pull-whole-snmp-table.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/pull-whole-snmp-table.py>` script. + + +See also: :doc:`library reference </docs/api-reference>`. diff --git a/docs/source/examples/hlapi/v1arch/asyncore/manager/cmdgen/transport-tweaks.rst b/docs/source/examples/hlapi/v1arch/asyncore/manager/cmdgen/transport-tweaks.rst new file mode 100644 index 00000000..5c948d51 --- /dev/null +++ b/docs/source/examples/hlapi/v1arch/asyncore/manager/cmdgen/transport-tweaks.rst @@ -0,0 +1,29 @@ +.. toctree:: + :maxdepth: 2 + +Transport tweaks +---------------- + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-timeout-and-retries.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-timeout-and-retries.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-timeout-and-retries.py>` script. + + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/fetch-variables-over-ipv6.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/fetch-variables-over-ipv6.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/fetch-variables-over-ipv6.py>` script. + + +See also: :doc:`library reference </docs/api-reference>`. diff --git a/docs/source/examples/hlapi/v1arch/asyncore/manager/cmdgen/walking-operations.rst b/docs/source/examples/hlapi/v1arch/asyncore/manager/cmdgen/walking-operations.rst new file mode 100644 index 00000000..e843fb42 --- /dev/null +++ b/docs/source/examples/hlapi/v1arch/asyncore/manager/cmdgen/walking-operations.rst @@ -0,0 +1,18 @@ +.. toctree:: + :maxdepth: 2 + +Walking operations +------------------ + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/pull-whole-mib.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/pull-whole-mib.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/pull-whole-mib.py>` script. + + +See also: :doc:`library reference </docs/api-reference>`. diff --git a/docs/source/examples/hlapi/v1arch/asyncore/sync/agent/ntforg/common-notifications.rst b/docs/source/examples/hlapi/v1arch/asyncore/sync/agent/ntforg/common-notifications.rst new file mode 100644 index 00000000..bf3b4fbc --- /dev/null +++ b/docs/source/examples/hlapi/v1arch/asyncore/sync/agent/ntforg/common-notifications.rst @@ -0,0 +1,59 @@ +.. toctree:: + :maxdepth: 2 + +Common notifications +-------------------- + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/generic-v1-trap.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/generic-v1-trap.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/generic-v1-trap.py>` script. + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/generic-v2c-trap.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/generic-v2c-trap.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/generic-v2c-trap.py>` script. + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py>` script. + + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-inform.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-inform.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-inform.py>` script. + + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/generic-v1-trap.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/generic-v1-trap.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/generic-v1-trap.py>` script. + +See also: :doc:`library reference </docs/api-reference>`. diff --git a/docs/source/examples/hlapi/v1arch/asyncore/sync/agent/ntforg/evaluating-notification-type.rst b/docs/source/examples/hlapi/v1arch/asyncore/sync/agent/ntforg/evaluating-notification-type.rst new file mode 100644 index 00000000..c40ca45e --- /dev/null +++ b/docs/source/examples/hlapi/v1arch/asyncore/sync/agent/ntforg/evaluating-notification-type.rst @@ -0,0 +1,17 @@ +.. toctree:: + :maxdepth: 2 + +Evaluating NOTIFICATION-TYPE +---------------------------- + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py>` script. + +See also: :doc:`library reference </docs/api-reference>`. diff --git a/docs/source/examples/hlapi/v1arch/asyncore/sync/contents.rst b/docs/source/examples/hlapi/v1arch/asyncore/sync/contents.rst new file mode 100644 index 00000000..046138ff --- /dev/null +++ b/docs/source/examples/hlapi/v1arch/asyncore/sync/contents.rst @@ -0,0 +1,74 @@ + +Synchronous SNMP (v1arch) +========================= + +This chapter illustrates various uses of the synchronous high-level +programming interface to client-side SNMP entities along the lines +of `RFC1905 <https://tools.ietf.org/html/rfc1905>`_. + +.. note:: The following examples involve creating Python iterator, + the next() call is used to invoke iterator just once. + +In most examples approximate analogues of well known Net-SNMP snmp* tools +command line options are shown. That may help those readers who, by chance +are familiar with Net-SNMP tools, better understanding what the example +code does. + +Here's a quick example on a simple SNMP GET by high-level API: + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/v1-get.py + :start-after: options: + :end-before: Functionally + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/v1-get.py + :start-after: """# + :language: python + +.. note:: + + If MIB lookup is required (e.g. when :py:class:`~pysnmp.smi.rfc1902.ObjectIdentity`, + :py:class:`~pysnmp.smi.rfc1902.ObjectType` or :py:class:`~pysnmp.smi.rfc1902.NotificationType` + objects being used), the `lookupMib=True` should also be passed. + +The following code performs a series of SNMP GETNEXT operations +fetching a table of SNMP variables from SNMP Agent: + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/pull-whole-mib.py + :start-after: options: + :end-before: Functionally + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/pull-whole-mib.py + :start-after: """# + :language: python + +More examples on Command Generator API usage follow. + +.. toctree:: + + /examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/snmp-versions + /examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/modifying-variables + /examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/walking-operations + /examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/table-operations + /examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/mib-tweaks + /examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/transport-tweaks + /examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/advanced-topics + +The following code sends SNMP TRAP: + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/generic-v2c-trap.py + :start-after: options: + :end-before: Functionally + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/agent/ntforg/generic-v2c-trap.py + :start-after: """# + :language: python + +More examples on Notification Originator API usage follow. + +.. toctree:: + + /examples/hlapi/v1arch/asyncore/sync/agent/ntforg/common-notifications + /examples/hlapi/v1arch/asyncore/sync/agent/ntforg/evaluating-notification-type + +More specific SNMP operations can still be performed with PySNMP via +its Native API to Standard SNMP Applications. diff --git a/docs/source/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/advanced-topics.rst b/docs/source/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/advanced-topics.rst new file mode 100644 index 00000000..aec0b85b --- /dev/null +++ b/docs/source/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/advanced-topics.rst @@ -0,0 +1,39 @@ +.. toctree:: + :maxdepth: 2 + +Advanced Command Generator +-------------------------- + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/getbulk-limit-number-of-packets.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/getbulk-limit-number-of-packets.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/getbulk-limit-number-of-packets.py>` script. + + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/multiple-get-calls.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/multiple-get-calls.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/multiple-get-calls.py>` script. + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/query-agents-from-multuple-threads-over-ipv4-and-ipv6.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/query-agents-from-multuple-threads-over-ipv4-and-ipv6.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/query-agents-from-multuple-threads-over-ipv4-and-ipv6.py>` script. + + +See also: :doc:`library reference </docs/api-reference>`. diff --git a/docs/source/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/mib-tweaks.rst b/docs/source/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/mib-tweaks.rst new file mode 100644 index 00000000..3bc98656 --- /dev/null +++ b/docs/source/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/mib-tweaks.rst @@ -0,0 +1,48 @@ +.. toctree:: + :maxdepth: 2 + +MIB tweaks +---------- + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/enable-mib-lookup.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/enable-mib-lookup.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/enable-mib-lookup.py>` script. + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/preload-pysnmp-mibs.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/preload-pysnmp-mibs.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/preload-pysnmp-mibs.py>` script. + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-asn1-mib-search-path.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-asn1-mib-search-path.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-asn1-mib-search-path.py>` script. + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-pysnmp-mibs-search-path.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-pysnmp-mibs-search-path.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-pysnmp-mibs-search-path.py>` script. + + +See also: :doc:`library reference </docs/api-reference>`. diff --git a/docs/source/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/modifying-variables.rst b/docs/source/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/modifying-variables.rst new file mode 100644 index 00000000..b6aa9add --- /dev/null +++ b/docs/source/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/modifying-variables.rst @@ -0,0 +1,30 @@ + +.. toctree:: + :maxdepth: 2 + +Modifying variables +------------------- + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/coerce-set-value-to-mib-spec.py>` script. + + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/set-multiple-scalar-values.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/set-multiple-scalar-values.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/set-multiple-scalar-values.py>` script. + + +See also: :doc:`library-reference </docs/api-reference>`. diff --git a/docs/source/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/snmp-versions.rst b/docs/source/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/snmp-versions.rst new file mode 100644 index 00000000..2d408866 --- /dev/null +++ b/docs/source/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/snmp-versions.rst @@ -0,0 +1,29 @@ +.. toctree:: + :maxdepth: 2 + +SNMP versions +------------- + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/v1-get.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/v1-get.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/v1-get.py>` script. + + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/v2c-get.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/v2c-get.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/v2c-get.py>` script. + + +See also: :doc:`library reference </docs/api-reference>`. diff --git a/docs/source/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/table-operations.rst b/docs/source/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/table-operations.rst new file mode 100644 index 00000000..ede8a8ed --- /dev/null +++ b/docs/source/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/table-operations.rst @@ -0,0 +1,50 @@ +.. toctree:: + :maxdepth: 2 + +Table operations +---------------- + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/get-table-object-by-index.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/get-table-object-by-index.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/get-table-object-by-index.py>` script. + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/get-table-object-by-multiple-indices.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/get-table-object-by-multiple-indices.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/get-table-object-by-multiple-indices.py>` script. + + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/getbulk-fetch-scalar-and-table-variables-over-ipv6.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/getbulk-fetch-scalar-and-table-variables-over-ipv6.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/getbulk-fetch-scalar-and-table-variables-over-ipv6.py>` script. + + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/pull-whole-snmp-table.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/pull-whole-snmp-table.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/pull-whole-snmp-table.py>` script. + + +See also: :doc:`library reference </docs/api-reference>`. diff --git a/docs/source/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/table-operations.rst- b/docs/source/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/table-operations.rst- new file mode 100644 index 00000000..7314acd1 --- /dev/null +++ b/docs/source/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/table-operations.rst- @@ -0,0 +1,50 @@ +.. toctree:: + :maxdepth: 2 + +Table operations +---------------- + +.. include:: /../../examples/hlapi/asyncore/sync/manager/cmdgen/get-table-object-by-index.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/asyncore/sync/manager/cmdgen/get-table-object-by-index.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/asyncore/sync/manager/cmdgen/get-table-object-by-index.py>` script. + +.. include:: /../../examples/hlapi/asyncore/sync/manager/cmdgen/get-table-object-by-multiple-indices.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/asyncore/sync/manager/cmdgen/get-table-object-by-multiple-indices.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/asyncore/sync/manager/cmdgen/get-table-object-by-multiple-indices.py>` script. + + +.. include:: /../../examples/hlapi/asyncore/sync/manager/cmdgen/getbulk-fetch-scalar-and-table-variables-over-ipv6.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/asyncore/sync/manager/cmdgen/getbulk-fetch-scalar-and-table-variables-over-ipv6.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/asyncore/sync/manager/cmdgen/getbulk-fetch-scalar-and-table-variables-over-ipv6.py>` script. + + +.. include:: /../../examples/hlapi/asyncore/sync/manager/cmdgen/pull-whole-snmp-table.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/asyncore/sync/manager/cmdgen/pull-whole-snmp-table.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/asyncore/sync/manager/cmdgen/pull-whole-snmp-table.py>` script. + + +See also: :doc:`library reference </docs/api-reference>`. diff --git a/docs/source/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/transport-tweaks.rst b/docs/source/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/transport-tweaks.rst new file mode 100644 index 00000000..5c948d51 --- /dev/null +++ b/docs/source/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/transport-tweaks.rst @@ -0,0 +1,29 @@ +.. toctree:: + :maxdepth: 2 + +Transport tweaks +---------------- + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-timeout-and-retries.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-timeout-and-retries.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/custom-timeout-and-retries.py>` script. + + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/fetch-variables-over-ipv6.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/fetch-variables-over-ipv6.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/fetch-variables-over-ipv6.py>` script. + + +See also: :doc:`library reference </docs/api-reference>`. diff --git a/docs/source/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/walking-operations.rst b/docs/source/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/walking-operations.rst new file mode 100644 index 00000000..e843fb42 --- /dev/null +++ b/docs/source/examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/walking-operations.rst @@ -0,0 +1,18 @@ +.. toctree:: + :maxdepth: 2 + +Walking operations +------------------ + +.. include:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/pull-whole-mib.py + :start-after: """ + :end-before: """# + +.. literalinclude:: /../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/pull-whole-mib.py + :start-after: """# + :language: python + +:download:`Download</../../examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/pull-whole-mib.py>` script. + + +See also: :doc:`library reference </docs/api-reference>`. |