2018-02-27 14:15:56 -06:00
{%- macro set_default_topology() %}
{%- if default_topo is defined %}
{{ default_topo }}
{%- else %}
def
{%- endif %}
2018-05-08 10:37:35 -05:00
{%- endmacro -%}
2018-02-27 14:15:56 -06:00
{# Determine device topology and filename postfix #}
2020-04-30 14:50:59 -05:00
{%- if DEVICE_METADATA is defined and DEVICE_METADATA['localhost']['type'] is defined %}
2018-02-27 14:15:56 -06:00
{%- set switch_role = DEVICE_METADATA['localhost']['type'] %}
2020-11-10 17:06:35 -06:00
{%- if 'torrouter' in switch_role.lower() and 'mgmt' not in switch_role.lower()%}
2018-02-27 14:15:56 -06:00
{%- set filename_postfix = 't0' %}
2020-11-10 17:06:35 -06:00
{%- elif 'leafrouter' in switch_role.lower() and 'mgmt' not in switch_role.lower()%}
2018-02-27 14:15:56 -06:00
{%- set filename_postfix = 't1' %}
{%- else %}
{%- set filename_postfix = set_default_topology() %}
{%- endif %}
{%- else %}
{%- set filename_postfix = set_default_topology() %}
{%- set switch_role = '' %}
2018-05-08 10:37:35 -05:00
{%- endif -%}
2018-02-27 14:15:56 -06:00
2023-01-01 01:59:54 -06:00
{% set voq_chassis = false %}
{%- 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 -%}
2018-02-27 14:15:56 -06:00
{# Import default values from device HWSKU folder #}
2020-12-13 13:35:39 -06:00
{%- import 'buffers_defaults_%s.j2' % filename_postfix as defs with context %}
2018-02-27 14:15:56 -06:00
2018-05-08 10:37:35 -05:00
{%- set default_cable = defs.default_cable -%}
2018-02-27 14:15:56 -06:00
{# 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 #}
2019-03-05 16:06:00 -06:00
{%- if defs.ports2cable is defined %}
{%- set ports2cable = defs.ports2cable %}
{%- else %}
{%- set ports2cable = {
'torrouter_server' : '5m',
'leafrouter_torrouter' : '40m',
'spinerouter_leafrouter' : '300m'
}
-%}
{%- endif %}
2018-02-27 14:15:56 -06:00
{%- macro cable_length(port_name) %}
{%- set cable_len = [] %}
{%- for local_port in DEVICE_NEIGHBOR %}
{%- if local_port == port_name %}
2019-02-05 00:43:08 -06:00
{%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %}
2018-02-27 14:15:56 -06:00
{%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %}
{%- set neighbor_role = neighbor.type %}
2020-07-27 12:57:07 -05:00
{%- if 'asic' == neighbor_role | lower %}
{%- set roles1 = 'internal' %}
2020-09-23 10:07:09 -05:00
{%- if 'internal' not in ports2cable %}
{%- set _ = ports2cable.update({'internal': '5m'}) %}
{%- endif -%}
2020-07-27 12:57:07 -05:00
{%- else %}
{%- set roles1 = switch_role + '_' + neighbor_role %}
{%- set roles2 = neighbor_role + '_' + switch_role %}
{%- set roles1 = roles1 | lower %}
{%- set roles2 = roles2 | lower %}
2020-11-12 11:03:59 -06:00
{%- set roles1 = roles1.replace('backend', '') %}
{%- set roles2 = roles2.replace('backend', '') %}
2020-07-27 12:57:07 -05:00
{%- endif %}
2018-02-27 14:15:56 -06:00
{%- 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 %}
2020-11-10 17:06:35 -06:00
{%- if 'torrouter' in switch_role.lower() and 'mgmt' not in switch_role.lower()%}
2018-02-27 14:15:56 -06:00
{%- for local_port in VLAN_MEMBER %}
2018-12-04 12:07:44 -06:00
{%- if local_port[1] == port_name %}
2018-02-27 14:15:56 -06:00
{%- set roles3 = switch_role + '_' + 'server' %}
{%- set roles3 = roles3 | lower %}
2020-11-12 11:03:59 -06:00
{%- set roles3 = roles3.replace('backend', '') %}
2018-02-27 14:15:56 -06:00
{%- 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 = [] %}
2023-01-01 01:59:54 -06:00
{%- set SYSTEM_PORT_ALL = [] %}
2018-02-27 14:15:56 -06:00
2023-01-01 01:59:54 -06:00
{%- if voq_chassis %}
{%- 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 %}
{%- endfor %}
{%- endif %}
2018-02-27 14:15:56 -06:00
{%- if PORT is not defined %}
2021-11-24 07:00:23 -06:00
{%- if defs.generate_port_lists is defined %}
{%- if defs.generate_port_lists(PORT_ALL) %} {% endif %}
{%- endif %}
2018-02-27 14:15:56 -06:00
{%- else %}
{%- for port in PORT %}
2022-03-09 18:04:36 -06:00
{%- if not port.startswith('Ethernet-Rec') and not port.startswith('Ethernet-IB') %}
{%- if PORT_ALL.append(port) %}{%- endif %}
{%- endif %}
2018-02-27 14:15:56 -06:00
{%- endfor %}
{%- endif %}
2018-06-21 13:51:37 -05:00
{%- set PORT_ACTIVE = [] %}
2021-11-24 07:00:23 -06:00
{%- set PORT_INACTIVE = [] %}
2018-06-21 13:51:37 -05:00
{%- 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 %}
2021-11-24 07:00:23 -06:00
{%- for port in PORT_ALL %}
{%- if port not in DEVICE_NEIGHBOR.keys() %}
{%- if PORT_INACTIVE.append(port) %}{%- endif %}
{%- endif %}
{%- endfor %}
2018-06-21 13:51:37 -05:00
{%- endif %}
{%- set port_names_list_active = [] %}
{%- for port in PORT_ACTIVE %}
{%- if port_names_list_active.append(port) %}{%- endif %}
2018-02-27 14:15:56 -06:00
{%- endfor %}
2018-06-21 13:51:37 -05:00
{%- set port_names_active = port_names_list_active | join(',') %}
2018-02-27 14:15:56 -06:00
2022-06-02 15:03:27 -05:00
{%- 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(',') %}
2021-11-24 07:00:23 -06:00
{%- 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(',') %}
2018-02-27 14:15:56 -06:00
{
"CABLE_LENGTH": {
"AZURE": {
2019-02-01 13:18:02 -06:00
{% for port in PORT_ALL %}
2018-02-27 14:15:56 -06:00
{%- set cable = cable_length(port) %}
"{{ port }}": "{{ cable }}"{%- if not loop.last %},{% endif %}
{% endfor %}
}
},
2018-05-08 10:37:35 -05:00
{% if defs.generate_buffer_pool_and_profiles is defined %}
{{ defs.generate_buffer_pool_and_profiles() }}
2021-11-24 07:00:23 -06:00
{% elif defs.generate_buffer_pool_and_profiles_with_inactive_ports is defined %}
{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }}
2018-05-08 10:37:35 -05:00
{% endif %}
2021-11-24 07:00:23 -06:00
{%- if port_names_active|length > 0 or port_names_inactive|length > 0 -%}
2018-05-08 10:37:35 -05:00
{%- if defs.generate_profile_lists is defined %}
2018-06-21 13:51:37 -05:00
{{ defs.generate_profile_lists(port_names_active) }},
2021-11-24 07:00:23 -06:00
{% elif defs.generate_profile_lists_with_inactive_ports is defined %}
{{ defs.generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) }},
2018-05-08 10:37:35 -05:00
{% endif %}
2022-07-20 01:48:15 -05:00
{% if (defs.generate_pg_profiles_with_extra_lossless_pgs_with_inactive_ports is defined) and (port_names_extra_queues != '') %}
{{ defs.generate_pg_profiles_with_extra_lossless_pgs_with_inactive_ports(port_names_active, port_names_extra_queues, port_names_inactive) }},
2021-11-24 07:00:23 -06:00
{% elif defs.generate_pg_profiles_with_inactive_ports is defined %}
{{ defs.generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) }},
2022-07-20 01:48:15 -05:00
{% elif defs.generate_pg_profils is defined %}
{{ defs.generate_pg_profils(port_names_active) }}
2018-05-08 10:37:35 -05:00
{% else %}
2018-02-27 14:15:56 -06:00
"BUFFER_PG": {
2019-10-18 11:14:39 -05:00
{% for port in PORT_ACTIVE %}
2020-12-13 13:35:39 -06:00
{% if dynamic_mode is defined %}
"{{ port }}|3-4": {
"profile" : "NULL"
},
{% endif %}
2019-10-02 15:01:16 -05:00
"{{ port }}|0": {
SONIC QOS YANG - Remove qos tables field value refernce format (#7752)
Depends on Azure/sonic-utilities#1626
Depends on Azure/sonic-swss#1754
QOS tables in config db used ABNF format i.e "[TABLE_NAME|name] to refer fieldvalue to other qos tables.
Example:
Config DB:
"Ethernet92|3": {
"scheduler": "[SCHEDULER|scheduler.1]",
"wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]"
},
"Ethernet0|0": {
"profile": "[BUFFER_PROFILE|ingress_lossy_profile]"
},
"Ethernet0": {
"dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]",
"pfc_enable": "3,4",
"pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]",
"tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]",
"tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]"
},
This format is not consistent with other DB schema followed in sonic.
And also this reference in DB is not required, This is taken care by YANG "leafref".
Removed this format from all platform files to consistent with other sonic db schema.
Example:
"Ethernet92|3": {
"scheduler": "scheduler.1",
"wred_profile": "AZURE_LOSSLESS"
},
Dependent pull requests:
#7752 - To modify platfrom files
#7281 - Yang model
Azure/sonic-utilities#1626 - DB migration
Azure/sonic-swss#1754 - swss change to remove ABNF format
2021-09-28 11:21:24 -05:00
"profile" : "ingress_lossy_profile"
2019-10-02 15:01:16 -05:00
}{% if not loop.last %},{% endif %}
{% endfor %}
2018-02-27 14:15:56 -06:00
},
2018-05-08 10:37:35 -05:00
{% endif %}
2023-01-01 01:59:54 -06:00
{% if voq_chassis %}
"BUFFER_QUEUE": {
{% for system_port in SYSTEM_PORT_ALL %}
"{{ system_port }}|3-4": {
"profile" : "egress_lossless_profile"
},
{% endfor %}
{% for system_port in SYSTEM_PORT_ALL %}
"{{ system_port }}|0-2": {
"profile" : "egress_lossy_profile"
},
{% endfor %}
{% for system_port in SYSTEM_PORT_ALL %}
"{{ system_port }}|5-6": {
"profile" : "egress_lossy_profile"
}{% if not loop.last %},{% endif %}
{% endfor %}
}
{% else %}
2022-07-20 01:48:15 -05:00
{% if (defs.generate_queue_buffers_with_extra_lossless_queues_with_inactive_ports is defined) and (port_names_extra_queues != '') %}
2022-06-02 15:03:27 -05:00
{{ 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) }}
2022-07-20 01:48:15 -05:00
{% elif 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) }}
2018-05-08 10:37:35 -05:00
{% else %}
2018-02-27 14:15:56 -06:00
"BUFFER_QUEUE": {
2019-10-18 11:14:39 -05:00
{% for port in PORT_ACTIVE %}
2019-10-02 15:01:16 -05:00
"{{ port }}|3-4": {
SONIC QOS YANG - Remove qos tables field value refernce format (#7752)
Depends on Azure/sonic-utilities#1626
Depends on Azure/sonic-swss#1754
QOS tables in config db used ABNF format i.e "[TABLE_NAME|name] to refer fieldvalue to other qos tables.
Example:
Config DB:
"Ethernet92|3": {
"scheduler": "[SCHEDULER|scheduler.1]",
"wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]"
},
"Ethernet0|0": {
"profile": "[BUFFER_PROFILE|ingress_lossy_profile]"
},
"Ethernet0": {
"dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]",
"pfc_enable": "3,4",
"pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]",
"tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]",
"tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]"
},
This format is not consistent with other DB schema followed in sonic.
And also this reference in DB is not required, This is taken care by YANG "leafref".
Removed this format from all platform files to consistent with other sonic db schema.
Example:
"Ethernet92|3": {
"scheduler": "scheduler.1",
"wred_profile": "AZURE_LOSSLESS"
},
Dependent pull requests:
#7752 - To modify platfrom files
#7281 - Yang model
Azure/sonic-utilities#1626 - DB migration
Azure/sonic-swss#1754 - swss change to remove ABNF format
2021-09-28 11:21:24 -05:00
"profile" : "egress_lossless_profile"
2018-02-27 14:15:56 -06:00
},
2019-10-02 15:01:16 -05:00
{% endfor %}
2019-10-18 11:14:39 -05:00
{% for port in PORT_ACTIVE %}
2019-10-02 15:01:16 -05:00
"{{ port }}|0-2": {
SONIC QOS YANG - Remove qos tables field value refernce format (#7752)
Depends on Azure/sonic-utilities#1626
Depends on Azure/sonic-swss#1754
QOS tables in config db used ABNF format i.e "[TABLE_NAME|name] to refer fieldvalue to other qos tables.
Example:
Config DB:
"Ethernet92|3": {
"scheduler": "[SCHEDULER|scheduler.1]",
"wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]"
},
"Ethernet0|0": {
"profile": "[BUFFER_PROFILE|ingress_lossy_profile]"
},
"Ethernet0": {
"dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]",
"pfc_enable": "3,4",
"pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]",
"tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]",
"tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]"
},
This format is not consistent with other DB schema followed in sonic.
And also this reference in DB is not required, This is taken care by YANG "leafref".
Removed this format from all platform files to consistent with other sonic db schema.
Example:
"Ethernet92|3": {
"scheduler": "scheduler.1",
"wred_profile": "AZURE_LOSSLESS"
},
Dependent pull requests:
#7752 - To modify platfrom files
#7281 - Yang model
Azure/sonic-utilities#1626 - DB migration
Azure/sonic-swss#1754 - swss change to remove ABNF format
2021-09-28 11:21:24 -05:00
"profile" : "egress_lossy_profile"
2018-12-04 22:51:55 -06:00
},
2019-10-02 15:01:16 -05:00
{% endfor %}
2019-10-18 11:14:39 -05:00
{% for port in PORT_ACTIVE %}
2019-10-02 15:01:16 -05:00
"{{ port }}|5-6": {
SONIC QOS YANG - Remove qos tables field value refernce format (#7752)
Depends on Azure/sonic-utilities#1626
Depends on Azure/sonic-swss#1754
QOS tables in config db used ABNF format i.e "[TABLE_NAME|name] to refer fieldvalue to other qos tables.
Example:
Config DB:
"Ethernet92|3": {
"scheduler": "[SCHEDULER|scheduler.1]",
"wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]"
},
"Ethernet0|0": {
"profile": "[BUFFER_PROFILE|ingress_lossy_profile]"
},
"Ethernet0": {
"dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]",
"pfc_enable": "3,4",
"pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]",
"tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]",
"tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]"
},
This format is not consistent with other DB schema followed in sonic.
And also this reference in DB is not required, This is taken care by YANG "leafref".
Removed this format from all platform files to consistent with other sonic db schema.
Example:
"Ethernet92|3": {
"scheduler": "scheduler.1",
"wred_profile": "AZURE_LOSSLESS"
},
Dependent pull requests:
#7752 - To modify platfrom files
#7281 - Yang model
Azure/sonic-utilities#1626 - DB migration
Azure/sonic-swss#1754 - swss change to remove ABNF format
2021-09-28 11:21:24 -05:00
"profile" : "egress_lossy_profile"
2019-10-02 15:01:16 -05:00
}{% if not loop.last %},{% endif %}
{% endfor %}
2018-02-27 14:15:56 -06:00
}
2018-05-08 10:37:35 -05:00
{% endif %}
2023-01-01 01:59:54 -06:00
{% endif %}
2021-11-24 07:00:23 -06:00
{%- if dynamic_mode is defined -%}
2020-12-13 13:35:39 -06:00
,
2021-11-24 07:00:23 -06:00
{%- endif -%}
{%- endif -%}
{% if dynamic_mode is defined %}
2020-12-13 13:35:39 -06:00
"DEFAULT_LOSSLESS_BUFFER_PARAMETER": {
"AZURE": {
"default_dynamic_th": "0"
2022-10-19 11:36:56 -05:00
{%- if shp is defined -%}
,
"max_headroom_size" : "0",
"over_subscribe_ratio" : "1"
{%- endif -%}
2020-12-13 13:35:39 -06:00
}
},
"LOSSLESS_TRAFFIC_PATTERN": {
"AZURE": {
"mtu": "1024",
"small_packet_percentage": "100"
}
}
{% endif %}
2018-02-27 14:15:56 -06:00
}