Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tolerance percentage to validate #1813

Merged

Conversation

sjhloco
Copy link
Contributor

@sjhloco sjhloco commented Dec 13, 2022

This pr adds the ability to validate based on a percentage tolerance either side of the specified value (useful for BGP prefixes). I was trying to keep it as close to existing operators ("<d", ">d", "d<->d"), in the end came up with "t%d". The logic behind it is that a tolerance of "t percent of d" is allowed either side of the value of d. For example "10%100" would be 10% of 100, so a value between 90 and 110 is accepted. I didnt really want to use a % sign but couldn't think of a better way to represent this. Have done tests and docs that I could find, let me know if need anything else.

@mirceaulinic mirceaulinic added this to the 5.0.0 milestone Mar 21, 2024
Copy link
Member

@mirceaulinic mirceaulinic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool!

@mirceaulinic mirceaulinic merged commit f7dbc1c into napalm-automation:develop Mar 21, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants