I have the following XML that I want to model with YANG. The XML contains a list of nodes and each node contains a list of neighbor nodes.
<nodes>
<node>
<id>1</id>
<node>
<id>2</id>
</node>
</node>
<node>
<id>3</id>
<node>
<id>4</id>
</node>
</node>
</nodes>
Please find below the YANG model I tried to create. Unfortunately, Yang does not support circular references in grouping.
grouping node {
list node {
leaf id {
type int32;
}
uses node;
}
}
container nodes {
uses node;
}
I saw in draft-ietf-netmod-routing-cfg-16 and on ietf mail archive that a way to emulate recursion is to use leafref. How can the above xml be modeled with grouping and leafref?