Subject: [netmod] A question about rpc's xpath

From: [email-masked]
Date: Tue, 20 May 2014 15:05:18 +0800

Hi all,
      I'm confused with rpc's xpath expression.
      For example:
      module a {
            prefix a;
           rpc foo {
               input {
                  leaf foo1 {...}
               }
               output {
                  leaf foo1 {...}
               }
           }
      }

    The xpath of the leaf name foo1 in foo's input is 
"a:foo/a:input/a:foo1"? or is "a:foo/a:foo1"?
    If it's latter, how to express the xpath of the leaf foo1 in foo's 
output?

    Another question, how to distinguish the xpath of datadef and the 
xpath of rpc?
    For example:
    module a {
        prefix a;
        container foo {
              container input {
                  leaf foo1 {...}
              }
        }
 
         rpc foo {
               input {
                  leaf foo1 {...}
               }
               output {
                  leaf foo1 {...}
               }
           }
    }

    The xpath "a:foo/a:input/a:foo1" points the leaf foo1 in container or 
the leaf foo1 in rpc foo's input?
 
/frank
--------------------------------------------------------
ZTE Information Security Notice: The information contained in this mail (and any attachment transmitted herewith) is privileged and confidential and is intended for the exclusive use of the addressee(s).  If you are not an intended recipient, any disclosure, reproduction, distribution or other dissemination or use of the information contained is strictly prohibited.  If you have received this mail in error, please delete it and notify us immediately.
--------------------------------------------------------
ZTE Information Security Notice: The information contained in this mail (and any attachment transmitted herewith) is privileged and confidential and is intended for the exclusive use of the addressee(s).  If you are not an intended recipient, any disclosure, reproduction, distribution or other dissemination or use of the information contained is strictly prohibited.  If you have received this mail in error, please delete it and notify us immediately.

---

From: Juergen Schoenwaelder <[email-masked]>
Date: Tue, 20 May 2014 09:14:07 +0200

See section 7.5.3 of RFC 6020:

   o  If the context node represents RPC input parameters, the tree is
      the RPC XML instance document.  The XPath root node has the
      element representing the RPC operation being defined as the only
      child.

   o  If the context node represents RPC output parameters, the tree is
      the RPC reply instance document.  The XPath root node has the
      elements representing the RPC output parameters as children.

See also section 7.13.4 of RFC 6020 for the encoding of RPCs.

/js

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

-- 
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: [email-masked]
Date: Tue, 20 May 2014 15:25:36 +0800

Juergen,
     I do know it, but I want to use rpc's xpath as target node in augment 
or deviation.
So, there is no XML instance document.

For example:

module b {
    prefix b;
    import a {
        prefix a;
    }

    augment "a:foo/a:input" {
          leaf foo2 {...}
    }
}

Which node is the target node of this augument? the input in container foo 
or the input in rpc foo?

/frank
Juergen Schoenwaelder <[email-masked]> 写于 
2014-05-20 15:14:07:

> Juergen Schoenwaelder <[email-masked]> 
> 2014-05-20 15:14
> 
> 请答复 给
> Juergen Schoenwaelder <[email-masked]>
> 
> 收件人
> 
> [email-masked], 
> 
> 抄送
> 
> [email-masked], [email-masked], [email-masked], 
> [email-masked]
> 
> 主题
> 
> Re: [netmod] A question about rpc's xpath
> 

> > ZTE Information Security Notice: The information contained in this
> mail (and any attachment transmitted herewith) is privileged and 
> confidential and is intended for the exclusive use of the addressee
> (s).  If you are not an intended recipient, any disclosure, 
> reproduction, distribution or other dissemination or use of the 
> information contained is strictly prohibited.  If you have received 
> this mail in error, please delete it and notify us immediately.
> > ZTE Information Security Notice: The information contained in this
> mail (and any attachment transmitted herewith) is privileged and 
> confidential and is intended for the exclusive use of the addressee
> (s).  If you are not an intended recipient, any disclosure, 
> reproduction, distribution or other dissemination or use of the 
> information contained is strictly prohibited.  If you have received 
> this mail in error, please delete it and notify us immediately.
>

---

From: Juergen Schoenwaelder <[email-masked]>
Date: Tue, 20 May 2014 09:41:13 +0200

>      I do know it, but I want to use rpc's xpath as target node in augment 

No, you were asking the wrong question then. The path statement in an
augment has nothing to do with xpath. See section 7.15 of RFC 6020,
second paragraph.

/js

---

