Skip to content

Commit

Permalink
frontend; lack of bfd session logged for gateways with static+bfd
Browse files Browse the repository at this point in the history
BIRD removes a BFD session if the net devive hosting it becomes unavailable.
This might be misleading, as the status printouts won't indicate any of that,
while the related gateway will be considered down.
  • Loading branch information
zolug committed Feb 3, 2023
1 parent 643d843 commit c19b1d2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cmd/frontend/internal/bird/bird.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
"github.com/nordix/meridio/pkg/log"
)

var regexError *regexp.Regexp = regexp.MustCompile(`Error|<ERROR>|<BUG>|<FATAL>`)
var regexError *regexp.Regexp = regexp.MustCompile(`Error|<ERROR>|<BUG>|<FATAL>|syntax error`)
var regexInfo *regexp.Regexp = regexp.MustCompile(`<INFO>|<WARNING>|BGP session|Connected|Received:|Started|Neighbor|Startup delayed`)

func NewRoutingService(ctx context.Context, commSocket string, configFile string) *RoutingService {
Expand Down
4 changes: 3 additions & 1 deletion cmd/frontend/internal/bird/proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package bird

import (
"bufio"
"fmt"
"regexp"
"strings"
)
Expand Down Expand Up @@ -95,11 +96,12 @@ func bfdDown(p *Protocol) bool {
scanner := bufio.NewScanner(strings.NewReader(p.BfdSessions()))
for scanner.Scan() {
if bfdMatch := regexBFD.FindStringSubmatch(scanner.Text()); bfdMatch != nil {
p.Log(" bfd: " + bfdMatch[0])
p.Log(fmt.Sprintf(" bfd: %s", bfdMatch[0]))
return bfdMatch[1] != "Up"
}
}
// did not find the BFD session
p.Log(" bfd: no session")
return true
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/frontend/internal/bird/static_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,9 @@ func TestParseProtocolsStaticWithMissingBfd(t *testing.T) {
expectedLog := `BIRD 2.0.7 ready.` + "\n" +
`Name Proto Table State Since Info` + "\n" +
`NBR-gateway1 Static master4 up 21:10:21.868 bfd: 169.254.100.254 ext-vlan Up 22:13:19.019 0.100 0.500` + "\n" +
`NBR-gateway2 Static master6 up 21:10:21.868` + "\n" +
`NBR-gateway2 Static master6 up 21:10:21.868 bfd: no session` + "\n" +
`NBR-gateway3 Static master4 up 21:10:21.886 bfd: 169.254.100.253 ext-vlan Up 22:13:19.439 0.100 0.500` + "\n" +
`NBR-gateway4 Static master6 up 21:10:21.886` + "\n"
`NBR-gateway4 Static master6 up 21:10:21.886 bfd: no session` + "\n"

assert.NotNil(t, cs)
assert.Empty(t, cs.Log())
Expand Down
2 changes: 1 addition & 1 deletion cmd/frontend/internal/frontend/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,7 @@ func (fes *FrontEndService) reconfigurationAgent(ctx context.Context, reconfCh <
func (fes *FrontEndService) reconfigure(ctx context.Context, path string) error {
stringOut, err := fes.routingService.Configure(ctx, path)
if err != nil {
return err
return fmt.Errorf("%v; %v", err, stringOut)
} else {
fes.logger.V(1).Info("routing service reconfigured", "out", strings.Split(stringOut, "\n"))
fes.logger.Info("routing service configuration applied")
Expand Down

0 comments on commit c19b1d2

Please sign in to comment.