Commit 5df14ee
authored
bgp: remember to delete router from db (#516)
When the delete_router API endpoint was called, the router was not fully
being deleted. "mgadm bgp config router list" would still display a
router despite returning a 204 No Content indicating the operation was
successful:
```
[trey@zebes:~/git/maghemite on main]
% ./target/debug/mgadm bgp config router list
[
Router {
asn: 1,
graceful_shutdown: false,
id: 1,
listen: "[::]:179",
},
]
[trey@zebes:~/git/maghemite on main]
% ./target/debug/mgadm bgp config router delete 1
[trey@zebes:~/git/maghemite on main]
% ./target/debug/mgadm bgp config router list
[
Router {
asn: 1,
graceful_shutdown: false,
id: 1,
listen: "[::]:179",
},
]
```
This is because the API handler would remove the router from the
BgpContext struct, but not from the persistent sled db.
This change ensures the router is removed from the sled db, not just the
in-memory BgpContext data structure. Now the router gets deleted from
the sled db, and mgadm properly reflects the running state:
```
[trey@zebes:~/git/maghemite on trey/fix_router_del]
% ./target/debug/mgadm bgp config router list
[
Router {
asn: 1,
graceful_shutdown: false,
id: 1,
listen: "[::]:179",
},
]
[trey@zebes:~/git/maghemite on trey/fix_router_del]
% ./target/debug/mgadm bgp config router delete 1
[trey@zebes:~/git/maghemite on trey/fix_router_del]
% ./target/debug/mgadm bgp config router list
[]
```
Signed-off-by: Trey Aspelund <t.k.aspelund@gmail.com>1 parent 1732ed7 commit 5df14ee
1 file changed
+7
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
150 | 156 | | |
151 | 157 | | |
152 | 158 | | |
| |||
0 commit comments