Must statement fails

Hi,

In my module I have the following definition:

        container private-as-handling {
        must "../../peer-group[peer-group-name=current()]/peer-parameters/peer-type ='EXTERNAL'";
            description "private AS in AS_PATH treatment: replacing,removing or doing nothing";
            leaf enable {
                description "enable or disable handling of private AS";
                type boolean;
                default false;
            }
            leaf remove-private-as {
                type eci-bgp-types:remove-private-as-option;
                description
                "Remove or replace private AS numbers from updates sent to peers.";
            }
        }
        leaf minimum-advertisement-interval {
            type int32 {
                range "1..3600";
            }
        must "../../peer-group[peer-group-name=current()]/peer-parameters/peer-type ='EXTERNAL'";
            default 30;

I don’t set the container private-as-handling nor the leaf minimum-advertisement-interval and I am using peer-type == INTERNAL.
I suspect that the problem is that confd sets these container & leaf by default to default values and therefore the must statement fails:

Aborted: ‘routing control-plane-protocols control-plane-protocol bgp master bgp peer-groups peer-group ibgp minimum-advertisement-interval’ (value “30”): the ‘must’ expression “…/…/peer-group[peer-group-name=current()]/peer-parameters/peer-type =‘EXTERNAL’” failed

Is there any solution for that?

Thanks,

Evyatar Wiesel

Since you are not using a “when” statement here, I assume you want the “must” statement’s XPath expression to be valid if the leaf value matches the default value. Then try something like:

must ". =  30 or ../../peer-group[peer-group-name=current()]/peer-parameters/peer-type ='EXTERNAL'";

Hi,

I would like the must statement to be valid only in case user set this value.
If user didn’t set minimum-advertisement-interval the validation should be true.

Thanks,
Evyatar