Open Ethernet Networking (OpEN) API Guide and Reference Manual
3.6.0.3
|
This document provides a brief description of the Simple Network Management Protocol (SNMP) OpEN APIs. The SNMP OpEN APIs allow processes outside of the ICOS main process (switchdrvr) access to the SNMP configuration.
Here is a summary of SNMP configuration and management related capabilities
All 'Set' operations affect the Switch behavior and configuration.
In the main function, the sample application initializes the OpEN API RPC service by calling openapiClientRegister() and waits for the RPC service in switchdrvr to start. A Client Handle is returned by openapiClientRegister() which is used while invoking the OpEN APIs. The application then exercises the associated OpEN APIs and logs informational and/or error messages on the console. The example application runs to its completion and exits.
snmp_example.c is a sample application that demonstrates the use of the SNMP OpEN API. The snmp_example executable is started from the command line. A -v command line option is available which enables verbose mode. In addition to configuring some basic system level objects, such as system name and location, the example performs 3 basic steps;
# ./snmp_example
Begin Sanity tests...
Sanity Success - testSnmpSysNameSet - system-name.
Sanity Success - testSnmpSysLocationSet - system-location.
Sanity Success - testSnmpSysContactSet - system-contact.
Sanity Success - testSnmpLocalEngineIdSet - default.
Sanity Success - testSnmpLocalEngineIdSet - 123456.
Create SNMP users...
Sanity Success - testSnmpUserCreate - admin1.
Sanity Success - testSnmpUserCreate - admin1.
Sanity Success - testSnmpUserCreate - admin2.
Sanity Success - testSnmpUserCreate - admin3.
Sanity Success - testSnmpUserCreate - admin4.
Sanity Success - testSnmpUserCreate - admin5.
Sanity Success - testSnmpUserCreate - delete-user.
Create SNMP groups...
Sanity Success - testSnmpGroupCreate - network-admin.
Sanity Success - testSnmpGroupCreate - network-guest.
Sanity Success - testSnmpGroupCreate - delete-group.
Create SNMP views...
Sanity Success - testSnmpViewCreate - view-1.
Sanity Success - testSnmpViewCreate - view-2.
Create SNMP filters...
Sanity Success - testSnmpFilterCreate - filter-1.
Sanity Success - testSnmpFilterCreate - filter-2.
Create SNMP hosts...
Sanity Success - testSnmpHostCreate - 10.10.10.1.
Sanity Success - testSnmpHostCreate - 10.10.10.2.
Sanity Success - testSnmpHostCreate - 2001::.
Create SNMP Communities...
Sanity Success - testSnmpCommunity - public-test.
Sanity Success - testSnmpCommunity - private-test.
Sanity Success - testSnmpCommunity - delete-community.
Sanity Success - testSnmpCommunityGroup - delete-private-map.
Enable miscellaneous SNMP trap flags...
Sanity Success - testSnmpTrapFlagSet - flag bits 1088.
Retrieve some SNMP entries...
Sanity Success - testSnmpSysNameGet - system-name.
Sanity Success - testSnmpSysLocationGet - system-location.
Sanity Success - testSnmpSysContactGet - system-contact.
Sanity Success - testSnmpLocalEngineIdGet - 123456.
Sanity Success - testSnmpUserGet - admin2.
Sanity Success - testSnmpGroupGet - network-admin.
Sanity Success - testSnmpViewGet - view-1.
Sanity Success - testSnmpHostGet - 2001::.
Sanity Success - testSnmpCommunityGet - public-test.
Sanity Success - testSnmpCommunityGet - private-test.
Sanity Success - testSnmpCommunityGet - delete-private-map.
Sanity Success - testSnmpTrapFlagGet - OPEN_SNMP_MULTI_USERS_TRAP_FLAG.
Sanity Success - testSnmpTrapFlagGet - OPEN_SNMP_USER_AUTH_TRAP_FLAG.
Delete some SNMP entries...
Sanity Success - testSnmpLocalEngineIdDelete - .
Sanity Success - testSnmpViewDelete - view-2.
Sanity Success - testSnmpFilterDelete - filter-2.
Sanity Success - testSnmpHostDelete - 10.10.10.2.
Sanity Success - testSnmpUserDelete - delete-user.
Sanity Success - testSnmpGroupDelete - delete-group.
Sanity Success - testSnmpCommunityDelete - delete-community.
Sanity Success - testSnmpCommunityDelete - delete-private-map.
Attempt to set the trap source-interface...
Sanity Success - testSnmpTrapSourceInterface - interface type : VLAN.
Creating SNMP communities with IP address and mask...
Sanity Success - testSnmpCommunityWithIPAddrCreate - test1.
Sanity Success - testSnmpCommunityWithIPAddrCreate - test2.
Sanity Success - testSnmpCommunityAndIPAddrGet - test1.
SNMP community get next is successful :test1 next community :test2
Sanity Success - testSnmpCommunityAndIPAddrGetNext - test1.
Sanity Success - testSnmpCommunityAndIPAddrDelete - test2.
Creating SNMP Trap configuration.
Sanity Success - testSnmpTrapManagerConfigCreate - community1.
Sanity Success - testSnmpTrapManagerConfigCreate - community2.
Sanity Success - testSnmpTrapManagerConfigGet - community1.
Sanity Success - testSnmpTrapManagerConfigDelete - community2.
Sanity Success - testSnmpTrapManagerConfigGet - community1.
Sanity Success - testSnmpTrapManagerConfigGetNext - community1.
Complete.
In addition to snmp_example.c, a python implementation has also been provided for demonstration purposes. This python snmp_example.py script essentially duplicates the snmp_example.c implementation.
In addition to snmp_example.c, a ruby implementation has also been provided for demonstration purposes. This ruby snmp_example.rb application essentially duplicates the snmp_example.c implementation.
OPENAPITRAPMANAGERCONFIGGETNEXICLI Command | OpEN API Reference |
---|---|
(Config)# [no] snmp-server location <location> | openapiSnmpSysLocationSet() openapiSnmpSysLocationGet() |
(Config)# [no] snmp-server sysname <sys-name> | openapiSnmpSysNameSet() openapiSnmpSysNameGet() |
(Config)# [no] snmp-server contact <contact-name> | openapiSnmpSysContactSet() openapiSnmpSysContactGet() |
(Config)# [no] snmp-server engineID local <engine-id> [default] | openapiSnmpLocalEngineIdSet() openapiSnmpLocalEngineIdGet() openapiSnmpLocalEngineIdDelete() |
(Config)# [no] snmp-server user <name-name> <group-name> [auth] [auth-key] [remote] | openapiSnmpUserCreate() openapiSnmpUserDelete() openapiSnmpUserGetNext() |
(Config)# [no] snmp-server group <group-name> <v1,v2,v3> [context] [read] [write] [notify] | openapiSnmpGroupCreate() openapiSnmpGroupDelete() openapiSnmpGroupGetNext() |
(Config)# [no] snmp-server view <view-name> <oid-tree> <excluded, included> | openapiSnmpViewCreate() openapiSnmpViewDelete() openapiSnmpViewGetNext() |
(Config)# [no] snmp-server filter <filer-name> <oid-tree> <excluded, included> | openapiSnmpFilterCreate() openapiSnmpFilterDelete() openapiSnmpFilterGetNext() |
(Config)# [no] snmp-server host <host-address> <oid-tree> <community-name> [informs] [traps] | openapiSnmpHostCreate() openapiSnmpHostDelete() openapiSnmpHostGetNext() |
(Config)# [no] snmp-server community <community-name> [ip-address] [ro] [rw] [su] [view] | openapiSnmpCommunityCreate() openapiSnmpCommunityDelete() openapiSnmpCommunityGetNext() |
(Config)# [no] snmp-server community-group <community-name> <group-name> [ip-address] | openapiSnmpCommunityGroupCreate() |
(Config)# [no] snmp-server enable traps [acl] [boxs-fan-status] [boxs-power-status] [boxs-temp-status] [bgp] [link-mode] [multi-users] [ospfv2] [ospfv3] [stp-mode] [user-auth] [violation] | openapiSnmpTrapFlagSet() openapiSnmpTrapFlagGet() |
(Config)# [no] snmptrap source-interface <slot/port> [loopback] [tunnel] [vlan] | openapiSnmpTrapSrcIntfSet() openapiSnmpTrapSrcIntfGet() |
(Config)# [no] snmp-server community <community-name> [ip-address] [ip-mask] [mode] [status] | openapiSnmpCommunityAndIPAddrCreate() openapiSnmpCommunityAndIPAddrDelete() openapiSnmpCommunityAndIPAddrGet() openapiTrapManagerConfigCommunityGetNext() openapiTrapManagerConfigIPGetNext() |
(Config)# [no] snmptrap <community-name> ipaddr <ip-address> [version] [status] | openapiTrapManagerConfigCreate() openapiTrapManagerConfigDelete() openapiTrapManagerConfigGet() openapiTrapManagerConfigGetNext() |
(Priv-User Mode)# show snmptrap | openapiTrapManagerConfigGet() openapiTrapManagerConfigGetNext() |
(Priv-User Mode)# show snmpcommunity | openapiSnmpCommunityAndIPAddrGet() openapiTrapManagerConfigCommunityGetNext() openapiTrapManagerConfigIPGetNext() |