Erlang/OTP Forums

Author Message

<  Erlang bugs mailing list  ~  snmp bug?

Guest
Posted: Sat Feb 06, 2010 8:19 pm Reply with quote
Guest
I've been communicating with snmp devices on the network with erlang, but I'm having issues getting MIBs into erlang, but I'm running into errors with the compiler.

One of the mibs I've focused on uses the TEXTUAL-CONVENTION macro, but I get these errors when trying to compile it:

root@vm1:~# erlc AP-SERIES-300-UPS-MODULE-MIB.mib
AP-SERIES-300-UPS-MODULE-MIB.mib: 47: Error: Macro 'TEXTUAL-CONVENTION' not imported.
AP-SERIES-300-UPS-MODULE-MIB.mib: 54: Error: Macro 'TEXTUAL-CONVENTION' not imported.

Now, I recognize this may be an issue with the MIB file itself, and I consider myself far from an snmp expert. But in digging, I've noticed that there are a number of MIBs that come with erlang, and some of them are compiled and put into the priv directory, but not all.

In digging some more, it seems like those MIBs don't compile. For example, SNMPv2-TC.mib, which I believe is needed for understanding TEXTUAL-CONVENTIONS, gives this error:

root@vm1:~# erlc SNMPv2-TC.mib
SNMPv2-TC.mib: 8: Error: syntax error before: 'TEXTUAL-CONVENTION'

In fact, there are a number of mib files that ship with erlang that give errors like this, all on line with MACRO statements.

The erlang code leads me to believe that these *should* work and compile, but it looks like they don't. So, while I'm not positive this is a bug, it smells a bit like one, hence why I'm posting.

Thanks,
Caleb
________________________________________________________________
erlang-bugs (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-bugs-unsubscribe@erlang.org

Post received from mailinglist
Guest
Posted: Mon Feb 08, 2010 8:15 am Reply with quote
Guest
Hi,

Caleb Tennis <caleb.tennis@gmail.com> wrote:
> I've been communicating with snmp devices on the network with erlang, but I'm
> having issues getting MIBs into erlang, but I'm running into errors with the
> compiler.
>
> One of the mibs I've focused on uses the TEXTUAL-CONVENTION macro, but I get
> these errors when trying to compile it:
>
> root@vm1:~# erlc AP-SERIES-300-UPS-MODULE-MIB.mib
> AP-SERIES-300-UPS-MODULE-MIB.mib: 47: Error: Macro 'TEXTUAL-CONVENTION' not
> imported.
> AP-SERIES-300-UPS-MODULE-MIB.mib: 54: Error: Macro 'TEXTUAL-CONVENTION' not
> imported.
>
> Now, I recognize this may be an issue with the MIB file itself

It is. The MIB must IMPORT the TEXTUAL-CONVENTION macro.

> In digging some more, it seems like those MIBs don't compile. For example,
> SNMPv2-TC.mib, which I believe is needed for understanding
> TEXTUAL-CONVENTIONS, gives this error:
>
> root@vm1:~# erlc SNMPv2-TC.mib
> SNMPv2-TC.mib: 8: Error: syntax error before: 'TEXTUAL-CONVENTION'

SNMPv2-TC isn't really a MIB; it defines the ASN.1 macro
TEXTUAL-CONVENTION, but unfortunately it also uses the macro and
defines some common TEXTUAL-CONVENTIONs.

> In fact, there are a number of mib files that ship with erlang that give
> errors like this, all on line with MACRO statements.
>
> The erlang code leads me to believe that these *should* work and compile, but
> it looks like they don't. So, while I'm not positive this is a bug, it
> smells a bit like one, hence why I'm posting.

The erlang MIB compiler simply cannot handle the MACRO statement. It
should be straightforward to do what libsmi does - check that the
module that contains the MACRO is one of the known modules, and simply
skip the MACRO invocation.


In any case, the real bug here is that your MIB does not IMPORT
TEXTUAL-CONVENTION. Even if the erlang MIB compiler could compile
SNMPv2-TC, your MIB needs to be fixed.



/martin

________________________________________________________________
erlang-bugs (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-bugs-unsubscribe@erlang.org

Post received from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum