container choice_demo {
choice choice_option {
case add_update_case {
leaf add {
mandatory true;
type string;
}
leaf update{
type string;
}
}
case del_case {
leaf del {
mandatory true;
type string;
}
}
} // end of choice_option_2
}
Here I wanted a choice between add_update and delete. But in add_update I have add as mandatory param and update as optional. But it is possible to give only update in the add_update choice. Somehow add is not becoming mandatory in that choice statement.
Thanks. It does not allow on commit. But I wanted a mechanism to indicate clearly to user that update is optional but add is mandatory. Instead of prompting an error on commit.
I came to this option as I had a problem while writing the yang model:
Actual requirement - this works as it is not under ‘ínput’: