From 2964b71e721ce9ea88e92471b77a602cf7f7b741 Mon Sep 17 00:00:00 2001 From: Arvindsrinivasan Lakshmi Narasimhan <55814491+arlakshm@users.noreply.github.com> Date: Fri, 8 Nov 2024 11:28:38 -0800 Subject: [PATCH] Skip the lanes for host config DB for multi asic VS (#20727) How I did it Skip the lanes for host config DB for multi asic VS and add UT How to verify it UT and compile yang_mgmt and yang_model wheel package --- .../tests/yang_model_tests/tests/port.json | 6 ++ .../yang_model_tests/tests_config/port.json | 67 +++++++++++++++++++ .../yang-models/sonic-port.yang | 4 +- 3 files changed, 76 insertions(+), 1 deletion(-) diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/port.json b/src/sonic-yang-models/tests/yang_model_tests/tests/port.json index f53d19f42e63..3c0d59cc247d 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/port.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/port.json @@ -174,6 +174,12 @@ }, "PORT_VOQ_CHASSIS_WITH_LANES": { "desc": "PORT_VOQ_CHASSIS_WITH_LANES no failure." + }, + "PORT_WITH_NO_LANES_ON_MULT_ASIC_VS": { + "desc": "PORT_WITH_NO_LANES_ON_MULT_ASIC_VS no failure." + }, + "PORT_WITH_NO_LANES_ON_MULT_ASIC_VS_2": { + "desc": "PORT_WITH_NO_LANES_ON_MULT_ASIC_VS_2 no failure." } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json index bd375b73717b..005961c1daae 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json @@ -952,5 +952,72 @@ ] } } + }, + "PORT_FABRIC_WITH_NO_LANES": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "switch_type": "fabric" + } + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet0", + "alias": "etp1a", + "speed": 100000, + "role": "Int" + + } + ] + } + } + }, + "PORT_WITH_NO_LANES_ON_MULT_ASIC_VS": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "hwsku": "msft_multi_asic_vs" + } + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet0", + "alias": "etp1a", + "speed": 100000, + "role": "Int" + + } + ] + } + } + }, + "PORT_WITH_NO_LANES_ON_MULT_ASIC_VS_2": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "hwsku": "msft_four_asic_vs" + } + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet0", + "alias": "etp1a", + "speed": 100000, + "role": "Int" + + } + ] + } + } } + } diff --git a/src/sonic-yang-models/yang-models/sonic-port.yang b/src/sonic-yang-models/yang-models/sonic-port.yang index 7d315626d5cf..528f661b8fcf 100644 --- a/src/sonic-yang-models/yang-models/sonic-port.yang +++ b/src/sonic-yang-models/yang-models/sonic-port.yang @@ -74,7 +74,9 @@ module sonic-port{ when "not(not(/sdm:sonic-device_metadata/sdm:DEVICE_METADATA/sdm:localhost/sdm:asic_name) and ((/sdm:sonic-device_metadata/sdm:DEVICE_METADATA/sdm:localhost/sdm:switch_type='voq') or (/sdm:sonic-device_metadata/sdm:DEVICE_METADATA/sdm:localhost/sdm:switch_type='chassis-packet') or - (/sdm:sonic-device_metadata/sdm:DEVICE_METADATA/sdm:localhost/sdm:switch_type='fabric')))"; + (/sdm:sonic-device_metadata/sdm:DEVICE_METADATA/sdm:localhost/sdm:switch_type='fabric') or + (/sdm:sonic-device_metadata/sdm:DEVICE_METADATA/sdm:localhost/sdm:hwsku='msft_four_asic_vs') or + (/sdm:sonic-device_metadata/sdm:DEVICE_METADATA/sdm:localhost/sdm:hwsku='msft_multi_asic_vs')))"; description "Number of hardware lanes for the port. This is mandatory for all devices except for chassis devices"; mandatory true;