Generator
Generator Module¶
generator ¶
Configuration generation functionality.
This module provides functionality to generate device configurations, documentation, and test files from AVD inventory data.
ConfigurationGenerator ¶
Generator for device configurations.
This class handles generation of device configurations from AVD inventory data using py-avd library.
Examples:
>>> generator = ConfigurationGenerator()
>>> configs = generator.generate(inventory, output_path)
>>> print(f"Generated {len(configs)} configurations")
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workflow
|
str
|
Workflow type (‘eos-design’ or ‘cli-config’), by default “eos-design” |
'eos-design'
|
Source code in avd_cli/logics/generator.py
generate ¶
generate(
inventory: InventoryData,
output_path: Path,
device_filter: Optional[DeviceFilter] = None,
) -> List[Path]
Generate device configurations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inventory
|
InventoryData
|
Loaded inventory data (should contain ALL devices for proper AVD context) |
required |
output_path
|
Path
|
Output directory for generated configs |
required |
device_filter
|
Optional[DeviceFilter]
|
Filter to determine which devices to generate configs for, by default None. Note: All devices are used for avd_facts calculation, filter only affects which config files are written. |
None
|
Returns:
| Type | Description |
|---|---|
List[Path]
|
List of generated configuration file paths |
Raises:
| Type | Description |
|---|---|
ConfigurationGenerationError
|
If generation fails |
Source code in avd_cli/logics/generator.py
DocumentationGenerator ¶
Generator for device documentation.
This class handles generation of device documentation from AVD inventory data using py-avd library.
Source code in avd_cli/logics/generator.py
generate ¶
generate(
inventory: InventoryData,
output_path: Path,
device_filter: Optional[DeviceFilter] = None,
) -> List[Path]
Generate device documentation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inventory
|
InventoryData
|
Loaded inventory data (should contain ALL devices for proper AVD context) |
required |
output_path
|
Path
|
Output directory for generated docs |
required |
device_filter
|
Optional[DeviceFilter]
|
Filter to determine which devices to generate docs for, by default None. Note: All devices are used for avd_facts calculation, filter only affects which doc files are written. |
None
|
Returns:
| Type | Description |
|---|---|
List[Path]
|
List of generated documentation file paths |
Raises:
| Type | Description |
|---|---|
DocumentationGenerationError
|
If generation fails |
Source code in avd_cli/logics/generator.py
657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 | |
TestGenerator ¶
Generator for test files (ANTA).
This class handles generation of ANTA test files from AVD inventory data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
test_type
|
str
|
Test type (‘anta’ or ‘robot’), by default “anta” |
'anta'
|
Source code in avd_cli/logics/generator.py
generate ¶
generate(
inventory: InventoryData,
output_path: Path,
device_filter: Optional[DeviceFilter] = None,
) -> List[Path]
Generate test files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inventory
|
InventoryData
|
Loaded inventory data (should contain ALL devices for proper AVD context) |
required |
output_path
|
Path
|
Output directory for generated tests |
required |
device_filter
|
Optional[DeviceFilter]
|
Filter to determine which devices to generate tests for, by default None. Note: All devices are used for avd_facts calculation, filter only affects which test files are written. |
None
|
Returns:
| Type | Description |
|---|---|
List[Path]
|
List of generated test file paths |
Raises:
| Type | Description |
|---|---|
TestGenerationError
|
If generation fails |
Source code in avd_cli/logics/generator.py
1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 | |
generate_all ¶
generate_all(
inventory: InventoryData,
output_path: Path,
workflow: str = "eos-design",
device_filter: Optional[DeviceFilter] = None,
) -> Tuple[List[Path], List[Path], List[Path]]
Generate all outputs: configurations, documentation, and tests.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inventory
|
InventoryData
|
Loaded inventory data (should contain ALL devices for proper AVD context) |
required |
output_path
|
Path
|
Output directory for all generated files |
required |
workflow
|
str
|
Workflow type, by default “eos-design” |
'eos-design'
|
device_filter
|
Optional[DeviceFilter]
|
Filter to determine which devices to generate outputs for, by default None. Note: All devices are used for avd_facts calculation, filter only affects which output files are written. |
None
|
Returns:
| Type | Description |
|---|---|
Tuple[List[Path], List[Path], List[Path]]
|
Tuple of (config_files, doc_files, test_files) |