Dependency error when added a check in must

Hi,

I am using openconfig dns configuration.
I have a requirement to set Ipv6 configuration only when ipv6 is enabled.
I annotated dns server to set ip only when ipv6 is enabled. But i am getting dependency error when fxs files are loaded in confd.log and keypath error when condition is evaludated.

error log “The dependency node ‘/oc-sys:system/settings/config/ipv6-disable’ for node ‘/oc-sys:system/dns/servers/server’ in module ‘openconfig-system’ does not exist”

I am able to configure /oc-sys:system/settings/config/ipv6-disable from cli, but not able to use in annotate.

Could you please let me know if i am missing anything?

~Karthik

No container settings (nor any leaf ipv6-disable) exists in recent release of OpenConfig YANG modules, how did you added them?

Hi @mvf ,

Settings is augmented configuration in system path.
I have created a container “settings” under system and added leaf ipv6-disable.

If it is augmented, then it belongs to a different namespace, so the path needs to look like

/oc-sys:system/sys-aug:settings/sys-aug:config/sys-aug:ipv6-disable

where sys-aug is the prefix of the augmenting module.

Hi @mvf ,

I tried that also. But still i see these errors. I enabled xpath log and developerLog , is there any other way i can get more debug info to identify the issue?

~Karthik

Can you post (the relevant parts of) all non-openconfig modules involved?

hi @mvf ,

It looks something like this

module: system-settings
augment /oc-sys:system:
±-rw settings
±-rw config
| ±-rw ipv6-disable? boolean

 tailf:annotate "/oc-sys:system/oc-sys:dns/oc-sys:servers/oc-sys:server" {
     must "((/oc-sys:system/sysset:settings/sysset:config/sysset:ipv6-disable=true) and
             contains(current(), ':'))" { <== please ignore the condition for time being.
         error-message "...";
     }
 }

I am getting different error, this may be caused by a different ConfD release - what release are you using? But in either case, I’m afraid you can’t get exactly what you are trying to do:

  • the module system-settings depends on openconfig-system since it augments it;
  • by adding the annotation to /system/dns/servers/server you make openconfig-system depend on system-settings.

So you have a circular dependency and confdc should refuse this - maybe in your release it is not able to detect it properly in compile time and fails in runtime.

But you should be able to do it the other way round - add your must statement to the disable-ipv6 leaf instead, either directly (the module is under your control, I believe) or through an annotation; if I understand what you are trying to achieve, it may look like this:

    leaf ipv6-disable {
      type boolean;
      default false;
      must "not(. = 'true' and
        /oc-sys:system/oc-sys:dns/oc-sys:servers/oc-sys:server[contains(oc-sys:address, ':')])" {
        error-message "no IPv6 servers, sorry";
      }
    }

Thanks @mvf
I will check the solution you proposed.
Initially I thought of trying this way, but I have few other configurations which require these checks. So created a new annotation file.
Will check this once.

Hi @mvf ,

In continuation to this question,
Now i subscribed for any changes in enabled leaf after adding must conditions. I am expecting my callback to be called on changing this parameter. But callback is getting called even if do any changes for those configuration which i added as must other than enabled. Is that possible or am i doing some thing wrong?

For example, if i change DNS configuration, callback is called although i subscribed only for enabled.

Yes, it looks like dependencies implicitly created by must or the like can cause that subscriptions are triggered even if the node subscribed to has not changed. But:

  • Is that a problem? Subsequent calls to functions like cdb_get_modifications* or cdb_diff_iterate will filter that out; and checking the path that your callback is invoked with can only be recommended anyway.

  • You may affect that somehow by modifying the XPath expression. For instance, the expression I suggested you before seems to cause more irrelevant subscription triggers than this one:

    must "not(. = 'true'" +
       "and /oc-sys:system/oc-sys:dns/oc-sys:servers/oc-sys:server" +
       "/oc-sys:config/oc-sys:address[contains(., ':')])";
    

    Note that this expression and the previous one are equivalent, but now the part without the predicate addresses only the leaf; I guess that’s what counts.