I\'m having difficulty implementing a custom MIB in a PySNMP agent.
I\'ve started with:
http://pysnmp.sourceforge.net/examples/4.x/v3arch/agent/cmdrsp.html
As for implementing a Managed Object Instance, you have two choices:
Load and subclass the MibScalarInstance class, then override its readGet() method to make it returning your live value. Then instantiate your new class (make sure to pass it appropriate OID that identifies it) and pass it to exportSymbols(), so its OID will get registered at pysnmp Agent.
Load the Integer32 class, subclass it and override its "clone()" method to make it returning your live value. Then load the MibScalarInstance class, instantiate it passing appropriate OID and the instance of your Integer32 subclass, then pass MibScalarInstance object to exportSymbols(), so its OID will get registered at pysnmp Agent.
It may make sense to keep all your code in your own MIB module. Take a look at pysnmp/smi/mibs/instances/*.py to get an idea.
From within your Agent app, invoke mibBuilder.loadModules('TRC-MIB') to load your MIB module into Agent.
In your code you seem to somehow combine the above two approaches: MyDeliveryTime.readGet() will not work, however MyDeliveryTime.clone() or deliveryTimeInstance.readGet() will.
I also faced a similar issue:
Tried putting the MY-MIB.[pyc] files in the ~/.pysnmp/mibs folders but I think what really worked was putting these files in the folder /usr/lib/pytho*/site/pysnmp/smi/mibs/ .
Am working on pysnmp-4.3.9