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

Function Test_GetLabelChunkBody

pkg/zebra/zapi_test.go:1073–1101  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1071}
1072
1073func Test_GetLabelChunkBody(t *testing.T) {
1074 assert := assert.New(t)
1075
1076 // Test only with ZAPI version 5 and 6
1077 routeType := RouteBGP
1078 for v := uint8(5); v <= MaxZapiVer; v++ {
1079 // decodeFromBytes
1080 buf := make([]byte, 12)
1081 buf[0] = byte(routeType) // Route Type
1082 binary.BigEndian.PutUint16(buf[1:], 0) // Instance
1083 buf[3] = 0 // Keep
1084 binary.BigEndian.PutUint32(buf[4:], 80) // Start
1085 binary.BigEndian.PutUint32(buf[8:], 89) // End
1086
1087 b := &GetLabelChunkBody{}
1088 software := NewSoftware(v, "")
1089 err := b.decodeFromBytes(buf, v, software)
1090 assert.NoError(err)
1091
1092 // serialize
1093 b.ChunkSize = 10
1094 buf, err = b.serialize(v, software)
1095 assert.NoError(err)
1096 assert.Equal(byte(routeType), buf[0])
1097 bi := make([]byte, 4)
1098 binary.BigEndian.PutUint32(bi, 10)
1099 assert.Equal(bi, buf[4:8]) // Chunksize
1100 }
1101}
1102
1103func Test_vrfLabelBody(t *testing.T) {
1104 assert := assert.New(t)

Callers

nothing calls this directly

Calls 4

decodeFromBytesMethod · 0.95
serializeMethod · 0.95
NewSoftwareFunction · 0.85
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…