summaryrefslogtreecommitdiff
path: root/examples/v1arch/asyncore/manager/ntfrcv/listen-on-ipv4-and-ipv6-interfaces.py
diff options
context:
space:
mode:
authorIlya Etingof <etingof@gmail.com>2016-04-01 01:08:28 +0200
committerIlya Etingof <etingof@gmail.com>2016-04-01 01:08:28 +0200
commit9541f201e33cd613995cee2e7a7656aa687deb51 (patch)
treefdc955b26681f10d7755a2f2aff115c3bcf85bfa /examples/v1arch/asyncore/manager/ntfrcv/listen-on-ipv4-and-ipv6-interfaces.py
parent18f39e2228d370a336500c5ecc539658d890f06d (diff)
downloadpysnmp-git-9541f201e33cd613995cee2e7a7656aa687deb51.tar.gz
pep8 reformatted
Diffstat (limited to 'examples/v1arch/asyncore/manager/ntfrcv/listen-on-ipv4-and-ipv6-interfaces.py')
-rw-r--r--examples/v1arch/asyncore/manager/ntfrcv/listen-on-ipv4-and-ipv6-interfaces.py34
1 files changed, 10 insertions, 24 deletions
diff --git a/examples/v1arch/asyncore/manager/ntfrcv/listen-on-ipv4-and-ipv6-interfaces.py b/examples/v1arch/asyncore/manager/ntfrcv/listen-on-ipv4-and-ipv6-interfaces.py
index 0dd60faa..9e3cec2b 100644
--- a/examples/v1arch/asyncore/manager/ntfrcv/listen-on-ipv4-and-ipv6-interfaces.py
+++ b/examples/v1arch/asyncore/manager/ntfrcv/listen-on-ipv4-and-ipv6-interfaces.py
@@ -37,34 +37,19 @@ def cbFun(transportDispatcher, transportDomain, transportAddress, wholeMsg):
return
reqMsg, wholeMsg = decoder.decode(
wholeMsg, asn1Spec=pMod.Message(),
- )
+ )
print('Notification message from %s:%s: ' % (
transportDomain, transportAddress
- )
)
+ )
reqPDU = pMod.apiMessage.getPDU(reqMsg)
if reqPDU.isSameTypeWith(pMod.TrapPDU()):
if msgVer == api.protoVersion1:
- print('Enterprise: %s' % (
- pMod.apiTrapPDU.getEnterprise(reqPDU).prettyPrint()
- )
- )
- print('Agent Address: %s' % (
- pMod.apiTrapPDU.getAgentAddr(reqPDU).prettyPrint()
- )
- )
- print('Generic Trap: %s' % (
- pMod.apiTrapPDU.getGenericTrap(reqPDU).prettyPrint()
- )
- )
- print('Specific Trap: %s' % (
- pMod.apiTrapPDU.getSpecificTrap(reqPDU).prettyPrint()
- )
- )
- print('Uptime: %s' % (
- pMod.apiTrapPDU.getTimeStamp(reqPDU).prettyPrint()
- )
- )
+ print('Enterprise: %s' % (pMod.apiTrapPDU.getEnterprise(reqPDU).prettyPrint()))
+ print('Agent Address: %s' % (pMod.apiTrapPDU.getAgentAddr(reqPDU).prettyPrint()))
+ print('Generic Trap: %s' % (pMod.apiTrapPDU.getGenericTrap(reqPDU).prettyPrint()))
+ print('Specific Trap: %s' % (pMod.apiTrapPDU.getSpecificTrap(reqPDU).prettyPrint()))
+ print('Uptime: %s' % (pMod.apiTrapPDU.getTimeStamp(reqPDU).prettyPrint()))
varBinds = pMod.apiTrapPDU.getVarBindList(reqPDU)
else:
varBinds = pMod.apiPDU.getVarBindList(reqPDU)
@@ -73,6 +58,7 @@ def cbFun(transportDispatcher, transportDomain, transportAddress, wholeMsg):
print('%s = %s' % (oid.prettyPrint(), val.prettyPrint()))
return wholeMsg
+
transportDispatcher = AsyncoreDispatcher()
transportDispatcher.registerRecvCbFun(cbFun)
@@ -88,9 +74,9 @@ transportDispatcher.registerTransport(
)
## Local domain socket
-#transportDispatcher.registerTransport(
+# transportDispatcher.registerTransport(
# unix.domainName, unix.UnixSocketTransport().openServerMode('/tmp/snmp-manager')
-#)
+# )
transportDispatcher.jobStarted(1)