f-41: config, frr: base BGP pilotée par l'agent au démarrage #41

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-10-11 19:52:46 +02:00
commit bf0e83862f
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
12 changed files with 331 additions and 18 deletions

View file

@ -22,9 +22,26 @@ func (c *Client) ApplyBase(b Base) error {
if err := b.validate(); err != nil {
return err
}
running, err := c.runningConfig()
if err != nil {
return err
}
stale, err := b.staleReflectors(running)
if err != nil {
return err
}
if err := c.configure(b.commands()...); err != nil {
return err
}
if len(stale) > 0 {
cmds := []string{fmt.Sprintf("router bgp %d", b.ASN)}
for _, rr := range stale {
cmds = append(cmds, "no neighbor "+rr)
}
if err := c.configure(append(cmds, "exit")...); err != nil {
return err
}
}
return c.save()
}