Skip to content

yanglint cannot handle single uses in sx:augment-structure #2377

@micnovak

Description

@micnovak

Use following YANG datamodel (file example.yang):

module example {
    yang-version 1.1;
    namespace "ex:ample";
    prefix example;

    import ietf-yang-structure-ext {
        prefix sx;
    }

    grouping files {
        container files {
            list file {
                key id;

                leaf id {
                    type uint32;
                }
            }
        }
    }

    sx:structure struct {
        container c {
            leaf b {
                type uint32;
            }
        }
    }

    sx:augment-structure "/example:struct/c" {
        //leaf a {type uint32;}
        uses files;
    }
}

yanglint 3.7.8

yanglint example.yang
libyang err : Ext plugin "ly2 structure v1": Extension sx:augment-structure does not define any data-def-stmt statements. (/example:{extension='sx:augment-structure'}//example:struct/c)

According to https://datatracker.ietf.org/doc/html/rfc7950#section-14 , uses is part of the data-def-stmt (uses-stmt)

   data-def-stmt       = container-stmt /
                         leaf-stmt /
                         leaf-list-stmt /
                         list-stmt /
                         choice-stmt /
                         anydata-stmt /
                         anyxml-stmt /
                         uses-stmt

When you add artificial leaf like below, it works fine.

    sx:augment-structure "/example:struct/c" {
        leaf a {type uint32;}
        uses files;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    is:bugBug description.status:completedFrom the developer perspective, the issue was solved (bug fixed, question answered,...)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions