Skip to content

No access to meta.List's key when module defines list in augment #110

Open
@berupp

Description

I am trying to work with the AST of a module. I am loading the following YANG using parser.LoadModule

module myModule {

    yang-version "1.1";
	
    namespace "http://myModule.com/ns/yang/eth_dm";
	
    prefix "myModule";
   
    organization "myOrg";
 
    revision 2024-02-26 {
        description
            "Newly generated revision";
        reference "1.0.0";
    }
       augment "/otherModule:object-type" {
	    when "/otherModule:object-type/otherModule:typename = 'eth-dm'";
		container eth-dm {
			uses monitored-objects;
		}
	}

	grouping monitored-objects {
		container monitored-objects {
			list monitored-object {
				key "monitored-object-id monitored-object-name";
			}
		}
	}
}

Trying to access they key of the monitored-objects list is not possible

module.Groupings()["monitored-objects"].DataDefinitions()[0].(*meta.Container).DataDefinitions()[0].(*meta.List).KeyMeta()

is returning nil.

The private key property of meta.List is populated, but I noticed that the entire container monitored-objects is not compiled because it is only referenced by the augment and not a by container rooted in the module. Therefore, the code which is populating the keyMeta property of meta.List isn't executed. Which also means that I can provide a key that is referencing a non-existent leaf without getting any compile errors on LoadModule.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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