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:
parent
94c2f82867
commit
bf0e83862f
12 changed files with 331 additions and 18 deletions
|
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue