ConfD User Community

Why validate callback invoked twice?


#1

examples.confd/validate/c

# make all
# make start
# make cli
localhost# config
localhost(config)# mtest a_number 88
localhost(config)# commit
The following warnings were generated:
  'mtest a_number': Dangerous value: 88
  'mtest a_number': Dangerous value: 88
Proceed? [yes,no] 

when I try the validate example, why does the validate callback invoked twice?


#2

Are you using ConfD 6.0? It looks as if there is a bug either in the yang-compiler or in ConfD itself.

I tried both ConfD 6.0 and ConfD 6.1, with ConfD 6.0 I see the same thing as you but ConfD 6.1 works as expected.

There are no changed in the example code between 6.0 and 6.1.


#3

Something is definitely wrong in the 6.0 yang-compiler, it emits two warnings for missing tailf:dependency at the same line in mtest.annot.yang while the 6.1 compiler only emit one.

First confdc from ConfD 6.0:
/confd/confd6/confd-6.0/bin/confdc -c -a mtest.annot.yang mtest.yang
mtest.annot.yang:14: warning: The ‘tailf:validate’ expression should have a tailf:dependency. If it doesn’t, the function is called for every commit.
mtest.annot.yang:14: warning: The ‘tailf:validate’ expression should have a tailf:dependency. If it doesn’t, the function is called for every commit.

Then confdc from ConfD 6.1:
/confd/confd/confd-6.1/bin/confdc -c -a mtest.annot.yang mtest.yang
mtest.annot.yang:14: warning: The ‘tailf:validate’ expression should have a tailf:dependency. If it doesn’t, the function is called for every commit.


#4

Thanks, I’ve tried the version of 6.1 it works.


#5

From the ConfD-6.1 CHANGES:

  • Toolchain: The YANG compiler applied annotations twice, which could
    cause e.g. validation callbacks to be invoked twice for each
    validation. This has been fixed.

The bug is also present in 5.4 (fixed in 5.4.4) and 6.0 (should be fixed in 6.0.4, not released yet).