avd
avd copied to clipboard
Validate user input
Enhancement summary
Currently you can enter anything you want in variables that require a prefix/subnet (ex. static_routes.destination_address_prefix
in tenants) (probably some other types too but this is the one I noticed). It would be great that when entering wrong values into a variable it would throw an error or at least a warning.
Which component of AVD is impacted
eos_designs
Use case example
Someone overlooks the fact that a prefix is needed but enters an IP address instead.
Describe the solution you would like
It could be done by either extending the current test plugin arista.avd.defined
to allow to test if the variable is a network (which would require wrapping every subnet value in an if
block) or add a new filter called arista.avd.validate
that could test the value against pre defined types or against a provided regex.
Describe alternatives you have considered
No response
Additional context
No response
Contributing Guide
- [X] I agree to follow this project's Code of Conduct
I think we could extend the plugin "defined.py" using pythons "ipaddress" module to create testing for additional custom var_types like "ipaddress" or "prefix".
This would simply add additional var_types to test for in arista.avd.defined.
Let me know if this is a fine way to go and I'll try to add it.
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 15 days
This will be addressed by schemas, so we validate the input data once, instead of having to validate inside the templates. I will assign this to myself, since I am working on that project.
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 15 days
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 15 days
Requires formats - #2385
This issue is stale because it has been open 90 days with no activity. The issue will be reviewed by a maintainer and may be closed