Subject: [Netconf] extracting yang models from RFC

From: Michael Richardson <[email-masked]>
Date: Wed, 10 Jun 2015 09:46:16 -0400

Please excuse me if this is a FAQ, but a scan of 6020 didn't reveal any
advice.  I'm also mostly ignorant of MIB or YANG authoring, I'm just trying
to help get a more consistent experience.  I know that we have tools to
extract MIBs from RFCs, and I assume that we have the same for YANG models.

I also googled for "how to format yang model in rfc", and I looked
at: https://tools.ietf.org/wg/netconf/trac/wiki, and
looked at:
https://mailarchive.ietf.org/arch/search/?q=netconf+how+to+format+yang+in+internet-draft&f_list=netconf

What is the recommended way to embed the YANG definition into an ID?
Should it be as a single section, with a single <figure><artwork>,
or should/can it be split up into multiple figures?

I'm writing a makefile/sed pipeline to insert the raw .yang file into
the XML to reduce editing errors.  <> must be escaped as &lt; in
<artwork>, but I'm unaware of any other stuffing that must be done.

Probably this is a solved problem...

--
Michael Richardson <[email-masked]>, Sandelman Software Works
 -= IPv6 IoT consulting =-

---

From: Kent Watsen <[email-masked]>
Date: Wed, 10 Jun 2015 19:20:56 +0000

See rfcstrip located here:
http://www.yang-central.org/twiki/pub/Main/YangTools/rfcstrip

Just do 'rfcstrip <i-d or rfc file>' and you'll get the extracted YANG
modules (and more).

Cheers,
Kent

---

From: Michael Richardson <[email-masked]>
Date: Wed, 10 Jun 2015 15:26:26 -0400

> Just do 'rfcstrip <i-d or rfc file>' and you'll get the extracted YANG

okay, sure, I knew such things existed (but I hadn't found it)
But, what should I do on the input side of things to make rfcstrip
work better?
I guess I can round trip it until I get it right... let's try.

okay, back to my original question. rfcstrip results in empty
output from the ID in question, so I'm back to my original question: what do
I put in to make rfcstrip work?
(and where is that documented?)

--
]               Never tell me the odds!                 | ipv6 mesh networks [
]   Michael Richardson, Sandelman Software Works        | network architect  [
]     [email-masked]  http://www.sandelman.ca/        |   ruby on rails    [

---

From: "Marc Blanchet" <[email-masked]>
Date: Wed, 10 Jun 2015 15:29:31 -0400

> (and where is that documented?)

interesting. During the discussion on the new RFC format, I stated 
specifically on the mike that those should be well handled for 
extraction and formatting (no page headers in the middle…).  I 
haven’t looked at the new proposed format, but I hope it should be 
« simpler » than now.

Marc.

> Tools-discuss mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/tools-discuss
>
> Please report datatracker.ietf.org bugs at 
> http://tools.ietf.org/tools/ietfdb
> Please report tools.ietf.org bugs at 
> http://tools.ietf.org/tools/issues or
> send email to [email-masked]

---

From: Kent Watsen <[email-masked]>
Date: Wed, 10 Jun 2015 19:43:02 +0000

>(and where is that documented?)

Code should be wrapped by <CODE BEGINS> and <CODE ENDS> markers.

See here for where it's defined:
https://tools.ietf.org/html/draft-ietf-netmod-rfc6087bis-02#section-4.1

Cheers,
Kent

---

From: Michael Richardson <[email-masked]>
Date: Wed, 10 Jun 2015 15:48:42 -0400

> extraction and
    > formatting (no page headers in the middle…).  I haven’t looked at the new
    > proposed format, but I hope it should be « simpler » than now.

I don't know if <figure><artwork> is what's in the new format or not.
In any case, I'm not at the new format... I'm dealing with the xml2txt
workflow.  So I wouldn't say there is either success or failure of
what you asked for at this point.

I'm using xml2rfc 2.4.7 (probably not the absolute latest, but it has worked
up to now).  I'm assuming, looking at the awk script in the middle of the
rfcstrip shell code, that it is looking for "module FOO {" to start.

Hmm. I note that this code is not terminated with a } at the exactly
same level in the ID.... aha the last line of original file had a },
and no trailing new line, so that very last line was never included.

rfcstrip now works, and the round trip is the same except for some extra
blank lines added, and slightly different indent on descriptions that
cross multiple lines.

---

From: Paul Hoffman <[email-masked]>
Date: Wed, 10 Jun 2015 12:54:22 -0700

On Jun 10, 2015, at 12:29 PM, Marc Blanchet <[email-masked]> wrote:
> interesting. During the discussion on the new RFC format, I stated specifically on the mike that those should be well handled for extraction and formatting (no page headers in the middle…).  I haven’t looked at the new proposed format, but I hope it should be « simpler » than now.

Much simpler: see the <sourcecode> element in <https://datatracker.ietf.org/doc/draft-hoffman-xml2rfc/>.

--Paul Hoffman