Skip to content

Commit 99de167

Browse files
[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
1 parent 42efc03 commit 99de167

22 files changed

+2186
-0
lines changed

scripts/sonic_sku_create.py

+776
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{%- set default_topo = 't0' %}
2+
{%- include 'buffers_config.j2' %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
{% set default_cable = '5m' %}
2+
{% set ingress_lossless_pool_size = '4194304' %}
3+
{% set ingress_lossy_pool_size = '7340032' %}
4+
{% set egress_lossless_pool_size = '16777152' %}
5+
{% set egress_lossy_pool_size = '7340032' %}
6+
7+
{%- macro generate_port_lists(PORT_ALL) %}
8+
{# Generate list of ports #}
9+
{%- for port_idx in range(0, 32) %}
10+
{%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %}
11+
{%- endfor %}
12+
{%- endmacro %}
13+
14+
{%- macro generate_buffer_pool_and_profiles() %}
15+
"BUFFER_POOL": {
16+
"ingress_lossless_pool": {
17+
"size": "{{ ingress_lossless_pool_size }}",
18+
"type": "ingress",
19+
"mode": "dynamic"
20+
},
21+
"ingress_lossy_pool": {
22+
"size": "{{ ingress_lossy_pool_size }}",
23+
"type": "ingress",
24+
"mode": "dynamic"
25+
},
26+
"egress_lossless_pool": {
27+
"size": "{{ egress_lossless_pool_size }}",
28+
"type": "egress",
29+
"mode": "dynamic"
30+
},
31+
"egress_lossy_pool": {
32+
"size": "{{ egress_lossy_pool_size }}",
33+
"type": "egress",
34+
"mode": "dynamic"
35+
}
36+
},
37+
"BUFFER_PROFILE": {
38+
"ingress_lossless_profile": {
39+
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
40+
"size":"0",
41+
"dynamic_th":"0"
42+
},
43+
"ingress_lossy_profile": {
44+
"pool":"[BUFFER_POOL|ingress_lossy_pool]",
45+
"size":"0",
46+
"dynamic_th":"3"
47+
},
48+
"egress_lossless_profile": {
49+
"pool":"[BUFFER_POOL|egress_lossless_pool]",
50+
"size":"0",
51+
"dynamic_th":"7"
52+
},
53+
"egress_lossy_profile": {
54+
"pool":"[BUFFER_POOL|egress_lossy_pool]",
55+
"size":"4096",
56+
"dynamic_th":"3"
57+
},
58+
"q_lossy_profile": {
59+
"pool":"[BUFFER_POOL|egress_lossy_pool]",
60+
"size":"0",
61+
"dynamic_th":"3"
62+
}
63+
},
64+
{%- endmacro %}
65+
66+
{%- macro generate_profile_lists(port_names) %}
67+
"BUFFER_PORT_INGRESS_PROFILE_LIST": {
68+
"{{ port_names }}": {
69+
"profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]"
70+
}
71+
},
72+
"BUFFER_PORT_EGRESS_PROFILE_LIST": {
73+
"{{ port_names }}": {
74+
"profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]"
75+
}
76+
}
77+
{%- endmacro %}
78+
79+
{%- macro generate_queue_buffers(port_names) %}
80+
"BUFFER_QUEUE": {
81+
"{{ port_names }}|3-4": {
82+
"profile" : "[BUFFER_PROFILE|egress_lossless_profile]"
83+
},
84+
"{{ port_names }}|0-1": {
85+
"profile" : "[BUFFER_PROFILE|q_lossy_profile]"
86+
}
87+
}
88+
{%- endmacro %}
89+
90+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
{% set default_cable = '5m' %}
2+
{% set ingress_lossless_pool_size = '2097152' %}
3+
{% set ingress_lossy_pool_size = '5242880' %}
4+
{% set egress_lossless_pool_size = '16777152' %}
5+
{% set egress_lossy_pool_size = '5242880' %}
6+
7+
{%- macro generate_port_lists(PORT_ALL) %}
8+
{# Generate list of ports #}
9+
{%- for port_idx in range(0, 32) %}
10+
{%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %}
11+
{%- endfor %}
12+
{%- endmacro %}
13+
14+
{%- macro generate_buffer_pool_and_profiles() %}
15+
"BUFFER_POOL": {
16+
"ingress_lossless_pool": {
17+
"size": "{{ ingress_lossless_pool_size }}",
18+
"type": "ingress",
19+
"mode": "dynamic"
20+
},
21+
"ingress_lossy_pool": {
22+
"size": "{{ ingress_lossy_pool_size }}",
23+
"type": "ingress",
24+
"mode": "dynamic"
25+
},
26+
"egress_lossless_pool": {
27+
"size": "{{ egress_lossless_pool_size }}",
28+
"type": "egress",
29+
"mode": "dynamic"
30+
},
31+
"egress_lossy_pool": {
32+
"size": "{{ egress_lossy_pool_size }}",
33+
"type": "egress",
34+
"mode": "dynamic"
35+
}
36+
},
37+
"BUFFER_PROFILE": {
38+
"ingress_lossless_profile": {
39+
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
40+
"size":"0",
41+
"dynamic_th":"0"
42+
},
43+
"ingress_lossy_profile": {
44+
"pool":"[BUFFER_POOL|ingress_lossy_pool]",
45+
"size":"0",
46+
"dynamic_th":"3"
47+
},
48+
"egress_lossless_profile": {
49+
"pool":"[BUFFER_POOL|egress_lossless_pool]",
50+
"size":"0",
51+
"dynamic_th":"7"
52+
},
53+
"egress_lossy_profile": {
54+
"pool":"[BUFFER_POOL|egress_lossy_pool]",
55+
"size":"4096",
56+
"dynamic_th":"3"
57+
},
58+
"q_lossy_profile": {
59+
"pool":"[BUFFER_POOL|egress_lossy_pool]",
60+
"size":"0",
61+
"dynamic_th":"3"
62+
}
63+
},
64+
{%- endmacro %}
65+
66+
{%- macro generate_profile_lists(port_names) %}
67+
"BUFFER_PORT_INGRESS_PROFILE_LIST": {
68+
"{{ port_names }}": {
69+
"profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]"
70+
}
71+
},
72+
"BUFFER_PORT_EGRESS_PROFILE_LIST": {
73+
"{{ port_names }}": {
74+
"profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]"
75+
}
76+
}
77+
{%- endmacro %}
78+
79+
{%- macro generate_queue_buffers(port_names) %}
80+
"BUFFER_QUEUE": {
81+
"{{ port_names }}|3-4": {
82+
"profile" : "[BUFFER_PROFILE|egress_lossless_profile]"
83+
},
84+
"{{ port_names }}|0-1": {
85+
"profile" : "[BUFFER_PROFILE|q_lossy_profile]"
86+
}
87+
}
88+
{%- endmacro %}
89+
90+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# PG lossless profiles.
2+
# speed cable size xon xoff threshold
3+
10000 5m 34816 18432 16384 0
4+
25000 5m 34816 18432 16384 0
5+
40000 5m 34816 18432 16384 0
6+
50000 5m 34816 18432 16384 0
7+
100000 5m 36864 18432 18432 0
8+
10000 40m 36864 18432 18432 0
9+
25000 40m 39936 18432 21504 0
10+
40000 40m 41984 18432 23552 0
11+
50000 40m 41984 18432 23552 0
12+
100000 40m 54272 18432 35840 0
13+
10000 300m 49152 18432 30720 0
14+
25000 300m 71680 18432 53248 0
15+
40000 300m 94208 18432 75776 0
16+
50000 300m 94208 18432 75776 0
17+
100000 300m 184320 18432 165888 0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# name lanes alias
2+
Ethernet0 0,1,2,3 etp1
3+
Ethernet4 4,5,6,7 etp2
4+
Ethernet8 8,9,10,11 etp3
5+
Ethernet12 12,13,14,15 etp4
6+
Ethernet16 16,17,18,19 etp5
7+
Ethernet20 20,21,22,23 etp6
8+
Ethernet24 24,25,26,27 etp7
9+
Ethernet28 28,29,30,31 etp8
10+
Ethernet32 32,33,34,35 etp9
11+
Ethernet36 36,37,38,39 etp10
12+
Ethernet40 40,41,42,43 etp11
13+
Ethernet44 44,45,46,47 etp12
14+
Ethernet48 48,49,50,51 etp13
15+
Ethernet52 52,53,54,55 etp14
16+
Ethernet56 56,57,58,59 etp15
17+
Ethernet60 60,61,62,63 etp16
18+
Ethernet64 64,65,66,67 etp17
19+
Ethernet68 68,69,70,71 etp18
20+
Ethernet72 72,73,74,75 etp19
21+
Ethernet76 76,77,78,79 etp20
22+
Ethernet80 80,81,82,83 etp21
23+
Ethernet84 84,85,86,87 etp22
24+
Ethernet88 88,89,90,91 etp23
25+
Ethernet92 92,93,94,95 etp24
26+
Ethernet96 96,97,98,99 etp25
27+
Ethernet100 100,101,102,103 etp26
28+
Ethernet104 104,105,106,107 etp27
29+
Ethernet108 108,109,110,111 etp28
30+
Ethernet112 112,113,114,115 etp29
31+
Ethernet116 116,117,118,119 etp30
32+
Ethernet120 120,121,122,123 etp31
33+
Ethernet124 124,125,126,127 etp32

0 commit comments

Comments
 (0)