Tags: openconfig/ygot
Tags
🐜: squash bug related to leaf-lists and shadow schemas. (#980) * 🐜: squash bug related to leaf-lists and shadow schemas. * (M) util/reflect.go - Fix missing parameter to string output. * (M) ytypes/{leaf,node,node_test,schema_test,util_schema}.go - Two bugs fixed. 1. In the case that one calls `SetNode` with something that was not a gNMI `TypedValue` and was not JSON, then we could panic when attempting to type cast it. 2. If a schema was generated that uses path compression, and `SetNode` was called for a node that was compressed out, but `PreferShadowPaths` was not set AND this node was a leaf-list then rather than performing a no-op (the expected behaviour, since we asked to set a node that was not the 'preferred' thing to set), then we would bail with an error since the schema was not a leaf schema. Small fix, lots of testing to find the root cause here. * (M) ytypes/schema_test/set_test.go - Bug reproduction. * Remove `TestFish`. 🐠
Fix `Marshal7951` for direct union leaf calls. (#947) When `jsonValue` is called using the output of `reflect.ValueOf()` instead of `reflect.StructField`, any interface type is lost through re-packing to the empty interface (any). This means the `reflect.Kind` of a union field is no longer the union type, but instead its underlying concrete type. The current code doesn't handle this case, leading to runtime errors. This handling code is now added, with a couple more fixes related to `empty` types. ----- Tested manually that the following ygnmi call is no longer affected by the original error: ```go sp := gnmi.OC().NetworkInstance("DEFAULT").Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_STATIC, "STATIC") return ygnmi.Replace(context.Background(), c, sp.Static("1.1.1.1/32").SetTag().Config(), oc.NetworkInstance_Protocol_Static_SetTag_Union(oc.UnionUint32(42))) ```
Avoid panic when calling Elem on a nil map member. (#941) * (M) ygot/struct_validation_map(_test)?.go - if a map was received that had a nil value in it, this caused a panic to occur since `(reflect.Value).Elem()` does not handle these cases cleanly. Add a check whether the value is nil before calling Elem.
Add support leaf-lists in paths->protobuf. (#926) * Add support leaf-lists in paths->protobuf. * (M) protomap/integration_tests/integration_test.go - Add test case for a failure that was causing a panic, where a leaf-list of union values was being handed to PathsToProto. Currently not yet implemented, but test checks error handling works as expected. * (M) protomap/proto(_test)?.go - Add support and testing for mapping of leaf-lists of YANG inbuilt types to protobufs. * Add TODO. * Throw an error for `repeated` in `makeWrapper`. * Add support for mapping leaf-lists of unions to protobufs. (#927) * Add support for mapping leaf-lists of unions to protobufs. * (M) integration_tests/integration_test.go - Reflect the fact that the gRIBI integration test cases is now implemented. * (M) protomap/proto.go - Add support for mapping both []any and gNMI TypedValue messages to fields within a protobuf from input gNMI paths. * (M) protomap/testdata/... - Additional fields in test protobufs. * Add outdated file. * Remove stale output. * Improve test coverage - add handling for bool.
Remove bottleneck in validation (#923) Even with debugLibrary not enabled ValueStr is calculated in this call, which causes significant bottlenecks in validation. All other calls to DbgPrint already use ValueStrDebug to avoid formatting string output that won't ever be used.
PreviousNext