Skip to content

Add vendor specific hook to populate management port status in STATE_DB#26790

Open
lotus-nexthop wants to merge 1 commit into
sonic-net:masterfrom
nexthop-ai:lotus.eth0-monit
Open

Add vendor specific hook to populate management port status in STATE_DB#26790
lotus-nexthop wants to merge 1 commit into
sonic-net:masterfrom
nexthop-ai:lotus.eth0-monit

Conversation

@lotus-nexthop

@lotus-nexthop lotus-nexthop commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Why I did it

Nexthop's platforms have an unmanaged switch sitting between the front panel rj45 and the CPU's eth0.
As a result eth0's link state as advertised by the kernel (/sys/class/net/eth0/operstate), does not reflect the state of the rj45.

e.g.

Front Panel RJ45 (Management Port)
         |
        A
         |
    BCM53134 Switch (management switch running in unmanaged mode)
       /    \
      B      C
     /        \
    BMC    CPU (eth0)

Link A may be down (if RJ45 for example is unplugged), but link C (/sys/class/net/eth0/operstate) still says up.

Work item tracking
  • Microsoft ADO (number only):

How I did it

Use get_management_port_link_status_override from sonic platform API introduced by sonic-net/sonic-platform-common#654 to populate the management port link state to STATE_DB. This will reflect the correct link state in SNMP (or any future consumers of this state).

How to verify it

Note this requires sonic-net/sonic-platform-common#654 and the platform dependent implementation of it.

admin@gold230:~$ sonic-db-cli CONFIG_DB HSET 'MGMT_PORT|eth0' admin_status up
0
admin@gold230:~$ sudo sonic-db-cli STATE_DB HGET 'MGMT_PORT_TABLE|eth0' oper_status
up

Now I log into management switch to bring the port down. After a minute when monit runs we see on the console:

admin@gold230:~$ sudo sonic-db-cli STATE_DB HGET 'MGMT_PORT_TABLE|eth0' oper_status
down

Which release branch to backport (provide reason below if selected)

  • 202305
  • 202311
  • 202405
  • 202411
  • 202505
  • 202511

Tested branch (Please provide the tested image version)

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@lotus-nexthop lotus-nexthop changed the title use eth0 override in monit Add vendor specific hook to populate management port status in STATE_DB Apr 15, 2026
@yxieca

yxieca commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

/azpw ms_conflict

@lotus-nexthop lotus-nexthop marked this pull request as ready for review April 22, 2026 23:33
@lotus-nexthop lotus-nexthop requested a review from lguohan as a code owner April 22, 2026 23:33
@lotus-nexthop

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Lotus Fenn <lotus@nexthop.ai>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

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