E2E: remove duplicates from FRR route parsing
Due to the fact that we now support MP-BGP, we have duplicate nexthops
because they are received both from the v4 session and the v6 session.
We remove the duplicates so we can check the 1:1 mapping with the nodes.
@@ -186,6 +186,7 @@ func ParseRoutes(vtyshRes string) (map[string]Route, error) {
for _, n := range frrRoutes {
r.LocalPref = n.LocalPref
r.Origin = n.Origin
+ out:
for _, h := range n.Nexthops {
ip := net.ParseIP(h.IP)
if ip == nil {
@@ -194,6 +195,11 @@ func ParseRoutes(vtyshRes string) (map[string]Route, error) {
if ip.To4() == nil && h.Scope == "link-local" {
continue
}
+ for _, current := range r.NextHops {
+ if ip.Equal(current) {
+ continue out
+ }
+ }
r.NextHops = append(r.NextHops, ip)
}
}
