Skip to content

Commit

Permalink
[db_migrator][Mellanox] Update Mellanox buffer migrator with 2km-cabl…
Browse files Browse the repository at this point in the history
…e supported (sonic-net#1564)

What I did
Update mellanox buffer migrator with 2km-cable supported

Signed-off-by: Stephen Sun stephens@nvidia.com

How I did it
- Introduce database version 1.0.6 which is based on 201911. This version represents the buffer configuration with 2kb-cable supported.
- As 1.0.6 is the latest version in 201911, change the "from" version of warm-reboot to 1.0.6. All mock APPL_DB files are renamed (from xxx_version_1_0_5.json to xxx_version_1_0_6.json) correspondingly.
- Add mock files for CONFIG_DB for version 1.0.6.

How to verify it
Run manually test and unit test.
  • Loading branch information
stephenxs authored Jun 1, 2021
1 parent c2b760f commit 1da879c
Show file tree
Hide file tree
Showing 75 changed files with 44,735 additions and 266 deletions.
21 changes: 19 additions & 2 deletions scripts/db_migrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,23 @@ def version_1_0_5(self):
Version 1_0_5.
"""
log.log_info('Handling version_1_0_5')

# Check ASIC type, if Mellanox platform then need DB migration
if self.asic_type == "mellanox":
if self.mellanox_buffer_migrator.mlnx_migrate_buffer_pool_size('version_1_0_5', 'version_1_0_6') \
and self.mellanox_buffer_migrator.mlnx_migrate_buffer_profile('version_1_0_5', 'version_1_0_6') \
and self.mellanox_buffer_migrator.mlnx_flush_new_buffer_configuration():
self.set_version('version_1_0_6')
else:
self.set_version('version_1_0_6')

return 'version_1_0_6'

def version_1_0_6(self):
"""
Version 1_0_6.
"""
log.log_info('Handling version_1_0_6')
if self.asic_type == "mellanox":
speed_list = self.mellanox_buffer_migrator.default_speed_list
cable_len_list = self.mellanox_buffer_migrator.default_cable_len_list
Expand All @@ -461,8 +478,8 @@ def version_1_0_5(self):
abandon_method = self.mellanox_buffer_migrator.mlnx_abandon_pending_buffer_configuration
append_method = self.mellanox_buffer_migrator.mlnx_append_item_on_pending_configuration_list

if self.mellanox_buffer_migrator.mlnx_migrate_buffer_pool_size('version_1_0_5', 'version_2_0_0') \
and self.mellanox_buffer_migrator.mlnx_migrate_buffer_profile('version_1_0_5', 'version_2_0_0') \
if self.mellanox_buffer_migrator.mlnx_migrate_buffer_pool_size('version_1_0_6', 'version_2_0_0') \
and self.mellanox_buffer_migrator.mlnx_migrate_buffer_profile('version_1_0_6', 'version_2_0_0') \
and (not self.mellanox_buffer_migrator.mlnx_is_buffer_model_dynamic() or \
self.migrate_config_db_buffer_tables_for_dynamic_calculation(speed_list, cable_len_list, '0', abandon_method, append_method)) \
and self.mellanox_buffer_migrator.mlnx_flush_new_buffer_configuration() \
Expand Down
70 changes: 56 additions & 14 deletions scripts/mellanox_buffer_migrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Current version: 2.0.0 for shared headroom pool and dynamic buffer calculation support.
Historical version:
- 201911:
- 1.0.6 for 2km cable support
- 1.0.5 for shared headroom pool support
- 1.0.4 for optimized headroom calculation:
- For Microsoft SKUs, calculate headroom with small packet percentage as 50%
Expand Down Expand Up @@ -119,7 +120,7 @@ def __init__(self, configDB):
# This is the buffer configuration from the very beginning
# Buffer pool configuration info
"buffer_pool_list" : ['ingress_lossless_pool', 'egress_lossless_pool', 'ingress_lossy_pool', 'egress_lossy_pool'],
# default buffer pools
# Default buffer pools
"buffer_pools": {
"spc1_t0_pool": {"ingress_lossless_pool": { "size": "4194304", "type": "ingress", "mode": "dynamic" },
"ingress_lossy_pool": { "size": "7340032", "type": "ingress", "mode": "dynamic" },
Expand Down Expand Up @@ -209,7 +210,7 @@ def __init__(self, configDB):
}
},
"version_1_0_4": {
# version 1.0.4 is introduced for updating the buffer settings
# Version 1.0.4 is introduced for updating the buffer settings
# Buffer pool info for normal mode
"buffer_pool_list" : ['ingress_lossless_pool', 'ingress_lossy_pool', 'egress_lossless_pool', 'egress_lossy_pool'],
"buffer_pools": {
Expand Down Expand Up @@ -247,7 +248,7 @@ def __init__(self, configDB):
"pg_lossless_40000_300m_profile": {"size": "78848", "xon":"19456"},
"pg_lossless_50000_300m_profile": {"size": "86016", "xon":"19456"},
"pg_lossless_100000_300m_profile": {"size": "123904", "xon":"19456"}},
# lossless headroom info for MSFT SKUs.
# Lossless headroom info for MSFT SKUs.
"msft": {"pg_lossless_10000_5m_profile": {"size": "41984", "xon":"19456"},
"pg_lossless_25000_5m_profile": {"size": "41984", "xon":"19456"},
"pg_lossless_40000_5m_profile": {"size": "41984", "xon":"19456"},
Expand Down Expand Up @@ -324,15 +325,15 @@ def __init__(self, configDB):
}
},
"version_1_0_5": {
# version 1.0.5 is introduced for shared headroom pools
# Version 1.0.5 is introduced for shared headroom pools
"pool_convert_map": {
"spc1_t0_pool_sku_map": {"Mellanox-SN2700-C28D8": "spc1_2700-d48c8_t0_pool_shp",
"Mellanox-SN2700-D48C8": "spc1_2700-d48c8_t0_pool_shp",
"Mellanox-SN2700-D40C8S8": "spc1_2700-d48c8_t0_pool_shp",
"Mellanox-SN2700-D40C8S8": "spc1_2700-d48c8_t0_single_pool_shp",
"Mellanox-SN2700": "spc1_2700_t0_pool_shp"},
"spc1_t1_pool_sku_map": {"Mellanox-SN2700-C28D8": "spc1_2700-d48c8_t1_pool_shp",
"Mellanox-SN2700-D48C8": "spc1_2700-d48c8_t1_pool_shp",
"Mellanox-SN2700-D40C8S8": "spc1_2700-d48c8_t1_pool_shp",
"Mellanox-SN2700-D40C8S8": "spc1_2700-d48c8_t1_single_pool_shp",
"Mellanox-SN2700": "spc1_2700_t1_pool_shp"}
},
"pool_mapped_from_old_version": {
Expand Down Expand Up @@ -441,8 +442,43 @@ def __init__(self, configDB):
}
}
},
"version_1_0_6": {
# Version 1.0.6 is introduced for 2km cable support
#
# pool_mapped_from_old_version is not required because no pool flavor mapping changed

# Buffer pool info for normal mode
"buffer_pool_list" : ['ingress_lossless_pool', 'ingress_lossy_pool', 'egress_lossless_pool', 'egress_lossy_pool'],

"buffer_pools": {
"spc1_2700_t1_pool_shp": {"doublepool": { "size": "4439552", "xoff": "2146304" }, "egress_lossless_pool": { "size": "13945824"}},

# Buffer pool for single pool
"spc1_2700_t1_single_pool_shp": {"singlepool": { "size": "8719360", "xoff": "2146304" }, "egress_lossless_pool": { "size": "13945824"}},

# The following pools are used for upgrading from 1.0.5 to the newer version
"spc2_3800-c64_t1_pool_shp": {"singlepool": {"size": "24219648", "xoff": "4169728"}, "egress_lossless_pool": {"size": "34287552"}}
},
"buffer_pools_inherited": {
"version_1_0_4": ["spc1_t0_pool", "spc1_t1_pool", "spc2_t0_pool", "spc2_t1_pool", "spc3_t0_pool", "spc3_t1_pool"],
"version_1_0_5": [# Generic SKUs for 3800
"spc2_3800_t0_pool",
"spc2_3800_t1_pool",
# Non generic SKUs
"spc1_2700_t0_pool_shp",
"spc1_2700_t0_single_pool_shp",
"spc1_2700-d48c8_t0_pool_shp",
"spc1_2700-d48c8_t0_single_pool_shp",
"spc2_3800-c64_t0_pool_shp", "spc2_3800-d112c8_t0_pool_shp",
"spc2_3800-d24c52_t0_pool_shp", "spc2_3800-d28c50_t0_pool_shp",
"spc1_2700-d48c8_t1_pool_shp",
"spc1_2700-d48c8_t1_single_pool_shp",
"spc2_3800-d112c8_t1_pool_shp",
"spc2_3800-d24c52_t1_pool_shp", "spc2_3800-d28c50_t1_pool_shp"],
}
},
"version_2_0_0": {
# version 2.0.0 is introduced for dynamic buffer calculation
# Version 2.0.0 is introduced for dynamic buffer calculation
#
"pool_mapped_from_old_version": {
"spc1_t0_pool": "spc1_pool",
Expand All @@ -463,13 +499,19 @@ def __init__(self, configDB):
"spc3_pool": {"doublepool": {"size": "dynamic"}, "egress_lossless_pool": { "size": "60817392" }}
},
"buffer_pools_inherited": {
"version_1_0_5": ["spc1_2700_t0_pool", "spc1_2700_t1_pool",
"spc1_2700_t0_pool_shp", "spc1_2700_t1_pool_shp",
"spc1_2700_t0_single_pool_shp", "spc1_2700_t1_single_pool_shp",
"spc1_2700-d48c8_t0_pool_shp", "spc1_2700-d48c8_t1_pool_shp",
"spc1_2700-d48c8_t0_single_pool_shp", "spc1_2700-d48c8_t1_single_pool_shp",
"spc2_3800-c64_t0_pool_shp", "spc2_3800-c64_t1_pool_shp", "spc2_3800-d112c8_t0_pool_shp", "spc2_3800-d112c8_t1_pool_shp",
"spc2_3800-d24c52_t0_pool_shp", "spc2_3800-d24c52_t1_pool_shp", "spc2_3800-d28c50_t0_pool_shp", "spc2_3800-d28c50_t1_pool_shp"]
"version_1_0_5": ["spc1_2700_t0_pool_shp",
"spc1_2700_t0_single_pool_shp",
"spc1_2700-d48c8_t0_pool_shp",
"spc1_2700-d48c8_t0_single_pool_shp",
"spc2_3800-c64_t0_pool_shp", "spc2_3800-d112c8_t0_pool_shp",
"spc2_3800-d24c52_t0_pool_shp", "spc2_3800-d28c50_t0_pool_shp",
"spc1_2700-d48c8_t1_pool_shp",
"spc1_2700-d48c8_t1_single_pool_shp",
"spc2_3800-d112c8_t1_pool_shp",
"spc2_3800-d24c52_t1_pool_shp", "spc2_3800-d28c50_t1_pool_shp"],
"version_1_0_6": ["spc1_2700_t1_pool_shp",
"spc1_2700_t1_single_pool_shp",
"spc2_3800-c64_t1_pool_shp"]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,18 +187,13 @@
"BUFFER_POOL_TABLE:egress_lossy_pool": {
"type": "egress",
"mode": "dynamic",
"size": "3859968"
"size": "7719936"
},
"BUFFER_POOL_TABLE:ingress_lossless_pool": {
"xoff": "1032192",
"type": "ingress",
"mode": "dynamic",
"size": "3859968"
},
"BUFFER_POOL_TABLE:ingress_lossy_pool": {
"type": "ingress",
"mode": "dynamic",
"size": "3859968"
"size": "7719936"
},
"BUFFER_PORT_EGRESS_PROFILE_LIST_TABLE:Ethernet4": {
"profile_list": "[BUFFER_PROFILE_TABLE:egress_lossless_profile],[BUFFER_PROFILE_TABLE:egress_lossy_profile]"
Expand Down Expand Up @@ -285,88 +280,88 @@
"profile_list": "[BUFFER_PROFILE_TABLE:egress_lossless_profile],[BUFFER_PROFILE_TABLE:egress_lossy_profile]"
},
"BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet4": {
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]"
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile]"
},
"BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet8": {
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]"
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile]"
},
"BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet12": {
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]"
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile]"
},
"BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet16": {
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]"
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile]"
},
"BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet20": {
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]"
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile]"
},
"BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet24": {
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]"
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile]"
},
"BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet28": {
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]"
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile]"
},
"BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet32": {
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]"
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile]"
},
"BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet36": {
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]"
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile]"
},
"BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet40": {
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]"
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile]"
},
"BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet44": {
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]"
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile]"
},
"BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet48": {
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]"
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile]"
},
"BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet52": {
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]"
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile]"
},
"BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet56": {
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]"
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile]"
},
"BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet60": {
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]"
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile]"
},
"BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet64": {
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]"
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile]"
},
"BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet68": {
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]"
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile]"
},
"BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet72": {
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]"
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile]"
},
"BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet76": {
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]"
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile]"
},
"BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet80": {
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]"
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile]"
},
"BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet84": {
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]"
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile]"
},
"BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet88": {
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]"
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile]"
},
"BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet92": {
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]"
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile]"
},
"BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet96": {
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]"
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile]"
},
"BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet112": {
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]"
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile]"
},
"BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet116": {
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]"
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile]"
},
"BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet120": {
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]"
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile]"
},
"BUFFER_PORT_INGRESS_PROFILE_LIST_TABLE:Ethernet124": {
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]"
"profile_list": "[BUFFER_PROFILE_TABLE:ingress_lossless_profile]"
},
"BUFFER_PROFILE_TABLE:egress_lossless_profile": {
"dynamic_th": "7",
Expand All @@ -385,7 +380,7 @@
},
"BUFFER_PROFILE_TABLE:ingress_lossy_profile": {
"dynamic_th": "3",
"pool": "[BUFFER_POOL_TABLE:ingress_lossy_pool]",
"pool": "[BUFFER_POOL_TABLE:ingress_lossless_pool]",
"size": "0"
},
"BUFFER_PROFILE_TABLE:pg_lossless_10000_5m_profile": {
Expand Down
Loading

0 comments on commit 1da879c

Please sign in to comment.