From bb896893a798b1ddf5abd9cd17af77455ddd7432 Mon Sep 17 00:00:00 2001 From: "Ladue, David (dl3158)" Date: Tue, 16 Oct 2018 16:29:58 -0400 Subject: expanding docs, including V3 specs Change-Id: Id9aff7c62426d8e695374799df30ef6b12be667b Issue-ID: DCAEGEN2-624 Signed-off-by: Ladue, David (dl3158) --- docs/sections/services/snmptrap/offeredapis.rst | 45 ++++++++++++++++++------- 1 file changed, 33 insertions(+), 12 deletions(-) (limited to 'docs/sections/services/snmptrap/offeredapis.rst') diff --git a/docs/sections/services/snmptrap/offeredapis.rst b/docs/sections/services/snmptrap/offeredapis.rst index e9a8afeb..48b40d11 100644 --- a/docs/sections/services/snmptrap/offeredapis.rst +++ b/docs/sections/services/snmptrap/offeredapis.rst @@ -4,11 +4,11 @@ Offered APIs ============ -**SNMPTRAP** supports the Simple Network Management Protocol (SNMP) +**trapd** supports the Simple Network Management Protocol (SNMP) standard. It is a well documented and pervasive protocol, used in all networks worldwide. -As an API offering, the only way to interact with **SNMPTRAP** is +As an API offering, the only way to interact with **trapd** is to send traps that conform to the industry standard specification (RFC1215 - available at https://tools.ietf.org/html/rfc1215 ) to a running instance. To accomplish this, you may: @@ -18,17 +18,28 @@ running instance. To accomplish this, you may: setting the "trap target" or "snmp manager" to the IP address of the running VM/container hosting SNMPTRAP. -2. Mimic a SNMP trap using various freely available utilities. Two - examples are provided below, be sure to change the target +2. Simulate a SNMP trap using various freely available utilities. Two + examples are provided below, *be sure to change the target ("localhost") and port ("162") to applicable values in your - environment. + environment.* -Net-SNMP --------- +NetSNMP snmptrap +---------------- -.. code-block:: bash +One way to simulate an arriving SNMP trap is to use the Net-SNMP utility/command snmptrap. +This command can send V1, V2c or V3 traps to a manager based on the parameters provided. - snmptrap -d -v 1 -c public ${to_ip_address}:${to_portt} .1.3.6.1.4.1.99999 localhost 6 1 '55' .1.11.12.13.14.15 s "test trap" +The example below sends a SNMP V1 trap to the specified host. Prior to running this command, export +the values of *to_ip_address* (set it to the IP of the VM hosting the ONAP trapd container) and *to_port* (typically +set to "162"): + + ``export to_ip_address=192.168.1.1`` + + ``export to_port=162`` + +Then run the Net-SNMP command/utility: + + ``snmptrap -d -v 1 -c not_public ${to_ip_address}:${to_portt} .1.3.6.1.4.1.99999 localhost 6 1 '55' .1.11.12.13.14.15 s "test trap"`` .. note:: @@ -36,8 +47,14 @@ Net-SNMP they can be ignored, the trap has successfully been sent to the specified destination. -pysnmp ------- +python using pysnmp +------------------- + +Another way to simulate an arriving SNMP trap is to send one with the python *pysnmp* module. (Note that this +is the same module that ONAP trapd is based on). + +To do this, create a python script called "send_trap.py" with the following contents. You'll need to change the +target (from "localhost" to whatever the destination IP/hostname of the trap receiver is) before saving: .. code-block:: python @@ -58,4 +75,8 @@ pysnmp if errorIndication: print(errorIndication) else: - print("successfully sent first trap example, number %d" % i) + print("successfully sent trap") + +To run the pysnmp example: + + ``python ./send_trap.py`` -- cgit 1.2.3-korg