-
Notifications
You must be signed in to change notification settings - Fork 122
Open
Description
When not-supported deviations are used on intermediate nodes, leaf ref lookups on child nodes fail with error: ERROR Generating GoStruct Code: could not resolve leafref path: [ <path> ]
This seems to be occurring in the following code section:
e := t.GetLeafValue(fixedPath)
if e == nil {
return nil, fmt.Errorf("could not resolve leafref path: %v from %v, tree: %v", fixedPath, contextEntry, t)
}
Line 85 in 2dd1852
| return nil, fmt.Errorf("could not resolve leafref path: %v from %v, tree: %v", fixedPath, contextEntry, t) |
Deviations should be considered when performing leaf ref lookup or returning nil should not be a failure case (potentially toggle-able by flag)
Reproduction:
instance.yang
module test-instance {
yang-version "1";
// namespace
namespace "instance";
prefix "t-inst";
grouping instance-top {
description
"Top-level grouping containing a list of instances.";
container instances {
description
"instances";
list instance {
key "name";
description
"instances configured on the local system";
leaf name {
type leafref {
path "../config/name";
}
description
"A unique name identifying the instance";
}
container config {
description
"Configuration parameters relating to an
instance";
uses instance-config;
}
}
}
}
grouping instance-config {
description
"Configuration parameters relating to a top-level
instance";
leaf name {
type string;
description
"name for the instance.";
}
}
uses instance-top;
}
test-deviations.yang
module test-deviations {
namespace "instance-deviations";
prefix "test-devs";
import test-instance { prefix t-inst; }
organization "test";
deviation /t-inst:instances/t-inst:instance/t-inst:config {
deviate "not-supported";
}
}
ygot generator run with
-compress_paths=false -output_dir=~ -package_name=pkg -ignore_circdeps -ignore_unsupported=true -exclude_modules=ietf-interfaces
-generate_fakeroot -fakeroot_name=device -generate_simple_unions -generate_append -generate_getters -generate_rename -structs_split_files_count=5 -ygot_path=<> -ytypes_path=<> -goyang_path=<> -path=test third_party/openconfig/vendor/cisco/yang/test/instance.yang third_party/openconfig/vendor/cisco/yang/test/test-deviations.yang
Metadata
Metadata
Assignees
Labels
No labels