smidump generating invalid XML output for RFC1158 mib

Dear list users,
I am trying to dump a MIB to XML using smidump (v0.4.8) but the output provides invalid XML.
The MIB in question is: http://www.snmplink.org/OnLineMIB/Standards/index.html#124 (RFC1158-MIB, "rfc 1158 MIB-II.mib"). Some sources do have syntax errors (like missing comma's) which I corrected in the source file already. The XML output from smidump however is invalid XML. It generates the following XML e.g.:
------------------------ <table name="ipNetToMediaTable" oid="1.3.6.1.2.1.4.22" status="mandatory"> <description> ... </description> <row name="ipNetToMediaEntry" oid="1.3.6.1.2.1.4.22.1" status="mandatory"> <linkage> </linkage> <description> ... </description> <scalar name="ipNetToMediaIfIndex" oid="1.3.6.1.2.1.4.22.1.1" status="mandatory"> ------------------------
As can be seen in this example, the <row> tag is never closed and neither is the <table> tag. This is not the only occurance though and happends several times in this same file. This means I can not parse the XML output and also means I'm missing data. Is this a known bug? Is there a workaround? Or am I doing something wrong?
With kind regards,
Peter Postma

Hi,
it is difficult to help as long as I am not 100% sure which version you use. In this particular case, RFC1158-MIB has a number of things that are not valid in more recent SMI versions such as SMIv1 and SMIv2. My recommendation would simply to avoid RFC1158-MIB since it has been superseeded by RFC1213-MIB which has been superseeded by other MIBs itself.
/js
On Mon, Dec 16, 2013 at 02:15:31PM +0000, Peter Postma wrote:
Dear list users,
I am trying to dump a MIB to XML using smidump (v0.4.8) but the output provides invalid XML.
The MIB in question is: http://www.snmplink.org/OnLineMIB/Standards/index.html#124 (RFC1158-MIB, "rfc 1158 MIB-II.mib"). Some sources do have syntax errors (like missing comma's) which I corrected in the source file already. The XML output from smidump however is invalid XML. It generates the following XML e.g.:
<table name="ipNetToMediaTable" oid="1.3.6.1.2.1.4.22" status="mandatory"> <description> ... </description> <row name="ipNetToMediaEntry" oid="1.3.6.1.2.1.4.22.1" status="mandatory"> <linkage> </linkage> <description> ... </description> <scalar name="ipNetToMediaIfIndex" oid="1.3.6.1.2.1.4.22.1.1" status="mandatory"> ------------------------
As can be seen in this example, the <row> tag is never closed and neither is the <table> tag. This is not the only occurance though and happends several times in this same file. This means I can not parse the XML output and also means I'm missing data. Is this a known bug? Is there a workaround? Or am I doing something wrong?

Hi,
The problem there is that I try to load (and parse) the dependencies. RFC1213 has a dependency (import) with RFC1212 (OBJECT-TYPE FROM RFC-1212), which in turn imports from RFC1158-MIB (DisplayString FROM RFC1158-MIB). So how would I satisfy the import dependencies when not using RFC1158? Or did HP provide a wrong version of RFC1213/RFC1212 which should not have included that depencency?
Attached are the input and output I get with the following command:
smidump --format=xml --keep-going --quiet --level=0 ./rfc1158_MIB-II.mib 2>&1
With kind regards,
Peter Postma
-----Oorspronkelijk bericht----- Van: Juergen Schoenwaelder [mailto:j.schoenwaelder@jacobs-university.de] Verzonden: maandag 16 december 2013 15:44 Aan: Peter Postma CC: libsmi@ibr.cs.tu-bs.de Onderwerp: Re: [libsmi] smidump generating invalid XML output for RFC1158 mib
Hi,
it is difficult to help as long as I am not 100% sure which version you use. In this particular case, RFC1158-MIB has a number of things that are not valid in more recent SMI versions such as SMIv1 and SMIv2. My recommendation would simply to avoid RFC1158-MIB since it has been superseeded by RFC1213-MIB which has been superseeded by other MIBs itself.
/js
On Mon, Dec 16, 2013 at 02:15:31PM +0000, Peter Postma wrote:
Dear list users,
I am trying to dump a MIB to XML using smidump (v0.4.8) but the output provides invalid XML.
The MIB in question is: http://www.snmplink.org/OnLineMIB/Standards/index.html#124 (RFC1158-MIB, "rfc 1158 MIB-II.mib"). Some sources do have syntax errors (like missing comma's) which I corrected in the source file already. The XML output from smidump however is invalid XML. It generates the following XML e.g.:
<table name="ipNetToMediaTable" oid="1.3.6.1.2.1.4.22" status="mandatory"> <description> ... </description> <row name="ipNetToMediaEntry" oid="1.3.6.1.2.1.4.22.1" status="mandatory"> <linkage> </linkage> <description> ... </description> <scalar name="ipNetToMediaIfIndex" oid="1.3.6.1.2.1.4.22.1.1" status="mandatory"> ------------------------
As can be seen in this example, the <row> tag is never closed and neither is the <table> tag. This is not the only occurance though and happends several times in this same file. This means I can not parse the XML output and also means I'm missing data. Is this a known bug? Is there a workaround? Or am I doing something wrong?

