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

Function TestUnknownPathAttributes

internal/pkg/table/path_test.go:500–524  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

498}
499
500func TestUnknownPathAttributes(t *testing.T) {
501 peerP := PathCreatePeer()
502 pathP := PathCreatePath(peerP)
503
504 type255 := bgp.BGPAttrType(255)
505 unknownAttr := bgp.NewPathAttributeUnknown(bgp.BGPAttrFlag(0), type255, []byte{0x01, 0x02, 0x03})
506 pathP[0].setPathAttr(unknownAttr)
507
508 // Check if the unknown attribute is present
509 assert.NotNil(t, pathP[0].getPathAttr(type255))
510
511 found255 := false
512 var last bgp.BGPAttrType
513 for _, attr := range pathP[0].GetPathAttrs() {
514 assert.NotNil(t, attr)
515 if last >= attr.GetType() {
516 t.Errorf("Path attributes are not sorted: %v >= %v", last, attr.GetType())
517 }
518 last = attr.GetType()
519 if attr.GetType() == type255 {
520 found255 = true
521 }
522 }
523 assert.True(t, found255, "Unknown attribute of type 255 should be present in the path attributes list")
524}

Callers

nothing calls this directly

Calls 9

BGPAttrTypeTypeAlias · 0.92
NewPathAttributeUnknownFunction · 0.92
BGPAttrFlagTypeAlias · 0.92
PathCreatePeerFunction · 0.85
PathCreatePathFunction · 0.85
setPathAttrMethod · 0.80
getPathAttrMethod · 0.80
GetPathAttrsMethod · 0.80
GetTypeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…