ConfD User Community

Reg must constraint


we need to define a constraint like, if the destination is v4, then next-hop should not be v6 vice versa.

In the must constraint, can we give the typedef name for the string pattern to be matched ? what i am looking for is, definitions of (regex for ) ipv4-address/prefix(same with v6) are present in type defed. can we use these directly or need to repeat every occurrence in the must.



No, you can’t use a must expression that would verify the actual type used in a union-typed leaf. But in your case you do not have to use the full ipv4/ipv6 regex expressions; I think simple check for ":" in the IP address string is enough to determine the type (unless I’m wrong, every IPv6 address contains colon, no IPv4 address contains colon). Would that work for you?