Subject: Re: [yang-doctors] [netmod] Recursive extensions?

From: Nadeau Thomas <[email-masked]>
Date: Mon, 17 Oct 2016 17:01:36 -0400

Adding Yang Doctors to the thread.

	—Tom

> On Oct 17, 2016:4:42 PM, at 4:42 PM, Robert Varga <[email-masked]> wrote:
> 
> Hello everyone,
> 
> neither RFC6020 nor RFC7950 seem to be explicit about this, so I thought
> I'd ask.
> 
> Are recursive, directly or transitively, extensions valid yang?
> 
> For example:
> 
> module foo {
>    namespace "foo";
>    prefix foo;
>    yang-version 1;
> 
>    extension a {
>        foo:b;
>    }
> 
>    extension b {
>        foo:c;
>    }
> 
>    extension c {
>        foo:a;
>    }
> 
>    extension r {
>        foo:r;
>    }
> }
> 
> Thanks,
> Robert
> 
> _______________________________________________
> netmod mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/netmod

---

From: Andy Bierman <[email-masked]>
Date: Mon, 17 Oct 2016 17:46:45 -0700

> > Are recursive, directly or transitively, extensions valid yang?

Extensions are not recursive.
Your syntax below is valid but not meaningful.
Extension definitions are not C macros expanded on use.
Your use of external statements within the YANG extension-stmt is valid,
but they are ignored when processing the extension-stmt.

You are declaring 4 external keywords, none of which take an argument.
Each usage will validate correctly (no argument given).

 Andy

> yang-doctors mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/yang-doctors
>

---

From: Martin Bjorklund <[email-masked]>
Date: Tue, 18 Oct 2016 09:06:49 +0200 (CEST)

> Your syntax below is valid but not meaningful.

Here's a real (and meaningful) example of a "recursive" extension:

  extension substatement {
    argument name {
      tailf:arg-type {
        type string;
      }
    }
    tailf:use-in "extension";
    tailf:occurence "*";

    tailf:substatement "tailf:occurence";  // <-- reference to self
    description
      "Specifies which statements can occur as substatement to the
      given statement.";
  }

This is not different from how the core YANG statements can be used;
e.g., you can use "container" within "container".

/martin

---

From: Robert Varga <[email-masked]>
Date: Tue, 18 Oct 2016 18:01:02 +0200

>> Your syntax below is valid but not meaningful.

Hello Martin,

> e.g., you can use "container" within "container".

I though it may be useful for a complex set of language extensions,
thanks for confirming.

Regards,
Robert