From 861ea26d1887354033f4568059e1f3f79c4b62e3 Mon Sep 17 00:00:00 2001 From: jingwenxie Date: Thu, 10 Mar 2022 14:42:43 -0800 Subject: [PATCH] [yang]: Update DEVICE_METADATA yang models to support 'sub_role' (#10161) #### Why I did it Fix https://github.com/Azure/sonic-buildimage/issues/9591 #### How I did it Add 'sub_role' to device_metadata yang models. #### How to verify it Run UT for sonc-yang-models. --- src/sonic-yang-models/tests/files/sample_config_db.json | 3 ++- .../tests/yang_model_tests/tests/device_metadata.json | 5 ++++- .../yang_model_tests/tests_config/device_metadata.json | 9 +++++++++ .../yang-models/sonic-device_metadata.yang | 5 +++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index 6dbffce671..920181646c 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -302,7 +302,8 @@ "asic_name": "Asic0", "switch_id": "2", "switch_type": "voq", - "max_cores": "8" + "max_cores": "8", + "sub_role": "FrondEnd" } }, "VLAN": { diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json b/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json index ca26e24cd3..ecfff6f69a 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json @@ -100,6 +100,9 @@ }, "DEVICE_METADATA_CORRECT_VOQ_CONFIG": { "desc": "Verifying VOQ configuration." - } + }, + "DEVICE_METADATA_VALID_SUB_ROLE_CONFIG": { + "desc": "Verifying valid sub_role configuration." + } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json index bfc9c080b7..de0d4e15dc 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json @@ -274,5 +274,14 @@ } } } + }, + "DEVICE_METADATA_VALID_SUB_ROLE_CONFIG": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "sub_role": "FrontEnd" + } + } + } } } diff --git a/src/sonic-yang-models/yang-models/sonic-device_metadata.yang b/src/sonic-yang-models/yang-models/sonic-device_metadata.yang index 0dc88f436d..87170850d8 100644 --- a/src/sonic-yang-models/yang-models/sonic-device_metadata.yang +++ b/src/sonic-yang-models/yang-models/sonic-device_metadata.yang @@ -127,6 +127,11 @@ module sonic-device_metadata { type string; } + leaf sub_role { + type string; + description "sub_role indicates if ASIC is FrondEnd or BackEnd."; + } + leaf downstream_subrole { type string; }