Skip to content

Sonic redis database accessors - #184

Merged
hardikdr merged 3 commits into
ironcore-dev:mainfrom
Giluerre:pr2/sonic-db-accessors
Oct 12, 2026
Merged

hardikdr merged 3 commits into
ironcore-dev:mainfrom
Giluerre:pr2/sonic-db-accessors

Conversation

@Giluerre

Copy link
Copy Markdown
Contributor

Proposed Changes

What

Add typed SONiC DB accessor interfaces to the public pkg/sonic package:

  • PortAccessor
  • InterfaceAccessor
  • VLANAccessor
  • DeviceAccessor

The package provides Redis-backed implementations for reading and writing
SONiC CONFIG_DB and STATE_DB entries.

Fixes #
Moving them to a public package makes the SONiC DB access layer reusable by
other components without depending on internal agent packages.

@Giluerre Giluerre changed the title Sonisonic db accessors Sonic redis database accessors Sep 25, 2026
@Giluerre
Giluerre force-pushed the pr2/sonic-db-accessors branch from 02dab74 to efb3a9b Compare September 25, 2026 08:29
Add typed accessor interfaces (PortAccessor, InterfaceAccessor, VLANAccessor,
DeviceAccessor) with Redis-backed implementations for reading and writing
SONiC CONFIG_DB and STATE_DB entries. Moving these to a public package makes
them reusable outside the internal agent.

Signed-off-by: Daniel Beres <daniel.beres@sap.com>
@Giluerre
Giluerre force-pushed the pr2/sonic-db-accessors branch from efb3a9b to 855910c Compare September 25, 2026 08:39
@Giluerre
Giluerre marked this pull request as ready for review September 25, 2026 08:42
@Giluerre
Giluerre requested a review from a team as a code owner September 25, 2026 08:42
Comment thread pkg/sonic/db_interface.go Resolved
Comment thread pkg/sonic/db_interface.go Resolved
Comment thread pkg/sonic/db_vlan.go Resolved
@hardikdr hardikdr added the area/switch-automation Automation processes for network switch management and operations. label Sep 26, 2026
@hardikdr hardikdr added this to Roadmap Sep 26, 2026
Daniel Beres added 2 commits September 28, 2026 12:09
Signed-off-by: Daniel Beres <daniel.beres@sap.com>
…erStatus

Signed-off-by: Daniel Beres <daniel.beres@sap.com>
@Giluerre
Giluerre force-pushed the pr2/sonic-db-accessors branch from 7dab0d1 to 61d7c44 Compare September 28, 2026 13:46

@byteocean byteocean left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks. But I have one extra point which could be further thought about. I am wondering, would it be better to put all these prefixes for keys as constant strings somewhere in a file, and use only variable names when an entry is set. E.g., const portPrefex string = 'PORT|', etc. because by doing so, one can have an overview of involved Redis entries and easy to find once one of them got changed in a different version?

@hardikdr

Copy link
Copy Markdown
Member

LGTM, Thanks. But I have one extra point which could be further thought about. I am wondering, would it be better to put all these prefixes for keys as constant strings somewhere in a file, and use only variable names when an entry is set. E.g., const portPrefex string = 'PORT|', etc. because by doing so, one can have an overview of involved Redis entries and easy to find once one of them got changed in a different version?

Overall, I agree with @byteocean 's suggestion.
@Giluerre do you want to address that here in this PR, or should we make a general improvement later?

@hardikdr hardikdr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Giluerre recommended to merge this one for now

@hardikdr
hardikdr merged commit b937bfd into ironcore-dev:main Oct 12, 2026
14 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Fabric Automation Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/switch-automation Automation processes for network switch management and operations.

Projects

Status: Done
Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants