[SNMP4J] Community String Indexing

Damian A Starosielsky damian.s at ig.com.br
Tue Jan 30 23:06:23 CET 2007


Frank,

Thanks again for the quick reply. Although I was not registering objects
with null context, I was extending BaseAgent which was, and I think that
was causing problems.

After I fixed that, I noticed that I was having some problems with contexts
that were a substring of another context, I guess because of the 
context-prefix
based security model. Registering a MOTable or MOGroup under the public at 1
context and then later under the public at 10 context caused the
DuplicateRegistrationException.

The exception only stopped when I created the following mappings:

community -> securityName -> context
public at 1 -> public at 1 -> 00000001
public at 2 -> public at 2 -> 00000002
public at 3 -> public at 3 -> 00000003
...
public at 10 -> public at 10 -> 00000010
public at 11 -> public at 11 -> 00000011
public at 12 -> public at 12 -> 00000012
...

This way there was no prefix conflict and things worked great.

FYI, with this I completed the evaluation cycle for the AgenPro product
and made my recommendation for its purchase.

Thanks again for all your help and congratulations for the great work on
SNMP4J, SNMP4J-AGENT and AgentPro.

Damian

Frank Fock wrote:

> 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
>>>
>>>
>>>
>>
>>
>>
>






More information about the SNMP4J mailing list