-
Notifications
You must be signed in to change notification settings - Fork 73
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
[BUG] We need 'pure_address' use type for IP address validation #1831
Comments
We could follow
|
Why not use native python types? |
We are using native python types (and libraries) behind the scenes, but we also have to do data structure validation, and because I didn't want to go full-YANG, I wrote my own validator. That thing can validate (among other things) IPv4 and IPv6 addresses and prefixes, but you have to specify how you plan to use them -- prefixes can't have host bits, addresses can't have all-zero or all-one host bits. Then there's the option of having unnumbered interface addresses and specifying interface IP address as int (offset in subnet), whereas these same options are not valid for an IPv4/IPv6 address used as a next hop in a static route. |
Oh, so these are just types that you're using for validation? I missed that. I was responding to the last message in the thread. Sorry |
Add more granular IPv4/IPv6 attribute uses: * Address and prefix * Host and subnet prefix * Interface address and ID Also: replace netaddr module with built-in ipaddress in data/types.py Closes #1831
Add more granular IPv4/IPv6 attribute uses: * Address and prefix * Host and subnet prefix * Interface address and ID Also: replace netaddr module with built-in ipaddress in data/types.py Closes ipspace#1831
Next hops in static routes are another example of IP addresses that cannot be prefixes and cannot take int or bool values. Looks like we have to differentiate between 'subnet_address' (which can be int or bool) and 'address' (which must be a string but without the prefix length).
I will try to change all current validation definitions to use 'subnet_address', and use 'address' for real IP addresses. This seems cleaner than inventing another 'really_an_address' keyword.
The text was updated successfully, but these errors were encountered: