Skip to content

Commit

Permalink
[202012] Fix migration of pfcwd_sw_enable (#2204)
Browse files Browse the repository at this point in the history
* Fix migration of pfcwd_sw_enable

Signed-off-by: bingwang <wang.bing@microsoft.com>
  • Loading branch information
bingwang-ms authored Jun 9, 2022
1 parent 74bf951 commit b0d7062
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion scripts/db_migrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,8 @@ def migrate_pfcwd_sw_enable_table(self):
"""
qos_maps = self.configDB.get_table('PORT_QOS_MAP')
for k, v in qos_maps.items():
if 'pfc_enable' in v:
# Skip migration if the key already presents
if ('pfcwd_sw_enable' not in v) and ('pfc_enable' in v):
v['pfcwd_sw_enable'] = v['pfc_enable']
self.configDB.set_entry('PORT_QOS_MAP', k, v)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"Ethernet100": {
"dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]",
"pfc_enable": "3,4",
"pfc_enable": "2,3,4,6",
"pfcwd_sw_enable": "3,4",
"pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]",
"tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]",
Expand Down
3 changes: 2 additions & 1 deletion tests/db_migrator_input/config_db/qos_map_table_input.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
},
"Ethernet100": {
"dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]",
"pfc_enable": "3,4",
"pfc_enable": "2,3,4,6",
"pfcwd_sw_enable": "3,4",
"pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]",
"tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]",
"tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]"
Expand Down
1 change: 1 addition & 0 deletions tests/db_migrator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,3 +273,4 @@ def test_pfc_enable_migrator(self):

diff = DeepDiff(resulting_table, expected_table, ignore_order=True)
assert not diff

0 comments on commit b0d7062

Please sign in to comment.