d9cd1a1355
Signed-off-by: bingwang <wang.bing@microsoft.com> Why I did it This PR brings two changes Add lossy PG profile for PG2 and PG6 on T1 for ports between T1 and T2. After PR Update qos config to clear queues for bounced back traffic #10176 , the DSCP_TO_TC_MAP and TC_TO_PG_MAP is updated when remapping is enable DSCP_TO_TC_MAP Before After Why do this change "2" : "1" "2" : "2" Only change for leaf router to map DSCP 2 to TC 2 as TC 2 will be used for lossless TC "6" : "1" "6" : "6" Only change for leaf router to map DSCP 6 to TC 6 as TC 6 will be used for lossless TC TC_TO_PRIORITY_GROUP_MAP Before After Why do this change "2" : "0" "2" : "2" Only change for leaf router to map TC 2 to PG 2 as PG 2 will be used for lossless PG "6" : "0" "6" : "6" Only change for leaf router to map TC 6 to PG 6 as PG 6 will be used for lossless PG So, we have two new lossy PGs (2 and 6) for the T2 facing ports on T1, and two new lossless PGs (2 and 6) for the T0 facing port on T1. However, there is no lossy PG profile for the T2 facing ports on T1. The lossless PGs for ports between T1 and T0 have been handled by buffermgrd .Therefore, We need to add lossy PG profiles for T2 facing ports on T1. We don't have this issue on T0 because PG 2 and PG 6 are lossless PGs, and there is no lossy traffic mapped to PG 2 and PG 6 Map port level TC7 to PG0 Before the PCBB change, DSCP48 -> TC 6 -> PG 0. After the PCBB change, DSCP48 -> TC 7 -> PG 7 Actually, we can map TC7 to PG0 to save a lossy PG. How I did it Update the qos and buffer template. How to verify it Verified by UT.
241 lines
9.6 KiB
Django/Jinja
241 lines
9.6 KiB
Django/Jinja
{%- macro set_default_topology() %}
|
|
{%- if default_topo is defined %}
|
|
{{ default_topo }}
|
|
{%- else %}
|
|
def
|
|
{%- endif %}
|
|
{%- endmacro -%}
|
|
|
|
{# Determine device topology and filename postfix #}
|
|
{%- if DEVICE_METADATA is defined and DEVICE_METADATA['localhost']['type'] is defined %}
|
|
{%- set switch_role = DEVICE_METADATA['localhost']['type'] %}
|
|
{%- if 'torrouter' in switch_role.lower() and 'mgmt' not in switch_role.lower()%}
|
|
{%- set filename_postfix = 't0' %}
|
|
{%- elif 'leafrouter' in switch_role.lower() and 'mgmt' not in switch_role.lower()%}
|
|
{%- set filename_postfix = 't1' %}
|
|
{%- else %}
|
|
{%- set filename_postfix = set_default_topology() %}
|
|
{%- endif %}
|
|
{%- else %}
|
|
{%- set filename_postfix = set_default_topology() %}
|
|
{%- set switch_role = '' %}
|
|
{%- endif -%}
|
|
|
|
{# Import default values from device HWSKU folder #}
|
|
{%- import 'buffers_defaults_%s.j2' % filename_postfix as defs with context %}
|
|
|
|
{%- set default_cable = defs.default_cable -%}
|
|
|
|
{# Port configuration to cable length look-up table #}
|
|
{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #}
|
|
{# Roles described in the minigraph #}
|
|
{%- if defs.ports2cable is defined %}
|
|
{%- set ports2cable = defs.ports2cable %}
|
|
{%- else %}
|
|
{%- set ports2cable = {
|
|
'torrouter_server' : '5m',
|
|
'leafrouter_torrouter' : '40m',
|
|
'spinerouter_leafrouter' : '300m'
|
|
}
|
|
-%}
|
|
{%- endif %}
|
|
|
|
{%- macro cable_length(port_name) %}
|
|
{%- set cable_len = [] %}
|
|
{%- for local_port in DEVICE_NEIGHBOR %}
|
|
{%- if local_port == port_name %}
|
|
{%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %}
|
|
{%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %}
|
|
{%- set neighbor_role = neighbor.type %}
|
|
{%- if 'asic' == neighbor_role | lower %}
|
|
{%- set roles1 = 'internal' %}
|
|
{%- if 'internal' not in ports2cable %}
|
|
{%- set _ = ports2cable.update({'internal': '5m'}) %}
|
|
{%- endif -%}
|
|
{%- else %}
|
|
{%- set roles1 = switch_role + '_' + neighbor_role %}
|
|
{%- set roles2 = neighbor_role + '_' + switch_role %}
|
|
{%- set roles1 = roles1 | lower %}
|
|
{%- set roles2 = roles2 | lower %}
|
|
{%- set roles1 = roles1.replace('backend', '') %}
|
|
{%- set roles2 = roles2.replace('backend', '') %}
|
|
{%- endif %}
|
|
{%- if roles1 in ports2cable %}
|
|
{%- if cable_len.append(ports2cable[roles1]) %}{% endif %}
|
|
{%- elif roles2 in ports2cable %}
|
|
{%- if cable_len.append(ports2cable[roles2]) %}{% endif %}
|
|
{%- endif %}
|
|
{%- endif %}
|
|
{%- endif %}
|
|
{%- endfor %}
|
|
{%- if cable_len -%}
|
|
{{ cable_len.0 }}
|
|
{%- else %}
|
|
{%- if 'torrouter' in switch_role.lower() and 'mgmt' not in switch_role.lower()%}
|
|
{%- for local_port in VLAN_MEMBER %}
|
|
{%- if local_port[1] == port_name %}
|
|
{%- set roles3 = switch_role + '_' + 'server' %}
|
|
{%- set roles3 = roles3 | lower %}
|
|
{%- set roles3 = roles3.replace('backend', '') %}
|
|
{%- if roles3 in ports2cable %}
|
|
{%- if cable_len.append(ports2cable[roles3]) %}{% endif %}
|
|
{%- endif %}
|
|
{%- endif %}
|
|
{%- endfor %}
|
|
{%- if cable_len -%}
|
|
{{ cable_len.0 }}
|
|
{%- else -%}
|
|
{{ default_cable }}
|
|
{%- endif %}
|
|
{%- else -%}
|
|
{{ default_cable }}
|
|
{%- endif %}
|
|
{%- endif %}
|
|
{%- endmacro %}
|
|
|
|
{%- set PORT_ALL = [] %}
|
|
|
|
{%- if PORT is not defined %}
|
|
{%- if defs.generate_port_lists is defined %}
|
|
{%- if defs.generate_port_lists(PORT_ALL) %} {% endif %}
|
|
{%- endif %}
|
|
{%- else %}
|
|
{%- for port in PORT %}
|
|
{%- if not port.startswith('Ethernet-Rec') and not port.startswith('Ethernet-IB') %}
|
|
{%- if PORT_ALL.append(port) %}{%- endif %}
|
|
{%- endif %}
|
|
{%- endfor %}
|
|
{%- endif %}
|
|
|
|
{%- set PORT_ACTIVE = [] %}
|
|
{%- set PORT_INACTIVE = [] %}
|
|
{%- 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_ALL %}
|
|
{%- if port not in DEVICE_NEIGHBOR.keys() %}
|
|
{%- if PORT_INACTIVE.append(port) %}{%- endif %}
|
|
{%- endif %}
|
|
{%- endfor %}
|
|
{%- endif %}
|
|
|
|
{%- 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 port_names_list_extra_queues = [] %}
|
|
{%- for port in PORT_ACTIVE %}
|
|
{%- if ((SYSTEM_DEFAULTS is defined) and ('tunnel_qos_remap' in SYSTEM_DEFAULTS) and (SYSTEM_DEFAULTS['tunnel_qos_remap']['status'] == 'enabled')) 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 port_names_extra_queues = port_names_list_extra_queues | join(',') %}
|
|
|
|
{%- set port_names_list_inactive = [] %}
|
|
{%- for port in PORT_INACTIVE %}
|
|
{%- if port_names_list_inactive.append(port) %}{%- endif %}
|
|
{%- endfor %}
|
|
{%- set port_names_inactive = port_names_list_inactive | join(',') %}
|
|
{
|
|
"CABLE_LENGTH": {
|
|
"AZURE": {
|
|
{% for port in PORT_ALL %}
|
|
{%- set cable = cable_length(port) %}
|
|
"{{ port }}": "{{ cable }}"{%- if not loop.last %},{% endif %}
|
|
|
|
{% endfor %}
|
|
}
|
|
},
|
|
|
|
{% if defs.generate_buffer_pool_and_profiles is defined %}
|
|
{{ defs.generate_buffer_pool_and_profiles() }}
|
|
{% elif defs.generate_buffer_pool_and_profiles_with_inactive_ports is defined %}
|
|
{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }}
|
|
{% endif %}
|
|
|
|
|
|
{%- if port_names_active|length > 0 or port_names_inactive|length > 0 -%}
|
|
{%- if defs.generate_profile_lists is defined %}
|
|
{{ defs.generate_profile_lists(port_names_active) }},
|
|
{% elif defs.generate_profile_lists_with_inactive_ports is defined %}
|
|
{{ defs.generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) }},
|
|
{% endif %}
|
|
|
|
{%- if defs.generate_pg_profils is defined %}
|
|
{{ defs.generate_pg_profils(port_names_active) }}
|
|
{% elif defs.generate_pg_profiles_with_inactive_ports is defined %}
|
|
{{ defs.generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) }},
|
|
{% elif (defs.generate_pg_buffers_with_extra_lossy_pgs is defined) and (port_names_extra_queues != '') %}
|
|
{{ defs.generate_pg_buffers_with_extra_lossy_pgs(port_names_active, port_names_extra_queues) }}
|
|
{% elif (defs.generate_pg_buffers_with_extra_lossy_pgs_with_inactive_ports is defined) and (port_names_extra_queues != '') %}
|
|
{{ defs.generate_pg_buffers_with_extra_lossy_pgs_with_inactive_ports(port_names_active, port_names_extra_queues, port_names_inactive) }}
|
|
{% else %}
|
|
"BUFFER_PG": {
|
|
{% for port in PORT_ACTIVE %}
|
|
{% if dynamic_mode is defined %}
|
|
"{{ port }}|3-4": {
|
|
"profile" : "NULL"
|
|
},
|
|
{% endif %}
|
|
"{{ port }}|0": {
|
|
"profile" : "ingress_lossy_profile"
|
|
}{% if not loop.last %},{% endif %}
|
|
|
|
{% endfor %}
|
|
},
|
|
{% endif %}
|
|
|
|
{% if defs.generate_queue_buffers is defined %}
|
|
{{ defs.generate_queue_buffers(port_names_active) }}
|
|
{% elif defs.generate_queue_buffers_with_inactive_ports is defined %}
|
|
{{ defs.generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) }}
|
|
{% elif (defs.generate_queue_buffers_with_extra_lossless_queues_with_inactive_ports is defined) and (port_names_extra_queues != '') %}
|
|
{{ defs.generate_queue_buffers_with_extra_lossless_queues_with_inactive_ports(port_names_active, port_names_extra_queues, port_names_inactive) }}
|
|
{% elif (defs.generate_queue_buffers_with_extra_lossless_queues is defined) and (port_names_extra_queues != '') %}
|
|
{{ defs.generate_queue_buffers_with_extra_lossless_queues(port_names_active, port_names_extra_queues) }}
|
|
{% else %}
|
|
"BUFFER_QUEUE": {
|
|
{% for port in PORT_ACTIVE %}
|
|
"{{ port }}|3-4": {
|
|
"profile" : "egress_lossless_profile"
|
|
},
|
|
{% endfor %}
|
|
{% for port in PORT_ACTIVE %}
|
|
"{{ port }}|0-2": {
|
|
"profile" : "egress_lossy_profile"
|
|
},
|
|
{% endfor %}
|
|
{% for port in PORT_ACTIVE %}
|
|
"{{ port }}|5-6": {
|
|
"profile" : "egress_lossy_profile"
|
|
}{% if not loop.last %},{% endif %}
|
|
|
|
{% endfor %}
|
|
}
|
|
{% endif %}
|
|
{%- if dynamic_mode is defined -%}
|
|
,
|
|
{%- endif -%}
|
|
{%- endif -%}
|
|
{% if dynamic_mode is defined %}
|
|
"DEFAULT_LOSSLESS_BUFFER_PARAMETER": {
|
|
"AZURE": {
|
|
"default_dynamic_th": "0"
|
|
}
|
|
},
|
|
"LOSSLESS_TRAFFIC_PATTERN": {
|
|
"AZURE": {
|
|
"mtu": "1024",
|
|
"small_packet_percentage": "100"
|
|
}
|
|
}
|
|
{% endif %}
|
|
}
|