-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 built-in functions to perform CIDR math #897
Comments
Yep, add the declaration to ast/builtins.go like the rest and the put the implementation inside topdown. If you'd like to upstream this that would be awesome. If you can implement it on top of the Go standard library (instead of pulling in a thirdparty library) that would be ideal. |
stdlib over everything, I don't think supernet is supported by stdlib though, but I'll make sure to verify first! |
What and where should I add tests for that? |
Take a look at topdown/aggregates_test.go for an example. You can copy that structure more or less.
This will execute the test case in a subtest. The test will invoke the the rule For these, it should be enough to test the different branches. No overlap, x superset of y, y superset of x, etc. Also, please add a section to the language reference docs so that we can refer to these and link people to them. |
This patch adds a new built-in `net.cidr_overlap`. See open-policy-agent#897 Signed-off-by: arekkas <[email protected]>
This patch adds a new built-in `net.cidr_overlap`. See #897 Signed-off-by: arekkas <[email protected]>
Closing this now that #959 is merged. We can revisit other cidr built-ins as needed. |
Admission control policies that constrain the attributes of network policies are an obvious use case for OPA. To improve the user experience for policy authors, we should add built-in functions to perform CIDR math.
For example:
The text was updated successfully, but these errors were encountered: