That's a really weird error message:-) - it should presumably say "leaf", not "container". This is probably not the best place to look for pyang support (out of curiosity, why are you using it?), but using
confdc, you should (unless you're using an ancient version) instead get an error like
the node 'isis-protocol-instance' from module 'ietf-routing' (in node 'control-plane-protocol' from 'ietf-routing') is not found. Maybe not a whole lot better, but at least it avoids claiming that isis-protocol-instance should be a container:-) - and gives an important hint:
'isis-protocol-instance' from module 'ietf-routing'.
unique statement is interpreted in the context of the deviated module - just as if it had actually been defined in ietf-routing. And in that context, isis-protocol-instance must be prefixed with the prefix of the module where it is defined, i.e. the module you are quoting the
augment statement from. And there is an additional problem, that you're already on to: isis-protocol-instance is not a child of the control-plane-protocol list, but of the 'isis' container augmented from ietf-isis, which thus needs to be included in the
unique argument - i.e. it should be
unique "name isis:isis/<your-module-prefix>:isis-protocol-instance";`
confdc gives you a brand new error:
deviation causes circular dependency between ietf-isis.yang and ./ietf-routing.yang - and it's true: ietf-isis depends on ietf-routing since it augments ietf-routing, and your
unique statement makes ietf-routing depend on ietf-isis, since it references a node from ietf-isis - and such circular dependencies are forbidden by the YANG spec. (There is actually also a circular dependency between your module and ietf-routing, since your module effectively augments ietf-routing, and the
unique statement also references the isis-protocol-instance node from your module.)
Unfortunately I can't see a way to achieve what you want using YANG alone - perhaps you could instead of deviate-adding the
unique annotate a
tailf:validate statement, and check the uniqueness in the validation callback. Or perhaps you can come up with a different modeling, that avoids the circular dependency.