ConfD User Community

Does Yang support "validate" like this?


#1

I am working in a project which has a yang schema like

    list group {
    list all-models {
       key model;
       leaf model {
           type system-model;
       }
    }

    container $model {
      ...
    }
    }

In this case, the type system-model is a customized defined type which is enum. Assuming enum includes : model_a, model_b, model_c.
Then the continer $model, the reason I used $model is because this container will be augmented from another yang files. So the “list group” may be (depends on how the external yang file augment to this “list group”)

    list group {
    list all-models {
       key model;
       leaf model {
           type system-model;
       }
    }

    container model_a {
      ...
    }

    container model_b {
      ...
    }
    }

Then in this case, the user can’t add “model_c” to list all-models since container “model_c” doesn’t exist in list group.
In this case, is there a way using yang syntax to validate ? If user want to add “model_c” into list all-models, the confd will report error to prevent user doing that.

Thanks in advance.


#2

I’m not sure if such possibility exists. The only thing that occurs to me is validation point in application.