-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathqos_config.j2
More file actions
670 lines (652 loc) · 22.9 KB
/
qos_config.j2
File metadata and controls
670 lines (652 loc) · 22.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
{%- set PORT_ALL = [] %}
{%- set PORT_BP = [] %}
{%- set PORT_DPC = [] %}
{%- set SYSTEM_PORT_ALL = [] %}
{%- set PORT_QOS_BYPASS = [] %}
{%- set PORT_UPLINK = [] %}
{%- set PORT_DOWNLINK = [] %}
{%- set PORT_SERVICE = [] %}
{%- set SYSTEM_PORT_ACTIVE = [] %}
{%- set hostname = "" %}
{%- set asicname = "" %}
{%- set voq_chassis = false %}
{% if template_exists("buffers.json.j2") %}
{% import "buffers.json.j2" as buffer_defs with context %}
{%- set filename_postfix = buffer_defs.default_topo | default("def", true) %}
{% else %}
{%- set filename_postfix = "def" %}
{% endif %}
{# Allow includer to pre-package defs without needing an import #}
{%- if defs is not defined %}
{# Import default values from device HWSKU folder #}
{%- if template_exists('buffers_defaults_%s.j2' % filename_postfix) %}
{%- import 'buffers_defaults_%s.j2' % filename_postfix as defs with context %}
{%- endif -%}
{%- endif -%}
{%- if DEVICE_METADATA is defined and DEVICE_METADATA['localhost']['switch_type'] is defined and DEVICE_METADATA['localhost']['switch_type'] == 'voq' %}
{%- set voq_chassis = true %}
{%- endif -%}
{%- if voq_chassis %}
{%- if DEVICE_METADATA is defined and 'localhost' in DEVICE_METADATA and 'hostname' in DEVICE_METADATA['localhost'] -%}
{%- set hostname = DEVICE_METADATA['localhost']['hostname'] -%}
{%- endif %}
{%- if DEVICE_METADATA is defined and 'localhost' in DEVICE_METADATA and 'asic_name' in DEVICE_METADATA['localhost'] -%}
{%- set asicname = DEVICE_METADATA['localhost']['asic_name'] -%}
{%- endif %}
{%- for system_port in SYSTEM_PORT %}
{% if '|' not in system_port %}
{%- set system_port_name = system_port|join("|") %}
{% else %}
{%- set system_port_name = system_port %}
{% endif %}
{%- if 'cpu' not in system_port_name.lower() and 'IB' not in system_port_name and 'Rec' not in system_port_name %}
{%- if SYSTEM_PORT_ALL.append(system_port_name) %}{%- endif %}
{%- endif %}
{#- find all system_port_name has hostname|asicname. If it is true, get the portname and check if the port name is present in the deviceNeighbor -#}
{%- if hostname != "" and asicname != "" -%}
{%- if system_port_name.lower().startswith((hostname + '|' + asicname).lower()) -%}
{%- set port_name = system_port_name.split('|')[2] -%}
{%- if DEVICE_NEIGHBOR is defined and port_name in DEVICE_NEIGHBOR.keys() -%}
{%- if SYSTEM_PORT_ACTIVE.append(system_port_name) %}{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- endfor %}
{%- endif %}
{%- for port in PORT %}
{%- if not port.startswith('Ethernet-Rec') and not port.startswith('Ethernet-IB') %}
{%- if PORT_ALL.append(port) %}{% endif %}
{%- if 'role' in PORT[port] and PORT[port]['role'] == 'Dpc' %}
{%- if PORT_DPC.append(port) %}{%- endif %}
{%- endif %}
{%- endif %}
{%- endfor %}
{%- if generate_bp_port_list is defined %}
{%- if generate_bp_port_list(PORT,PORT_BP) %} {% endif %}
{%- endif %}
{%- if generate_qos_bypass_port_list is defined %}
{%- if generate_qos_bypass_port_list(PORT_QOS_BYPASS) %} {% endif %}
{%- endif %}
{%- if defs is defined and defs.generate_service_port_list is defined %}
{%- if defs.generate_service_port_list(PORT_SERVICE) %}{% endif %}
{%- endif %}
{%- if PORT_ALL | sort_by_port_index %}{% endif %}
{%- set port_names_list_all = [] %}
{%- for port in PORT_ALL %}
{%- if port_names_list_all.append(port) %}{% endif %}
{%- endfor %}
{%- set port_names_all = port_names_list_all | join(',') -%}
{%- set PORT_ACTIVE = [] %}
{%- if DEVICE_NEIGHBOR is not defined %}
{%- set PORT_ACTIVE = PORT_ALL %}
{%- else %}
{%- for port in DEVICE_NEIGHBOR.keys() %}
{%- if PORT_ACTIVE.append(port) %}{%- endif %}
{%- endfor %}
{%- for port in PORT_BP %}
{%- if PORT_ACTIVE.append(port) %}{%- endif %}
{%- endfor %}
{%- for port in PORT_DPC %}
{%- if PORT_ACTIVE.append(port) %}{%- endif %}
{%- endfor %}
{%- endif %}
{%- set PORT_ACTIVE = PORT_ACTIVE | reject('in', PORT_QOS_BYPASS) | list %}
{%- if PORT_ACTIVE | sort_by_port_index %}{% endif %}
{# Generate uplink and downlink port lists based on router type and neighbors #}
{%- if DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined %}
{%- if 'type' in DEVICE_METADATA['localhost'] and DEVICE_NEIGHBOR is defined %}
{%- set local_router_type = DEVICE_METADATA['localhost']['type'] %}
{%- for port in PORT_ACTIVE %}
{%- if DEVICE_NEIGHBOR.get(port) and DEVICE_NEIGHBOR[port].name is defined and DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR[port].name in DEVICE_NEIGHBOR_METADATA %}
{%- set neighbor_info = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[port].name] %}
{%- if 'LeafRouter' in local_router_type %}
{%- if 'ToRRouter' in neighbor_info.type %}
{%- if PORT_DOWNLINK.append(port) %}{%- endif %}
{%- elif 'SpineRouter' in neighbor_info.type %}
{%- if PORT_UPLINK.append(port) %}{%- endif %}
{%- endif %}
{%- elif 'ToRRouter' in local_router_type %}
{%- if 'LeafRouter' in neighbor_info.type %}
{%- if PORT_UPLINK.append(port) %}{%- endif %}
{%- else %}
{%- if PORT_DOWNLINK.append(port) %}{%- endif %}
{%- endif %}
{%- endif %}
{%- else %}
{%- if PORT_DOWNLINK.append(port) %}{%- endif %}
{%- endif %}
{%- endfor %}
{%- else %}
{%- for port in PORT_ACTIVE %}
{%- if PORT_DOWNLINK.append(port) %}{%- endif %}
{%- endfor %}
{%- endif %}
{%- endif %}
{%- set port_names_downlink = PORT_DOWNLINK | join(',') -%}
{%- set port_names_uplink = PORT_UPLINK | join(',') -%}
{%- set port_names_list_active = [] %}
{%- for port in PORT_ACTIVE %}
{%- if port_names_list_active.append(port) %}{%- endif %}
{%- endfor %}
{%- set port_names_active = port_names_list_active | join(',') -%}
{%- set tunnel_qos_remap_enable = false %}
{%- if ((SYSTEM_DEFAULTS is defined) and ('tunnel_qos_remap' in SYSTEM_DEFAULTS) and (SYSTEM_DEFAULTS['tunnel_qos_remap']['status'] == 'enabled')) %}
{%- set tunnel_qos_remap_enable = true %}
{%- endif %}
{%- set port_names_list_extra_queues = [] %}
{%- for port in PORT_ACTIVE %}
{% if ((generate_dscp_to_tc_map is defined) and tunnel_qos_remap_enable) and
(('type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] == 'LeafRouter' and DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR[port].name in DEVICE_NEIGHBOR_METADATA and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[port].name].type == 'ToRRouter') or
('subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' and DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR[port].name in DEVICE_NEIGHBOR_METADATA and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[port].name].type == 'LeafRouter')) %}
{%- if port_names_list_extra_queues.append(port) %}{%- endif %}
{% endif %}
{%- endfor %}
{%- set LOSSLESS_TC = [] %}
{%- if generate_lossless_tc_list is defined %}
{{- generate_lossless_tc_list(LOSSLESS_TC) }}
{%- else %}
{%- set LOSSLESS_TC = ['3','4'] %}
{%- endif %}
{%- set pfc_to_pg_map_supported_asics = ['mellanox', 'barefoot'] -%}
{%- set backend_device_types = ['BackEndToRRouter', 'BackEndLeafRouter'] -%}
{%- set apollo_resource_types = ['DL-NPU-Apollo'] -%}
{%- set require_global_dscp_to_tc_map = true -%}
{
{% if (generate_tc_to_pg_map is defined) and tunnel_qos_remap_enable %}
{{- generate_tc_to_pg_map() }}
{% elif (generate_tc_to_pg_map is defined) and
('type' in DEVICE_METADATA['localhost'] and
DEVICE_METADATA['localhost']['type'] in backend_device_types) and
('resource_type' in DEVICE_METADATA['localhost'] and
DEVICE_METADATA['localhost']['resource_type'] == 'ComputeAI') %}
{{- generate_tc_to_pg_map() }}
{% elif generate_tc_to_pg_map_per_sku is defined %}
{{- generate_tc_to_pg_map_per_sku() }}
{% else %}
"TC_TO_PRIORITY_GROUP_MAP": {
{% if PORT_DPC %}
"AZURE_DPC": {
"0": "0",
"1": "0",
"2": "0",
"3": "0",
"4": "0",
"5": "0",
"6": "0",
"7": "7"
},
{% endif %}
"AZURE": {
"0": "0",
"1": "0",
"2": "0",
"3": "3",
"4": "4",
"5": "0",
"6": "0",
"7": "7"
}
},
{% endif %}
{% if (generate_pfc_to_queue_map is defined) %}
{{- generate_pfc_to_queue_map() }}
{% else %}
"MAP_PFC_PRIORITY_TO_QUEUE": {
"AZURE": {
"0": "0",
"1": "1",
"2": "2",
"3": "3",
"4": "4",
"5": "5",
"6": "6",
"7": "7"
}
},
{% endif %}
{% if (generate_tc_to_queue_map is defined) and tunnel_qos_remap_enable %}
{{- generate_tc_to_queue_map() }}
{% elif (generate_tc_to_queue_map_per_sku is defined) %}
{{ generate_tc_to_queue_map_per_sku() }}
{% else %}
"TC_TO_QUEUE_MAP": {
"AZURE": {
"0": "0",
"1": "1",
"2": "2",
"3": "3",
"4": "4",
"5": "5",
"6": "6",
"7": "7"
}
},
{% endif %}
{% if 'type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] in backend_device_types and 'storage_device' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['storage_device'] == 'true' %}
{%- set require_global_dscp_to_tc_map = false %}
"DOT1P_TO_TC_MAP": {
"AZURE": {
"0": "1",
"1": "0",
"2": "2",
"3": "3",
"4": "4",
"5": "5",
"6": "6",
"7": "7"
}
},
{% elif (generate_dscp_to_tc_map is defined) and tunnel_qos_remap_enable %}
{{- generate_dscp_to_tc_map() }}
{% elif (generate_dscp_to_tc_map is defined) and
('type' in DEVICE_METADATA['localhost'] and
DEVICE_METADATA['localhost']['type'] in backend_device_types) and
('resource_type' in DEVICE_METADATA['localhost'] and
DEVICE_METADATA['localhost']['resource_type'] == 'ComputeAI') %}
{{- generate_dscp_to_tc_map() }}
{% elif (generate_dscp_to_tc_map_per_sku is defined) %}
{{ generate_dscp_to_tc_map_per_sku() }}
{% else %}
"DSCP_TO_TC_MAP": {
"AZURE": {
"0" : "1",
"1" : "1",
"2" : "1",
"3" : "3",
"4" : "4",
"5" : "2",
"6" : "1",
"7" : "1",
"8" : "0",
"9" : "1",
"10": "1",
"11": "1",
"12": "1",
"13": "1",
"14": "1",
"15": "1",
"16": "1",
"17": "1",
"18": "1",
"19": "1",
"20": "1",
"21": "1",
"22": "1",
"23": "1",
"24": "1",
"25": "1",
"26": "1",
"27": "1",
"28": "1",
"29": "1",
"30": "1",
"31": "1",
"32": "1",
"33": "1",
"34": "1",
"35": "1",
"36": "1",
"37": "1",
"38": "1",
"39": "1",
"40": "1",
"41": "1",
"42": "1",
"43": "1",
"44": "1",
"45": "1",
"46": "5",
"47": "1",
"48": "6",
"49": "1",
"50": "1",
"51": "1",
"52": "1",
"53": "1",
"54": "1",
"55": "1",
"56": "1",
"57": "1",
"58": "1",
"59": "1",
"60": "1",
"61": "1",
"62": "1",
"63": "1"
}
},
{% endif %}
{% if (generate_tc_to_dscp_map is defined) and tunnel_qos_remap_enable %}
{{- generate_tc_to_dscp_map() }}
{% elif (generate_tc_to_dscp_map_per_sku is defined) %}
{{ generate_tc_to_dscp_map_per_sku() }}
{% endif %}
{% if (generate_scheduler_config is defined) %}
{{- generate_scheduler_config() }}
{% else %}
{% if 'resource_type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['resource_type'] in apollo_resource_types %}
"SCHEDULER": {
"scheduler.0": {
"type" : "DWRR",
"weight": "1"
},
"scheduler.1": {
"type" : "DWRR",
"weight": "1"
},
"scheduler.2": {
"type" : "DWRR",
"weight": "100"
}
},
{% elif (generate_tc_to_pg_map is defined) and
('type' in DEVICE_METADATA['localhost'] and
DEVICE_METADATA['localhost']['type'] in backend_device_types) and
('resource_type' in DEVICE_METADATA['localhost'] and
DEVICE_METADATA['localhost']['resource_type'] == 'ComputeAI') %}
"SCHEDULER": {
"scheduler.0": {
"type" : "DWRR",
"weight": "40"
},
"scheduler.1": {
"type" : "DWRR",
"weight": "30"
},
"scheduler.2": {
"type" : "DWRR",
"weight": "25"
},
"scheduler.3": {
"type" : "DWRR",
"weight": "5"
}
},
{% elif generate_scheduler_per_sku is defined %}
{{ generate_scheduler_per_sku() }}
{% else %}
"SCHEDULER": {
"scheduler.0": {
"type" : "DWRR",
"weight": "14"
},
"scheduler.1": {
"type" : "DWRR",
"weight": "15"
}
},
{% endif %}
{% endif %}
{% if asic_type in pfc_to_pg_map_supported_asics %}
"PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": {
{% if port_names_list_extra_queues|length > 0 %}
"AZURE_DUALTOR": {
"2": "2",
"3": "3",
"4": "4",
"6": "6"
},
{% endif %}
"AZURE": {
"3": "3",
"4": "4"
}
},
{% endif %}
{% if (generate_port_qos_map is defined) %}
{{- generate_port_qos_map(port_names_active) }}
{% elif (generate_port_qos_map_per_sku is defined) and (PORT_DOWNLINK|length > 0 or PORT_UPLINK|length > 0) %}
"PORT_QOS_MAP": {
{% if port_names_downlink and port_names_downlink.strip() %}
{{ generate_port_qos_map_per_sku(port_names_downlink, 'downlink') }}{% if port_names_uplink and port_names_uplink.strip() %},{% endif %}
{% endif %}
{% if port_names_uplink and port_names_uplink.strip() %}
{{ generate_port_qos_map_per_sku(port_names_uplink, 'uplink') }}
{% endif %}
},
{% else %}
"PORT_QOS_MAP": {
{% if generate_global_dscp_to_tc_map is defined %}
{{- generate_global_dscp_to_tc_map() }}
{% elif require_global_dscp_to_tc_map %}
"global": {
"dscp_to_tc_map" : "AZURE"
}{% if PORT_ACTIVE %},{% endif %}
{% endif %}
{% for port in PORT_ACTIVE %}
"{{ port }}": {
{% if 'type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] in backend_device_types and 'storage_device' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['storage_device'] == 'true' %}
"dot1p_to_tc_map" : "AZURE",
{% else %}
{# Apply separated DSCP_TO_TC_MAP to uplink ports on ToR and Leaf #}
{% if different_dscp_to_tc_map and tunnel_qos_remap_enable %}
{% if ('type' in DEVICE_METADATA['localhost']) and (DEVICE_METADATA['localhost']['type'] == 'LeafRouter') and (port not in port_names_list_extra_queues) %}
"dscp_to_tc_map" : "AZURE_UPLINK",
{% elif ('subtype' in DEVICE_METADATA['localhost']) and (DEVICE_METADATA['localhost']['subtype'] == 'DualToR') and (port in port_names_list_extra_queues) %}
"dscp_to_tc_map" : "AZURE_UPLINK",
{% else %}
"dscp_to_tc_map" : "AZURE",
{% endif %}
{% else %}
"dscp_to_tc_map" : "AZURE",
{% endif %}
{% endif %}
{# Apply separated TC_TO_QUEUE_MAP to uplink ports on ToR #}
{% if different_tc_to_queue_map and tunnel_qos_remap_enable and port in port_names_list_extra_queues %}
"tc_to_queue_map" : "AZURE_UPLINK",
{% else %}
"tc_to_queue_map" : "AZURE",
{% endif %}
{% if asic_type in pfc_to_pg_map_supported_asics %}
{% if port in port_names_list_extra_queues %}
"pfc_to_pg_map" : "AZURE_DUALTOR",
{% else %}
"pfc_to_pg_map" : "AZURE",
{% endif %}
{% endif %}
{% if port not in PORT_DPC %}
{% if port not in PORT_SERVICE %}
{% if port in port_names_list_extra_queues %}
"pfc_enable" : "2,3,4,6",
{% else %}
"pfc_enable" : "{{ LOSSLESS_TC|join(',') }}",
{% endif %}
"pfcwd_sw_enable" : "{{ LOSSLESS_TC|join(',') }}",
{% endif %}
{% endif %}
{% if port not in PORT_DPC %}
"tc_to_pg_map" : "AZURE"{% if port not in PORT_SERVICE %},{% endif %}
{% else %}
"tc_to_pg_map" : "AZURE_DPC"{% if port not in PORT_SERVICE %},{% endif %}
{% endif %}
{% if port not in PORT_SERVICE %}
"pfc_to_queue_map": "AZURE"
{% endif %}
}{% if not loop.last %},{% endif %}
{% endfor %}
},
{% endif %}
{% if generate_wred_profiles is defined %}
{{- generate_wred_profiles() }}
{% else %}
"WRED_PROFILE": {
"AZURE_LOSSLESS" : {
"wred_green_enable" : "true",
"wred_yellow_enable" : "true",
"wred_red_enable" : "true",
"ecn" : "ecn_all",
"green_max_threshold" : "2097152",
"green_min_threshold" : "1048576",
"yellow_max_threshold" : "2097152",
"yellow_min_threshold" : "1048576",
"red_max_threshold" : "2097152",
"red_min_threshold" : "1048576",
"green_drop_probability" : "5",
"yellow_drop_probability": "5",
"red_drop_probability" : "5"
}
},
{% endif %}
{% if voq_chassis %}
"QUEUE": {
{% for system_port in SYSTEM_PORT_ALL %}
"{{ system_port }}|3": {
{% if system_port in SYSTEM_PORT_ACTIVE -%}
"scheduler": "scheduler.1",
{% endif -%}
"wred_profile": "AZURE_LOSSLESS"
},
{% endfor %}
{% for system_port in SYSTEM_PORT_ALL %}
"{{ system_port }}|4": {
{% if system_port in SYSTEM_PORT_ACTIVE -%}
"scheduler": "scheduler.1",
{% endif -%}
"wred_profile": "AZURE_LOSSLESS"
}{% if not loop.last %},{% else %}
{% if SYSTEM_PORT_ACTIVE and SYSTEM_PORT_ACTIVE|length > 0 %},{% endif %}
{% endif %}
{% endfor %}
{% for system_port in SYSTEM_PORT_ACTIVE %}
"{{ system_port }}|0": {
"scheduler": "scheduler.0"
},
{% endfor %}
{% for system_port in SYSTEM_PORT_ACTIVE %}
"{{ system_port }}|1": {
"scheduler": "scheduler.0"
},
{% endfor %}
{% for system_port in SYSTEM_PORT_ACTIVE %}
"{{ system_port }}|2": {
"scheduler": "scheduler.0"
},
{% endfor %}
{% for system_port in SYSTEM_PORT_ACTIVE %}
"{{ system_port }}|5": {
"scheduler": "scheduler.0"
},
{% endfor %}
{% for system_port in SYSTEM_PORT_ACTIVE %}
"{{ system_port }}|6": {
"scheduler": "scheduler.0"
}{% if not loop.last %},{% endif %}
{% endfor %}
}
{% elif generate_direction_based_queue_per_sku is defined and (PORT_DOWNLINK|length > 0 or PORT_UPLINK|length > 0) %}
"QUEUE": {
{% for port in PORT_DOWNLINK %}
{{ generate_direction_based_queue_per_sku(port, 'downlink') }}
{%- if not loop.last or PORT_UPLINK|length > 0 -%},{% endif %}
{% endfor %}
{% for port in PORT_UPLINK %}
{{ generate_direction_based_queue_per_sku(port, 'uplink') }}
{%- if not loop.last -%},{% endif %}
{% endfor %}
}
{% elif generate_single_queue_per_sku is defined %}
"QUEUE": {
{% for port in PORT_ACTIVE %}
{{ generate_single_queue_per_sku(port) }}
{%- if not loop.last -%},{% endif %}
{% endfor %}
}
{% elif generate_queue_config is defined %}
{{- generate_queue_config(port_names_active) }}
{% else %}
"QUEUE": {
{% if 'type' in DEVICE_METADATA['localhost'] and
DEVICE_METADATA['localhost']['type'] in backend_device_types and
'resource_type' in DEVICE_METADATA['localhost'] and
DEVICE_METADATA['localhost']['resource_type'] == 'ComputeAI' %}
{% for port in PORT_ACTIVE %}
"{{ port }}|0": {
"scheduler": "scheduler.0"
},
"{{ port }}|1": {
"scheduler": "scheduler.1"
},
"{{ port }}|3": {
"scheduler" : "scheduler.2",
"wred_profile": "AZURE_LOSSLESS"
},
"{{ port }}|4": {
"scheduler" : "scheduler.3",
"wred_profile": "AZURE_LOSSLESS"
}{% if not loop.last %},{% endif %}
{% endfor %}
{% else %}
{% for port in PORT_ACTIVE %}
"{{ port }}|3": {
{% if port not in PORT_DPC %}
"scheduler" : "scheduler.1",
"wred_profile": "AZURE_LOSSLESS"
{% else %}
"scheduler": "scheduler.0"
{% endif %}
},
{% endfor %}
{% if 'resource_type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['resource_type'] in apollo_resource_types %}
{% for port in PORT_ACTIVE %}
"{{ port }}|4": {
"scheduler" : "scheduler.2",
"wred_profile": "AZURE_LOSSLESS"
},
{% endfor %}
{% else %}
{% for port in PORT_ACTIVE %}
"{{ port }}|4": {
{% if port not in PORT_DPC %}
"scheduler" : "scheduler.1",
"wred_profile": "AZURE_LOSSLESS"
{% else %}
"scheduler": "scheduler.0"
{% endif %}
},
{% endfor %}
{% endif %}
{% for port in PORT_ACTIVE %}
"{{ port }}|0": {
"scheduler": "scheduler.0"
},
{% endfor %}
{% for port in PORT_ACTIVE %}
"{{ port }}|1": {
"scheduler": "scheduler.0"
},
{% endfor %}
{% for port in PORT_ACTIVE %}
"{{ port }}|2": {
{% if port in port_names_list_extra_queues and port not in PORT_DPC %}
"scheduler" : "scheduler.1",
"wred_profile": "AZURE_LOSSLESS"
{% else %}
"scheduler": "scheduler.0"
{% endif %}
},
{% endfor %}
{% for port in PORT_ACTIVE %}
"{{ port }}|5": {
"scheduler": "scheduler.0"
},
{# DSCP 48 is mapped to QUEUE 7 in macro generate_dscp_to_tc_map #}
{% if (generate_dscp_to_tc_map is defined) and tunnel_qos_remap_enable %}
"{{ port }}|7": {
"scheduler": "scheduler.0"
},
{% endif %}
{% endfor %}
{% for port in PORT_ACTIVE %}
"{{ port }}|6": {
{% if port in port_names_list_extra_queues and port not in PORT_DPC %}
"scheduler" : "scheduler.1",
"wred_profile": "AZURE_LOSSLESS"
{% else %}
"scheduler": "scheduler.0"
{% endif %}
}{% if not loop.last %},{% endif %}
{% endfor %}
{% endif %}
}
{% endif %}
}