-
-
Notifications
You must be signed in to change notification settings - Fork 96
Expand subnet value predicates #1373
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a problem with the current implementation.
Instead of expanding just value predicates, it expands any expression :subnet == <subnet>
, making it impossible to query just for subnets by equality.
In a call with @mavam we discussed two possible options:
- Move the expansion into the parser.
- Make value predicates valid predicates, i.e., don't expand them during parsing at all.
The second one would be a larger refactoring, so we'll likely opt for the first. The documentation should be rewritten accordingly to make clear this only affects value predicates.
Previously, we used to perform this inside the predicate parser. However, this makes it impossible to understand whether value predicate expansion occurred already during expression parsing. By hositing the expansion procedure, we can now perform more powerful expansions that result in multiple predicates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some nits. I ran this locally and it works fine on my end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved modulo some minor fixups.
📔 Description
This PR expands value predicates of type
subnet
as follows: given a subnetS
, the parser expands it to:subnet == S
and the normalization then further to:subnet == S || :addr in S
.📝 Checklist
🎯 Review Instructions
File by file.