Hi Frank,
Thanks for your guidence. Context works with v2 as well.
– Anirban
Hi Frank,
Thanks for your guidence. Context works with v2 as well.
– Anirban
Hi Frank,
Reviving an old thread. I think there is a bug regarding “Context” implementation of latest 2.7.8 Snmp4j agents.
Your “3.6.x” Snmp4j agent version has following code
public Context next() {
curContext = iterator.next();
return curContext;
}
for the following classContextInfo implements Iterator<Context>
But the latest “2.7.8” Snmp4j agent version has following code
public Object next() {
curContext = (OctetString) iterator.next();
return curContext;
}
This throws ClassCastException and makes 2.x with Java 8 unusable with the context use case.
Is it possible to fix it, otherwise I need to move my entire application to java 9+ which would be a pain.
–Anirban
Hi Anirban,
Thanks for reporting this bug. It has been fixed with the following snapshot and will be released with version 2.7.9 of SNMP4J-Agent soon:
https://snmp.app/dist/snapshot/org/snmp4j/snmp4j-agent/2.7.9-SNAPSHOT/snmp4j-agent-2.7.9-20230205.215859-2.jar
Best regards,
Frank
Thanks for Publishing 2.7.9 Agent so fast .
Hi Frank,
There is serious bug in SNMP4J Agent 2.7.9 regarding contexts.
Data from multiple contexts is over written arbitrarily.
Can you please have a look at that?
–Anirban
What do you mean by that statement? What data is overwritten when and by what other data?
Are you talking about runtime or persistent data?
Hi Frank,
I observed, in your Sample Agent, the getVariable method has the following code snippet
OctetString context = null;
int pos = name.indexOf(':');
if (pos >= 0) {
context = new OctetString(name.substring(0, pos));
oid = new OID(name.substring(pos + 1));
} else {
oid = new OID(name);
}
Does this mean, for every context you need a different engine id?
–Anirban
Yes, each context need a so called contextEngineId
in addition to the context name.
However, the getVariable
method in the sample agent uses a simplified approach for illustration. It is not meant/usable as an API.
HI Frank,
Thanks for your reply. However I have few more questions.
–Anirban
Hi Anirban,
ScopedPDU
as contextEngineID
before sending it.contextEgineID
is completely independent to the authoritative engine ID.contextEngineID
, then there is only a single SNMP engine supporting many contexts. Otherwise, there could be several context engines supporting 1-n contexts.Understood.
I must appreciate the way your supporting lot us. I never any question unanswered. Thanks for that.