In our existing code, we have mac-address lists where an entry can be an empty string “” which indicates that it matches any mac address. We also have IP lists. So you can have an IP + MAC to match against, or IP + any mac address==“”. I didn’t see a definitive answer on this and thought I’d ask.
I wanted to understand the capability of Yang to express this.
- I know one representation of this is the leaf not being present, but since they are correlated above with the IP address, that doesn’t work well.
- Is it possible to assign the value of “null string” to a string based value from the confd CLI? We could not figure out a way to enter it.
- What is the regex that will allow this. We did get a regex string that seemed to work with the compiler, but it did not allow the entry of “” as the value.
Here is the regex we are using:
typedef tolt-mac-address-or-empty {
type string {
pattern ‘([0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5})?’;
}
description
“MAC address in standard colon-separated format (e.g., 00:1A:2B:3C:4D:5E)
or an empty string.”;
}