Subject: [netmod] xpaths and Wrapping Long Lines - draft-ietf-netmod-yang-tree-diagrams-03

From: Ian Farrer <[email-masked]>
Date: Thu, 21 Dec 2017 10:42:18 +0100

Hi,

I’m just looking at the guidance on wrapping long lines given in Section 3.1. Unfortunately, this doesn’t cover the case where I refer to a long path. E.g:

augment /nat:nat/nat:instances/nat:instance/nat:mapping-table/nat:mapping-entry:

In this case, the total length (unindented) is 80 characters, 82 indented and the path is 72 characters. Moving the path onto it’s own line with indents will exceed the 72 character limit, so I need a line break in the path. What’s the correct way to do this?

Thanks,
Ian

---

From: Ladislav Lhotka <[email-masked]>
Date: Thu, 21 Dec 2017 11:28:55 +0100

Hi Ian,

On Thu, 2017-12-21 at 10:42 +0100, Ian Farrer wrote:
> Hi,
> 
> I’m just looking at the guidance on wrapping long lines given in Section 3.1.
> Unfortunately, this doesn’t cover the case where I refer to a long path. E.g:
> 
> In this case, the total length (unindented) is 80 characters, 82 indented and
> the path is 72 characters. Moving the path onto it’s own line with indents
> will exceed the 72 character limit, so I need a line break in the path. What’s
> the correct way to do this?

XPath syntax permits whitespace between tokens, but the argument of "augment" is
a schema node identifier and not XPath. The ABNF productions for schema node
identifiers do not permit whitespace but you can always use string
concatenation:

augment "/nat:nat/nat:instances/nat:instance/"
      + "nat:mapping-table/nat:mapping-entry";

Lada

> 
> Thanks,
> Ian 
> _______________________________________________
> netmod mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/netmod
-- 
Ladislav Lhotka
Head, CZ.NIC Labs
PGP Key ID: 0xB8F92B08A9F76C67

---

From: Ian Farrer <[email-masked]>
Date: Thu, 21 Dec 2017 11:29:37 +0100

Great. Many thanks,
Ian

> On 21. Dec 2017, at 11:28, Ladislav Lhotka <[email-masked]> wrote:
> 
> Hi Ian,
>

---

From: Martin Bjorklund <[email-masked]>
Date: Thu, 21 Dec 2017 11:39:47 +0100 (CET)

>       + "nat:mapping-table/nat:mapping-entry";

But this is in the YANG source; I think Ian asked about the tree
diagram syntax.  Maybe the corresponding syntax in the tree diagram
could be simply:

augment /nat:nat/nat:instances/nat:instance
        /nat:mapping-table/nat:mapping-entry:

Or even simpler, maybe we can say that any string in the tree diagram
syntax can follow the YANG string rules.

/martin

---

From: Juergen Schoenwaelder <[email-masked]>
Date: Thu, 21 Dec 2017 11:43:28 +0100

>         /nat:mapping-table/nat:mapping-entry:

Works for me.
 
> syntax can follow the YANG string rules.

The YANG string rules are for machines to get the parsing right. Since
the tree diagrams are for humans, the less noise the better.

/js

-- 
Juergen Schoenwaelder           Jacobs University Bremen gGmbH
Phone: +49 421 200 3587         Campus Ring 1 | 28759 Bremen | Germany
Fax:   +49 421 200 3103         <http://www.jacobs-university.de/>

---

From: Robert Wilton <[email-masked]>
Date: Thu, 21 Dec 2017 11:14:51 +0000

>>          /nat:mapping-table/nat:mapping-entry:
This is a trivial thing, but I would probably outdent or indent the 
second and subsequent lines to help it seem like one string rather than 
a list of strings.

E.g. perhaps:

Or

Thanks,
Rob

---

From: Ian Farrer <[email-masked]>
Date: Thu, 21 Dec 2017 12:15:00 +0100

Thanks. This suggestion seems cleanest. Can the tree diagrams draft be updated to describe this?

BR,
Ian

> On 21. Dec 2017, at 11:43, Juergen Schoenwaelder <[email-masked]> wrote:
>

---

From: Ladislav Lhotka <[email-masked]>
Date: Thu, 21 Dec 2017 12:28:14 +0100

> diagram syntax.  Maybe the corresponding syntax in the tree diagram

Oh, sorry, I thought is was about 6087bis.

Lada

---

From: Martin Bjorklund <[email-masked]>
Date: Thu, 21 Dec 2017 15:03:30 +0100 (CET)

> be updated to describe this?

I suggest we add to the section "Wrapping Long Lines"

NEW:

Long paths (e.g., leafref paths or augment targets) can be split and
printed on more than one line.  For example:

  augment /nat:nat/nat:instances/nat:instance/nat:mapping-table
            /nat:mapping-entry:

then also fix in 2.6:

OLD:

      If the type is a leafref, the type is printed as "-> TARGET",
      where TARGET is either the leafref path, with prefixes removed
      if possible.

NEW:

      If the type is a leafref, the type is either printed as
      "-> TARGET", where TARGET is the leafref path, with prefixes
      removed if possible, or printed as "leafref".

FYI, I have fixed pyang so that it breaks long augment targets:

$ pyang -f tree --tree-line-length 55 x.yang 
module: x
  augment /y:pretty-long-identifier-name/y:shorter
            /y:another-long-identifier-name
            /y:also-short/y:but-this-is-long-again:
    +--rw bar?   string

/martin