ConfD User Community

Confd triggering validation for all leafs even though dependency of each tailf:validate is set to '.'

Hi!
I have a use case where i am writing separate validation scripts for all the leafs in my yang file.
When i am trying to test the validation script on one of the leafs, the validation scripts for all other leafs are also getting triggered.
My understanding from confd documentation is that when you specify the dependency to be “.” , the validation for that leaf is done only when a commit to that leaf is done?

Please help me understand this behaviour and if you have a suggestion for my use-case, it will be helpful.

Hello. Please, can you share sample (simplified?) of your YANG file.

example of the file –

leaf a
{
    type uint8
    tailf:validate rule-a {
        tailf:dependency '.';
    }
}
leaf b
{
    type uint8
    tailf:validate rule-b {
        tailf:dependency '.';
    }
}
leaf c
{
    type uint8
    tailf:validate rule-c {
        tailf:dependency '.';
    }
}

Now, when there is a commit to leaf c, only rule-c should be triggered right?
In my system, i am noticing that rule-a, rule-b and rule-c is being triggered. Is this the expected behaviour?

Just to make sure, are you registering validationpoint callbacks to different callback functions?

If not, is validation function called several times with different keypath parameter?

static int validate(struct confd_trans_ctx *tctx,
                    confd_hkeypath_t *kp,
                    confd_value_t *newval)

yes, i am registering validationpoint callbacks to different callback functions.

from the above example:
rule-a is the callback function for leaf a
rule-b is the callback function for leaf b
rule-c is the callback function for leaf c

each function is getting called for its own key_path :
rule-a is getting called for leaf a
rule-b is getting called for leaf b
rule-c is getting called for leaf c
even when there is a commit only to leaf c.

Hello again, I have tried to create small example, but I was not able to reproduce the issue.
I have only one validation callback function, but I print keypath. The printout shows only modified keypath is
validated (you can see time gaps between my commits)

19-Nov-2021::11:46:03.272 400us [7f363df83740] TRACE confd-app.c:46: ==> init_validation
19-Nov-2021::11:46:03.272 431us [7f363df83740] TRACE confd-app.c:49: <== init_validation ret 0
19-Nov-2021::11:46:03.272 557us [7f363df83740] TRACE confd-app.c:64: ==> validate
19-Nov-2021::11:46:03.272 575us [7f363df83740] TRACE confd-app.c:69: keypath=/a
19-Nov-2021::11:46:03.272 585us [7f363df83740] TRACE confd-app.c:71: <== validate rv 0
19-Nov-2021::11:46:03.283 058us [7f363df83740] TRACE confd-app.c:55: ==> stop_validation
19-Nov-2021::11:46:03.283 093us [7f363df83740] TRACE confd-app.c:57: <== stop_validation rv=0

19-Nov-2021::11:46:11.831 213us [7f363df83740] TRACE confd-app.c:46: ==> init_validation
19-Nov-2021::11:46:11.831 247us [7f363df83740] TRACE confd-app.c:49: <== init_validation ret 0
19-Nov-2021::11:46:11.831 381us [7f363df83740] TRACE confd-app.c:64: ==> validate
19-Nov-2021::11:46:11.831 401us [7f363df83740] TRACE confd-app.c:69: keypath=/b
19-Nov-2021::11:46:11.831 412us [7f363df83740] TRACE confd-app.c:71: <== validate rv 0
19-Nov-2021::11:46:11.843 763us [7f363df83740] TRACE confd-app.c:55: ==> stop_validation
19-Nov-2021::11:46:11.843 793us [7f363df83740] TRACE confd-app.c:57: <== stop_validation rv=0

19-Nov-2021::11:46:17.097 542us [7f363df83740] TRACE confd-app.c:46: ==> init_validation
19-Nov-2021::11:46:17.097 578us [7f363df83740] TRACE confd-app.c:49: <== init_validation ret 0
19-Nov-2021::11:46:17.097 814us [7f363df83740] TRACE confd-app.c:64: ==> validate
19-Nov-2021::11:46:17.097 833us [7f363df83740] TRACE confd-app.c:69: keypath=/c
19-Nov-2021::11:46:17.097 844us [7f363df83740] TRACE confd-app.c:71: <== validate rv 0
19-Nov-2021::11:46:17.106 618us [7f363df83740] TRACE confd-app.c:55: ==> stop_validation
19-Nov-2021::11:46:17.106 661us [7f363df83740] TRACE confd-app.c:57: <== stop_validation rv=0

You can download example here:

https://cisco.box.com/s/6q70vgukuf1oxgohxvq09lsfeb36kgvc

There is a README file, can you try it in your environment? Thanks.

@mnovak i will try this out and re-check my configuration again.
thank you for taking the time out to help me with this :smiley: