MAC Adress Data Type
A mac_address data type tests data for being an instance of
python's built-in class str and if it represents a MAC address (EUI-48).
Features/Limitations
- Validate MAC notation
- Validate MAC format
- Supports MAC format conversion
- Validate MAC specific attributes
- Validate against allowed and not allowed MAC addresses
- Supports Referencing Feature
MAC Adress Definition Syntax
Table
| Key/Option | Type | Default Value | Restrictions | Description |
|---|---|---|---|---|
| type | str |
'mac_address' | ||
| description | str |
Data type description | ||
| default_value | Must match data type's type(s) | Value used to set as default value | ||
| allowed_ranges | list[dict] |
min length: 1 | Value must be within defined ranges | |
| - start | str |
required | ||
| end | str |
required | ||
| not_allowed_ranges | list[dict] |
Value mustn't be within defined ranges | ||
| - start | str |
required | ||
| end | str |
required | ||
| allowed_values | list |
Data must match one of these values | ||
| - < value > | str |
Must match data type's type(s) | ||
| not_allowed_values | list |
Data mustn't match all of these values | ||
| - < value > | str |
Must match data type's type(s) | ||
| notation | enum |
canonical | allowed_values: - canonical - bit-reversed |
Canonical is used in i.e. Ethernet Bit-reversed is used i.e. in Token Ring |
| format | enum |
allowed_values: - EUI-48 - colon-separated - dot-separated - HEX-12 |
- EUI-48 example: 01-01-01-aa-bb-cc - colon-separated example: 01:01:01:aa:bb:cc - dot-separated example: 0101.01aa.bbcc - HEX-12 example: 010101aabbcc |
|
| formats | list[enum] |
excludes: format | ||
| - < format > | enum |
allowed_values: - EUI-48 - colon-separated - dot-separated - HEX-12 |
- EUI-48 example: 01-01-01-aa-bb-cc - colon-separated example: 01:01:01:aa:bb:cc - dot-separated example: 0101.01aa.bbcc - HEX-12 example: 010101aabbcc |
|
| uaa | bool |
MAC address must be universally (true) or locally (false) administered | ||
| group | bool |
MAC address must be a group (true) or a unicast (false) address | ||
| convert_notation | bool |
False |
||
| convert_to_format | enum |
allowed_values: - EUI-48 - colon-separated - dot-separated - HEX-12 |
||
| template | str |
must be definded in schema | Merge options from this template | |
| template_merge_options | dict |
Define schema-global template merge instructions | ||
| recursive | bool |
True |
Merge data type definition options in template options recursively. If false, data type defintion options overwrites template options. |
|
| list_merge | str |
append_rp | Allowed values: - append - append_rp - prepend - prepend_rp - replace |
How lists within options data should be merged. |
| reference | dict|str |
|||
| option 1 | str |
Reference keys (implies unique global mode) | ||
| option 2 | dict |
|||
| key | str |
required | ||
| mode | str |
Allowed values: - unique - producer - consumer |
||
| unique_scope | str |
Allowed values: - global - namespace |
||
| producer_scope | str |
Allowed values: - global - namespace |
||
| consumer_scope | str |
Allowed values: - global - namespace |
||
| allow_orphan_producer | bool |
True |
||
| credit | int |
1 (if mode consumer) | min: 0 | |
| references | list[dict|str] |
|||
| - |
dict|str |
|||
| option 1 | str |
Reference keys (implies unique global mode) | ||
| option 2 | dict |
|||
| key | str |
required | ||
| mode | str |
Allowed values: - unique - producer - consumer |
||
| unique_scope | str |
Allowed values: - global - namespace |
||
| producer_scope | str |
Allowed values: - global - namespace |
||
| consumer_scope | str |
Allowed values: - global - namespace |
||
| allow_orphan_producer | bool |
True |
||
| credit | int |
1 (if mode consumer) | min: 0 | |
| doc_value_name | str |
Set value name for documentation |
YAML
type: mac_address
description: <str>
default_value: <default_value>
allowed_ranges:
- start: <str>
end: <str>
not_allowed_ranges:
- start: <str>
end: <str>
allowed_values:
- <str>
not_allowed_values:
- <str>
notation: <canonical|bit-reversed>
format: <EUI-48|colon-separated|dot-separated|HEX-12>
formats:
- <EUI-48|colon-separated|dot-separated|HEX-12>
uaa: <true|false>
group: <true|false>
convert_notation: <true|false>
convert_to_format: <EUI-48|colon-separated|dot-separated|HEX-12>
template: <str>
template_merge_options:
recursive: <true|false>
list_merge: <append|append_rp|prepend|prepend_rp|replace>
reference: <reference_definition>
# Multitype!!!
<str>
# or:
key: <str>
mode: <unique|producer|consumer>
unique_scope: <global|namespace>
producer_scope: <global|namespace>
consumer_scope: <global|namespace>
allow_orphan_producer: <true|false>
credits: <int>
references:
- <reference_definition>
# Multitype!!!
<str>
# or
key: <str>
mode: <unique|producer|consumer>
unique_scope: <global|namespace>
producer_scope: <global|namespace>
consumer_scope: <global|namespace>
allow_orphan_producer: <true|false>
credits: <int>
doc_value_name: <str>
Example
type: mac_address
description: "Example mac_address definition"
default_value: "00:00:02:aa:bb:cc"
notation: canonical
formats:
- EUI_48
- dot-separated
uaa: true
group: false
convert_notation: bit-reversed
convert_to_format: colon-separated
not_allowed_values:
- 04-01-01-ff-ff-ff
reference: ref_key