Skip to content

Commit

Permalink
Rename macro
Browse files Browse the repository at this point in the history
Signed-off-by: bingwang <wang.bing@microsoft.com>
  • Loading branch information
bingwang-ms committed Apr 25, 2022
1 parent e78d970 commit 1a2284f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{%- set default_topo = 't0' %}

{% if DEVICE_METADATA is defined and 'subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' %}
{%- macro generate_extra_lossless_buffers(port_names, port_names_require_extra_buffer) %}
{%- macro generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) %}
"BUFFER_QUEUE": {
{% for port in port_names %}
{% if port in port_names_require_extra_buffer %}
{% for port in port_names.split(',') %}
{% if port in port_names_require_extra_buffer.split(',') %}
"{{ port }}|0-1": {
"profile" : "egress_lossy_profile"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

{% if DEVICE_METADATA is defined and 'type' in DEVICE_METADATA['localhost'] and
(DEVICE_METADATA['localhost']['type'] == 'LeafRouter' or DEVICE_METADATA['localhost']['subtype'] == 'DualToR') %}
{%- macro generate_extra_lossless_buffers(port_names, port_names_require_extra_buffer) %}
{%- macro generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) %}
"BUFFER_QUEUE": {
{% for port in port_names %}
{% if port in port_names_require_extra_buffer %}
{% for port in port_names.split(',') %}
{% if port in port_names_require_extra_buffer.split(',') %}
"{{ port }}|0-1": {
"profile" : "egress_lossy_profile"
},
Expand Down
9 changes: 6 additions & 3 deletions files/build_templates/buffers_config.j2
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,12 @@ def

{%- set port_names_list_extra_queues = [] %}
{%- for port in PORT_ACTIVE %}
{% if (generate_extra_lossless_buffers is defined) 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
{% if (generate_queue_buffers_with_extra_lossless_queues is defined) 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 %}
Expand Down Expand Up @@ -190,8 +191,10 @@ def
{{ 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 generate_extra_lossless_buffers is defined %}
{{ generate_extra_lossless_buffers(port_names_list_active, port_names_list_extra_queues) }}
{% elif generate_queue_buffers_with_extra_lossless_queues_with_inactive_ports is defined %}
{{ generate_queue_buffers_with_extra_lossless_queues_with_inactive_ports(port_names_active, port_names_extra_queues, port_names_inactive) }}
{% elif generate_queue_buffers_with_extra_lossless_queues is defined %}
{{ generate_queue_buffers_with_extra_lossless_queues(port_names_active, port_names_extra_queues) }}
{% else %}
"BUFFER_QUEUE": {
{% for port in PORT_ACTIVE %}
Expand Down

0 comments on commit 1a2284f

Please sign in to comment.