[SNMP4J] Community String Indexing

Frank Fock fock at agentpp.com
Tue Jan 30 02:24:48 CET 2007


Hi Damian,

Hmmh, the current code should work although the
DefaultMOContextScope.isOverlapping method indeed
does not check the context. The context is distinguished
before.

Have you registered the MIB object with a null context?
This will cause a conflict! To register a MIB object for
the default context "", use "new OctetString()" instead
of "null". Then you will be able to register an object
for the same OID in different (additional) contexts too.

Please let me know if the problem persists.

Best regards,
Frank

Damian A Starosielsky wrote:
> Frank,
> 
> Thanks for the quick reply.
> I am trying your recommended approach but I am getting the following 
> exception:
> 
> 
> org.snmp4j.agent.DuplicateRegistrationException: 
> org.snmp4j.agent.DefaultMOContextScope[context=public at 1,lowerBound=1.3.6.1.2.1.17.1.4.1,lowerIncluded=false,upperBound=1.3.6.1.2.1.17.1.4.2,upperIncluded=false] 
> 
>    at org.snmp4j.agent.DefaultMOServer.register(DefaultMOServer.java:154)
>    at 
> net.airdefense.simulator.snmp.Simulator.populateDot1dBasePortTable(Simulator.java:116) 
> 
>    at 
> net.airdefense.simulator.snmp.Simulator.registerManagedObjects(Simulator.java:126) 
> 
>    at org.snmp4j.agent.BaseAgent.registerSnmpMIBs(BaseAgent.java:179)
>    at 
> net.airdefense.simulator.snmp.Simulator.registerSnmpMIBs(Simulator.java:280) 
> 
>    at org.snmp4j.agent.BaseAgent.init(BaseAgent.java:160)
>    at net.airdefense.simulator.snmp.Simulator.main(Simulator.java:295)
> 
> Could it be that the isOverlapping() method called from 
> ManagedObject.lookup
> is not context aware?
> 
> Thanks,
> Damian
> 
> Frank Fock wrote:
> 
>> Hi Damian,
>>
>> Yes, what you call "community indexing" is supported
>> by SNMP4J-Agent. The concept is called "contexts"
>> here. This concept has been introduced in SNMPv3,
>> but you can also use communities to map on contexts.
>>
>> The mapping is defined in the SNMP-COMMUNITY-MIB
>> which is provided/implemented by SNMP4J-Agent.
>> In the agent, you simply register one DefaultMOTable
>> with context "public", one with context "public at 1"
>> etc. Then simply map an equally named community to
>> these contexts and you are done.
>>
>> Best regards,
>> Frank
>>
>> Damian A Starosielsky wrote:
>>
>>> I am using snmp4j-agent to implement a Cisco switch simulator.
>>>
>>> I am particularly interested in the dot1dTpFdbTable.
>>>
>>> The problem is that I need to simulate what Cisco calls "Community 
>>> String Indexing".
>>> What is means, is that each VLAN in the switch corresponds to a 
>>> different
>>> agent instance, listening on the same UDP port, but responding based 
>>> on which community you use.
>>>
>>> Example:
>>>
>>> community: public -> dot1dTpFdbTable will have the MACs of the 
>>> default VLAN
>>> community: public at 1 -> dot1dTpFdbTable will have the MACs of VLAN 1
>>> community: public at 55 -> dot1dTpFdbTable will have the MACs of VLAN 55
>>>
>>> Is this supported in the snmp4j library? How should I approach this 
>>> problem?
>>>
>>> More details on community string indexing can be found in:
>>>
>>> http://www.cisco.com/en/US/tech/tk648/tk362/technologies_tech_note09186a00801c9199.shtml 
>>>
>>>
>>> Thanks!
>>> Damian
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> SNMP4J mailing list
>>> SNMP4J at agentpp.org
>>> http://lists.agentpp.org/mailman/listinfo/snmp4j
>>
>>
> 
> 
> 

-- 
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com




More information about the SNMP4J mailing list