From 4528ae7c08f0fb31b27b0835dc362d6e159419fa Mon Sep 17 00:00:00 2001 From: Jingwen Xie Date: Mon, 7 Mar 2022 05:40:30 +0000 Subject: [PATCH 1/3] [yang]: Update DEVICE_METADATA yang models to support 'sub_role' --- 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 | 4 ++++ 4 files changed, 19 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 e7b03092efac..853eedf5ef3e 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -297,7 +297,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 ca26e24cd329..ecfff6f69a6f 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 bfc9c080b758..de0d4e15dcee 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 0dc88f436d8f..120f3c2d5df0 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,10 @@ module sonic-device_metadata { type string; } + leaf sub_role { + type string; + } + leaf downstream_subrole { type string; } From db0776b9f119c3c5599485b2afcdc8c9777a554a Mon Sep 17 00:00:00 2001 From: Jingwen Xie Date: Tue, 8 Mar 2022 03:16:09 +0000 Subject: [PATCH 2/3] Add description for sub_role --- src/sonic-yang-models/yang-models/sonic-device_metadata.yang | 1 + 1 file changed, 1 insertion(+) 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 120f3c2d5df0..545802aba12e 100644 --- a/src/sonic-yang-models/yang-models/sonic-device_metadata.yang +++ b/src/sonic-yang-models/yang-models/sonic-device_metadata.yang @@ -129,6 +129,7 @@ module sonic-device_metadata { leaf sub_role { type string; + description "sub_roble indicates if ASIC is FrondEnd or BackEnd."; } leaf downstream_subrole { From 5704fa71e74d237aafd9cc2f4e4383f0282ccb91 Mon Sep 17 00:00:00 2001 From: Jingwen Xie Date: Wed, 9 Mar 2022 01:12:15 +0000 Subject: [PATCH 3/3] typo --- src/sonic-yang-models/yang-models/sonic-device_metadata.yang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 545802aba12e..87170850d895 100644 --- a/src/sonic-yang-models/yang-models/sonic-device_metadata.yang +++ b/src/sonic-yang-models/yang-models/sonic-device_metadata.yang @@ -129,7 +129,7 @@ module sonic-device_metadata { leaf sub_role { type string; - description "sub_roble indicates if ASIC is FrondEnd or BackEnd."; + description "sub_role indicates if ASIC is FrondEnd or BackEnd."; } leaf downstream_subrole {