|
13 | 13 | {%- set filename_postfix = 't0' %}
|
14 | 14 | {%- elif 'leafrouter' in switch_role.lower() and 'mgmt' not in switch_role.lower()%}
|
15 | 15 | {%- set filename_postfix = 't1' %}
|
| 16 | +{%- elif 'spinerouter' in switch_role.lower() and 'mgmt' not in switch_role.lower()%} |
| 17 | +{%- set filename_postfix = 't2' %} |
16 | 18 | {%- else %}
|
17 | 19 | {%- set filename_postfix = set_default_topology() %}
|
18 | 20 | {%- endif %}
|
|
26 | 28 | {%- set voq_chassis = true %}
|
27 | 29 | {%- endif -%}
|
28 | 30 |
|
29 |
| -{# Import default values from device HWSKU folder #} |
30 |
| -{%- import 'buffers_defaults_%s.j2' % filename_postfix as defs with context %} |
31 |
| - |
32 |
| -{%- set default_cable = defs.default_cable -%} |
| 31 | +{# Allow includer to pre-package defs without needing an import #} |
| 32 | +{%- if defs is not defined -%} |
| 33 | + {# Import default values from device HWSKU folder #} |
| 34 | + {%- import 'buffers_defaults_%s.j2' % filename_postfix as defs with context %} |
| 35 | + {%- set default_cable = defs.default_cable -%} |
| 36 | +{%- endif -%} |
33 | 37 |
|
34 | 38 | {# Port configuration to cable length look-up table #}
|
35 | 39 | {# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #}
|
|
48 | 52 | -%}
|
49 | 53 | {%- endif %}
|
50 | 54 |
|
| 55 | +{%- if cable_length is not defined %} |
51 | 56 | {%- macro cable_length(port_name) %}
|
52 | 57 | {%- set cable_len = [] %}
|
53 | 58 | {%- for local_port in DEVICE_NEIGHBOR %}
|
|
84 | 89 | {%- elif cable_len -%}
|
85 | 90 | {{ cable_len.0 }}
|
86 | 91 | {%- else %}
|
87 |
| - {%- if 'torrouter' in switch_role.lower() and 'mgmt' not in switch_role.lower()%} |
| 92 | + {%- if port_name.startswith('Ethernet-BP') %} |
| 93 | + {%- if 'internal' not in ports2cable %} |
| 94 | + {%- set _ = ports2cable.update({'internal': '5m'}) %} |
| 95 | + {%- endif -%} |
| 96 | + {%- set _ = cable_len.append(ports2cable['internal']) %} |
| 97 | + {%- elif 'torrouter' in switch_role.lower() and 'mgmt' not in switch_role.lower()%} |
88 | 98 | {%- for local_port in VLAN_MEMBER %}
|
89 | 99 | {%- if local_port[1] == port_name %}
|
90 | 100 | {%- set roles3 = switch_role + '_' + 'server' %}
|
|
95 | 105 | {%- endif %}
|
96 | 106 | {%- endif %}
|
97 | 107 | {%- endfor %}
|
98 |
| - {%- if cable_len -%} |
99 |
| - {{ cable_len.0 }} |
100 |
| - {%- else -%} |
101 |
| - {{ default_cable }} |
102 |
| - {%- endif %} |
| 108 | + {%- endif %} |
| 109 | + {%- if cable_len -%} |
| 110 | + {{ cable_len.0 }} |
103 | 111 | {%- else -%}
|
104 |
| - {%- if port_name.startswith('Ethernet-BP') %} |
105 |
| - {%- if 'internal' not in ports2cable %} |
106 |
| - {%- set _ = ports2cable.update({'internal': '5m'}) %} |
107 |
| - {%- endif -%} |
108 |
| - {{ ports2cable['internal'] }} |
109 |
| - {%- else -%} |
110 |
| - {{ default_cable }} |
111 |
| - {%- endif %} |
| 112 | + {{ default_cable }} |
112 | 113 | {%- endif %}
|
113 | 114 | {%- endif %}
|
114 | 115 | {%- endmacro %}
|
| 116 | +{%- endif %} |
115 | 117 |
|
116 | 118 | {%- set PORT_ALL = [] %}
|
117 | 119 | {%- set PORT_BP = [] %}
|
|
195 | 197 | {%- if port_names_list_inactive.append(port) %}{%- endif %}
|
196 | 198 | {%- endfor %}
|
197 | 199 | {%- set port_names_inactive = port_names_list_inactive | join(',') %}
|
| 200 | + |
198 | 201 | {
|
| 202 | +{% if (defs.generate_cable_length_config is defined) %} |
| 203 | + {%- set port_names_list_all = [] %} |
| 204 | + {%- for port in PORT_ALL %} |
| 205 | + {%- if port_names_list_all.append(port) %}{%- endif %} |
| 206 | + {%- endfor %} |
| 207 | + {%- set port_names_all = port_names_list_all | join(',') %} |
| 208 | + {{- defs.generate_cable_length_config(port_names_all) }} |
| 209 | +{% else %} |
199 | 210 | "CABLE_LENGTH": {
|
200 | 211 | "AZURE": {
|
201 | 212 | {% for port in PORT_ALL %}
|
|
205 | 216 | {% endfor %}
|
206 | 217 | }
|
207 | 218 | },
|
| 219 | +{% endif %} |
208 | 220 |
|
209 | 221 | {% if defs.generate_buffer_pool_and_profiles is defined %}
|
210 | 222 | {{ defs.generate_buffer_pool_and_profiles() }}
|
|
0 commit comments