08-19-2020 09:35 AM - edited 08-19-2020 10:38 AM
Hi all,
I have a yang with a leaf that will contain a mac-address. There is in the requirement the min and max values that can be accepted ex:
min: 0000.0000.0001
max: ffff.ffff.ffff
I looked on the tailf_yang_extensions documentation and didn't find anything.
Is there a way to validate this information?
Thank's in advance!
Solved! Go to Solution.
08-19-2020 10:47 AM
I have a yang with a leaf that will contain a mac-address. There is in the requirement the min and max values that can be accepted ex:
min: 0000.0000.0001
max: ffff.ffff.ffff
I don't recognize this format. There is a built-in type called 'mac-address' defined in ietf-yang-types.yang - it is a list of octets - a typical value looks like 'aa:bb:cc:dd:ee:ff'. It is defined as
typedef mac-address { type string { pattern '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'; } }
If you want to restrict such a value, you can define your own type with an appropriate pattern. For example, if you want the values to start with 'de', you can do
typedef my-mac-address { type string { pattern 'de:[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){4}'; } }
/Ram
08-19-2020 10:47 AM
I have a yang with a leaf that will contain a mac-address. There is in the requirement the min and max values that can be accepted ex:
min: 0000.0000.0001
max: ffff.ffff.ffff
I don't recognize this format. There is a built-in type called 'mac-address' defined in ietf-yang-types.yang - it is a list of octets - a typical value looks like 'aa:bb:cc:dd:ee:ff'. It is defined as
typedef mac-address { type string { pattern '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'; } }
If you want to restrict such a value, you can define your own type with an appropriate pattern. For example, if you want the values to start with 'de', you can do
typedef my-mac-address { type string { pattern 'de:[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){4}'; } }
/Ram
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide