Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[16.0] Omit empty fields in dpc.go on JSON serialization#5369

Merged
eriknordmark merged 2 commits into
lf-edge:16.0from
OhmSpectator:backport/16.0/feature/omit-empty-fields-in-dpc-list
Nov 10, 2025
Merged

[16.0] Omit empty fields in dpc.go on JSON serialization#5369
eriknordmark merged 2 commits into
lf-edge:16.0from
OhmSpectator:backport/16.0/feature/omit-empty-fields-in-dpc-list

Conversation

@OhmSpectator

Copy link
Copy Markdown
Member

Description

Backport of #5364

PR dependencies

None.

How to test and validate this PR

  1. Start a device with 8 physical ports (port0-port7, one named port5-starlink).
  2. Create 12 VLAN adapters on port5-starlink with IDs 4001-4012 and labels like port5-starlink.4001, all using ADAPTER_USAGE_MANAGEMENT.
  3. Create one network-instance of type switch per physical adapter.
    The configuration should apply partially (some “too long” label warnings), but nim must not crash.
  4. Add a 13th VLAN adapter on port5-starlink (ID 4013, same usage).

Before the fix nim crashes.
After the fix nim stays alive and reports a validation error for the 13th VLAN instead of crashing.

Changelog notes

Simplify DPC’s internal representation to avoid exceeding JSON message size limits and to support more sophisticated network configurations.

Checklist

  • I've provided a proper description
  • I've added the proper documentation
  • I've tested my PR on amd64 device
  • I've tested my PR on arm64 device
  • I've written the test verification instructions
  • I've set the proper labels to this PR
  • I've added a reference link to the original PR
  • PR's title follows the template
  • I've checked the boxes above, or I've provided a good reason why I didn't
    check them.

Add json:",omitempty" tags to all struct fields in dpc.go to omit
zero/empty values from JSON serialization. This produces cleaner JSON
output for device port configuration structures and prevents from
creating too large messages.

Signed-off-by: Nikolay Martyanov <[email protected]>
(cherry picked from commit 8e86414)
So that we are following the best practicies and meke Yetus happy =P

Signed-off-by: Nikolay Martyanov <[email protected]>
(cherry picked from commit 2677fac)
@OhmSpectator

Copy link
Copy Markdown
Member Author

/rerun red

@eriknordmark eriknordmark merged commit c1852e6 into lf-edge:16.0 Nov 10, 2025
44 of 46 checks passed
rucoder added a commit to rucoder/eve that referenced this pull request Nov 11, 2025
- this release introduces support for DPC types that have "omitempty"
  annotations. see lf-edge#5369

Signed-off-by: Mikhail Malyshev <[email protected]>
@rucoder rucoder mentioned this pull request Nov 11, 2025
7 tasks
eriknordmark pushed a commit that referenced this pull request Nov 11, 2025
- this release introduces support for DPC types that have "omitempty"
  annotations. see #5369

Signed-off-by: Mikhail Malyshev <[email protected]>
rucoder added a commit to rucoder/eve that referenced this pull request Nov 20, 2025
- this release introduces support for DPC types that have "omitempty"
  annotations. see lf-edge#5369

Signed-off-by: Mikhail Malyshev <[email protected]>
(cherry picked from commit 524b084)
rucoder added a commit to rucoder/eve that referenced this pull request Nov 20, 2025
- this release introduces support for DPC types that have "omitempty"
  annotations. see lf-edge#5369

Signed-off-by: Mikhail Malyshev <[email protected]>
(cherry picked from commit 524b084)
rene pushed a commit that referenced this pull request Nov 22, 2025
- this release introduces support for DPC types that have "omitempty"
  annotations. see #5369

Signed-off-by: Mikhail Malyshev <[email protected]>
(cherry picked from commit 524b084)
rene pushed a commit that referenced this pull request Nov 22, 2025
- this release introduces support for DPC types that have "omitempty"
  annotations. see #5369

Signed-off-by: Mikhail Malyshev <[email protected]>
(cherry picked from commit 524b084)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants