[code sync] Merge code from sonic-net/sonic-utilities:202605 to 202607 - #423
Merged
Conversation
mssonicbld
commented
Jul 30, 2026
Collaborator
… GCU (#4728) <!-- Please make sure you've read and understood our contributing guidelines: https://github.com/Azure/SONiC/blob/gh-pages/CONTRIBUTING.md CODE_OF_CONDUCT.md LICENSE README.md SECURITY.md SUPPORT.md azure-pipelines failure_prs.log scripts 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 Extended Generic Configuration Updater (GCU) platform validation coverage for Mellanox Spectrum 6 and added MSFT-related Spectrum 6 SKUs in the ASIC mapping so config updates are accepted on newer SN6600-based platforms. #### How I did it - Updated gcu_field_operation_validators.conf.json to: - expand spc6 HWSKU list with Mellanox-SN6600_LD-P128C2 and Mellanox-SN6600_LD-P64O128C2 add spc6 minimum-version platform entries (20260500) in relevant validator rules - Updated field_operation_validators.py so get_asic_name() detects spc6 for Mellanox HWSKUs. - Added unit test coverage in tests/generic_config_updater/field_operation_validator_test.py for spc6 ASIC detection. #### How to verify it - Run unit tests: - pytest -k test_get_asic_spc6 tests/generic_config_updater/field_operation_validator_test.py - On an SPC6/MSFT SKU device, run a representative GCU update operation and confirm validation no longer rejects the platform as unsupported. - Optionally validate that existing non-SPC6 platform checks continue to pass. 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)
In sonic-net/sonic-utilities#4462 functionality was added to include a IP_TYPE qualifier on rules with IP_PROTOCOL. This broke custom ACL types that don't support the IP_TYPE qualifier. sonic-net/sonic-buildimage#28028 This change will avoid adding IP_TYPE on those custom ACL types. #### What I did Skip adding `IP_TYPE` qualifier automatically on custom ACL types that don't support `IP_TYPE` qualifier #### How I did it In `acl-loader` check if `IP_TYPE` is in the `MATCHES` attribute of `ACL_TABLE_TYPE` before adding the `IP_TYPE` qualifier. #### How to verify it I executed the same steps described in sonic-net/sonic-buildimage#28028 Before this change I'd see the `IP_TYPE` added to the `RULE_1` entry in CONFIG_DB: ``` # sonic-db-cli CONFIG_DB hgetall "ACL_RULE|TEST_NOIPTYPE|RULE_1" {'IP_PROTOCOL': '6', 'IP_TYPE': 'IP', 'PACKET_ACTION': 'FORWARD', 'PRIORITY': '9999', 'SRC_IP': '20.0.0.2/32'} root@ctn106:~# show acl rule Table Rule Priority Action Match Status ------------- ------ ---------- -------- ------------------- -------- TEST_NOIPTYPE RULE_1 9999 FORWARD IP_PROTOCOL: 6 Inactive IP_TYPE: IP SRC_IP: 20.0.0.2/32 ``` And the error syslog in orchagent: ``` 2026 Jun 29 18:22:34.681995 ctn106 ERR swss#orchagent: :- validateAclRuleMatch: Match SAI_ACL_ENTRY_ATTR_FIELD_ACL_IP_TYPE in rule RULE_1 is not supported by table TEST_NOIPTYPE 2026 Jun 29 18:22:34.681995 ctn106 ERR swss#orchagent: :- doAclRuleTask: Unknown or invalid rule attribute 'IP_TYPE : IP' 2026 Jun 29 18:22:34.682107 ctn106 ERR swss#orchagent: :- doAclRuleTask: Failed to create ACL rule. Rule configuration is invalid ``` After this change I see the `IP_TYPE` isn't added to the `RULE_1` entry in CONFIG_DB: ``` root@ctn106:~# sonic-db-cli CONFIG_DB hgetall "ACL_RULE|TEST_NOIPTYPE|RULE_1" {'IP_PROTOCOL': '6', 'PACKET_ACTION': 'FORWARD', 'PRIORITY': '9999', 'SRC_IP': '20.0.0.2/32'} root@ctn106:~# show acl rule Table Rule Priority Action Match Status ------------- ------ ---------- -------- ------------------- -------- TEST_NOIPTYPE RULE_1 9999 FORWARD IP_PROTOCOL: 6 Active SRC_IP: 20.0.0.2/32 ``` And the rule is successfully added: ``` 2026 Jun 29 18:56:24.439088 ctn106 NOTICE swss#orchagent: :- add: Successfully created ACL rule RULE_1 in table TEST_NOIPTYPE ``` #### Previous command output (if the output of a command-line utility has changed) N/A #### New command output (if the output of a command-line utility has changed) N/A #### Casts * 202511 * 202605 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 CODE_OF_CONDUCT.md LICENSE README.md SECURITY.md SUPPORT.md azure-pipelines failure_prs.log scripts 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 Fixed intermittent failures in `tests/config_mgmt_test.py`, `tests/config_dpb_test.py`, and `tests/config_override_test.py` during sonic-utilities CI (including parallel pytest-xdist runs). Typical failures addressed: - `TestConfigMgmt::test_upper_case_mac_fix` — `Exception: ConfigMgmtDPB Class creation failed` - `TestConfigMgmt::test_table_without_yang` — `AssertionError: assert 'unknown_table' in {}` - Other `ConfigMgmt` / `ConfigMgmtDPB` init paths — `Exception: ConfigMgmt Class creation failed` Test-only changes; no production `config_mgmt.py` behavior changes. #### How I did it **YANG fixture fix (`test_upper_case_mac_fix`)** - Use the full sample `configDbJson` instead of a `PORT`-only snapshot plus `DEVICE_METADATA`. A minimal CONFIG_DB can fail `sonic_yang` `loadData()` with `LYD_OPT_STRICT` when newer YANG models require cross-table context (`ACL_TABLE`, `VLAN_MEMBER`, `INTERFACE`, etc.). - Keep the test intent: add `DEVICE_METADATA` with mixed-case MAC `00:11:22:BB:CC:DD` and the same assertions for libyang lower-casing of `yang:mac-address` during dynamic port breakout (`_createConfigToLoad()`). **Per-worker JSON paths (pytest-xdist race)** After parallel pytest (`-n auto --dist loadfile`, sonic-utilities #4516), several tests still used fixed `startConfigDb.json` / `portBreakOutConfigDb.json` paths in the source tree or shared `/tmp`. Concurrent xdist workers could overwrite those files, causing partial/empty/wrong JSON (constructor failures) or missing `unknown_table` (empty `tablesWithOutYang()`). - Add `worker_tmp_path()` in `tests/utils.py`, using `WORKER_TMP` from `tests/conftest.py` when set, otherwise a per-worker directory under the system temp dir (`sonic-utilities-gwN/`). - `tests/config_mgmt_test.py`: `setUp()` uses per-worker JSON paths. - `tests/config_override_test.py`: `startConfigDb.json` via `worker_tmp_path()`. - `tests/config_dpb_test.py`: replace shared `/tmp` paths with `worker_tmp_path()`; use `Path.unlink(missing_ok=True)` in teardown instead of `os.system("rm -f ...")`. Same per-worker scratch pattern as other tests stabilized after #4516 (e.g. ecn/mmuconfig). #### How to verify it **Standalone sonic-utilities (parallel, matches CI):** ```bash cd src/sonic-utilities pip install ".[testing]" python3 -m pytest tests/config_mgmt_test.py::TestConfigMgmt -n auto --dist loadfile -v python3 -m pytest tests/config_override_test.py::TestConfigOverride -n auto --dist loadfile -v python3 -m pytest tests/config_dpb_test.py -n auto --dist loadfile -v ``` Repeat several times; focus on `test_upper_case_mac_fix` and `test_table_without_yang`. Focused checks: ``` python3 -m pytest tests/config_mgmt_test.py::TestConfigMgmt::test_upper_case_mac_fix -v python3 -m pytest tests/config_mgmt_test.py::TestConfigMgmt::test_table_without_yang -v ``` 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)
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.