On Mon, Dec 16, 2013 at 02:56:27PM +0000, Peter Postma wrote:
Hi,
The problem there is that I try to load (and parse) the dependencies. RFC1213 has a dependency (import) with RFC1212 (OBJECT-TYPE FROM RFC-1212), which in turn imports from RFC1158-MIB (DisplayString FROM RFC1158-MIB). So how would I satisfy the import dependencies when not using RFC1158? Or did HP provide a wrong version of RFC1213/RFC1212 which should not have included that depencency?
The MIB modules that are bundled with libsmi solve this by uncommenting the import of DisplayString FROM RFC1158-MIB. ;-)
Since the very early MIB modules are very 'magic', I would recommend to use the ones provided by libsmi instead of any vendor provided MIB modules.
/js

Peter,
Possibly, this could be a pragmatic way out : edit your copy of RFC1212 MIB, remove IMPORT from RFC1158, and add a line reading
DisplayString ::= OCTET STRING
Note from a grey-haired person working in NMS area for a long time: you'll find other (even quite modern) MIBs is the wild from time to time (notably if you go for enterprise specific MIBSs) that contain constructs MIB compilers will struggle with. One option is to try different compilers (all are fussy, but not all necessarily in the same manner); the other option is to "correct" the MIB. Another option is to notify MIB writers or compiler developers, but experience shows this is often the (infinitely) long term way towards a solution.
On 16/12/13 15:56, Peter Postma wrote:
Hi,
The problem there is that I try to load (and parse) the dependencies. RFC1213 has a dependency (import) with RFC1212 (OBJECT-TYPE FROM RFC-1212), which in turn imports from RFC1158-MIB (DisplayString FROM RFC1158-MIB). So how would I satisfy the import dependencies when not using RFC1158? Or did HP provide a wrong version of RFC1213/RFC1212 which should not have included that depencency?
With kind regards,
Peter Postma
Cheers, Erik Pessers erik.pessers@acm.org

Dear Erik,
Thank you for your reply. I indeed followed Juergen's suggestion and removed RFC1158 from the set and commented away the dependency import in RFC1212. I was now able to proceed with the parsing of the MIB files I needed so all seems well for now.
I already came to the same conclusion in regards to the syntax validity of some vendor (Dell/HP) provided MIBs and have ended up correcting any syntax errors (like missing commas) and skipping ones I simply can't parse so long as I don't specifically seem to need them for the system I'm working on.
Libsmi (smilint & smidump) is proofing to cover the requirements I have quite well (bar the 2 issues which I posted to the mailinglist, of which this one is solved now). I am limited to tools which can be installed in Linux (centOS) from package (not compiled by hand) and would prefer to steer away from JAVA based tools since there is no JAVA runtime environment on the machines the system will be running on and I'd like to keep it that way.
With kind regards,
Peter Postma
-----Oorspronkelijk bericht----- Van: libsmi-bounces@ibr.cs.tu-bs.de [mailto:libsmi-bounces@ibr.cs.tu-bs.de] Namens Erik Pessers Verzonden: dinsdag 17 december 2013 11:17 Aan: libsmi@ibr.cs.tu-bs.de Onderwerp: Re: [libsmi] smidump generating invalid XML output for RFC1158 mib
Peter,
Possibly, this could be a pragmatic way out : edit your copy of RFC1212 MIB, remove IMPORT from RFC1158, and add a line reading
DisplayString ::= OCTET STRING
Note from a grey-haired person working in NMS area for a long time: you'll find other (even quite modern) MIBs is the wild from time to time (notably if you go for enterprise specific MIBSs) that contain constructs MIB compilers will struggle with. One option is to try different compilers (all are fussy, but not all necessarily in the same manner); the other option is to "correct" the MIB. Another option is to notify MIB writers or compiler developers, but experience shows this is often the (infinitely) long term way towards a solution.
On 16/12/13 15:56, Peter Postma wrote:
Hi,
The problem there is that I try to load (and parse) the dependencies. RFC1213 has a dependency (import) with RFC1212 (OBJECT-TYPE FROM RFC-1212), which in turn imports from RFC1158-MIB (DisplayString FROM RFC1158-MIB). So how would I satisfy the import dependencies when not using RFC1158? Or did HP provide a wrong version of RFC1213/RFC1212 which should not have included that depencency?
With kind regards,
Peter Postma
Cheers, Erik Pessers erik.pessers@acm.org -- !! This message is brought to you via the `libsmi' mailing list. !! Please do not reply to this message to unsubscribe. To unsubscribe or adjust !! your settings, send a mail message to libsmi-request@ibr.cs.tu-bs.de !! or look at https://www.ibr.cs.tu-bs.de/mailman/listinfo/libsmi.
participants (3)
-
Erik Pessers
-
Juergen Schoenwaelder
-
Peter Postma