openconfig / ygot

A YANG-centric Go toolkit - Go/Protobuf Code Generation; Validation; Marshaling/Unmarshaling
Apache License 2.0
286 stars 107 forks source link

feat: support for diffing presence containers #990

Open JonasKs opened 1 month ago

JonasKs commented 1 month ago

Closes #936.

The implementation ended up being somewhat as described in #936, where we indicate that presence container has a nil value in the findSetLeaves function.
In addition to this, we added a presence container interface, which is used in the marshalStructOrOrderedList to isolate the presence container which might have values, to act like an empty struct.

The result is that we do not break any current tests (even without the diff option), but we decided to add a diff option, with the reasoning described in #936:

Adding this as a non-optional, paired with ygot.BuildEmptyTree would also probably be breaking, as it would set all these presence containers?

We've confirmed this works in our setup. We're able to successfully configure all presence containers, even nested ones.

Co-authored-by: Terje Lafton terje@lafton.io

google-cla[bot] commented 1 month ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

JonasKs commented 1 month ago

Hello @wenovus and @robshakir - it took some time, but we finally managed to crack the code. Please review. 😊

coveralls commented 1 month ago

Coverage Status

coverage: 88.766% (-0.04%) from 88.807% when pulling bcaa4dc13c20953ea2beb8c488acfc54a137f19c on JonasKs:support-presence-containers into 100bd44fc21215ffcc4862f37d90f7c257b5fa2b on openconfig:master.

JonasKs commented 1 month ago

Also tagging #645 author, @hansthienpondt.

JonasKs commented 1 month ago

Hi @robshakir , friendly bump in case you missed this 😊

robshakir commented 1 week ago

I did miss it -- apologies, let me review ASAP.

JonasKs commented 1 week ago

I did miss it -- apologies, let me review ASAP.

No worries, @robshakir! We’ve been using the fork in production and it’s worked like a charm.