-
Notifications
You must be signed in to change notification settings - Fork 0
Description
mac-address in both IETF and IEEE yang is defined as a string.
The canonical representations are not the same.
IETF Format: pattern '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}’;
Canonical representation is documented as: "lowercase characters, and equivalent to MacAddress in SMIv2".
IEEE Format: pattern "[0-9a-fA-F]{2}(-[0-9a-fA-F]{2}){5}";
Canonical representation is documented as: "uses uppercase characters".
More information found:
2025-11-mac-address.pdf
Bottom Line: When a pattern has options, provide a way to indicate the canonical form, so that the end-user can follow the pattern, but be assured of what format will be used for string compare.
For example
typedef mac-address {
type string {
pattern '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}';
canonical '[0-9a-f]{6}';
}
Would indicate that whatever the string was, the comparison will be based off of the value as formatted with no ":" and in lower-case.
This would allow both the IETF and IEEE mac-address definitions to be updated and then they could be compared.