Augment on notification

Hi,

Is it possible to define a generic notification in one yang model and the augment on more data conditionally?

the thing I’m trying to achieve is to have a leaf ref in the notification that references different parts of our yang models depending on some data in the notification.

I have

notification general-notification{
leaf name {…}
//some general data
}

//foo.yang
augment “general-notification”{
when “name = ‘foo’”{
leaf index{
type leafref { path “somewhere/foo” }
}
// add more stuff?
}
}

//bar.yang
augment “general-notification”{
when “name = ‘bar’”{
leaf index{
type leafref { path “somewhereelse/bar” }
}
// add more stuff?
}
}

When I populate the data in the “struct confd_cs_node” I see the namespaces but I don’t know which one of the “index” noeds to populate.

Can I see the “when” condition in runtime soo I can populate the correct index node without duplicate the when logic in code?