Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with path statements in RPC #662

Closed
italobusi opened this issue Aug 4, 2020 · 1 comment
Closed

Issue with path statements in RPC #662

italobusi opened this issue Aug 4, 2020 · 1 comment

Comments

@italobusi
Copy link

italobusi commented Aug 4, 2020

We have found some issues with RPC XPaths when developing the YANG code for https://tools.ietf.org/html/draft-ietf-teas-yang-path-computation

As discussed during the TEAS WG session in IETF 108, this issue has been raised on pyang github.

The following code is accepted by pyang 1.75 but not by pyang 2.1:

                type leafref {
                  path "/te:tunnels-path-compute/te:input/"
                     + "te:path-compute-info/"
                     + "te-pc:tunnel-attributes/te-pc:tunnel-name";
                }

The following code instead is accepted by pyang 2.1 but not by pyang 1.7.5:

              leaf tunnel-attributes-ref {
                type leafref {
                  path "/te:tunnels-path-compute/"
                     + "te:path-compute-info/"
                     + "te-pc:tunnel-attributes/te-pc:tunnel-name";
                }

Moreover the following when statement, which is quite useful to constraint which information is provided by the RPC output based on some attributes in the RPC input, is accepted by pyang 1.7.5 but not accepted by pyang 2.1;

  augment "/te:tunnels-actions/te:output" {
    description
      "Augment Tunnels Action RPC input with path delete result";
    
    container path-computed-delete-result {
      when "derived-from-or-self(../../te:input/te:action-info/"
         + "te:action, 'tunnel-action-path-compute-delete')";
      description "Path Delete RPC output";
      leaf-list path-compute-transaction-id {
        type string;
        description
          "The list of the transaction-id values of the
           transient states that have been successfully deleted";
      }
    }   // container path-computed-delete-result
  }   // path-delete rpc output

@italobusi italobusi changed the title RPC paths Issue with path statements in RPC Aug 4, 2020
@fredgan
Copy link
Collaborator

fredgan commented Aug 6, 2020

Hi Italo,

Let me simplify your yang model

module mod1 {
  yang-version 1.1;
  namespace "urn:mod1";
  prefix m;

  rpc myrpc {
    input {
      container ic {
        leaf inputnode {
          type string;
        }
      }
    }
    output {
      leaf outputnode {
        when "/myrpc/ic/inputnode='xxx'";
        type string;
      }
    }
  }

  augment /myrpc/input/ic {
     leaf il {
       type leafref {
         path "/myrpc/ic/inputnode";
       }
     }
  }
}

I explored the RFC7950 carefully, finally I find the following:

  • 1 The argument for path is the same as XPath 1.0
    However, the special description said as follows,

o If the XPath expression is defined in a substatement to an "input"
statement in an "rpc" or "action" statement, the accessible tree
is the RPC or action operation instance, all state data in the
server, and the running configuration datastore. The root node
has top-level data nodes in all modules as children.
Additionally, for an RPC, the root node also has the node
representing the RPC operation being defined as a child. The node
representing the operation being defined has the operation's input
parameters as children.
So the input is ignored, the children are directly used.

In pyang 1.7.5, the XPath expression is not well validated, so the "input" is not checked correctly. The current version of pyang is checked correctly.

The yang model provided above is accepted by current pyang version. Please try it.

italobusi added a commit to IETF-TEAS-WG/ietf-teas-yang-path-computation that referenced this issue Aug 7, 2020
@fredgan fredgan closed this as completed Aug 8, 2020
italobusi added a commit to IETF-TEAS-WG/ietf-teas-yang-path-computation that referenced this issue Oct 1, 2020
Fixing issue #76, as suggested in:
- mbj4668/pyang#662 (comment)
- https://mailarchive.ietf.org/arch/msg/netmod/3vmzza2QQ2ZVxUOU_daRTZDt0P8/

Co-authored-by: sergiobelotti <sergio.belotti@nokia.com>
italobusi added a commit to IETF-TEAS-WG/ietf-teas-yang-path-computation that referenced this issue Feb 8, 2021
* Update ietf-te-path-computation.yang

Fixing issue #76 as suggested in mbj4668/pyang#662 (comment)

Updated based on the feedbacks from Martin Björklund:
https://mailarchive.ietf.org/arch/msg/netmod/3vmzza2QQ2ZVxUOU_daRTZDt0P8/

Updated to address YD review comments (open issue #83 )

Updated YANG model:
- to address Tom Petch's comments (#82)
- to clean-up the use of groupings (#84 (comment))

Updated as proposed in #77 (comment)

Update to address review comment: #84 (comment)

Co-authored-by: sergiobelotti <sergio.belotti@nokia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants