Skip to content

Prevent unconnected ports from reporting oper status up - #732

Open
sreeiyer-1 wants to merge 2 commits into
openconfig:mainfrom
sreeiyer-1:admin
Open

sreeiyer-1 wants to merge 2 commits into
openconfig:mainfrom
sreeiyer-1:admin

Conversation

@sreeiyer-1

@sreeiyer-1 sreeiyer-1 commented Sep 23, 2026 •

Copy link
Copy Markdown

Lucius creates fallback tap interfaces for ports whose kernel interfaces are absent. A later admin up is received for these interfaces can enable the tap interfaces and cause them to report The operational status as up. This can happen either at boot time or when the Ethernet interfaces is flapped.

Before processing the admin up request, check whether the eth interface derived from the first lane exists. If it is not present, ignore the admin request and leave the fallback port down. No change in the behaviour for connected ports and admin down requests.

In the test below, the topology used that 32 Ethernet interfaces with a breakout of 4. Only eth1 to eth16 are connected to a peer.

Ethernet48 below is an unconnected interface. The operational status follows admin status and shows as up :

root@sonic:/home/admin# show int status Ethernet48
  Interface        Lanes    Speed    MTU    FEC          Alias    Vlan    Oper    Admin                           Type    Asym PFC
-----------  -----------  -------  -----  -----  -------------  ------  ------  -------  -----------------------------  ----------
 Ethernet48  49,50,51,52      40G   9100    N/A  fortyGigE0/48  routed      up       up  OSFP 8X Pluggable Transceiver         N/A

root@sonic:/home/admin# config interface shut Ethernet48

root@sonic:/home/admin# show int status Ethernet48
  Interface        Lanes    Speed    MTU    FEC          Alias    Vlan    Oper    Admin                           Type    Asym PFC
-----------  -----------  -------  -----  -----  -------------  ------  ------  -------  -----------------------------  ----------
 Ethernet48  49,50,51,52      40G   9100    N/A  fortyGigE0/48  routed    down     down  OSFP 8X Pluggable Transceiver         N/A

root@sonic:/home/admin# config interface start Ethernet48
root@sonic:/home/admin# 
root@sonic:/home/admin# show int status Ethernet48
  Interface        Lanes    Speed    MTU    FEC          Alias    Vlan    Oper    Admin                           Type    Asym PFC
-----------  -----------  -------  -----  -----  -------------  ------  ------  -------  -----------------------------  ----------
 Ethernet48  49,50,51,52      40G   9100    N/A  fortyGigE0/48  routed      up       up  OSFP 8X Pluggable Transceiver         N/A

root@sonic:/home/admin# config interface start Ethernet48
root@sonic:/home/admin# sonic-db-cli APPL_DB HGETALL "PORT_TABLE:Ethernet48"
{'admin_status': 'up', 'alias': 'fortyGigE0/48', 'index': '13', 'lanes': '49,50,51,52', 'mtu': '9100', 'presence': '1', 'speed': '40000', 'id': '13', 'description': '', 'oper_status': 'up', 'flap_count': '3', 'last_up_time': 'Wed Sep 23 06:03:50 2026', 'last_down_time': 'Wed Sep 23 06:03:34 2026'}

After the changes :

root@sonic:/home/admin# show interfaces  status Ethernet48
  Interface        Lanes    Speed    MTU    FEC          Alias    Vlan    Oper    Admin                           Type    Asym PFC
-----------  -----------  -------  -----  -----  -------------  ------  ------  -------  -----------------------------  ----------
 Ethernet48  49,50,51,52      40G   9100    N/A  fortyGigE0/48  routed    down       up  OSFP 8X Pluggable Transceiver         N/A

root@sonic:/home/admin# config interface shut Ethernet48
root@sonic:/home/admin# show interfaces  status Ethernet48
  Interface        Lanes    Speed    MTU    FEC          Alias    Vlan    Oper    Admin                           Type    Asym PFC
-----------  -----------  -------  -----  -----  -------------  ------  ------  -------  -----------------------------  ----------
 Ethernet48  49,50,51,52      40G   9100    N/A  fortyGigE0/48  routed    down     down  OSFP 8X Pluggable Transceiver         N/A
root@sonic:/home/admin# 
root@sonic:/home/admin# config interface start Ethernet48
root@sonic:/home/admin# 
root@sonic:/home/admin# show interfaces  status Ethernet48
  Interface        Lanes    Speed    MTU    FEC          Alias    Vlan    Oper    Admin                           Type    Asym PFC
-----------  -----------  -------  -----  -----  -------------  ------  ------  -------  -----------------------------  ----------
 Ethernet48  49,50,51,52      40G   9100    N/A  fortyGigE0/48  routed    down       up  OSFP 8X Pluggable Transceiver         N/A

root@sonic:/home/admin# sonic-db-cli APPL_DB HGETALL "PORT_TABLE:Ethernet48"
{'admin_status': 'up', 'alias': 'fortyGigE0/48', 'index': '13', 'lanes': '49,50,51,52', 'mtu': '9100', 'presence': '1', 'speed': '40000', 'id': '13', 'description': '', 'oper_status': 'down', 'flap_count': '0'}

root@sonic:/var/log/swss# config interface start Ethernet48

2026/09/23 10:19:48 INFO ignoring admin-state update for port without backing interface oid=408 device=eth49 admin_state=true


root@sonic:/var/log/swss# config interface mtu Ethernet48 3000

2026/09/23 10:20:25 INFO setting port mtu oid=408 dev=eth49 mtu=3022
2026/09/23 10:20:25 ERROR failed to get link dev=eth49 err="Link not found"
2026/09/23 10:20:25 ERROR finished call protocol=grpc grpc.component=server grpc.service=lemming.dataplane.sai.Port grpc.method=SetPortAttribute grpc.method_type=unary peer.address=127.0.0.1:39710 grpc.start_time=2026-09-23T10:20:25Z grpc.code=Unknown grpc.error="Link not found" grpc.time_ms=0.323

Unit test

lemming/lemming$ go test ./dataplane/saiserver \
  -run 'TestSetPortAttribute/admin_status_ignored_without_backing_interface' \
  -v
go: downloading google.golang.org/genproto/googleapis/rpc v0.0.0-20260825221802-da73d73af1c5
go: downloading go.opentelemetry.io/otel v1.46.0
go: downloading go.opentelemetry.io/otel/trace v1.46.0
go: downloading github.com/go-logr/logr v1.4.4
go: downloading go.opentelemetry.io/otel/metric v1.46.0
=== RUN   TestSetPortAttribute
=== RUN   TestSetPortAttribute/admin_status_ignored_without_backing_interface
2026/09/23 10:32:23 INFO ignoring admin-state update for port without backing interface oid=3 device=eth125 admin_state=true
--- PASS: TestSetPortAttribute (0.01s)
    --- PASS: TestSetPortAttribute/admin_status_ignored_without_backing_interface (0.01s)
PASS
ok  	github.com/openconfig/lemming/dataplane/saiserver	0.048s

No change in the results of the other unit tests - GetSwitchStats continues to fail and all the other tests pass.

@google-cla

google-cla Bot commented Sep 23, 2026

Copy link
Copy Markdown

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.

@sreeiyer-1
sreeiyer-1 marked this pull request as ready for review September 23, 2026 11:20
@sreeiyer-1
sreeiyer-1 requested a review from a team as a code owner September 23, 2026 11:20
@sonikajindal

Copy link
Copy Markdown
Contributor

/gcbrun

Signed-off-by: Sree Iyer <sbiyer@google.com>
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.

2 participants