Subject: [yang-doctors] how to use container in rpc input

From: "Oren, Elisha" <[email-masked]>
Date: Tue, 19 Jul 2016 14:10:01 +0000

Hi,
I have a YANG container that represents an object with several fields in an external YANG file.
I need to use this object in an RPC input.

I've tried to use "uses" but it seems to work only with "grouping".

I prefer to use the external file as it, but I can change it (like encapsulate it with grouping etc) if there is no better way to do it.

Any ideas?

Thanks.

---

From: Andy Bierman <[email-masked]>
Date: Wed, 20 Jul 2016 02:03:38 -0700

Hi,

You seem to be confusing the conceptual model (grouping/uses)
with the external representation of the model (import, include).
Your conceptual model must be defined in YANG.  You cannot
refer to an external file at all.

Andy

On Tue, Jul 19, 2016 at 7:10 AM, Oren, Elisha <[email-masked]> wrote:

> I’ve tried to use “uses” but it seems to work only with “grouping”.
>
>
>
> I prefer to use the external file as it, but I can change it (like
> encapsulate it with grouping etc) if there is no better way to do it.
>
>
>
> Any ideas?
>
>
>
> Thanks.
>
> _______________________________________________
> yang-doctors mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/yang-doctors
>
>

---

From: "Oren, Elisha" <[email-masked]>
Date: Wed, 20 Jul 2016 13:32:36 +0000

Thanks for your reply but I feel like my question wasn’t clear enough,

let say I have this container:

container obj {
     leaf a {
           type string;
     }
     leaf b {
           type string;
     }
     leaf c {
           type string;
     }
}

And I want to write rpc that gets the container parameters (to create one for example) with some additional parameters :

rpc create-obj {
     input {
           leaf a {
           type string;
           }
           leaf b {
                type string;
           }
           leaf c {
                type string;
           }

           leaf additional-parameter {
                type string;
           }
     }
     output {
           leaf status {
                type string;
           }
     }
}

I’m looking for a way to avoid code - duplication of all the fields, something like

rpc create-obj {
     input {
           <all obj fields>

           leaf additional-parameter {
                type string;
           }
     }
     output {
           leaf status {
                type string;
           }
     }
}

Is there a way to to it or I’ll have to write and maintain the structure in two places?

Thanks.

From: Andy Bierman [mailto:[email-masked]]
Sent: Wednesday, July 20, 2016 12:04
To: Oren, Elisha <[email-masked]>
Cc: [email-masked]
Subject: Re: [yang-doctors] how to use container in rpc input

Hi,

Andy

On Tue, Jul 19, 2016 at 7:10 AM, Oren, Elisha <[email-masked]<mailto:[email-masked]>> wrote:
Hi,
I have a YANG container that represents an object with several fields in an external YANG file.
I need to use this object in an RPC input.

Any ideas?

Thanks.

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

---

From: Ladislav Lhotka <[email-masked]>
Date: Wed, 20 Jul 2016 16:48:55 +0200

> On 20 Jul 2016, at 15:32, Oren, Elisha <[email-masked]> wrote:
> 

Why would you need a new RPC? NM protocols have built-in operations for performing such changes (creating and editing an instance).

Lada

--
Ladislav Lhotka, CZ.NIC Labs
PGP Key ID: E74E8C0C

---

From: Andy Bierman <[email-masked]>
Date: Wed, 20 Jul 2016 23:54:02 -0700

Hi,

I don't know about other YANG doctors, but would never approve any
module that replicates the basic operations in NETCONF.  I realize every
YANG designer thinks their module is special but it's not.  It does not
scale
at all to have 100 different create-foo operations.

Andy

On Wed, Jul 20, 2016 at 11:47 PM, Oren, Elisha <[email-masked]> wrote:

> Because the RPC gets more additional arguments, and I want the rpc to do
> more things.
>
> -----Original Message-----
> From: Ladislav Lhotka [mailto:[email-masked]]
> Sent: Wednesday, July 20, 2016 17:49
> Cc: Andy Bierman <[email-masked]>; Benoit Claise <
> [email-masked]>
> > And I want to write rpc that gets the container parameters (to create
> one for example) with some additional parameters :
>
> Why would you need a new RPC? NM protocols have built-in operations for
> performing such changes (creating and editing an instance).
>
> Lada
>
> >
> > rpc create-obj {
> >      input {
> >            leaf a {
> >            type string;
> >            }
> >            leaf b {
> >                 type string;
> >            }
> >            leaf c {
> >                 type string;
> >            }
> >
> > You seem to be confusing the conceptual model (grouping/uses) with the
> > external representation of the model (import, include).
> > Your conceptual model must be defined in YANG.  You cannot refer to an
> > external file at all.
> >
> > Andy
> >
> >

---

From: Jan Lindblad <[email-masked]>
Date: Thu, 21 Jul 2016 08:58:00 +0200

+1
/jan

> On 21 juli 2016, at 08:54, Andy Bierman <[email-masked]> wrote:
> 
> Hi,
> 
> YANG designer thinks their module is special but it's not.  It does not scale
> On Wed, Jul 20, 2016 at 11:47 PM, Oren, Elisha <[email-masked] <mailto:[email-masked]>> wrote:
> Because the RPC gets more additional arguments, and I want the rpc to do more things.
> 
> From: Ladislav Lhotka [mailto:[email-masked] <mailto:[email-masked]>]
> To: Oren, Elisha <[email-masked] <mailto:[email-masked]>>
> Cc: Andy Bierman <[email-masked] <mailto:[email-masked]>>; Benoit Claise <[email-masked] <mailto:[email-masked]>>
> > On 20 Jul 2016, at 15:32, Oren, Elisha <[email-masked] <mailto:[email-masked]>> wrote:
> >
> > From: Andy Bierman [mailto:[email-masked] <mailto:[email-masked]>]
> > To: Oren, Elisha <[email-masked] <mailto:[email-masked]>>
> > Cc: [email-masked] <mailto:[email-masked]>
> > On Tue, Jul 19, 2016 at 7:10 AM, Oren, Elisha <[email-masked] <mailto:[email-masked]>> wrote:
> > Hi,
> > [email-masked] <mailto:[email-masked]>
> > https://www.ietf.org/mailman/listinfo/yang-doctors <https://www.ietf.org/mailman/listinfo/yang-doctors>
> >
> >
> > [email-masked] <mailto:[email-masked]>
> > https://www.ietf.org/mailman/listinfo/yang-doctors <https://www.ietf.org/mailman/listinfo/yang-doctors>
> 
> --

---

From: "Oren, Elisha" <[email-masked]>
Date: Thu, 21 Jul 2016 06:47:58 +0000

-----Original Message-----
From: Ladislav Lhotka [mailto:[email-masked]] 
Sent: Wednesday, July 20, 2016 17:49
To: Oren, Elisha <[email-masked]>
Cc: Andy Bierman <[email-masked]>; Benoit Claise <[email-masked]>
Subject: Re: [yang-doctors] how to use container in rpc input

Lada