Skip to content

[Monitor Link Group] Add STATE_DB table name macros#1181

Open
srodd-nexthop wants to merge 5 commits into
sonic-net:masterfrom
nexthop-ai:srodd.monitor-link-group
Open

[Monitor Link Group] Add STATE_DB table name macros#1181
srodd-nexthop wants to merge 5 commits into
sonic-net:masterfrom
nexthop-ai:srodd.monitor-link-group

Conversation

@srodd-nexthop
Copy link
Copy Markdown

@srodd-nexthop srodd-nexthop commented Apr 27, 2026

What I did

Add two STATE_DB table name macros to common/schema.h for the Monitor Link Group feature:

  • STATE_MONITOR_LINK_GROUP_STATE_TABLE_NAME — group operational state, consumed by show monitor-link
  • STATE_MONITOR_LINK_GROUP_MEMBER_TABLE_NAME — per-interface force-down signal, consumed by portmgrd and teammgrd

Why I did it

The Monitor Link Group feature (implemented in sonic-swss) publishes state to STATE_DB. The table name macros need to be defined in sonic-swss-common so they are available to all consumers without hardcoding strings.

The corresponding CFG_MONITOR_LINK_GROUP_TABLE_NAME is not added here — CONFIG_DB CFG_* macros are auto-generated into common/cfg_schema.h by gen_cfg_schema.py from the YANG model at build time.

How I verified it

  • sonic-swss-common builds cleanly
  • sonic-swss builds against it with intfmgrd, portmgrd, and teammgrd resolving the new symbols

Companion PRs

  • sonic-swss: MonitorLinkGroupMgr, PortMgr, TeamMgr implementation
  • sonic-yang-models: YANG model
  • sonic-utilities: show monitor-link CLI
  • SONiC/SONiC: HLD

HLD: sonic-net/SONiC#2308
Yang Changes: sonic-net/sonic-buildimage#27004
swss: sonic-net/sonic-swss#4523
Show: sonic-net/sonic-utilities#4497

#### What I did
Add two STATE_DB table name macros in common/schema.h:
- STATE_MONITOR_LINK_GROUP_STATE_TABLE_NAME
- STATE_MONITOR_LINK_GROUP_MEMBER_TABLE_NAME

#### Why I did it
The Monitor Link Group feature, implemented in sonic-swss (intfmgrd,
portmgrd, teammgrd), publishes group state and per-member control
state to STATE_DB. These table name macros are consumed by the swss
daemons and need to be defined in schema.h.

The corresponding CFG_MONITOR_LINK_GROUP_TABLE_NAME is intentionally
not added here: CFG_* macros are auto-generated into
common/cfg_schema.h by gen_cfg_schema.py from the YANG model
(sonic-monitor-link-group.yang) at build time.

#### How I did it
Added the two #define lines under a new "MONITOR LINK GROUP TABLES"
section header.

#### How to verify it
- Build sonic-swss-common successfully.
- Build sonic-swss against it and confirm intfmgrd/portmgrd/teammgrd
  compile with references to the new symbols.

Signed-off-by: Satishkumar Rodd <srodd@nexthop.ai>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Note that MonitorLinkGroupMgr (intfmgrd) produces these tables and
PortMgr/TeamMgr consume them, and that the corresponding CFG_* macro is
auto-generated into cfg_schema.h by gen_cfg_schema.py from
sonic-monitor-link-group.yang rather than added here.

Signed-off-by: Satishkumar Rodd <srodd@nexthop.ai>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Satishkumar Rodd <srodd@nexthop.ai>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

srodd-nexthop added a commit to nexthop-ai/sonic-swss that referenced this pull request May 14, 2026
…nsitional shim

STATE_MONITOR_LINK_GROUP_STATE_TABLE_NAME and STATE_MONITOR_LINK_GROUP_MEMBER_TABLE_NAME
are added to sonic-swss-common/common/schema.h by
sonic-net/sonic-swss-common#1181. Until that PR merges and the
swss-common artifact pulled by sonic-swss CI carries those macros,
this PR's build fails with 'STATE_MONITOR_LINK_GROUP_MEMBER_TABLE_NAME
not declared in scope' in cfgmgr/teammgr*, portmgr*, and intfmgrd.

Add #ifndef-guarded fallback definitions in cfgmgr/monitorlinkgroupmgr.h
and include that header from the four cfgmgr files that reference the
macros (portmgr.cpp, portmgrd.cpp, teammgr.cpp, teammgrd.cpp; the MLG
manager already includes its own header).

Once sonic-swss-common#1181 merges and schema.h carries these macros,
the #ifndef guards skip the fallback and the upstream definitions take
over. The shim can then be removed as a cleanup, but the #include lines
stay since the files legitimately consume MLG-MEMBER state.

Signed-off-by: Satishkumar Rodd <srodd@nexthop.ai>
srodd-nexthop added a commit to nexthop-ai/sonic-swss that referenced this pull request May 14, 2026
…nsitional shim

STATE_MONITOR_LINK_GROUP_STATE_TABLE_NAME and STATE_MONITOR_LINK_GROUP_MEMBER_TABLE_NAME
are added to sonic-swss-common/common/schema.h by
sonic-net/sonic-swss-common#1181. Until that PR merges and the
swss-common artifact pulled by sonic-swss CI carries those macros,
this PR's build fails with 'STATE_MONITOR_LINK_GROUP_MEMBER_TABLE_NAME
not declared in scope' in cfgmgr/teammgr*, portmgr*, and intfmgrd.

Add #ifndef-guarded fallback definitions in cfgmgr/monitorlinkgroupmgr.h
and include that header from the four cfgmgr files that reference the
macros (portmgr.cpp, portmgrd.cpp, teammgr.cpp, teammgrd.cpp; the MLG
manager already includes its own header).

Once sonic-swss-common#1181 merges and schema.h carries these macros,
the #ifndef guards skip the fallback and the upstream definitions take
over. The shim can then be removed as a cleanup, but the #include lines
stay since the files legitimately consume MLG-MEMBER state.

Signed-off-by: Satishkumar Rodd <srodd@nexthop.ai>
Retrigger Test vstest: our PR's Build amd64 passes (master Build amd64
failure was on a different scenario at 2026-05-16); our PR's only red
is Test vstest on the test_acl_mark.py OID flake, unrelated to this
PR's 5-line schema.h change.

Signed-off-by: Satishkumar Rodd <srodd@nexthop.ai>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Retrigger BuildSairedis amd64 stage: previous run hit
FlexCounter.addRemoveDashMeterCounter flake (downstream sairedis unit test).
PR diff is 5 #defines in common/schema.h, no flex counter code touched.

Signed-off-by: Satishkumar Rodd <srodd@nexthop.ai>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@ronan-nexthop
Copy link
Copy Markdown

/azpw retry

@mssonicbld
Copy link
Copy Markdown
Collaborator

Retrying failed(or canceled) jobs...

@mssonicbld
Copy link
Copy Markdown
Collaborator

Retrying failed(or canceled) stages in build 1117701:

✅Stage Test:

  • Job vstest: retried.

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