(b *testing.B)
| 300 | } |
| 301 | |
| 302 | func BenchmarkTableKey(b *testing.B) { |
| 303 | rd := bgp.NewRouteDistinguisherTwoOctetAS(1, 2) |
| 304 | esi, _ := bgp.ParseEthernetSegmentIdentifier([]string{"lacp", "aa:bb:cc:dd:ee:ff", "100"}) |
| 305 | nlri1, _ := bgp.NewIPAddrPrefix(netip.MustParsePrefix("192.168.1.0/24")) |
| 306 | nlri2, _ := bgp.NewIPAddrPrefix(netip.MustParsePrefix("2001:db8::/64")) |
| 307 | nlri3, _ := bgp.NewLabeledVPNIPAddrPrefix(netip.MustParsePrefix("192.168.1.0/24"), *bgp.NewMPLSLabelStack(100, 200, 300), rd) |
| 308 | nlri4, _ := bgp.NewLabeledVPNIPAddrPrefix(netip.MustParsePrefix("2001:db8::/64"), *bgp.NewMPLSLabelStack(100, 200, 300), rd) |
| 309 | prefix := []bgp.NLRI{ |
| 310 | nlri1, |
| 311 | nlri2, |
| 312 | nlri3, |
| 313 | nlri4, |
| 314 | } |
| 315 | |
| 316 | b.Run("TableKey known types", func(b *testing.B) { |
| 317 | b.ResetTimer() |
| 318 | for range b.N { |
| 319 | for _, p := range prefix { |
| 320 | _ = tableKey(p) |
| 321 | } |
| 322 | } |
| 323 | }) |
| 324 | |
| 325 | prefix = append(prefix, bgp.NewEVPNEthernetAutoDiscoveryRoute(rd, esi, 1, 2)) |
| 326 | b.Run("TableKey with unknown type", func(b *testing.B) { |
| 327 | b.ResetTimer() |
| 328 | for range b.N { |
| 329 | for _, p := range prefix { |
| 330 | _ = tableKey(p) |
| 331 | } |
| 332 | } |
| 333 | }) |
| 334 | } |
| 335 | |
| 336 | func TestTableSelectMalformedIPv4UCPrefixes(t *testing.T) { |
| 337 | table := NewTable(logger, bgp.RF_IPv4_UC) |
nothing calls this directly
no test coverage detected
searching dependent graphs…