forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Buffermgr]Graceful handling of buffer model change (sonic-net#1956)
Signed-off-by: Sudharsan Dhamal Gopalarathnam [email protected] What I did Handled buffer model changes gracefully. The use case is when config_db.json is loaded initially with no buffer configurations and when user executes 'config qos reload', it would result in buffer model changing from traditional to dynamic. This transition requires swss restart which will be shown as message to user. Why I did it When config qos reload is given in platforms with dynamic buffer model, swss restart is required. However, if swss is not restarted the buffermgrd will stay in static model and will program the orchagent with 'size' field not set in buffer pool due to dynamic mode checks in jinja2 template. This will result in orchagent calling SAI without SAI_BUFFER_POOL_ATTR_SIZE which is mandatory attribute. Since this results in a SAI create API failure, it will result in orchagent crash. So when the mode is changed to dynamic, buffermgrd will not process any configurations when running in static mode. How I verified it Added UT. Manually verified that config qos reload doesn't crash.
- Loading branch information
1 parent
b0aa6a0
commit d95823d
Showing
4 changed files
with
75 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,27 @@ | ||
import pytest | ||
import time | ||
|
||
class TestBufferModel(object): | ||
def test_bufferModel(self, dvs, testlog): | ||
config_db = dvs.get_config_db() | ||
metadata = config_db.get_entry("DEVICE_METADATA", "localhost") | ||
assert metadata["buffer_model"] == "traditional" | ||
|
||
def test_update_bufferModel(self, dvs, testlog): | ||
config_db = dvs.get_config_db() | ||
app_db = dvs.get_app_db() | ||
keys = app_db.get_keys("BUFFER_POOL_TABLE") | ||
num_keys = len(keys) | ||
|
||
try: | ||
fvs = {'buffer_model' : 'dynamic'} | ||
config_db.update_entry("DEVICE_METADATA", "localhost", fvs) | ||
fvs = {'mode':'dynamic', 'type':'egress'} | ||
config_db.update_entry("BUFFER_POOL", "temp_pool", fvs) | ||
time.sleep(2) | ||
app_db.wait_for_n_keys("BUFFER_POOL_TABLE", num_keys) | ||
|
||
finally: | ||
config_db.delete_entry("BUFFER_POOL", "temp_pool") | ||
fvs = {'buffer_model' : 'traditional'} | ||
config_db.update_entry("DEVICE_METADATA", "localhost", fvs) |