avd icon indicating copy to clipboard operation
avd copied to clipboard

Validate user input

Open melkypie opened this issue 2 years ago • 7 comments

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

melkypie avatar Nov 17 '21 06:11 melkypie

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.

ccsnw avatar Nov 18 '21 03:11 ccsnw

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

github-actions[bot] avatar Feb 17 '22 00:02 github-actions[bot]

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.

ClausHolbechArista avatar Feb 17 '22 08:02 ClausHolbechArista

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

github-actions[bot] avatar Jul 26 '22 00:07 github-actions[bot]

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

github-actions[bot] avatar Nov 11 '22 00:11 github-actions[bot]

Requires formats - #2385

gmuloc avatar Sep 04 '23 15:09 gmuloc

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

github-actions[bot] avatar Apr 25 '24 00:04 github-actions[bot]