From 6332aa31cc5a38866837fbd4a412df2b20f8f5e4 Mon Sep 17 00:00:00 2001 From: Yaqiang Zhu Date: Fri, 19 May 2023 00:00:20 +0800 Subject: [PATCH] [yang] Extend device_metadata yang model with rack_mgmt_map (#15109) * [yang] Extend device_metadata yang model with rack_mgmt_map * Update doc and sample --- src/sonic-yang-models/doc/Configuration.md | 3 ++- .../tests/files/sample_config_db.json | 3 ++- .../tests/device_metadata.json | 7 +++++++ .../tests_config/device_metadata.json | 18 ++++++++++++++++++ .../yang-models/sonic-device_metadata.yang | 8 ++++++++ 5 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/sonic-yang-models/doc/Configuration.md b/src/sonic-yang-models/doc/Configuration.md index eccf550ece..551eba5fb1 100644 --- a/src/sonic-yang-models/doc/Configuration.md +++ b/src/sonic-yang-models/doc/Configuration.md @@ -925,7 +925,8 @@ instance is supported in SONiC. "type": "ToRRouter", "bgp_adv_lo_prefix_as_128" : "true", "buffer_model": "traditional", - "yang_config_validation": "disable" + "yang_config_validation": "disable", + "rack_mgmt_map": "dummy_value" } } } 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 c9d3cfec61..6dc354666a 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -359,7 +359,8 @@ "sub_role": "FrontEnd", "dhcp_server": "disabled", "bgp_adv_lo_prefix_as_128": "true", - "yang_config_validation": "disable" + "yang_config_validation": "disable", + "rack_mgmt_map": "dummy_value" } }, "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 bdcea63ebb..c10101e1f6 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 @@ -135,5 +135,12 @@ "DEVICE_METADATA_SUPPRESS_PENDING_FIB_ENABLED_SYNCHRONOUS_MODE_DISABLED": { "desc": "Enable bgp-suppress-fib-pending when synchronous mode is disabled", "eStr": ["ASIC synchronous mode must be enabled in order to enable suppress FIB pending feature"] + }, + "DEVICE_METADATA_VALID_RACK_MGMT_MAP": { + "desc": "Verifying rack_mgmt_map configuration." + }, + "DEVICE_METADATA_INVALID_RACK_MGMT_MAP": { + "desc": "Verifying invalid rack_mgmt_map configuration.", + "eStr": "Invalid length for the rack mgmt map." } } 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 800a6972a4..1d0d2e6165 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 @@ -362,5 +362,23 @@ } } } + }, + "DEVICE_METADATA_VALID_RACK_MGMT_MAP": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "rack_mgmt_map": "dummy_value" + } + } + } + }, + "DEVICE_METADATA_INVALID_RACK_MGMT_MAP": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "rack_mgmt_map": "dummy_value-dummy_value-dummy_value-dummy_value-dummy_value-dummy_value-dummy_value-dummy_value-dummy_value-dummy_value-dummy_value-dummy_value-dummy_value" + } + } + } } } 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 f333320aff..39df414660 100644 --- a/src/sonic-yang-models/yang-models/sonic-device_metadata.yang +++ b/src/sonic-yang-models/yang-models/sonic-device_metadata.yang @@ -217,6 +217,14 @@ module sonic-device_metadata { error-message "ASIC synchronous mode must be enabled in order to enable suppress FIB pending feature"; } } + leaf rack_mgmt_map { + type string { + length 0..128 { + error-message "Invalid length for the rack mgmt map."; + } + } + description "Information of rack mgmt map."; + } } /* end of container localhost */ }