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
597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 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 | |
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
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 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 | |
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) |