Skip to content

Commit

Permalink
[DPB][YANG] extended yang-model - added 'buffer_model' field, added t…
Browse files Browse the repository at this point in the history
…est cases (sonic-net#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 <[email protected]>
  • Loading branch information
vadymhlushko-mlnx authored and raphaelt-nvidia committed May 13, 2021
1 parent 9f74a2f commit e55403a
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
}
}
12 changes: 12 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-device_metadata.yang
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
}
Expand Down

0 comments on commit e55403a

Please sign in to comment.