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 e4bcb56402..699ce6ad10 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -202,7 +202,8 @@ "mac": "00:11:22:33:dd:5a", "hostname": "asw.dc", "bgp_asn": "64850", - "hwsku": "Stone" + "hwsku": "Stone", + "buffer_model": "dynamic" } }, "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 1e560257ad..9b58c2fde1 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 @@ -32,5 +32,15 @@ "DEVICE_METADATA_TYPE_INCORRECT_PATTERN": { "desc": "DEVICE_METADATA_TYPE_INCORRECT_PATTERN pattern failure.", "eStrKey" : "Pattern" + }, + "DEVICE_METADATA_CORRECT_BUFFER_MODEL_PATTERN": { + "desc": "DEVICE_METADATA correct value for BUFFER_MODEL field" + }, + "DEVICE_METADATA_CORRECT_BUFFER_MODEL_PATTERN2": { + "desc": "DEVICE_METADATA correct value for BUFFER_MODEL field" + }, + "DEVICE_METADATA_INCORRECT_BUFFER_MODEL_PATTERN": { + "desc": "DEVICE_METADATA wrong value for BUFFER_MODEL field.", + "eStr": ["pattern", "does not satisfy"] } } 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 7a3bf81e19..0f0bdc8506 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 @@ -90,5 +90,32 @@ } } } + }, + "DEVICE_METADATA_CORRECT_BUFFER_MODEL_PATTERN": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "buffer_model": "dynamic" + } + } + } + }, + "DEVICE_METADATA_CORRECT_BUFFER_MODEL_PATTERN2": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "buffer_model": "traditional" + } + } + } + }, + "DEVICE_METADATA_INCORRECT_BUFFER_MODEL_PATTERN": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "buffer_model": "incorrect_pattern" + } + } + } } } 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 054b436f24..e563dc0d93 100644 --- a/src/sonic-yang-models/yang-models/sonic-device_metadata.yang +++ b/src/sonic-yang-models/yang-models/sonic-device_metadata.yang @@ -89,6 +89,18 @@ module sonic-device_metadata { pattern "ToRRouter|LeafRouter|SpineChassisFrontendRouter|ChassisBackendRouter|ASIC"; } } + + leaf buffer_model { + description "This leaf is added for dynamic buffer calculation. + The dynamic model represents the model in which the buffer configurations, + like the headroom sizes and buffer pool sizes, are dynamically calculated based + on the ports' speed, cable length, and MTU. This model is used by Mellanox so far. + The traditional model represents the model in which all the buffer configurations + are statically configured in CONFIG_DB tables. This is the default model used by all other vendors"; + type string { + pattern "dynamic|traditional"; + } + } } /* end of container localhost */ }