Here’s another patch for python-agentx that I already did on June 3rd and this one is rather a major one: it overthrows python-agentx’s variable handling completely.
Previously, python-agentx suffered from two defects:
- the order, in which variables were registered, mattered, because it was used to manually determine a “next OID” ordering for snmpwalk. This was neither documented nor is it correct, because the “next OID” is always the next OID that has retrievable data attached to it (see the RFCs). For example, given
1.2.5 = 100, a
snmpwalkmust always return
1.2.5 = 100when called with either
1.2.4, regardless of the registration order.
- for this reason, one also could not register OIDs that have no values attached to them but must be registered anyway since once can feed ANY OID in a MIB to snmpget/snmpgetnext/snmpwalk and the agent must be able to deal with it.
This modified version implements the lexicographic ordering demanded by the RFCs. When a new variable is registered, the module automatically takes care of maintaining the “next OID” links by comparing the numeric OIDs as documented in the appropriate MIB.
Also did some cleanup with regard to variable names and functions:
GetTextualOID (fixed this function as well, it didn’t work before). And there is a new function
The patch can be found at Sourceforge Bug report #3538293.