ConfD User Community

Symlink removal without affecting source xpath and symlinked xpath

Hi Team,
We a have yang model where all common data structures are kept in a yang file, let’s say common.yang with commonContainer as a top level container.
from common.yang file

module common
{
  container commonContainer {
  ...
  }
} 

We also have symlinks to this common structure in another yang file let’s say featureSepc.yang file
from featureSepciyang

module featureSpec
{
import common
{ 
   prefix COMMON
}
  container root
  {
     **tailf:symlink common {**
**        tailf:path "/COMMON:common/COMMON:commonContainer";**
**     }**
  }
}

We have exposed both source commonContainer xpath and symlinked commonContainer xpaths to customers.
As symlink is being deprecated in latest confd versions, we have chosen to remove symlink ang use augment around the original module.
as shown below.

module common
{
augment root {
  container commonContainer {
  ...
  }
}
}

because of this solution, we would retain symlinked xpath(/root/commonContainer), but we are the losing source xpath(/commonContainer).

Is there any other solution to this symlink removal, without loosing source/symlinked xpaths.

Thanks in Advance.

Regards,
Usha

If datamodel in your container is simple (contains e.g. only few leafs, no list), you may use tailf:link for each leaf.

Issue was also discussed here:

We have complex data model and approx 100 tables might get affected, so creating and linking leaf by leaf will not be possible for my case,

I’ve considered approches mentioned Tailf:symlink replacement in 7.5.x
Approach1: tailf:link which is not feasible option considering the complexity of our data model
Approach2: pyang --tailf-sanitize option which Inlines the subtree that a ‘tailf:symlink’ points to

with 2nd approach, we would retain both xpaths, but they will become two independant configuration items, is there any way to link both of them without using tailf:link option.

Please let me know if there are any other solutions apart from those I’ve mentioned above, I would like to explore them as well.

Thanks,
Usha

One option can be to duplicate your data model (use grouping if possible) and write transformation. Transformation example can be found in examples.confd/intro/10-c_transform. It transforms to different data model. Yours will be transforming to the same data model (probably can be done as simple change of keypath). In case you have many instances in the lists (thousands), transform may have some performance penalty, if you access many instances at the same time (e.g. showing everything).

1 Like

Thanks Michal for your help.
tailf:tansform seems to be feasible solution for my case even though some additional work is required to handle transaction points.