libyang
libyang copied to clipboard
yanglint can't find absolute path leafref target when defined within sx:augment-structure
Reproducible with: yanglint 3.7.8
This YANG should be valid AFAICT but yanglint can't find the leafref's target:
module example {
yang-version 1.1;
namespace "ex:ample";
prefix example;
import ietf-yang-structure-ext {
prefix sx;
}
container files {
list file {
key id;
leaf id {
type uint32;
}
}
}
sx:structure struct {
container c {
}
}
sx:augment-structure "/example:struct/c" {
leaf id {
type leafref {
path "/example:files/example:file/example:id";
}
}
}
}
yanglint example.yang libyang err : Not found node "files" in path. (/example:c/id)
I do not think standard YANG nodes are accessible from structures and vice versa, for XPath purposes based on the following text from ietf-yang-structure-ext:
The XPath document element is the extension statement itself,
such that the child nodes of the document element are
represented by the data-def-stmt substatements within this
extension. This conceptual document is the context for the
following YANG statements:
- must-stmt
- when-stmt
- path-stmt
- min-elements-stmt
- max-elements-stmt
- mandatory-stmt
- unique-stmt
- ordered-by
- instance-identifier data type