@@ -148,6 +148,7 @@ func TestValidateLeafList(t *testing.T) {
148148
149149type LeafListContainer struct {
150150 Int32LeafList []* int32 `path:"int32-leaf-list"`
151+ BinaryLeafList []Binary `path:"binary-leaf-list"`
151152 EnumLeafList []EnumType `path:"enum-leaf-list"`
152153 UnionLeafSlice []UnionLeafType `path:"union-leaflist"`
153154 UnionLeafSliceSimple []UnionLeafTypeSimple `path:"union-leaflist-simple"`
@@ -214,6 +215,14 @@ func TestUnmarshalLeafListGNMIEncoding(t *testing.T) {
214215 Type : & yang.YangType {Kind : yang .Yint32 },
215216 }
216217
218+ binaryLeafListSchema := & yang.Entry {
219+ Parent : containerSchema ,
220+ Name : "binary-leaf-list" ,
221+ Kind : yang .LeafEntry ,
222+ ListAttr : yang .NewDefaultListAttr (),
223+ Type : & yang.YangType {Kind : yang .Ybinary },
224+ }
225+
217226 enumLeafListSchema := & yang.Entry {
218227 Parent : containerSchema ,
219228 Name : "enum-leaf-list" ,
@@ -294,6 +303,20 @@ func TestUnmarshalLeafListGNMIEncoding(t *testing.T) {
294303 }},
295304 want : LeafListContainer {Int32LeafList : []* int32 {ygot .Int32 (- 42 ), ygot .Int32 (0 ), ygot .Int32 (42 )}},
296305 },
306+ {
307+ desc : "binary success" ,
308+ sch : binaryLeafListSchema ,
309+ val : & gpb.TypedValue {Value : & gpb.TypedValue_LeaflistVal {
310+ LeaflistVal : & gpb.ScalarArray {
311+ Element : []* gpb.TypedValue {
312+ {Value : & gpb.TypedValue_BytesVal {BytesVal : []byte {0xa0 , 0x00 , 0x00 , 0x00 }}},
313+ {Value : & gpb.TypedValue_BytesVal {BytesVal : []byte {0xb0 , 0x00 , 0x00 , 0x00 }}},
314+ {Value : & gpb.TypedValue_BytesVal {BytesVal : []byte {0xc0 , 0x00 , 0x00 , 0x00 }}},
315+ },
316+ },
317+ }},
318+ want : LeafListContainer {BinaryLeafList : []Binary {Binary ([]byte {0xa0 , 0x00 , 0x00 , 0x00 }), Binary ([]byte {0xb0 , 0x00 , 0x00 , 0x00 }), Binary ([]byte {0xc0 , 0x00 , 0x00 , 0x00 })}},
319+ },
297320 {
298321 desc : "int32 success with existing values" ,
299322 sch : int32LeafListSchema ,
0 commit comments