4-Byte Value Data Type
A 4byte_value data type tests data for being an instance of
python's built-in class int or str and if it represents a 4-Byte value.
Features/Limitations
- Validate integer value
- Validate string in colon-separated format
- Validate string in different dot-separated formats
- Validate hexadecimal string
- Supports format conversion
- Validate minimal and maximal value
- Validate against allowed and not allowed value ranges
- Validate against allowed and not allowed values
- Supports Referencing Feature
4-Byte Value Definition Syntax
Table
| Key/Option | Type | Default Value | Restrictions | Description |
|---|---|---|---|---|
| type | str |
'4byte_value' | ||
| description | str |
Data type description | ||
| default_value | Must match data type's type(s) | Value used to set as default value | ||
| convert_to | str |
Allowed values: - float - int - str |
||
| minimum | int|str |
Value must be greater or equal | ||
| maximum | int|str |
>= 'minimum' | Value must be lower or equal | |
| allowed_ranges | list[dict] |
min length: 1 | Value must be within defined ranges | |
| - start | int|str |
required | ||
| end | int|str |
required | ||
| not_allowed_ranges | list[dict] |
Value mustn't be within defined ranges | ||
| - start | int|str |
required | ||
| end | int|str |
required | ||
| allowed_values | list |
Data must match one of these values | ||
| - < value > | int|str |
Must match data type's type(s) | ||
| not_allowed_values | list |
Data mustn't match all of these values | ||
| - < value > | int|str |
Must match data type's type(s) | ||
| formats | list[enum] |
|||
| - < format > | enum |
allowed_values: - int - 1-dot-separated - 3-dot-separated - colon-separated - hex |
- int example: 101202 - 1-dot-separated example: 123.12 - 3-dot-separated example: 10.1.0.255 - colon-separated example: 123:12 - hex example: 0x1f23a |
|
| convert_to_format | enum |
allowed_values: - 1-dot-separated - 3-dot-separated - colon-separated - hex |
||
| 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: 4byte_value
description: <str>
default_value: <default_value>
convert_to: <float|int|str>
maximum: <int|str>
minimum: <int|str>
allowed_ranges:
- start: <int|str>
end: <int|str>
not_allowed_ranges:
- start: <int|str>
end: <int|str>
allowed_values:
- <int|str>
not_allowed_values:
- <int|str>
format: <int|colon-separated|hex>
convert_to_format: <colon-separated|hex>
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: 4byte_value
description: "Example 4byte_value definition"
default_value: "0:123"
formats:
- colon-separated
- 3-dot-separated
- hex
- int
convert_to_format: hex
not_allowed_values:
- 111
- 1:1
- 0xff
- 192.168.1.1
reference: ref_key