AVD transforms
Documents the transform implementations. To view artifacts as an operator, see Viewing Artifacts.
Four Python transforms turn the data produced by the two-phase pipeline into user-facing artifacts. All four are registered in .infrahub.yml.
The *_query.py files referenced below are generated from their matching .gql and the checked-in schema.graphql via infrahubctl graphql generate-return-types. Do not hand-edit them. See Transforms → Query Classes for the regeneration command.
| Transform | Target group | Content type | Wraps |
|---|---|---|---|
avd_eos_config | avd_devices | text/plain | pyavd.get_device_config() |
avd_device_doc | avd_devices | text/markdown | PyAVD device documentation |
avd_fabric_doc | fabrics | text/markdown | pyavd.get_fabric_documentation() |
avd_anta_catalog | avd_devices | application/yaml | pyavd.get_device_test_catalog() |
avd_eos_config​
Class: AvdEosConfigTransform
Source: transforms/avd_eos_config.py
Query: transforms/avd_device_config.gql
Pydantic model: transforms/avd_device_config_query.py
Renders a single device's Arista EOS CLI configuration.
Flow:
- Query resolves the target device and navigates to
AvdArtifact.structured_config_file. - Transform fetches the structured-config JSON from the
AvdStructuredConfigFile(aCoreFileObject). - Calls
pyavd.get_device_config(structured_config). - Returns the EOS CLI text.
If structured_config_file is missing or empty, the transform returns a user-readable "No structured config available" message rather than crashing — see Debugging the Pipeline for the diagnostic flow.
avd_device_doc​
Class: AvdDeviceDocTransform
Source: transforms/avd_device_doc.py
Query: transforms/avd_device_config.gql (reused)
Pydantic model: transforms/avd_device_config_query.py
Renders per-device markdown documentation.
Flow:
- Same query as
avd_eos_config— resolves device and its structured config. - Calls the PyAVD device documentation function on the structured config.
- Returns markdown.
avd_fabric_doc​
Class: AvdFabricDocTransform
Source: transforms/avd_fabric_doc.py
Query: transforms/avd_fabric_devices.gql
Pydantic model: transforms/avd_fabric_devices_query.py
Renders fabric-wide markdown documentation covering the full topology.
Flow:
- Query resolves the fabric and walks to every device in its pods and racks.
- Transform fetches hostvars and structured config files for all devices.
- Calls
pyavd.get_avd_facts(all_hostvars)to build the shared facts. - Calls
pyavd.get_fabric_documentation(avd_facts, structured_configs, fabric_name). - Returns markdown.
Fabric documentation requires hostvars to be present for every device in the fabric. If any device has no hostvars, the transform fails the artifact generation with a message naming the missing devices.
avd_anta_catalog​
Class: AvdAntaCatalogTransform
Source: transforms/avd_anta_catalog.py
Query: transforms/avd_anta_catalog.gql
Pydantic model: transforms/avd_anta_catalog_query.py
Renders a per-device ANTA test catalog as YAML.
Flow:
- Query resolves the
targetdevice and every device in the graph, so siblings can be filtered by fabric in the transform. The device's fabric ispod.parent, a discriminated union — only aNetworkFabricparent has thenameandanta_enabledfields the gating needs. - If the fabric has
anta_enabledunset or false, return a marker comment and stop. - Download each same-fabric device's structured config, passing it through
pyavd.validate_structured_config(). - Build one
AVDFabricDatafrom all of them — catalog generation is fabric-wide, unlike EOS config rendering. - Call
pyavd.get_device_test_catalog(hostname, target_structured_config, fabric_data)and dump it as YAML.
Every "cannot render" path returns a comment rather than raising, so the artifact always renders and states the reason:
# ANTA disabled for fabric Fabric-L3LS-Multi-Domain
# No structured config for leaf-infrahub-dc1-1
# ANTA catalog: no fabric for leaf-infrahub-dc1-1
Registration in .infrahub.yml​
python_transforms:
- name: avd_eos_config
class_name: AvdEosConfigTransform
file_path: "./transforms/avd_eos_config.py"
- name: avd_fabric_doc
class_name: AvdFabricDocTransform
file_path: "./transforms/avd_fabric_doc.py"
- name: avd_device_doc
class_name: AvdDeviceDocTransform
file_path: "./transforms/avd_device_doc.py"
- name: avd_anta_catalog
class_name: AvdAntaCatalogTransform
file_path: "./transforms/avd_anta_catalog.py"
artifact_definitions:
- name: avd_eos_configuration
targets: avd_devices
transformation: avd_eos_config
- name: avd_fabric_documentation
targets: fabrics
transformation: avd_fabric_doc
- name: avd_device_documentation
targets: avd_devices
transformation: avd_device_doc
- name: avd_anta_catalog
targets: avd_devices
transformation: avd_anta_catalog
content_type: application/yaml
Other transforms​
The repository also ships transforms outside the AVD pipeline — the cabling-plan CSV, computed interface descriptions, the ContainerLab topology, and the CloudVision webhook payload. They are documented in Transforms.
Adding a new transform​
See Extending the Pipeline → Adding a new transform output.