SNMP

Import OPBNOS API

from opbclient import opb_api as opbapi

Initialize client

Use the appropriate JSON file that corresponds to the targetted device name. This JSON file should contain request body parameters corresponding to any potential configuration/post requests.

node = opbapi.connect_to('SN2010')

Configure SNMP community

In order to configure SNMP community information, the API, configSNMPcomm(), must be invoked with appropriate parameters in dictionary format within the parameter 'dt'.

node.configSNMPcomm(dt="{"community":"Aviz"}")
Attribute Values Description
"community" "Aviz" community string that indicates specific access data

Get/Show SNMP Community

Retrieves SNMP community details

node.execute(['show snmp-community'])

Output

This is an example of the output of the above command:

b'{"public": {"TYPE": "RO"}}'

Delete SNMP Community

In order to delete the SNMP Community

node.deleteSNMPcomm(comm="public")

Configure SNMP trap

In order to configure SNMP trap information, the API, configSNMPtrap(), must be invoked with appropriate parameters in dictionary format within the parameter 'dt'.

node.configSNMPtrap(dt="{"version":"2", "server_id":"1", "community":"public", "ip_address":"10.X.X.XX"}")

'dt' parameters correlate to SNMP trap messeges sent by the network devices to the system.

Attribute Values Description
"version" int version number
"server_id" int server id numbers
"community" "public" SNMP community string to enable acessibility
"ip_address" "10.X.X.XX" system ip address

Get/Show SNMP Trap

Retrieves SNMP trap details

node.execute(['show snmp-trap'])

Output

This is an example of the output of the above command:

b'{"1": {"DestPort": "161","v2TrapDest": "Null","DestIp": "10.4.4.11","vrf": "None","Community": "public"}}'

Note: "1": the int value in the output indicates the server id:

Attribute Values Description
"DestPort" int destination port
"v2TrapDest" int/"Null" SNMPv2 trap destination
"DestIp" "10.X.X.XX" destination IP
"vrf" "None" indicates whether a specific VRF is associated with the trap host
"Community" "public" updated configured SNMP community

Delete SNMP Trap

In order to delete the SNMP Trap with server id

node.deleteSNMPtrap(s_id="1")