goyang: Cannot replace node with deviate/augment combo
We have a YANG module that we implement (ietf-routing-policy), but there are some changes that we’ve made. In order to maintain a separation between the IETF module and our modifications, instead of directly modifying the IETF module, we have removed unsupported nodes using deviations, and added new nodes by augmenting from a separate module.
The problem occurs when we remove an unsupported node and then try to replace it with a different node of the same name. The new node comes from a different module and therefore has a different prefix, but Entry.Dir
only cares about unprefixed names. So when the deviations are applied, it wipes out the new node.
I’m aware that prefix handling is incomplete (https://github.com/openconfig/goyang/issues/5) in goyang, and that we cannot change the way Entry.Dir
works without serious consequences. I would like to propose a workaround, in which we maintain a secondary map Entry.PrefixedDir
which acts exactly like Entry.Dir
except that its map keys are qualified with a prefix.
I have a branch in which I’ve made these changes, but I wanted to get feedback before submitting a PR.
About this issue
- Original URL
- State: open
- Created 4 years ago
- Comments: 24 (14 by maintainers)
Thanks @midakaloom, it looks like this is a bug in the error handling code. I’ve verified that capturing the error reports the
Duplicate node "c"
error message on Rob’s example whereas it is currently silently passing.