netconfd-pro Hooks Into Net-SNMP
The netconfd-pro server is always listening on port 161 and 162 for SNMP agent requests when the server is started with --with-snmp=true. During boot time the netconfd-procreates Trap sinks and enables the netconfd-pro SNMP server. This includes:
SNMP configuration file parsing
Registering a handler for incoming SNMP packets. This is the callback registered for incoming packets
Registering the Network Service Address Point (NSAP) with the net-snmp library and setup an agent session on the given transport. In this step netconfd-pro links the net-snmp library and registers all the needed callbacks and handlers that will be used for packet handling, PDU creation, and reply output
Then the server starts to check if there is any SNMP messages to process. It checks for any packets from the network. If there are any packets to process the server calls the net-snmp API to process them.
For SNMP requests, e.g. 'snmpget' on a GET2 node, the server will perform the following:
Parse the incoming packet (OID; request type ,get, getnext, etc)
Resolve the internal SNMP request type, request on indexed node, on scalar without any indexes, etc., based on the request type the server will adjust the target object resolution
Then the server will either try to find the best next OID and repeat the same steps or proceed to the actual value retrieval
In order to get the get2 value, the server calls the get2 callbacks starting from the table of the target node - the target node will always be a leaf
Based on the callback’s results, the server creates a new PDU to return, sets the return value(s) for the requested Varbind list in that PDU, and sends that packet back to the agent.
For config true and virtual nodes all the steps are the same except the server does not call get2 callbacks, it locates the requested Table in the database first, during the RESTCONF parse path processing, and after that the best value is retrieved from that Table.
yp-snmp – NETCONF and SNMP Message Paths
When converted MIB modules are loaded into netconfd-pro server the Northbound protocols, such as NETCONF, access the YANG datastores in the usual way, i.e. through the message path colored red in the above diagram. Any notifications are handled in the usual way.
SNMP messages are processed by the Net-SNMP process and the netconfd-pro server with the SIL providing the instrumentation, i.e. the message path colored yellow in the diagram above. The server generates any SNMP Traps necessary.