[SNMP4J] Building a broken agent

Ruland, Kevin Kevin.Ruland at arris.com
Mon Jul 16 15:40:59 CEST 2018


Frank,

Thanks for the advice.  Since I'm using this in a unit test, I have control over the requests being generated.  Right now my approach is to hook into the agent using a CommandResponder which marks the event as processed then generates the appropriate (actually buggy) response and pushes that out through a DatagramSocket.  It's not very elegant and has some timing/thread priority issues but was enough for me to track down the bug in my code.  I'll try with your approach once I patch the bug in my code.

Best wishes.
Kevin

-----Original Message-----
From: frank.fock at t-online.de [mailto:frank.fock at t-online.de] 
Sent: Friday, July 13, 2018 4:50 PM
To: Ruland, Kevin <Kevin.Ruland at arris.com>
Cc: snmp4j at agentpp.org
Subject: Re: [SNMP4J] Building a broken agent

Hello Kevin,

SNMP4J-Agent does a lot to ensure lexicographic ordering during request processing. Which is often a bug in implementations with other frameworks where the instrumentation code needs to assure the ordering. 

Therefore it will be not easy and straightforward to implement such a “bug" with SNMP4J-Agent. 
I would start with implementing your own CommandProcess and replace the DefaultRequestFactory by your own copy/subclass.
This factory then has to use its own version of a DefaultMOContextScope that manipulates the “substractScope” method by *not* changing the scope in any way. 

That will cause an endless loop in the agent (CommandProcessor) then. But you can of course use the default implementation of DefaultMOContextScope at any time later to escape the loop.   

Hope this helps.

Best regards,
Frank

> On 13. Jul 2018, at 15:33, Ruland, Kevin <Kevin.Ruland at arris.com> wrote:
> 
> Hello,
> 
> I'm trying to interface with a real device which has a nasty bug in its agent.  When I execute a bulk get to a specific oid, it just returns the same oid over and over (like a loop) instead of walking past to the next leaf in the tree.
> 
> I would like to write an agent in snmp4j-agent which exhibits this behavior, but I can't seem to figure out how to do this.  What's the proper place to hook this into the BaseAgent?
> 
> Thanks for the help.
> 
> Kevin Ruland
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Foosnmp.net%2Fmailman%2Flistinfo%2Fsnmp4j&data=01%7C01%7CKevin.Ruland%40arris.com%7C8b9f8387a3ba4a5e870208d5e90aa7d8%7Cf27929ade5544d55837ac561519c3091%7C1&sdata=WhZWcl%2BC4kt1M%2FCdbz8T59MoOST24rbmlEhyCEtuoYo%3D&reserved=0



More information about the SNMP4J mailing list