I’m working on a simulation for a modem that is supposed to cache values received in set requests. It’s not supposed to commit them until it receives a specific OID. (there are certain values that are supposed to be committed right away, though)
Will I need to iterate through the OIDs in the request and manually update the MIB with the values I want, cache the values that aren’t supposed to be committed right away, and just not call process_request() at all?
Or am I overlooking some setting that I should apply to specific MibLeafs?
there is some important information missing: If the value for OID1 is set to a new value and the agent receives a get for this OID1 before the commit OID is set. Should it return the old or new value?
My approach for the case “agent should return the new value” would be to keep the set functionality as it is. Only the set functionality of the MibLeaf for the commit OID needs to be overridden. It should collect all needed values form the other MibLeaf and do whatever it needs to do with the new values.
My approach for the case “agent should return the old value” would be: Override the set functionality of each MibLeaf to not store the new value in the ‘value’ member of the MibLeaf, but to store it in a shared OID/value structure (or inside a new member). Then override the set functionality of the commit OID to collect each OID/value from the shared structure and write the value of each MibLeaf.