pyavd¶
Warning
pyavd is still in the development phase. Please do not use.
Functions overview¶
Installation¶
Requirements (automatically installed with above command)
Reference¶
validate_inputs(inputs)
¶
Validate input variables according to the eos_designs
schema as documented on avd.arista.com.
Where supported by the schema, types will be auto type-converted like from “int” to “str”.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inputs |
dict
|
Dictionary with inputs for “eos_designs”. |
required |
Returns:
Type | Description |
---|---|
ValidationResult
|
Instance of ValidationResult, where “failed” is True if data is not valid according to the schema and “errors” is a list of AvdValidationErrors containing schema violations. |
Source code in python-avd/pyavd/validate_inputs.py
get_avd_facts(all_inputs)
¶
Build avd_facts using the AVD eos_designs_facts logic.
Variables should be converted and validated according to AVD eos_designs
schema first using pyavd.validate_inputs
.
Note! No support for inline templating or jinja templates for descriptions or ip addressing
Parameters:
Returns:
Source code in python-avd/pyavd/get_avd_facts.py
get_device_structured_config(hostname, inputs, avd_facts)
¶
Build and return the AVD structured configuration for one device.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hostname |
str
|
Hostname of device. |
required |
inputs |
dict
|
Dictionary with inputs for “eos_designs”.
Variables should be converted and validated according to AVD |
required |
avd_facts |
dict
|
Dictionary of avd_facts as returned from |
required |
Returns:
Type | Description |
---|---|
dict
|
Device Structured Configuration as a dictionary |
Source code in python-avd/pyavd/get_device_structured_config.py
validate_structured_config(structured_config)
¶
Validate structured config according the eos_cli_config_gen
schema as documented on avd.arista.com.
Where supported by the schema, types will be auto type-converted like from “int” to “str”.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
structured_config |
dict
|
Dictionary with structured configuration. |
required |
Returns:
Type | Description |
---|---|
ValidationResult
|
Instance of ValidationResult, where “failed” is True if data is not valid according to the schema and “errors” is a list of AvdValidationErrors containing schema violations. |
Source code in python-avd/pyavd/validate_structured_config.py
get_device_config(structured_config)
¶
Render and return the device configuration using AVD eos_cli_config_gen templates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
structured_config |
dict
|
Dictionary with structured configuration.
Variables should be converted and validated according to AVD |
required |
Returns:
Type | Description |
---|---|
str
|
Device configuration in EOS CLI format. |
Source code in python-avd/pyavd/get_device_config.py
get_device_doc(structured_config)
¶
Render and return the device documentation using AVD eos_cli_config_gen templates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
structured_config |
dict
|
Dictionary with structured configuration.
Variables should be converted and validated according to AVD |
required |
Returns:
Type | Description |
---|---|
str
|
Device documentation in Markdown format. |
Source code in python-avd/pyavd/get_device_doc.py
ValidationResult
¶
Object containing result of data validation
Attributes:
Name | Type | Description |
---|---|---|
failed |
bool
|
True if data is not valid according to the schema. Otherwise False. |
validation_errors |
list[AvdValidationError]
|
List of AvdValidationErrors containing schema violations. |