How allow delete property only together with another property

I want container status which can exist only if it has set two properties (leaf state and leaf value). So I add must statement to the container: must 'not(.) or (./state and ./value)'. But now I can’t delete this container with no status. How I can allow the deletion of the container?

container status {
    must 'not(.) or (./state and ./value)' {
        error-message "State and Value must be set";
    }
    leaf state {
        type int32;
    }
    leaf value {
        type int32;
    }
}

From your description (so far) I would do something like this:

container status {
    presence "";
    leaf state {
        type int32;
        mandatory true;
    }
    leaf value {
        type int32;
        mandatory true;
    }
}
1 Like

After reading what you want to do one more time, it seems like you can skip the “presence” part of the container:

container status {
    leaf state {
        type int32;
        mandatory true;
    }
    leaf value {
        type int32;
        mandatory true;
    }
}