I would like to assign different default value to a leaf according to type of key the list entries take. as an example, although not correct:
typedef type-id {
type enumeration {
enum a{
value 1;
}
enum b{
value 2;
}
enum c{
value 3;
}
}
}
list domain {
key id;
leaf id {
type type-id;
}
leaf my-leaf {
when "../id = 'a'"{
default 10;
}
when "../id = 'b'"{
default 20;
}
when "../id = 'c'"{
default 20;
}
}
}
So let say there are two entries for the list and the corresponding keys are 'a' and 'c' When I walk through the model I would like to have values as
domain id my-leaf
'a' 10
'c' 30
Which expression is the best solution for this purpose? How can I model such a structure?