Skip to content

Commit 6bcea45

Browse files
[DPB][YANG] extended yang-model - added 'buffer_model' field, added test cases (#6464)
- Why I did it The fix for the issue [DPB][YANG] sonic-device_metadata.yang is not aligned with newest changes in CONFIG_DB - How I did it CONFIG_DB was extended with the field buffer_model - added representation of this field inside the sonic-device_metadata.yang - How to verify it Run the command config interface breakout <interface> <breakout_mode> Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
1 parent 4e83d7d commit 6bcea45

File tree

4 files changed

+51
-1
lines changed

4 files changed

+51
-1
lines changed

src/sonic-yang-models/tests/files/sample_config_db.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@
202202
"mac": "00:11:22:33:dd:5a",
203203
"hostname": "asw.dc",
204204
"bgp_asn": "64850",
205-
"hwsku": "Stone"
205+
"hwsku": "Stone",
206+
"buffer_model": "dynamic"
206207
}
207208
},
208209
"VLAN": {

src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,15 @@
3232
"DEVICE_METADATA_TYPE_INCORRECT_PATTERN": {
3333
"desc": "DEVICE_METADATA_TYPE_INCORRECT_PATTERN pattern failure.",
3434
"eStrKey" : "Pattern"
35+
},
36+
"DEVICE_METADATA_CORRECT_BUFFER_MODEL_PATTERN": {
37+
"desc": "DEVICE_METADATA correct value for BUFFER_MODEL field"
38+
},
39+
"DEVICE_METADATA_CORRECT_BUFFER_MODEL_PATTERN2": {
40+
"desc": "DEVICE_METADATA correct value for BUFFER_MODEL field"
41+
},
42+
"DEVICE_METADATA_INCORRECT_BUFFER_MODEL_PATTERN": {
43+
"desc": "DEVICE_METADATA wrong value for BUFFER_MODEL field.",
44+
"eStr": ["pattern", "does not satisfy"]
3545
}
3646
}

src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,32 @@
9090
}
9191
}
9292
}
93+
},
94+
"DEVICE_METADATA_CORRECT_BUFFER_MODEL_PATTERN": {
95+
"sonic-device_metadata:sonic-device_metadata": {
96+
"sonic-device_metadata:DEVICE_METADATA": {
97+
"sonic-device_metadata:localhost": {
98+
"buffer_model": "dynamic"
99+
}
100+
}
101+
}
102+
},
103+
"DEVICE_METADATA_CORRECT_BUFFER_MODEL_PATTERN2": {
104+
"sonic-device_metadata:sonic-device_metadata": {
105+
"sonic-device_metadata:DEVICE_METADATA": {
106+
"sonic-device_metadata:localhost": {
107+
"buffer_model": "traditional"
108+
}
109+
}
110+
}
111+
},
112+
"DEVICE_METADATA_INCORRECT_BUFFER_MODEL_PATTERN": {
113+
"sonic-device_metadata:sonic-device_metadata": {
114+
"sonic-device_metadata:DEVICE_METADATA": {
115+
"sonic-device_metadata:localhost": {
116+
"buffer_model": "incorrect_pattern"
117+
}
118+
}
119+
}
93120
}
94121
}

src/sonic-yang-models/yang-models/sonic-device_metadata.yang

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,18 @@ module sonic-device_metadata {
8989
pattern "ToRRouter|LeafRouter|SpineChassisFrontendRouter|ChassisBackendRouter|ASIC";
9090
}
9191
}
92+
93+
leaf buffer_model {
94+
description "This leaf is added for dynamic buffer calculation.
95+
The dynamic model represents the model in which the buffer configurations,
96+
like the headroom sizes and buffer pool sizes, are dynamically calculated based
97+
on the ports' speed, cable length, and MTU. This model is used by Mellanox so far.
98+
The traditional model represents the model in which all the buffer configurations
99+
are statically configured in CONFIG_DB tables. This is the default model used by all other vendors";
100+
type string {
101+
pattern "dynamic|traditional";
102+
}
103+
}
92104
}
93105
/* end of container localhost */
94106
}

0 commit comments

Comments
 (0)