-
Notifications
You must be signed in to change notification settings - Fork 5
Add session shutdown logic to controller when drained #2573
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
base: main
Are you sure you want to change the base?
Add session shutdown logic to controller when drained #2573
Conversation
54c9c78 to
9779824
Compare
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.
Pull request overview
This PR implements device maintenance workflow by adding session shutdown logic when a device status is set to "Drained". It introduces a new DeviceStatusDrained state and modifies the controller template to automatically shut down BGP sessions, MSDP neighbors, and ISIS routing when a device enters this maintenance state.
- Added
DeviceStatusDrainedstatus constant to the device status enumeration - Modified
tunnel.tmplto conditionally shutdown routing protocols (BGP, MSDP, ISIS) when device status is "drained" - Added comprehensive test coverage with fixture file to verify drained device configuration
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| smartcontract/sdk/go/serviceability/state.go | Adds new DeviceStatusDrained constant and string representation |
| controlplane/controller/internal/controller/templates/tunnel.tmpl | Implements conditional shutdown logic for routing protocols based on device status |
| controlplane/controller/internal/controller/render_test.go | Adds test case for drained device configuration rendering |
| controlplane/controller/internal/controller/fixtures/base.config.drained.txt | Provides expected output fixture for drained device test |
| CHANGELOG.md | Documents the new feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
controlplane/controller/internal/controller/templates/tunnel.tmpl
Outdated
Show resolved
Hide resolved
controlplane/controller/internal/controller/templates/tunnel.tmpl
Outdated
Show resolved
Hide resolved
controlplane/controller/internal/controller/templates/tunnel.tmpl
Outdated
Show resolved
Hide resolved
controlplane/controller/internal/controller/templates/tunnel.tmpl
Outdated
Show resolved
Hide resolved
controlplane/controller/internal/controller/templates/tunnel.tmpl
Outdated
Show resolved
Hide resolved
controlplane/controller/internal/controller/templates/tunnel.tmpl
Outdated
Show resolved
Hide resolved
059db68 to
1a54fec
Compare
|
@martinsander00 - what happens when a device becomes active again? From what I can tell from the code, there is no logic to run |
I believe the "no router msdp" should take care of this for msdp, but the same issue exists for the isis overload bit, we need to add "no router isis" to handle that. Also it would be good to un-drain the device in the e2e test to prove it works. |
| no shutdown | ||
| ! | ||
| {{ if eq $.Device.Status.String "hard-drained" }} set-overload-bit | ||
| {{ 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.
Can you put the ! on its own line to make it more readable? Also I think there's an extra space before "set-overload-bit".
{{ if eq $.Device.Status.String "hard-drained" }} set-overload-bit
{{ end }}
!
@martinsander00 note that we can't do the same 'no router bgp` as we don't fully own the configuration for BGP i.e. the contributor often adds their own configuration. |
60723c1 to
fb9ff1e
Compare
fb9ff1e to
8276e61
Compare
Resolves: #2485
Summary of Changes
tunnel.tmplthat shuts down user BGP, IBGP sessions, MSDP neighbors, and ISIS whendevice.statusisDrainedTesting Verification
render_drained_device_config_successfullythat verifies shutdown commands are included in rendered config when device status is Drained