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 API endpoint for BGP announce set modification #6024

Merged
merged 8 commits into from
Jul 10, 2024
Merged

Conversation

rcgoodfellow
Copy link
Contributor

Fixes #6022

@rcgoodfellow rcgoodfellow marked this pull request as ready for review July 9, 2024 06:49
@rcgoodfellow
Copy link
Contributor Author

Basic testing performed in a4x2 and things work as expected.

@david-crespo
Copy link
Contributor

What's the difference between create and update if they take the same body?

@rcgoodfellow
Copy link
Contributor Author

What's the difference between create and update if they take the same body?

  • If the announce set does not exist, nothing.
  • If the announce set exists, but is empty, nothing.
  • If the announce set exists, and the update is purely additive, nothing.
  • If the announce set exists, and the update is not purely additive, then create will not remove existing entries, but update will.

More concisely, the update is a complete specification, and the announce set will match the request payload exactly on successful return, whereas a create can only add entries. I think for create, we may want to consider returning an error code if the announce set already exists.

@david-crespo
Copy link
Contributor

david-crespo commented Jul 9, 2024

Ok. I think that should be added as a description in the doc comment on each endpoint. Something like "Replaces existing announce set with the one specified." and "Adds new entries but does not modify existing ones." That mostly solves the issue in the following musings, so take them however you want.

The names update and create are a little counterintuitive to me for these operations — update less so than create. Update here works similarly to updating a project or whatever: you expect the state after the request to match what you passed in. "Create" is worse because when I see "create set" I expect it to create a set, not union the existing set with what I pass in.

Erroring if the set already exists would fix that, but that also means create becomes a special case of update for when there is no existing set, which makes me wonder whether we really need both. It seems like we could do ok with just update. That's the model we follow for firewall rules, though I admit it's kind of a pain and requires shenanigans in the client to simulate adding one rule at a time.

@rcgoodfellow
Copy link
Contributor Author

Something like "Replaces existing announce set with the one specified."

Done

It seems like we could do ok with just update

So say we all.

@morlandi7 morlandi7 added this to the 9 milestone Jul 10, 2024
@rcgoodfellow rcgoodfellow enabled auto-merge (squash) July 10, 2024 17:05
@rcgoodfellow rcgoodfellow merged commit 5671cd5 into main Jul 10, 2024
22 checks passed
@rcgoodfellow rcgoodfellow deleted the issue-6022 branch July 10, 2024 18:04
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.

Cannot modify BGP announce sets
3 participants