Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions pyang/statements.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ class Abort(Exception):

# reference phase:
# verifies all references; e.g. leafref, unique, key for config
'reference_0',
'reference_1',
'reference_2',
'reference_3',
Expand Down Expand Up @@ -228,6 +229,9 @@ class Abort(Exception):
('reference_1', 'action'):lambda ctx, s:v_reference_action(ctx, s),
('reference_1', 'notification'):lambda ctx, s:v_reference_action(ctx, s),
('reference_1', 'choice'):lambda ctx, s: v_reference_choice(ctx, s),
('reference_0', 'deviation'):lambda ctx, s:v_reference_deviation(ctx, s),
('reference_0', 'deviate'):lambda ctx, s:v_reference_deviate(ctx, s),

('reference_2', 'leaf'):lambda ctx, s:v_reference_leaf_leafref(ctx, s),
('reference_2', 'leaf-list'):lambda ctx, s:v_reference_leaf_leafref(ctx, s),
('reference_2', 'must'):lambda ctx, s:v_reference_must(ctx, s),
Expand All @@ -238,8 +242,6 @@ class Abort(Exception):
# ('reference_3', 'must'):lambda ctx, s:v_reference_must(ctx, s),
# ('reference_3', 'when'):lambda ctx, s:v_reference_when(ctx, s),
('reference_3', 'typedef'):lambda ctx, s:v_reference_leaf_leafref(ctx, s),
('reference_3', 'deviation'):lambda ctx, s:v_reference_deviation(ctx, s),
('reference_3', 'deviate'):lambda ctx, s:v_reference_deviate(ctx, s),
('reference_4', 'deviation'):lambda ctx, s:v_reference_deviation_4(ctx, s),
('reference_4', 'revision'):lambda ctx, s:v_reference_revision(ctx, s),

Expand Down Expand Up @@ -2351,6 +2353,12 @@ def inherit_parent_i_config(node, value):
and t.i_module.i_prefix != c.i_module.i_prefix):

c.arg = c.i_module.i_prefix + ':' + c.arg

if (c.keyword == 'type'
and getattr(t, "i_leafref", None) is not None
and c.arg != "leafref"):

delattr(t, "i_leafref")
t.substmts.append(c)
else: # delete
for c in stmt.substmts:
Expand Down
2 changes: 2 additions & 0 deletions test/test_issues/test_i771/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test:
$(PYANG) a.yang > /dev/null
18 changes: 18 additions & 0 deletions test/test_issues/test_i771/a.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module a {
prefix "a";
namespace "urn:a";

container a {
leaf b {
type leafref {
path "/d"; // does not exist
}
}
}

deviation "/a/b" {
deviate replace {
type string;
}
}
}