Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DPB][YANG] extended yang-model - added 'buffer_model' field #6464

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -194,7 +194,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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example for Description:

leaf buffer_model {
                    description "dynamic model field represents <WRITE A DESCRIPTION>";
                    type string {
                        pattern "dynamic|traditional";
                    }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

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";
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add description for this leaf to describe the function name.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @lguohan,
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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, can you add description field in the leaf node?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

description: ""

check other yang mode examples, they have added description.

}
/* end of container localhost */
}
Expand Down