diff options
author | Ladue, David (dl3158) <dl3158@att.com> | 2018-03-14 14:01:36 -0400 |
---|---|---|
committer | Ladue, David (dl3158) <dl3158@att.com> | 2018-03-18 02:42:23 -0400 |
commit | abb283c5a3b72eb2d91e6adb4eda68184f040f35 (patch) | |
tree | 4765c8d6cb54a2ddb2052c0955425604bc265230 /tests/test_snmptrapd_send_test_trap.py | |
parent | a6f91efda578965710630154b173cf1ee9b64727 (diff) |
copyright and controller ENV changes
Change-Id: Ic12aa439a03f19c7a06a536368a8d2a1f26855aa
Issue-ID: DCAEGEN2-271
Signed-off-by: Ladue, David (dl3158) <dl3158@att.com>
Diffstat (limited to 'tests/test_snmptrapd_send_test_trap.py')
-rwxr-xr-x | tests/test_snmptrapd_send_test_trap.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/test_snmptrapd_send_test_trap.py b/tests/test_snmptrapd_send_test_trap.py new file mode 100755 index 0000000..54d522e --- /dev/null +++ b/tests/test_snmptrapd_send_test_trap.py @@ -0,0 +1,40 @@ +from pysnmp.hlapi import * +from pysnmp import debug + +# debug.setLogger(debug.Debug('msgproc')) + +iters = range(0, 10, 1) +for i in iters: + errorIndication, errorStatus, errorIndex, varbinds = next(sendNotification(SnmpEngine(), + CommunityData('not_public'), + UdpTransportTarget(('localhost', 6164)), + ContextData(), + 'trap', + [ObjectType(ObjectIdentity('.1.3.6.1.4.1.999.1'), OctetString('test trap - ignore')), + ObjectType(ObjectIdentity('.1.3.6.1.4.1.999.2'), OctetString('ONAP pytest trap'))]) + ) + + if errorIndication: + print(errorIndication) + else: + print("successfully sent first trap example, number %d" % i) + +for i in iters: + errorIndication, errorStatus, errorIndex, varbinds = next(sendNotification(SnmpEngine(), + CommunityData('public'), + UdpTransportTarget(('localhost', 6164)), + ContextData(), + 'trap', + NotificationType( + ObjectIdentity('.1.3.6.1.4.1.74.2.46.12.1.1') + ).addVarBinds( + ('.1.3.6.1.4.1.999.1', OctetString('ONAP pytest trap - ignore (varbind 1)')), + ('.1.3.6.1.4.1.999.2', OctetString('ONAP pytest trap - ignore (varbind 2)')) + ) + ) + ) + + if errorIndication: + print(errorIndication) + else: + print("successfully sent second trap example, number %d" % i) |