summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Etingof <etingof@gmail.com>2016-12-03 22:39:11 +0100
committerIlya Etingof <etingof@gmail.com>2016-12-03 22:39:11 +0100
commitc8e35e747a0f1b5ab85d44809521991f1ed3a8fb (patch)
tree934e741cff8c7822608909fbf2e3ef9bf81e05a6
parent3a0acfa0c78cd345eac38f891824f32e30624fd7 (diff)
downloadpysnmp-git-c8e35e747a0f1b5ab85d44809521991f1ed3a8fb.tar.gz
document hlapi transport .setLocalAddress()
-rw-r--r--docs/source/docs/api-reference.rst10
-rw-r--r--pysnmp/hlapi/transport.py13
2 files changed, 23 insertions, 0 deletions
diff --git a/docs/source/docs/api-reference.rst b/docs/source/docs/api-reference.rst
index ad6b7f21..204caaa9 100644
--- a/docs/source/docs/api-reference.rst
+++ b/docs/source/docs/api-reference.rst
@@ -54,7 +54,10 @@ saves its configuration for the lifetime of SNMP engine object.
:maxdepth: 2
.. autoclass:: pysnmp.hlapi.UdpTransportTarget
+ :members: setLocalAddress
+
.. autoclass:: pysnmp.hlapi.Udp6TransportTarget
+ :members: setLocalAddress
Asynchronous: asyncore
----------------------
@@ -87,7 +90,10 @@ Transport configuration
:maxdepth: 2
.. autoclass:: pysnmp.hlapi.asyncore.UdpTransportTarget
+ :members: setLocalAddress
+
.. autoclass:: pysnmp.hlapi.asyncore.Udp6TransportTarget
+ :members: setLocalAddress
Asynchronous: asyncio
---------------------
@@ -121,7 +127,10 @@ Transport configuration
:maxdepth: 2
.. autoclass:: pysnmp.hlapi.asyncio.UdpTransportTarget
+ :members: setLocalAddress
+
.. autoclass:: pysnmp.hlapi.asyncio.Udp6TransportTarget
+ :members: setLocalAddress
Asynchronous: trollius
----------------------
@@ -166,6 +175,7 @@ Transport configuration
:maxdepth: 2
.. autoclass:: pysnmp.hlapi.twisted.UdpTransportTarget
+ :members: setLocalAddress
SNMP Engine
-----------
diff --git a/pysnmp/hlapi/transport.py b/pysnmp/hlapi/transport.py
index 30578836..1af38612 100644
--- a/pysnmp/hlapi/transport.py
+++ b/pysnmp/hlapi/transport.py
@@ -33,6 +33,19 @@ class AbstractTransportTarget(object):
return self.transportDomain, self.transportAddr
def setLocalAddress(self, iface):
+ """Set source address.
+
+ Parameters
+ ----------
+ iface : tuple
+ Indicates network address of a local interface from which SNMP packets will be originated.
+ Format is the same as of `transportAddress`.
+
+ Returns
+ -------
+ self
+
+ """
self.iface = iface
return self