From: [email-masked]
Date: Tue, 20 May 2014 15:46:03 +0800

/frank

OK. I'm wrong. But how to express rpc's absolute-schema-nodeid and 
descendant-schema-nodeid?

2014-05-20 15:41:13:

> 2014-05-20 15:41
> [email-masked], [email-masked], 
> [email-masked], [email-masked]
> 
> 主题
> 
> > > >     The xpath "a:foo/a:input/a:foo1" points the leaf foo1 in 
container 
> > or

---

From: Juergen Schoenwaelder <[email-masked]>
Date: Tue, 20 May 2014 09:52:41 +0200

If you need an example, take a look at the routing data model. But
yes, it is something like /a:foo/a:input/a:foo1 for your initial
example (reflecting the nesting in the schema tree).

/js

---

From: [email-masked]
Date: Tue, 20 May 2014 16:12:16 +0800

I have looked through routing data model. But this example can't resolve 
my question.

If a module defined a container has a same name with rpc, and this 
container has a child named 'input',
these two 'input's have the same absolute-schema-nodeid.

/frank

2014-05-20 15:52:41:

> 2014-05-20 15:52
> Re: 答复: Re: [netmod] A question about rpc's xpath
> 
> > > >      I do know it, but I want to use rpc's xpath as target node in 

> > augment 
> > > > Which node is the target node of this augument? the input in 
container 
> > foo 
> > > > >    o  If the context node represents RPC input parameters, the 
tree 
> > is
> > > > >       element representing the RPC operation being defined as 
the 
> > only
> > > > >       child.
> > > > > 
> > > > >    o  If the context node represents RPC output parameters, the 
tree 
> > is
> > > > > On Tue, May 20, 2014 at 03:05:18PM +0800, 
[email-masked] 
> > wrote:
> > > > > >     If it's latter, how to express the xpath of the leaf foo1 
in 
> > foo's 
> > > > 
> > > > > > output?
> > > > > > 
> > > > > >     Another question, how to distinguish the xpath of datadef 
and 
> > the

---

From: Jernej Tuljak <[email-masked]>
Date: Tue, 20 May 2014 10:14:24 +0200

>     If it's latter, how to express the xpath of the leaf foo1 in foo's 

In order to augment/deviate your RPC, you need to use an absolute schema 
node identifier, not XPath.
/a:foo/a:input
/a:foo/a:output

Schema node identifiers identify schema nodes - nodes of the schema 
tree. Their paths may contain non-instantiable nodes, such as 
input-stmt, output-stmt, choice-stmt, case-stmt, ... The relative 
version is only applicable as an argument to a refine-stmt, unique-stmt 
and as an argument to the augment statement that is used as child to 
refine statement.

XPath is reserved for must-stmt, when-stmt and, in a very specific way, 
for path-stmt arguments. They are used to refer to instantiable nodes 
only -  nodes of the data tree.

>     The xpath "a:foo/a:input/a:foo1" points the leaf foo1 in container 
> or the leaf foo1 in rpc foo's input?

You example is not valid YANG. It contains a duplicated name "foo".

Jernej

---

From: Jernej Tuljak <[email-masked]>
Date: Tue, 20 May 2014 10:17:26 +0200

