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.
[Mellanox] SKU creator Tool (sonic-net#1163)
I added a new script file sonic_sku_create.py to generate a new HWSKU based on XML file or Minigraph. But, focus is on creating HWSKU based on XML file and not on the minigraph and l2 mode. I also added a unit test pyTest script sku_create_test.py in sonic-utilities-test folder to test the script in Unit Testing mode. Motivation: To create SKU for Mellanox platforms based on XML file with Port related inputs and also through Minigraph file. This tool also allows to split a port or unsplit ports based on configuration which modifies the port related information in port_config.ini and config_db.json usage: sonic_sku_create.py [-h] [-v] (-f FILE | -m [MINIGRAPH_FILE] | -j JSON_FILE | -pp PORT_SPLIT PORT_SPLIT) [-b BASE] [-r] [-k HWSKU] [-p] [-vv] Create a new SKU optional arguments: -h, --help show this help message and exit -v, --version show program's version number and exit -f FILE, --file FILE SKU definition from xml file. -f OR -m or -j must be provided when creating a new SKU -m [MINIGRAPH_FILE], --minigraph_file [MINIGRAPH_FILE] SKU definition from minigraph file. -f OR -m or -j must be provided when creating a new SKU -j JSON_FILE, --json_file JSON_FILE SKU definition from config_db.json file. -f OR -m OR -j must be provided when creating a new SKU -pp PORT_SPLIT PORT_SPLIT, --port_split PORT_SPLIT PORT_SPLIT port name and split -b BASE, --base BASE SKU base definition -r, --remove Remove SKU folder -k HWSKU, --hwsku HWSKU SKU name to be used when creating a new SKU or for L2 configuration mode -p, --print Print port_config.ini without creating a new SKU -vv, --verbose Verbose output
- Loading branch information
1 parent
42efc03
commit 99de167
Showing
22 changed files
with
2,186 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 2 additions & 0 deletions
2
sonic-utilities-tests/sku_create_input/ACS-MSN2700/buffers.json.j2
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{%- set default_topo = 't0' %} | ||
{%- include 'buffers_config.j2' %} |
90 changes: 90 additions & 0 deletions
90
sonic-utilities-tests/sku_create_input/ACS-MSN2700/buffers_defaults_t0.j2
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 |
---|---|---|
@@ -0,0 +1,90 @@ | ||
{% set default_cable = '5m' %} | ||
{% set ingress_lossless_pool_size = '4194304' %} | ||
{% set ingress_lossy_pool_size = '7340032' %} | ||
{% set egress_lossless_pool_size = '16777152' %} | ||
{% set egress_lossy_pool_size = '7340032' %} | ||
|
||
{%- macro generate_port_lists(PORT_ALL) %} | ||
{# Generate list of ports #} | ||
{%- for port_idx in range(0, 32) %} | ||
{%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} | ||
{%- endfor %} | ||
{%- endmacro %} | ||
|
||
{%- macro generate_buffer_pool_and_profiles() %} | ||
"BUFFER_POOL": { | ||
"ingress_lossless_pool": { | ||
"size": "{{ ingress_lossless_pool_size }}", | ||
"type": "ingress", | ||
"mode": "dynamic" | ||
}, | ||
"ingress_lossy_pool": { | ||
"size": "{{ ingress_lossy_pool_size }}", | ||
"type": "ingress", | ||
"mode": "dynamic" | ||
}, | ||
"egress_lossless_pool": { | ||
"size": "{{ egress_lossless_pool_size }}", | ||
"type": "egress", | ||
"mode": "dynamic" | ||
}, | ||
"egress_lossy_pool": { | ||
"size": "{{ egress_lossy_pool_size }}", | ||
"type": "egress", | ||
"mode": "dynamic" | ||
} | ||
}, | ||
"BUFFER_PROFILE": { | ||
"ingress_lossless_profile": { | ||
"pool":"[BUFFER_POOL|ingress_lossless_pool]", | ||
"size":"0", | ||
"dynamic_th":"0" | ||
}, | ||
"ingress_lossy_profile": { | ||
"pool":"[BUFFER_POOL|ingress_lossy_pool]", | ||
"size":"0", | ||
"dynamic_th":"3" | ||
}, | ||
"egress_lossless_profile": { | ||
"pool":"[BUFFER_POOL|egress_lossless_pool]", | ||
"size":"0", | ||
"dynamic_th":"7" | ||
}, | ||
"egress_lossy_profile": { | ||
"pool":"[BUFFER_POOL|egress_lossy_pool]", | ||
"size":"4096", | ||
"dynamic_th":"3" | ||
}, | ||
"q_lossy_profile": { | ||
"pool":"[BUFFER_POOL|egress_lossy_pool]", | ||
"size":"0", | ||
"dynamic_th":"3" | ||
} | ||
}, | ||
{%- endmacro %} | ||
|
||
{%- macro generate_profile_lists(port_names) %} | ||
"BUFFER_PORT_INGRESS_PROFILE_LIST": { | ||
"{{ port_names }}": { | ||
"profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" | ||
} | ||
}, | ||
"BUFFER_PORT_EGRESS_PROFILE_LIST": { | ||
"{{ port_names }}": { | ||
"profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" | ||
} | ||
} | ||
{%- endmacro %} | ||
|
||
{%- macro generate_queue_buffers(port_names) %} | ||
"BUFFER_QUEUE": { | ||
"{{ port_names }}|3-4": { | ||
"profile" : "[BUFFER_PROFILE|egress_lossless_profile]" | ||
}, | ||
"{{ port_names }}|0-1": { | ||
"profile" : "[BUFFER_PROFILE|q_lossy_profile]" | ||
} | ||
} | ||
{%- endmacro %} | ||
|
||
|
90 changes: 90 additions & 0 deletions
90
sonic-utilities-tests/sku_create_input/ACS-MSN2700/buffers_defaults_t1.j2
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 |
---|---|---|
@@ -0,0 +1,90 @@ | ||
{% set default_cable = '5m' %} | ||
{% set ingress_lossless_pool_size = '2097152' %} | ||
{% set ingress_lossy_pool_size = '5242880' %} | ||
{% set egress_lossless_pool_size = '16777152' %} | ||
{% set egress_lossy_pool_size = '5242880' %} | ||
|
||
{%- macro generate_port_lists(PORT_ALL) %} | ||
{# Generate list of ports #} | ||
{%- for port_idx in range(0, 32) %} | ||
{%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} | ||
{%- endfor %} | ||
{%- endmacro %} | ||
|
||
{%- macro generate_buffer_pool_and_profiles() %} | ||
"BUFFER_POOL": { | ||
"ingress_lossless_pool": { | ||
"size": "{{ ingress_lossless_pool_size }}", | ||
"type": "ingress", | ||
"mode": "dynamic" | ||
}, | ||
"ingress_lossy_pool": { | ||
"size": "{{ ingress_lossy_pool_size }}", | ||
"type": "ingress", | ||
"mode": "dynamic" | ||
}, | ||
"egress_lossless_pool": { | ||
"size": "{{ egress_lossless_pool_size }}", | ||
"type": "egress", | ||
"mode": "dynamic" | ||
}, | ||
"egress_lossy_pool": { | ||
"size": "{{ egress_lossy_pool_size }}", | ||
"type": "egress", | ||
"mode": "dynamic" | ||
} | ||
}, | ||
"BUFFER_PROFILE": { | ||
"ingress_lossless_profile": { | ||
"pool":"[BUFFER_POOL|ingress_lossless_pool]", | ||
"size":"0", | ||
"dynamic_th":"0" | ||
}, | ||
"ingress_lossy_profile": { | ||
"pool":"[BUFFER_POOL|ingress_lossy_pool]", | ||
"size":"0", | ||
"dynamic_th":"3" | ||
}, | ||
"egress_lossless_profile": { | ||
"pool":"[BUFFER_POOL|egress_lossless_pool]", | ||
"size":"0", | ||
"dynamic_th":"7" | ||
}, | ||
"egress_lossy_profile": { | ||
"pool":"[BUFFER_POOL|egress_lossy_pool]", | ||
"size":"4096", | ||
"dynamic_th":"3" | ||
}, | ||
"q_lossy_profile": { | ||
"pool":"[BUFFER_POOL|egress_lossy_pool]", | ||
"size":"0", | ||
"dynamic_th":"3" | ||
} | ||
}, | ||
{%- endmacro %} | ||
|
||
{%- macro generate_profile_lists(port_names) %} | ||
"BUFFER_PORT_INGRESS_PROFILE_LIST": { | ||
"{{ port_names }}": { | ||
"profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" | ||
} | ||
}, | ||
"BUFFER_PORT_EGRESS_PROFILE_LIST": { | ||
"{{ port_names }}": { | ||
"profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" | ||
} | ||
} | ||
{%- endmacro %} | ||
|
||
{%- macro generate_queue_buffers(port_names) %} | ||
"BUFFER_QUEUE": { | ||
"{{ port_names }}|3-4": { | ||
"profile" : "[BUFFER_PROFILE|egress_lossless_profile]" | ||
}, | ||
"{{ port_names }}|0-1": { | ||
"profile" : "[BUFFER_PROFILE|q_lossy_profile]" | ||
} | ||
} | ||
{%- endmacro %} | ||
|
||
|
17 changes: 17 additions & 0 deletions
17
sonic-utilities-tests/sku_create_input/ACS-MSN2700/pg_profile_lookup.ini
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# PG lossless profiles. | ||
# speed cable size xon xoff threshold | ||
10000 5m 34816 18432 16384 0 | ||
25000 5m 34816 18432 16384 0 | ||
40000 5m 34816 18432 16384 0 | ||
50000 5m 34816 18432 16384 0 | ||
100000 5m 36864 18432 18432 0 | ||
10000 40m 36864 18432 18432 0 | ||
25000 40m 39936 18432 21504 0 | ||
40000 40m 41984 18432 23552 0 | ||
50000 40m 41984 18432 23552 0 | ||
100000 40m 54272 18432 35840 0 | ||
10000 300m 49152 18432 30720 0 | ||
25000 300m 71680 18432 53248 0 | ||
40000 300m 94208 18432 75776 0 | ||
50000 300m 94208 18432 75776 0 | ||
100000 300m 184320 18432 165888 0 |
33 changes: 33 additions & 0 deletions
33
sonic-utilities-tests/sku_create_input/ACS-MSN2700/port_config.ini
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# name lanes alias | ||
Ethernet0 0,1,2,3 etp1 | ||
Ethernet4 4,5,6,7 etp2 | ||
Ethernet8 8,9,10,11 etp3 | ||
Ethernet12 12,13,14,15 etp4 | ||
Ethernet16 16,17,18,19 etp5 | ||
Ethernet20 20,21,22,23 etp6 | ||
Ethernet24 24,25,26,27 etp7 | ||
Ethernet28 28,29,30,31 etp8 | ||
Ethernet32 32,33,34,35 etp9 | ||
Ethernet36 36,37,38,39 etp10 | ||
Ethernet40 40,41,42,43 etp11 | ||
Ethernet44 44,45,46,47 etp12 | ||
Ethernet48 48,49,50,51 etp13 | ||
Ethernet52 52,53,54,55 etp14 | ||
Ethernet56 56,57,58,59 etp15 | ||
Ethernet60 60,61,62,63 etp16 | ||
Ethernet64 64,65,66,67 etp17 | ||
Ethernet68 68,69,70,71 etp18 | ||
Ethernet72 72,73,74,75 etp19 | ||
Ethernet76 76,77,78,79 etp20 | ||
Ethernet80 80,81,82,83 etp21 | ||
Ethernet84 84,85,86,87 etp22 | ||
Ethernet88 88,89,90,91 etp23 | ||
Ethernet92 92,93,94,95 etp24 | ||
Ethernet96 96,97,98,99 etp25 | ||
Ethernet100 100,101,102,103 etp26 | ||
Ethernet104 104,105,106,107 etp27 | ||
Ethernet108 108,109,110,111 etp28 | ||
Ethernet112 112,113,114,115 etp29 | ||
Ethernet116 116,117,118,119 etp30 | ||
Ethernet120 120,121,122,123 etp31 | ||
Ethernet124 124,125,126,127 etp32 |
Oops, something went wrong.