From 1c4300f309be95d3b182a490032b3af2de95a89b Mon Sep 17 00:00:00 2001 From: Xincun Li <147451452+xincunli-sonic@users.noreply.github.com> Date: Fri, 16 Aug 2024 09:31:10 -0700 Subject: [PATCH] Skip default lanes dup check (#3489) * Add namespace check for multiasic * Skip Default lane duplication check. --- generic_config_updater/gu_common.py | 3 ++- tests/generic_config_updater/gu_common_test.py | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/generic_config_updater/gu_common.py b/generic_config_updater/gu_common.py index 938aa1d034..452bad1ee7 100644 --- a/generic_config_updater/gu_common.py +++ b/generic_config_updater/gu_common.py @@ -239,7 +239,8 @@ def validate_lanes(self, config_db): for port in port_to_lanes_map: lanes = port_to_lanes_map[port] for lane in lanes: - if lane in existing: + # default lane would be 0, it does not need validate duplication. + if lane in existing and lane != '0': return False, f"'{lane}' lane is used multiple times in PORT: {set([port, existing[lane]])}" existing[lane] = port return True, None diff --git a/tests/generic_config_updater/gu_common_test.py b/tests/generic_config_updater/gu_common_test.py index 4a16a5ca4f..21f50e0b7b 100644 --- a/tests/generic_config_updater/gu_common_test.py +++ b/tests/generic_config_updater/gu_common_test.py @@ -361,6 +361,13 @@ def test_validate_lanes__same_valid_lanes_multi_ports_no_spaces__failure(self): }} self.validate_lanes(config, '67') + def test_validate_lanes_default_value_duplicate_check(self): + config = {"PORT": { + "Ethernet0": {"lanes": "0", "speed": "10000"}, + "Ethernet1": {"lanes": "0", "speed": "10000"}, + }} + self.validate_lanes(config) + def validate_lanes(self, config_db, expected_error=None): # Arrange config_wrapper = gu_common.ConfigWrapper()