Subject: [netmod] YANG actions - need to define OK/error or can reuse NETCONF ok/rpc-error ?

From: "Sterne, Jason (Nokia - CA/Ottawa)" <[email-masked]>
Date: Thu, 7 Jun 2018 18:43:25 +0000

Hi all,

When defining an 'action' in a YANG 1.1 model, and we want the server to be able to respond with <ok> or some error information, do we need to define the ok/error info in the 'output' of the action, or can we define an action without any 'output' statement and have the server respond using the typical <ok> or <rpc-error> in NETCONF ?

I'm not sure if it is relevant, but when I look at the definition of the commit rpc in the NETCONF spec, there is no 'output' defined but clearly a response of <ok> or an rpc-error can be returned by a server.

If we don't define the ok/error in the action itself then I suppose other types of interfaces (RESTCONF) may or may not have other ways to reply ok/error (at least it won't be defined by the YANG model for the particular action).

But it does seem like a waste to go and specify ok/error information for every action out there if they only need to return ok or error information that could be carried in the standard rpc-error message.

Rgds,
Jason

---

From: Martin Bjorklund <[email-masked]>
Date: Thu, 07 Jun 2018 23:20:59 +0200 (CEST)

Hi,

"Sterne, Jason (Nokia - CA/Ottawa)" <[email-masked]> wrote:
> Hi all,
> 
> When defining an 'action' in a YANG 1.1 model, and we want the server
> to be able to respond with <ok> or some error information, do we need
> to define the ok/error info in the 'output' of the action, or can we
> define an action without any 'output' statement and have the server
> respond using the typical <ok> or <rpc-error> in NETCONF ?

You don't need to define "ok" - see section 7.15.2, the last paragraph
of RFC 7950:

   If the action operation invocation succeeded and no output parameters
   are returned, the <rpc-reply> contains a single <ok/> element defined
   in [RFC6241].  If output parameters are returned, they are encoded as
   child elements to the <rpc-reply> element defined in [RFC6241], in
   the same order as they are defined within the "output" statement.

/martin

> I'm not sure if it is relevant, but when I look at the definition of
> the commit rpc in the NETCONF spec, there is no 'output' defined but
> clearly a response of <ok> or an rpc-error can be returned by a
> server.
> 
> If we don't define the ok/error in the action itself then I suppose
> other types of interfaces (RESTCONF) may or may not have other ways to
> reply ok/error (at least it won't be defined by the YANG model for the
> particular action).
> 
> But it does seem like a waste to go and specify ok/error information
> for every action out there if they only need to return ok or error
> information that could be carried in the standard rpc-error message.
> 
> Rgds,
> Jason

---

From: "Sterne, Jason (Nokia - CA/Ottawa)" <[email-masked]>
Date: Thu, 7 Jun 2018 21:24:14 +0000

Thanks Martin.  I should have found that myself when I was looking through that section.

What about the case where the operation invocation did not succeed and there are no output parameters defined ?   

Rgds,
Jason

> -----Original Message-----
> From: Martin Bjorklund [mailto:[email-masked]]
> Sent: Thursday, June 7, 2018 5:21 PM
> To: Sterne, Jason (Nokia - CA/Ottawa) <[email-masked]>
> Cc: [email-masked]
> Subject: Re: [netmod] YANG actions - need to define OK/error or can reuse
> NETCONF ok/rpc-error ?
> 
> Hi,
>

---

From: Martin Bjorklund <[email-masked]>
Date: Fri, 08 Jun 2018 10:44:24 +0200 (CEST)

> there are no output parameters defined ?

In NETCONF that will be a <rpc-error>, as per RFC 6241.  The action is
invoked with a normal NETCONF <rpc> message.

/martin