(t *testing.T)
| 498 | } |
| 499 | |
| 500 | func 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 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…