
In the file tools/fortopat.c is this code:
for (range = smiRange, lp = 0; range; range = smiGetNextRange(range)) { lengths[lp++] = smiRange->minValue.value.unsigned32; lengths[lp++] = smiRange->maxValue.value.unsigned32;
This ought to be
for (range = smiRange, lp = 0; range; range = smiGetNextRange(range)) { lengths[lp++] = range->minValue.value.unsigned32; lengths[lp++] = range->maxValue.value.unsigned32;
or the ranges after the first one will effectively be ignored.

On Fri, Nov 02, 2007 at 04:12:54PM +0100, Arndt Jonasson wrote:
In the file tools/fortopat.c is this code:
for (range = smiRange, lp = 0; range; range = smiGetNextRange(range)) { lengths[lp++] = smiRange->minValue.value.unsigned32; lengths[lp++] = smiRange->maxValue.value.unsigned32;
This ought to be
for (range = smiRange, lp = 0; range; range = smiGetNextRange(range)) { lengths[lp++] = range->minValue.value.unsigned32; lengths[lp++] = range->maxValue.value.unsigned32;
or the ranges after the first one will effectively be ignored.
Thanks and fixed in the SVN.
Note that the format string to xsd pattern translation algorithm is actually broken and needs to be rewritten. This became clear when I started to add support for YANG; so I assume that not many people really have actually used the XSD mapping since we never received a bug report that the translation generates broken XSD (in the sense that you can't use it to validate instance documents).
/js

Juergen Schoenwaelder writes:
On Fri, Nov 02, 2007 at 04:12:54PM +0100, Arndt Jonasson wrote:
In the file tools/fortopat.c is this code:
for (range = smiRange, lp = 0; range; range = smiGetNextRange(range)) { lengths[lp++] = smiRange->minValue.value.unsigned32; lengths[lp++] = smiRange->maxValue.value.unsigned32;
This ought to be
for (range = smiRange, lp = 0; range; range = smiGetNextRange(range)) { lengths[lp++] = range->minValue.value.unsigned32; lengths[lp++] = range->maxValue.value.unsigned32;
or the ranges after the first one will effectively be ignored.
Thanks and fixed in the SVN.
Note that the format string to xsd pattern translation algorithm is actually broken and needs to be rewritten. This became clear when I started to add support for YANG; so I assume that not many people really have actually used the XSD mapping since we never received a bug report that the translation generates broken XSD (in the sense that you can't use it to validate instance documents).
I have been using a local adaptation of dump-xsd.c to generate our own XML schema format, and (with some fixes which I have reported) it seems to work at least for all the standard IETF mibs. Understanding it fully hasn't been my primary concern, though, and there may be lurking bugs.
Here is one more diff, which I forgot to report earlier. Also in fortopat.c:
if( iterDH->separator ) { /* iterDH->repTerm = hint[ pos++ ]; // repeat not supported */ pos++; } else { if( hint[ pos++ ] == '.' ) { iterDH->separator[0] = '\'; iterDH->separator[1] = '.'; } else iterDH->separator[0] = hint[ pos ]; }
should be
if( iterDH->separator[0] ) { /* iterDH->repTerm = hint[ pos++ ]; // repeat not supported */ pos++; } else { iterDH->separator[0] = hint[ pos++ ]; if (iterDH->separator[0] == '.') { iterDH->separator[0] = '\'; iterDH->separator[1] = '.'; } }

On Mon, Nov 05, 2007 at 11:19:36AM +0100, Arndt Jonasson wrote:
I have been using a local adaptation of dump-xsd.c to generate our own XML schema format, and (with some fixes which I have reported) it seems to work at least for all the standard IETF mibs. Understanding it fully hasn't been my primary concern, though, and there may be lurking bugs.
The problem is that (a) some DISPLAY-HINTs are not translated correctly and (b) you can't simply copy the SIZE restriction of an OCTET STRING when you move to a textual format; you actually have to translate the SIZE retrictions taking the DISPLAY-HINT transformation into account. Both, the XSD backend and the YANG backend currently do not do this. So what is needed is a rewrite of the translation code which not only tries to translate DISPLAY-HINTs into pattern but also returns new size restrictions that are meaningful in the "textual space".
Here is one more diff, which I forgot to report earlier. Also in fortopat.c:
if( iterDH->separator ) { /* iterDH->repTerm = hint[ pos++ ]; // repeat not supported */ pos++; } else { if( hint[ pos++ ] == '.' ) { iterDH->separator[0] = '\\'; iterDH->separator[1] = '.'; } else iterDH->separator[0] = hint[ pos ]; }
should be
if( iterDH->separator[0] ) { /* iterDH->repTerm = hint[ pos++ ]; // repeat not supported */ pos++; } else { iterDH->separator[0] = hint[ pos++ ]; if (iterDH->separator[0] == '.') { iterDH->separator[0] = '\\'; iterDH->separator[1] = '.'; } }
Thanks. Just checked in.
/js
participants (2)
-
Arndt Jonasson
-
Juergen Schoenwaelder