MCPcopy
hub / github.com/osrg/gobgp / TestTableKey

Function TestTableKey

internal/pkg/table/table_test.go:289–300  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

287}
288
289func TestTableKey(t *testing.T) {
290 tb := NewTable(logger, bgp.RF_IPv4_UC)
291 n1, _ := bgp.NewIPAddrPrefix(netip.MustParsePrefix("0.0.0.0/0"))
292 d1 := newDestination(n1, 0)
293 n2, _ := bgp.NewIPAddrPrefix(netip.MustParsePrefix("0.0.0.0/1"))
294 d2 := newDestination(n2, 0)
295
296 assert.NotEqual(t, tableKey(d1.GetNlri()), tableKey(d2.GetNlri()))
297 tb.setDestination(d1)
298 tb.setDestination(d2)
299 assert.Equal(t, len(tb.GetDestinations()), 2)
300}
301
302func BenchmarkTableKey(b *testing.B) {
303 rd := bgp.NewRouteDistinguisherTwoOctetAS(1, 2)

Callers

nothing calls this directly

Calls 8

setDestinationMethod · 0.95
GetDestinationsMethod · 0.95
NewIPAddrPrefixFunction · 0.92
NewTableFunction · 0.85
newDestinationFunction · 0.85
tableKeyFunction · 0.85
GetNlriMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…