Skip to content

"require-instance false" when pulling leafref definitions from grouping #644

@ericvoit

Description

@ericvoit

This issue was raised from Benoit to Radek on January 8th. However it never made it into the system, so it never got addressed.

The issue continues to resulting in errors in:

  • draft-ietf-netconf-subscribed-notifications
  • draft-ietf-netconf-yang-push
  • draft-ietf-netconf-restconf-notif

More drafts will be hitting this shortly.

Below is the original bug description:

Hi Benoit,

Attached is a YANG file showing a bug in yanglint. The error is that yanglint reports "The leafref leaf is config but refers to a non-config leaf". This occurs even though the leaf is marked "require-instance false".

Note this error only appears when the leafref is defined within a grouping. It does not occur when the leafref is defined directly within a data node. (see code snippet below which works fine)

Where do we get these issue addressed? I suspect I can't upload a new subscribed-notifications draft without this being fixed.

Eric


Code and test results

module yanglint-non-config-leafref-test2 {
  yang-version 1.1;
  namespace 
     "urn:ietf:params:xml:ns:yang:test";
  prefix t;

  organization "IETF";
  contact
    "Editor:   Eric Voit  <mailto:evoit@cisco.com>";
               
  description
    "Test of leafref in a group pointing to non-config data";
  
  revision 2018-01-08 {
      description ""; 
  }

  typedef foo-ref {
    type leafref {
      path "/t:aaa/t:aaa/t:name";
    }
    description ""; 
  }
  
  grouping foo {
    list subscription {
      key "identifier";
      description ""; 
      leaf identifier {
        type uint8;
        description ""; 
      }
      leaf foo {
        type foo-ref {
          require-instance false;
        }
		mandatory true;
        description ""; 
      }        
    }
  }
  
  container aaa {
    config false;
    description ""; 
    list aaa {
      key "name";
      description ""; 
      leaf name {
        type string;
        description ""; 
      }
    }
  }  

  container config-data {
    description ""; 
    uses foo;
  }
}

/* Below are the results of validating the above file:

validator version: 0.3, xym version: 0.4, pyang version: 1.7.3 confdc version: 6.2.1, yanglint version: yanglint 0.13.69

yanglint-non-config-leafref-test.yang

Pyang Validation
No warnings or errors

Pyang Output
module: yanglint-non-config-leafref-test2
    +--ro aaa
    |  +--ro aaa* [name]
    |     +--ro name    string
    +--rw config-data
       +--rw subscription* [identifier]
          +--rw identifier    uint8
          +--rw foo           foo-ref
		  
Confdc Output
No warnings or errors

yanglint Validation
err : The leafref leaf is config but refers to a non-config leaf. (/yanglint-non-config-leafref-test2:config-data/subscription/foo)
err : The leafref leaf is config but refers to a non-config leaf. (/yanglint-non-config-leafref-test2:config-data/subscription/foo)
err : Invalid value "foo" of "uses". (/yanglint-non-config-leafref-test2:config-data/foo)
err : Copying data from grouping failed. (/yanglint-non-config-leafref-test2:config-data/foo)
err : Module "yanglint-non-config-leafref-test2" parsing failed.

Note that yanglint does not have the errors if a grouping is NOT used

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions