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

statement: require-instance should be true if not present according to rfc7950 Sec 9.9.3 #302

Closed
nowaits opened this issue Feb 15, 2022 · 3 comments

Comments

@nowaits
Copy link
Contributor

nowaits commented Feb 15, 2022

Hi olof,
statement: require-instance should be true if not present according to rfc7950 Sec 9.9.3

diff --git a/lib/src/clixon_validate.c b/lib/src/clixon_validate.c
index ba5065e..96de9bf 100644
--- a/lib/src/clixon_validate.c
+++ b/lib/src/clixon_validate.c
@@ -134,7 +134,7 @@ validate_leafref(cxobj     *xt,
     char        *path_arg;
     yang_stmt   *ymod;
     cg_var      *cv;
-    int          require_instance = 0;
+    int          require_instance = 1;
     
     /* require instance */
     if ((yreqi = yang_find(ytype, Y_REQUIRE_INSTANCE, NULL)) != NULL){
-- 
@olofhagsand
Copy link
Member

Do you have any symptoms for that in a test/use case?
(For definition-of-done)

@nowaits
Copy link
Contributor Author

nowaits commented Feb 15, 2022

For example interface-ref-common in openconfig-interfaces.yang

grouping interface-ref-common {
    description
      "Reference leafrefs to interface / subinterface";

    leaf interface {
      type leafref {
        path "/oc-if:interfaces/oc-if:interface/oc-if:name";
      }
      description
        "Reference to a base interface.  If a reference to a
        subinterface is required, this leaf must be specified
        to indicate the base interface.";
    }

   ...
  }

leaf: interface is valid only if path "/oc-if:interfaces/oc-if:interface/oc-if:name" present.

@olofhagsand
Copy link
Member

Fix committed. Please verify

@nowaits nowaits closed this as completed Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants