|
1 | 1 | [
|
2 |
| -{% set ethernet_interfaces_names_list = [] %} |
3 |
| -{% for interface in ethernet_interfaces %} |
4 |
| - {%- if ethernet_interfaces_names_list.append(interface['name']) %}{% endif %} |
| 2 | +{% set port_names_list = [] %} |
| 3 | +{% for port in PORT %} |
| 4 | + {%- if port_names_list.append(port) %}{% endif %} |
5 | 5 | {% endfor %}
|
6 |
| -{% set ethernet_interfaces_names = ethernet_interfaces_names_list | join(',') %} |
| 6 | +{% set port_names = port_names_list | join(',') %} |
7 | 7 | {
|
8 | 8 | "BUFFER_POOL_TABLE:ingress_lossless_pool": {
|
9 | 9 | "size": "3024486",
|
|
68 | 68 | },
|
69 | 69 | "OP": "SET"
|
70 | 70 | },
|
71 |
| - { |
72 |
| - "BUFFER_PROFILE_TABLE:pg_lossless_profile": { |
73 |
| - "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]", |
74 |
| - "xon":"35616", |
75 |
| - "xoff":"31814", |
76 |
| - "size":"67430", |
77 |
| - "dynamic_th":"1" |
78 |
| - }, |
79 |
| - "OP": "SET" |
80 |
| - }, |
81 | 71 | {
|
82 | 72 | "BUFFER_PROFILE_TABLE:pg_lossy_profile": {
|
83 | 73 | "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]",
|
|
103 | 93 | "OP": "SET"
|
104 | 94 | },
|
105 | 95 | {
|
106 |
| - "BUFFER_PORT_INGRESS_PROFILE_LIST:{{ ethernet_interfaces_names }}": { |
| 96 | + "BUFFER_PORT_INGRESS_PROFILE_LIST:{{ port_names }}": { |
107 | 97 | "profile_list" : "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]"
|
108 | 98 | },
|
109 | 99 | "OP": "SET"
|
110 | 100 | },
|
111 | 101 | {
|
112 |
| - "BUFFER_PORT_EGRESS_PROFILE_LIST:{{ ethernet_interfaces_names }}": { |
| 102 | + "BUFFER_PORT_EGRESS_PROFILE_LIST:{{ port_names }}": { |
113 | 103 | "profile_list" : "[BUFFER_PROFILE_TABLE:egress_lossless_profile],[BUFFER_PROFILE_TABLE:egress_lossy_profile]"
|
114 | 104 | },
|
115 | 105 | "OP": "SET"
|
|
176 | 166 | }
|
177 | 167 | %}
|
178 | 168 |
|
179 |
| -{% set switch_role = minigraph_devices[minigraph_hostname]['type'] %} |
| 169 | +{% set switch_role = DEVICE_METADATA['localhost']['type'] %} |
180 | 170 |
|
181 |
| -{%- macro cable_length(interface_name) -%} |
182 |
| - {% set nei = '"'+minigraph_neighbors[interface_name]['name']+'"' -%} |
183 |
| - {% set nei_role = minigraph_devices[nei]['type'] -%} |
184 |
| - {% set roles1 = switch_role + '_' + nei_role %} |
185 |
| - {%- set roles2 = nei_role + '_' + switch_role -%} |
186 |
| - {%- if roles1 in ports2cable -%} |
187 |
| - {{ ports2cable[roles1] }} |
188 |
| - {%- elif roles2 in ports2cable -%} |
189 |
| - {{ ports2cable[roles2] }} |
190 |
| - {%- else -%} |
191 |
| - {{ supported_cable | last }} |
192 |
| - {%- endif -%} |
| 171 | +{%- macro cable_length(port_name) -%} |
| 172 | + {%- for neighbor in DEVICE_NEIGHBOR -%} |
| 173 | + {%- if DEVICE_NEIGHBOR[neighbor]['local_port'] == port_name -%} |
| 174 | + {%- set neighbor_role = DEVICE_NEIGHBOR[neighbor]['type'] -%} |
| 175 | + {%- set roles1 = switch_role + '_' + neighbor_role %} |
| 176 | + {%- set roles2 = neighbor_role + '_' + switch_role -%} |
| 177 | + {%- if roles1 in ports2cable -%} |
| 178 | + {{ ports2cable[roles1] }} |
| 179 | + {%- elif roles2 in ports2cable -%} |
| 180 | + {{ ports2cable[roles2] }} |
| 181 | + {%- else -%} |
| 182 | + {{ supported_cable | last }} |
| 183 | + {%- endif -%} |
| 184 | + {% endif %} |
| 185 | + {%- endfor -%} |
193 | 186 | {% endmacro %}
|
194 | 187 |
|
195 | 188 | {%- macro find_closest_greater_config(speed, cable) -%}
|
|
210 | 203 |
|
211 | 204 | {% set ingress_lossless_pg_pool_size = [] %}
|
212 | 205 | {% set used_pg_profiles = [] %}
|
213 |
| -{% for interface in ethernet_interfaces %} |
214 |
| - {%- set speed = interface['speed'] -%} |
215 |
| - {%- set cable = cable_length(interface['name']) -%} |
| 206 | +{% for port in PORT %} |
| 207 | + {%- set speed = PORT[port]['speed'] -%} |
| 208 | + {%- set cable = cable_length(port) -%} |
216 | 209 | {%- set port_config = speed + '_' + cable -%}
|
217 | 210 | {%- if not port_config in portconfig2profile -%}
|
218 | 211 | {% set port_config = find_closest_greater_config(speed, cable) -%}
|
|
222 | 215 | {# add to list profiles which were actually used #}
|
223 | 216 | {%- if profile not in used_pg_profiles and used_pg_profiles.append(profile) %}{% endif -%}
|
224 | 217 | {
|
225 |
| - "BUFFER_PG_TABLE:{{ interface['name'] }}:{{ pg_range }}": { |
| 218 | + "BUFFER_PG_TABLE:{{ port }}:{{ pg_range }}": { |
226 | 219 | "profile" : "[BUFFER_PROFILE_TABLE:{{ profile }}]"
|
227 | 220 | },
|
228 | 221 | "OP": "SET"
|
229 | 222 | },
|
230 |
| - |
231 | 223 | {% endfor -%}
|
232 | 224 |
|
233 | 225 | {# PG profiles declaration #}
|
| 226 | + |
234 | 227 | {% for profile_name in used_pg_profiles %}
|
235 | 228 | {%- set profile_config = pg_profiles[profile_name] %}
|
236 | 229 | {
|
|
255 | 248 | "OP": "SET"
|
256 | 249 | },
|
257 | 250 | {
|
258 |
| - "BUFFER_PG_TABLE:{{ ethernet_interfaces_names }}:0-1": { |
| 251 | + "BUFFER_PG_TABLE:{{ port_names }}:0-1": { |
259 | 252 | "profile" : "[BUFFER_PROFILE_TABLE:pg_lossy_profile]"
|
260 | 253 | },
|
261 | 254 | "OP": "SET"
|
262 | 255 | },
|
263 | 256 | {
|
264 |
| - "BUFFER_QUEUE_TABLE:{{ ethernet_interfaces_names }}:3-4": { |
| 257 | + "BUFFER_QUEUE_TABLE:{{ port_names }}:3-4": { |
265 | 258 | "profile" : "[BUFFER_PROFILE_TABLE:q_lossless_profile]"
|
266 | 259 | },
|
267 | 260 | "OP": "SET"
|
268 | 261 | },
|
269 | 262 | {
|
270 |
| - "BUFFER_QUEUE_TABLE:{{ ethernet_interfaces_names }}:0-1": { |
| 263 | + "BUFFER_QUEUE_TABLE:{{ port_names }}:0-1": { |
271 | 264 | "profile" : "[BUFFER_PROFILE_TABLE:q_lossy_profile]"
|
272 | 265 | },
|
273 | 266 | "OP": "SET"
|
|
282 | 275 | "OP": "SET"
|
283 | 276 | },
|
284 | 277 | {
|
285 |
| - "PORT_QOS_MAP_TABLE:{{ ethernet_interfaces_names }}": { |
| 278 | + "PORT_QOS_MAP_TABLE:{{ port_names }}": { |
286 | 279 | "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_TABLE:AZURE]"
|
287 | 280 | },
|
288 | 281 | "OP": "SET"
|
|
0 commit comments