mibble-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Mibble-users] problem with MIbLoader.load


From: Hall, Matthew
Subject: RE: [Mibble-users] problem with MIbLoader.load
Date: Tue, 13 Mar 2007 18:49:04 -0000

Yeah I don't think this is going to work right. Let's examine the API:

=====
public MibValueSymbol getSymbolByOid(java.lang.String oid)

    Returns a value symbol from this MIB. The search is performed by using the 
strictly numerical OID value specified. Differing from the getSymbolByValue() 
methods, this method may return a symbol with only a partial OID match. If an 
exact match for the OID is present in the MIB, this method will always return 
the same result as getSymbolByValue(). Otherwise, the symbol with the longest 
matching OID will be returned, making it possible to identify a MIB symbol from 
an OID containing table row indices or similar.
====

It appears that getSymbolByOid is MIB-local. Therefore it's not going to work 
unless the symbol you look up is specifically present in IF-MIB. Let's try 
something a little different:

=====
MibLoader loader = new MibLoader();
loader.load(new File(fileSNMPv2SMI));
loader.load(new File(fileSNMPv2TC));
loader.load(new File(fileSNMPv2CONF));
loader.load(new File(fileIANAifTypeMIB));
loader.load(new File(fileSNMPv2MIB));
loader.load(new File(fileIFMIB));

for (Mib mib : loader.getAllMibs()) {
    MibValueSymbol mvs = mib.getSymbolByOid(oid);
    if (mvs != null) {
        System.out.println("symbol [" + symbol "] located in mib [" + mib + 
"]");
    }
}
=====

Let me know if it helps, I haven't done much complicated programming with 
Mibble yet so this might not be quite right. :-) It seems like there must be 
some fancier way to do the lookup that's not tied to one MIB at a time...

Regards,
Matthew Hall
Security Solutions Engineer
Hewlett-Packard Company

> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden On Behalf
> Of Daniel Gyorfi
> Sent: Tuesday, March 13, 2007 10:30 AM
> To: Announcements, support, and forum for Mibble users
> Subject: Re: [Mibble-users] problem with MIbLoader.load
> 
> !
> 
> No problem, I hope it may help:
> 
> MibLoader loader = new MibLoader();
>            mib = loader.load(new File(fileSNMPv2SMI));
>            mib = loader.load(new File(fileSNMPv2TC));
>            mib = loader.load(new File(fileSNMPv2CONF));
>            mib = loader.load(new File(fileIANAifTypeMIB));
>            mib = loader.load(new File(fileSNMPv2MIB));
>            mib = loader.load(new File(fileIFMIB));
> valuesymbol = mib.getSymbolByOid(OID);
> 
> But as far as im concern, the IF-MIB only extends the MIB tree of
> SNMPv2-MIB.
> Besides the IF-MIB needs the SNMPv2-MIB (it never loads without that -
> so it needs thiese multiple loadings) and there arent any nodes, which
> would be on both MIBs' trees, so there is nothing to overwrite, I
> think.
> 
> As I know, the load method can load multiple MIB without problem....or
> not?
> "Loads a MIB file. This method will also load all imported MIB:s if
> not previously loaded by this loader.(--doesnt work for me) If a MIB
> with the same file name has already been loaded, it will be returned
> directly instead of reloading it."
> 
> Thanks anyway...
> 
> regards,
> Daniel

reply via email to

[Prev in Thread] Current Thread [Next in Thread]