Dne 20.5.2014 10:14, pis(e Jernej Tuljak:
>>     If it's latter, how to express the xpath of the leaf foo1 in 
>> foo's output?
>
> In order to augment/deviate your RPC, you need to use an absolute 
> schema node identifier, not XPath.
> /a:foo/a:input
> /a:foo/a:output
>
> version is only applicable as an argument to a refine-stmt, 
> unique-stmt and as an argument to the augment statement that is used 
> as child to refine statement.

Sorry, "argument to the augment statement that is used as child to uses 
statement" would be correct.

Jernej

>
> XPath is reserved for must-stmt, when-stmt and, in a very specific 
> way, for path-stmt arguments. They are used to refer to instantiable 
> nodes only -  nodes of the data tree.
>
>>
>> container or the leaf foo1 in rpc foo's input?
>

---

From: [email-masked]
Date: Tue, 20 May 2014 16:18:11 +0800

/frank

Jernej Tuljak <[email-masked]> 写于 2014-05-20 16:14:24:

> Jernej Tuljak <[email-masked]> 
> 2014-05-20 16:14
> 
> 收件人
> 
> [email-masked], 
> 
> 抄送
> 
> Dne 20.5.2014 9:05, piše [email-masked]:
> Hi all, 
>     The xpath of the leaf name foo1 in foo's input is "a:foo/
> a:input/a:foo1"? or is "a:foo/a:foo1"? 
output?
> tree. Their paths may contain non-instantiable nodes, such as input-
> stmt, output-stmt, choice-stmt, case-stmt, ... The relative version 
> is only applicable as an argument to a refine-stmt, unique-stmt and 
> as an argument to the augment statement that is used as child to 
> refine statement.
> 

> 
>     Another question, how to distinguish the xpath of datadef and 
> the xpath of rpc? 
>     For example: 
>     module a { 
>         prefix a; 
>         container foo { 
>               container input { 
>                   leaf foo1 {...} 
>               } 
>         } 
> 
>          rpc foo { 
>                input { 
>                   leaf foo1 {...} 
>                } 
>                output { 
>                   leaf foo1 {...} 
>                } 
>            } 
>     } 
> 

YANG specify rpc's identifier must not have the same identifier of data 
definition node?

---

From: Jernej Tuljak <[email-masked]>
Date: Tue, 20 May 2014 10:24:56 +0200

Dne 20.5.2014 10:18, piše [email-masked]:
> YANG specify rpc's identifier must not have the same identifier of 
> data definition node?

Yes. See section 6.2.1 in RFC6020.

    o  All leafs, leaf-lists, lists, containers, choices, rpcs,
       notifications, and anyxmls defined (directly or through a uses
       statement) within a parent node or at the top level of the module
       or its submodules share the same identifier namespace.  This
       namespace is scoped to the parent node or module, unless the
       parent node is a case node.  In that case, the namespace is scoped
       to the closest ancestor node that is not a case or choice node.

Jernej

---

From: [email-masked]
Date: Tue, 20 May 2014 16:32:33 +0800

/frank

Jernej Tuljak <[email-masked]> 写于 2014-05-20 16:24:56:

> 2014-05-20 16:24
> Jernej Tuljak <[email-masked]>, [email-masked], 
> [email-masked], [email-masked], [email-masked]
> 
> 主题
> 

>       to the closest ancestor node that is not a case or choice node.
Thanks a lot!
But I don't understand why rpc' identifier must not be the same to data 
definition node's identifier.

---

From: Juergen Schoenwaelder <[email-masked]>
Date: Tue, 20 May 2014 21:21:33 +0200

> definition node's identifier.

I think the examples in the thread motivate why disallowing name
clashes is a good idea.

/js

---

From: Andy Bierman <[email-masked]>
Date: Tue, 20 May 2014 12:45:02 -0700

> I think the examples in the thread motivate why disallowing name
This was a design decision in order to make the path-stmt
easier to use (e.g., so augment-stmt works consistently
across rpc, data, and notification statements).

/js
Andy

---

From: [email-masked]
Date: Wed, 21 May 2014 14:12:06 +0800

/frank

Andy Bierman <[email-masked]> 写于 2014-05-21 03:45:02:

> Andy Bierman <[email-masked]> 
> 2014-05-21 03:45
> 
> 收件人
> 
> Juergen Schoenwaelder <[email-masked]>, 
> [email-masked], Jernej Tuljak <[email-masked]>, 
> [email-masked], [email-masked], 
> [email-masked], "[email-masked]" <[email-masked]>, 
> 
> 抄送
> 
> 主题
> 

> across rpc, data, and notification statements).
I don't think it's a good design. Adding a substatement such as 'type' to 
indicate the target node belongs to which type(e.g. data/rpc/notification)
is a better solution.

---

From: Juergen Schoenwaelder <[email-masked]>
Date: Wed, 21 May 2014 08:45:36 +0200

> indicate the target node belongs to which type(e.g. data/rpc/notification)

I do not see which real-world problem you are having with the current
way YANG works. Note that the YANG 1.1 effort is constrained by a
number of things, one of them is backwards compatibility with YANG
1.0. Changing the path-stmt or the schema tree namespaces hardly can
be done in a backwards compatible way.

And anyway, the window for submitting new issues is closed.

/js

---

From: Andy Bierman <[email-masked]>
Date: Wed, 21 May 2014 08:22:37 -0700

> indicate the target node belongs to which type(e.g. data/rpc/notification)

I do not agree. Changing a simple statement to multiple statements
adds complexity, it doesn't reduce it.  Perhaps we would have done something
like that if identifier names were perceived as scarce resources.
It is not that hard to pick a different string.  A sub-statement would
allow the same string to represent a data, rpc, and/or notification node.
(that's it).

Andy