Skip to content

[code sync] Merge code from sonic-net/sonic-utilities:202511 to 202603#302

Merged
mssonicbld merged 11 commits into
Azure:202603from
mssonicbld:sonicbld/202603-merge
Apr 7, 2026
Merged

[code sync] Merge code from sonic-net/sonic-utilities:202511 to 202603#302
mssonicbld merged 11 commits into
Azure:202603from
mssonicbld:sonicbld/202603-merge

Conversation

@mssonicbld

Copy link
Copy Markdown
Collaborator
* 2767fdff - (origin/202511) Fix counterpoll CLI when running in a namespace (#4434) (2026-04-07) [mssonicbld]
* 7f7709f8 - [show interfaces] "show interfaces flap" command does not support multi-ASIC platforms (#4433) (2026-04-07) [mssonicbld]
* 8456d9a1 - scripts/generate_dump: Fix duplicate generate_dump entry (#4432) (2026-04-07) [mssonicbld]
* 79bb1175 - Fix docker daemon crash during package migration due to -H fd:// (#4431) (2026-04-07) [mssonicbld]
* 184a64ea - Clearing /tmp/tmp* is unsafe with parallel builds (#4430) (2026-04-07) [mssonicbld]
* d7644e40 - [GCU]: Restart telemetry container on port speed change via GCU to handle OID update (#4429) (2026-04-07) [mssonicbld]
* 56b024d4 - Use Singleton PlatformDataProvider to reduce module import time (#4428) (2026-04-07) [mssonicbld]
* 74773048 - [Secure Boot] Fix kexec error log on reboot (#4427) (2026-04-07) [mssonicbld]
* 8621a71f - [chassis] Fixed a bug in "show fabric isolation" output (#4426) (2026-04-07) [mssonicbld]
* 5c8525f4 - Adding cleanup for BGP_PEER_CONFIGURED_TABLE when config reload is done (#4424) (2026-04-07) [mssonicbld]<br>```

mssonicbld and others added 11 commits April 7, 2026 08:24
…ne (#4424)

<!--
 Please make sure you've read and understood our contributing guidelines:
 https://github.com/Azure/SONiC/blob/gh-pages/CONTRIBUTING.md

 failure_prs.log skip_prs.log Make sure all your commits include a signature generated with `git commit -s` **

 If this is a bug fix, make sure your description includes "closes #xxxx",
 "fixes #xxxx" or "resolves #xxxx" so that GitHub automatically closes the related
 issue when the PR is merged.

 If you are adding/modifying/removing any command or utility script, please also
 make sure to add/modify/remove any unit tests from the tests
 directory as appropriate.

 If you are modifying or removing an existing 'show', 'config' or 'sonic-clear'
 subcommand, or you are adding a new subcommand, please make sure you also
 update the Command Line Reference Guide (doc/Command-Reference.md) to reflect
 your changes.

 Please provide the following information:
-->

#### What I did
When config reload is done, BGP_PEER_CONFIGURED_TABLE is not cleared of pervious entries of BGP peers. Added logic to clean that up during config reload
#### How I did it
Connected to state db and cleared up all keys starting with BGP_PEER_CONFIGURED_TABLE|*
#### How to verify it
delete a peer from config_db.json and perform config reload. Peer should be deleted from state db table BGP_PEER_CONFIGURED_TABLE

Signed-off-by: Sonic Build Admin <sonicbld@microsoft.com>
#### Previous command output (if the output of a command-line utility has changed)

#### New command output (if the output of a command-line utility has changed)
<!--
 Please make sure you've read and understood our contributing guidelines:
 https://github.com/Azure/SONiC/blob/gh-pages/CONTRIBUTING.md

 failure_prs.log skip_prs.log Make sure all your commits include a signature generated with `git commit -s` **

 If this is a bug fix, make sure your description includes "closes #xxxx",
 "fixes #xxxx" or "resolves #xxxx" so that GitHub automatically closes the related
 issue when the PR is merged.

 If you are adding/modifying/removing any command or utility script, please also
 make sure to add/modify/remove any unit tests from the tests
 directory as appropriate.

 If you are modifying or removing an existing 'show', 'config' or 'sonic-clear'
 subcommand, or you are adding a new subcommand, please make sure you also
 update the Command Line Reference Guide (doc/Command-Reference.md) to reflect
 your changes.

 Please provide the following information:
-->

#### What I did
sonic-net/sonic-buildimage#24829
Fixed a bug in the "show fabric isolation" command output.
When the fabric port sees CRC/FEC-Uncorrectable error, the Fabric monitor feature Isolates the port and sets the ISOALTED=1 and also AUTO_ISOLATED=1 in the STATE_DB for that port in the FABRIC_PORT_TABLE. The field ISOLATED and CONFIG_ISOLATED are always present for all the fabric ports in FABRIC_PORT_TABLE. However the field AUTO_ISOLATED is not present always and added only when the port is auto ISOLATED.
Due to the bug in the FabricIsolation cli script, the Auto Isolated is shown 1 for all the ports printed in the show command after the port which is actually isolated. In the output shown below, the port 165 is isolated, however Auto-isolated is shown 1 for all the ports after 165 which is wrong.
<img width="415" height="245" alt="image" src="https://github.com/user-attachments/assets/26df22fd-615f-44c7-9b9a-3e7e44bef735" />

#### How I did it
Initialized the variable correctly inside the loop.
#### How to verify it
Induced the CRC error for one of the port and after that port is isolated, verified the "show fabric isolation" output shows the correct output.

<img width="342" height="239" alt="image" src="https://github.com/user-attachments/assets/749d13c0-9892-4f2c-af9a-70a49d7ee2e5" />

Signed-off-by: Sonic Build Admin <sonicbld@microsoft.com>

#### Previous command output (if the output of a command-line utility has changed)

#### New command output (if the output of a command-line utility has changed)
<!--
 Please make sure you've read and understood our contributing guidelines:
 https://github.com/Azure/SONiC/blob/gh-pages/CONTRIBUTING.md

 failure_prs.log skip_prs.log Make sure all your commits include a signature generated with `git commit -s` **

 If this is a bug fix, make sure your description includes "closes #xxxx",
 "fixes #xxxx" or "resolves #xxxx" so that GitHub automatically closes the related
 issue when the PR is merged.

 If you are adding/modifying/removing any command or utility script, please also
 make sure to add/modify/remove any unit tests from the tests
 directory as appropriate.

 If you are modifying or removing an existing 'show', 'config' or 'sonic-clear'
 subcommand, or you are adding a new subcommand, please make sure you also
 update the Command Line Reference Guide (doc/Command-Reference.md) to reflect
 your changes.

 Please provide the following information:
-->

#### What I did

Doing a reboot on SB enabled systems and check dmesg,

```
root@sonic/home/admin# dmesg -W
[33875.287197] ima: impossible to appraise a kernel image without a file descriptor; try using kexec_file_load syscall.
```

This is fixed in fast-reboot/warm-reboot script here sonic-net/sonic-utilities@317e649 but was missed in reboot script

#### How I did it

Use the -a argument with kexec

```
 -a, --kexec-syscall-auto Use file based syscall for kexec and fall
 back to the compatibility syscall when file based
 syscall is not supported or the kernel did not
 understand the image
```

Signed-off-by: Sonic Build Admin <sonicbld@microsoft.com>

#### How to verify it

#### Previous command output (if the output of a command-line utility has changed)

#### New command output (if the output of a command-line utility has changed)
<!--
 Please make sure you've read and understood our contributing guidelines:
 https://github.com/Azure/SONiC/blob/gh-pages/CONTRIBUTING.md

 failure_prs.log skip_prs.log Make sure all your commits include a signature generated with `git commit -s` **

 If this is a bug fix, make sure your description includes "closes #xxxx",
 "fixes #xxxx" or "resolves #xxxx" so that GitHub automatically closes the related
 issue when the PR is merged.

 If you are adding/modifying/removing any command or utility script, please also
 make sure to add/modify/remove any unit tests from the tests
 directory as appropriate.

 If you are modifying or removing an existing 'show', 'config' or 'sonic-clear'
 subcommand, or you are adding a new subcommand, please make sure you also
 update the Command Line Reference Guide (doc/Command-Reference.md) to reflect
 your changes.

 Please provide the following information:
-->

#### What I did
For `fwutil show` command which displays the usage/help message reduce the time taken by lazily importing PlatformDataProvider. This reduced the average time taken by ~50%.

#### How I did it
Use a singleton PlatformDataProvider in fwutil/main.py
#### How to verify it
Before the change
```
Running 'fwutil show' 10 times (gap 5s)...
Run 1: 972 ms
Run 2: 1058 ms
Run 3: 948 ms
Run 4: 1213 ms
Run 5: 1507 ms
Run 6: 1235 ms
Run 7: 1553 ms
Run 8: 1037 ms
Run 9: 1000 ms
Run 10: 1037 ms
---- fwutil show stats ----
Avg: 1156 ms
Min: 948 ms
Max: 1553 ms
```
After the change
```
Running 'fwutil show' 10 times (gap 5s)...
Run 1: 496 ms
Run 2: 482 ms
Run 3: 466 ms
Run 4: 445 ms
Run 5: 482 ms
Run 6: 463 ms
Run 7: 780 ms
Run 8: 662 ms
Run 9: 653 ms
Run 10: 659 ms
---- fwutil show stats ----
Avg: 558 ms
Min: 445 ms
Max: 780 ms
```

Signed-off-by: Sonic Build Admin <sonicbld@microsoft.com>

#### Previous command output (if the output of a command-line utility has changed)

#### New command output (if the output of a command-line utility has changed)
…ndle OID update (#4429)

<!--
 Please make sure you've read and understood our contributing guidelines:
 https://github.com/Azure/SONiC/blob/gh-pages/CONTRIBUTING.md

 failure_prs.log skip_prs.log Make sure all your commits include a signature generated with `git commit -s` **

 If this is a bug fix, make sure your description includes "closes #xxxx",
 "fixes #xxxx" or "resolves #xxxx" so that GitHub automatically closes the related
 issue when the PR is merged.

 If you are adding/modifying/removing any command or utility script, please also
 make sure to add/modify/remove any unit tests from the tests
 directory as appropriate.

 If you are modifying or removing an existing 'show', 'config' or 'sonic-clear'
 subcommand, or you are adding a new subcommand, please make sure you also
 update the Command Line Reference Guide (doc/Command-Reference.md) to reflect
 your changes.

 Please provide the following information:
-->

#### What I did
- Updated port_speed_change_validator to restart the telemetry container when a port speed is changed via GCU.
- Added unit tests to verify the correct behavior for port speed changes and no-change scenarios.

Microsoft ADO: 36692456

This is short term plan to restart telemetry in GCU.

Long term plan is telemetry reload automatically. Microsoft ADO: 36496651
#### How I did it
- Modified the validator to detect any port speed change and call _service_restart("telemetry") when detected, ensuring telemetry restarts and picks up the new port OID.
- Implemented tests using mocks for subprocess calls to simulate and verify the restart logic.

#### How to verify it
- Run the unit tests in service_validator_test.py to confirm that telemetry is restarted only when a port speed changes, and not for unrelated changes.
- Check that all tests pass, indicating correct validator and restart behavior.
- Test bed
```shell
stli@STG02-0101-0400-02T2-lc03:~$ show int sta
 Interface Lanes Speed MTU FEC Alias Vlan Oper Admin Type Asym PFC
--------------- --------------------------------------- ------- ----- ----- ----------------------- --------------- ------ ------- ------ ----------
...
 Ethernet64 264,265,266,267,268,269,270,271 400G 9100 rs FourHundredGigE0/3/0/8 routed down down N/A off

stli@STG02-0101-0400-02T2-lc03:~$ cat gcu_patch.json
 [
 {
 "op": "add",
 "path": "/asic0/PORT/Ethernet64",
 "value": {
 "index": "8",
 "description": "STG02-0101-0110-17T1:etp12",
 "alias": "HundredGigE0/3/0/8",
 "pfc_asym": "off",
 "fec": "rs",
 "speed": "100000",
 "mtu": "9100",
 "tpid": "0x8100",
 "lanes": "264,265,266,267",
 "asic_port_name": "Eth64-ASIC0",
 "role": "Ext",
 "admin_status": "up"
 }
 }
 ]

stli@STG02-0101-0400-02T2-lc03:~$ sudo config apply-patch gcu_patch.json
Patch Applier: asic0: Patch application starting.
Patch Applier: asic0: Patch: [{"op": "add", "path": "/PORT/Ethernet64", "value": {"index": "8", "description": "STG02-0101-0110-17T1:etp12", "alias": "HundredGigE0/3/0/8", "pfc_asym": "off", "fec": "rs", "speed": "100000", "mtu": "9100", "tpid": "0x8100", "lanes": "264,265,266,267", "asic_port_name": "Eth64-ASIC0", "role": "Ext", "admin_status": "up"}}]
Patch Applier: asic0 getting current config db.
Patch Applier: asic0: simulating the target full config after applying the patch.
Patch Applier: asic0: validating all JsonPatch operations are permitted on the specified fields
Patch Applier: asic0: validating target config does not have empty tables,
 since they do not show up in ConfigDb.
Patch Applier: asic0: sorting patch updates.
Patch Applier: The asic0 patch was converted into 6 changes:
Patch Applier: asic0: applying 6 changes in order:
Patch Applier: failure_prs.log skip_prs.log [{"op": "remove", "path": "/CABLE_LENGTH/AZURE/Ethernet64"}]
Patch Applier: failure_prs.log skip_prs.log [{"op": "replace", "path": "/PORT/Ethernet64/description", "value": "STG02-0101-0110-17T1:etp12"}]
Patch Applier: failure_prs.log skip_prs.log [{"op": "replace", "path": "/PORT/Ethernet64/speed", "value": "100000"}]
> /usr/local/lib/python3.11/dist-packages/generic_config_updater/services_validator.py(71)port_speed_change_validator()
-> return _service_restart("telemetry")
(Pdb) old_speed
'400000'
(Pdb) upd_speed
'100000'
(Pdb) c
Job for telemetry.service failed because start of the service was attempted too often.
See "systemctl status telemetry.service" and "journalctl -xeu telemetry.service" for details.
To force a start use "systemctl reset-failed telemetry.service"
followed by "systemctl start telemetry.service" again.
Patch Applier: failure_prs.log skip_prs.log [{"op": "remove", "path": "/PORT/Ethernet64"}]
Patch Applier: failure_prs.log skip_prs.log [{"op": "add", "path": "/PORT/Ethernet64", "value": {"index": "8", "description": "STG02-0101-0110-17T1:etp12", "alias": "HundredGigE0/3/0/8", "pfc_asym": "off", "fec": "rs", "speed": "100000", "mtu": "9100", "tpid": "0x8100", "lanes": "264,265,266,267", "asic_port_name": "Eth64-ASIC0", "role": "Ext", "admin_status": "up"}}]
Patch Applier: failure_prs.log skip_prs.log [{"op": "add", "path": "/CABLE_LENGTH/AZURE/Ethernet64", "value": "300m"}]
Patch Applier: asic0: verifying patch updates are reflected on ConfigDB.
Patch Applier: asic0 patch application completed.
Patch applied successfully.

stli@STG02-0101-0400-02T2-lc03:~$ show int sta
 Interface Lanes Speed MTU FEC Alias Vlan Oper Admin Type Asym PFC
--------------- --------------------------------------- ------- ----- ----- ----------------------- --------------- ------ ------- ------ ----------
...
 Ethernet64 264,265,266,267 100G 9100 rs HundredGigE0/3/0/8 routed down up N/A off

stli@STG02-0101-0400-02T2-lc03:~$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
aec6bcdb096d soniccr1.azurecr.io/chassis-port-counter-monitor:20260122 "/usr/local/bin/dock…" 7 days ago Up 7 days chassis-port-counter-monitor
2bb42c2ef60a docker-sonic-telemetry:latest "/usr/local/bin/supe…" 7 weeks ago Up About a minute telemetry
84e4a349cd4f docker-snmp:latest "/usr/bin/docker-snm…" 7 weeks ago Up 7 weeks snmp

stli@STG02-0101-0400-02T2-lc03:~$ sudo grep -i "spawned: 'telemetry'" /var/log/syslog
2026 Feb 5 02:08:13.183970 STG02-0101-0400-02T2-lc03 INFO telemetry#supervisord 2026-02-05 02:08:13,183 INFO spawned: 'telemetry' with pid 24
```

Signed-off-by: Sonic Build Admin <sonicbld@microsoft.com>

#### Previous command output (if the output of a command-line utility has changed)

#### New command output (if the output of a command-line utility has changed)
#### Why I did it

Many tests for various packages use /tmp/tmp.XXXXXXXX or /tmp/tmpi_XXXXX as the temporary file or directory pattern for mktemp. Since the same slave container is used for multiple simultaneous builds, destroying an in-progress build's temporary file or directory will cause those builds to fail.

While this has existed for a year, it appears the introduction of Trixie has reordered the builds a bit so that packages using the temp file patterns impacted are built simultaneously.

#### How I did it

It appears /tmp/tmpx and /tmp/tmpy are the toplevel directories created, clear those.

#### How to verify it

Run a trixie build with high parallelism.

#### Which release branch to backport

- [x] 202511

Fixes sonic-net/sonic-buildimage#25424

Signed-off-by: Sonic Build Admin <sonicbld@microsoft.com>
<!--
 Please make sure you've read and understood our contributing guidelines:
 https://github.com/Azure/SONiC/blob/gh-pages/CONTRIBUTING.md

 failure_prs.log skip_prs.log Make sure all your commits include a signature generated with `git commit -s` **

 If this is a bug fix, make sure your description includes "closes #xxxx",
 "fixes #xxxx" or "resolves #xxxx" so that GitHub automatically closes the related
 issue when the PR is merged.

 If you are adding/modifying/removing any command or utility script, please also
 make sure to add/modify/remove any unit tests from the tests
 directory as appropriate.

 If you are modifying or removing an existing 'show', 'config' or 'sonic-clear'
 subcommand, or you are adding a new subcommand, please make sure you also
 update the Command Line Reference Guide (doc/Command-Reference.md) to reflect
 your changes.

 Please provide the following information:
-->

#### Why I did
[PR #25398](sonic-net/sonic-buildimage#25398) changed the host's Docker config to use -H fd://. During image installation, sonic-installer copies these host options to run a temporary dockerd inside a chroot. Since systemd isn't running in the chroot to create and handover a socket dockerd crashes, causing sonic-package-manager migrate to fail.

#### What I did
Sanitized the copied DOCKER_OPTS so the temporary dockerd can start safely without systemd socket activation.
#### How I did it
- In sonic_installer/main.py (get_docker_opts), replaced fd:// with unix://.
- Updated mock arguments in test_sonic_installer.py to verify the sanitization logic.

#### How to verify it

Run sudo sonic-installer install <image.bin> and verify the installation completes successfully without failing during the package migration step.

Signed-off-by: Sonic Build Admin <sonicbld@microsoft.com>
<!--
 Please make sure you've read and understood our contributing guidelines:
 https://github.com/Azure/SONiC/blob/gh-pages/CONTRIBUTING.md

 failure_prs.log skip_prs.log Make sure all your commits include a signature generated with `git commit -s` **

 If this is a bug fix, make sure your description includes "closes #xxxx",
 "fixes #xxxx" or "resolves #xxxx" so that GitHub automatically closes the related
 issue when the PR is merged.

 If you are adding/modifying/removing any command or utility script, please also
 make sure to add/modify/remove any unit tests from the tests
 directory as appropriate.

 If you are modifying or removing an existing 'show', 'config' or 'sonic-clear'
 subcommand, or you are adding a new subcommand, please make sure you also
 update the Command Line Reference Guide (doc/Command-Reference.md) to reflect
 your changes.

 Please provide the following information:
-->
fixes #4292
#### What I did
The `generate_dump` script creates a symlink to itself in the dump directory before generating the initial tar archive. However, due to a typo in the cleanup step, the symlink was not correctly removed. As a result, when the dump directory was appended later using `save_to_tar`, the `generate_dump` entry was added a second time.

This patch corrects the cleanup target so that `generate_dump` symlink is properly removed, preventing duplicate.
#### How I did it
Updated the cleanup step in `generate_dump`:
From:
`$RM $V -f $TARDIR/sonic_dump`
To:
`$RM $V -f $TARDIR/generate_dump`
#### How to verify it
1. Run `show techsupport` on a SONiC target device.
2. Inspect the resulting tar archive in the path `/var/dump`. It should look like `sonic_dump_sonic_20260116_001237.tar.gz`.
3. Confirm that the dump directory should only contain a single `generate_dump`.

**Which release branch to backport**

- [x] 202305
- [x] 202311
- [x] 202405
- [x] 202411
- [x] 202505
- [x] 202511
- [x] 202605

Signed-off-by: Yi Xu <Yi.Xu@lumentum.com>
Signed-off-by: Sonic Build Admin <sonicbld@microsoft.com>
…ti-ASIC platforms (#4433)

<!--
 Please make sure you've read and understood our contributing guidelines:
 https://github.com/Azure/SONiC/blob/gh-pages/CONTRIBUTING.md

 failure_prs.log skip_prs.log Make sure all your commits include a signature generated with `git commit -s` **

 If this is a bug fix, make sure your description includes "closes #xxxx",
 "fixes #xxxx" or "resolves #xxxx" so that GitHub automatically closes the related
 issue when the PR is merged.

 If you are adding/modifying/removing any command or utility script, please also
 make sure to add/modify/remove any unit tests from the tests
 directory as appropriate.

 If you are modifying or removing an existing 'show', 'config' or 'sonic-clear'
 subcommand, or you are adding a new subcommand, please make sure you also
 update the Command Line Reference Guide (doc/Command-Reference.md) to reflect
 your changes.

 Please provide the following information:
-->

#### What I did
Added multi-ASIC platform support for `show interfaces flap` command
#### How I did it
- Added `multi_asic_click_options` decorator to support `-n/--namespace` and `-d/--display` options
- Updated the command to iterate across all namespaces and aggregate flap data from each ASIC's APP_DB
- Added flap mock data to multi-ASIC mock tables (`asic0/appl_db.json`, `asic1/appl_db.json`)
- Added multi-ASIC test file `tests/flap_test.py`
#### How to verify it
```bash
# Run multi-ASIC tests
pytest tests/flap_test.py -v

# On a multi-ASIC device
show interfaces flap
show interfaces flap -n asic0
```
#### Previous command output (if the output of a command-line utility has changed)
```bash
admin@sonic:~$ show interfaces flap
Interface Flap Count Admin Oper Link Down TimeStamp(UTC) Link Up TimeStamp(UTC)
----------- ------------ ------- ------- -------------------------- ------------------------
etp1 Never Unknown Unknown Never Never
etp2 Never Unknown Unknown Never Never
etp3 Never Unknown Unknown Never Never
etp4 Never Unknown Unknown Never Never
...

admin@sonic:~$ show interfaces flap -n asic0
Usage: show interfaces flap [OPTIONS] [INTERFACENAME]
Try "show interfaces flap -h" for help.

Error: no such option: -n
```
#### New command output (if the output of a command-line utility has changed)
```bash
admin@sonic:~$ show interfaces flap
Interface Flap Count Admin Oper Link Down TimeStamp(UTC) Link Up TimeStamp(UTC)
----------- ------------ ------- ------ -------------------------- ------------------------
Ethernet0 4097 Up Up Sat Feb 21 11:00:41 2026 Sat Feb 21 11:00:59 2026
Ethernet8 4035 Up Up Sat Feb 21 11:00:41 2026 Sat Feb 21 11:00:59 2026
Ethernet16 4015 Up Up Sat Feb 21 11:01:23 2026 Sat Feb 21 11:01:41 2026
Ethernet24 4019 Up Up Sat Feb 21 11:01:23 2026 Sat Feb 21 11:01:41 2026
...

admin@sonic:~$ show interfaces flap -n asic0
Interface Flap Count Admin Oper Link Down TimeStamp(UTC) Link Up TimeStamp(UTC)
----------- ------------ ------- ------ -------------------------- ------------------------
Ethernet0 4097 Up Up Sat Feb 21 11:00:41 2026 Sat Feb 21 11:00:59 2026
Ethernet8 4035 Up Up Sat Feb 21 11:00:41 2026 Sat Feb 21 11:00:59 2026
Ethernet16 4015 Up Up Sat Feb 21 11:01:23 2026 Sat Feb 21 11:01:41 2026
Ethernet24 4019 Up Up Sat Feb 21 11:01:23 2026 Sat Feb 21 11:01:41 2026
...
```

Signed-off-by: Sonic Build Admin <sonicbld@microsoft.com>
Fixes issue sonic-net/sonic-utilities#4375

Currently when using `sudo ip netns exec <namespace> counterpoll <args>` it will ignore the namespace and use the default namespace. This patch fixes that behavior to use namespace that the command is running in.

This is how the command worked previously but a regression was introduced breaking this behaviour.

<!--
 Please make sure you've read and understood our contributing guidelines:
 https://github.com/Azure/SONiC/blob/gh-pages/CONTRIBUTING.md

 failure_prs.log skip_prs.log Make sure all your commits include a signature generated with `git commit -s` **

 If this is a bug fix, make sure your description includes "closes #xxxx",
 "fixes #xxxx" or "resolves #xxxx" so that GitHub automatically closes the related
 issue when the PR is merged.

 If you are adding/modifying/removing any command or utility script, please also
 make sure to add/modify/remove any unit tests from the tests
 directory as appropriate.

 If you are modifying or removing an existing 'show', 'config' or 'sonic-clear'
 subcommand, or you are adding a new subcommand, please make sure you also
 update the Command Line Reference Guide (doc/Command-Reference.md) to reflect
 your changes.

 Please provide the following information:
-->

#### What I did
I changed the default value of the -n arg to be the namespace we are running the command in.

#### How to verify it

I verified that with my change the namespace being run in will be the default namespace chosen.

```
$ sonic-db-cli -n asic0 CONFIG_DB hgetall "FLEX_COUNTER_TABLE|PG_DROP"
{'FLEX_COUNTER_STATUS': 'enable'}
$ sudo ip netns exec asic0 counterpoll pg-drop disable
$ sonic-db-cli -n asic0 CONFIG_DB hgetall "FLEX_COUNTER_TABLE|PG_DROP"
{'FLEX_COUNTER_STATUS': 'disable'}
```

 I also verified that the command exits gracefully if the user attempts to confuse it with 2 namespaces like so:
```
sudo ip netns exec asic0 counterpoll pg-drop -n asic1 disable
Usage: counterpoll pg-drop [OPTIONS] COMMAND [ARGS]...
Try 'counterpoll pg-drop --help' for help.

Error: Invalid value for '-n' / '--namespace': 'asic1' is not 'asic0'.
```

#### Previous command output (if the output of a command-line utility has changed)
```
$ sonic-db-cli -n asic0 CONFIG_DB hgetall "FLEX_COUNTER_TABLE|PG_DROP"
{'FLEX_COUNTER_STATUS': 'enable'}
$ sudo ip netns exec asic0 counterpoll pg-drop disable
$ sonic-db-cli -n asic0 CONFIG_DB hgetall "FLEX_COUNTER_TABLE|PG_DROP"
{'FLEX_COUNTER_STATUS': 'enable'}
```

#### New command output (if the output of a command-line utility has changed)
Seen above

Signed-off-by: Sonic Build Admin <sonicbld@microsoft.com>
@mssonicbld mssonicbld merged commit f7e9fdd into Azure:202603 Apr 7, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant