|
1 |
| -{# Default values which will be used if no actual configura available #} |
2 |
| -{% set default_cable = '300m' %} |
3 |
| -{% set default_ports_num = 32 -%} |
4 |
| - |
5 |
| -{# Port configuration to cable length look-up table #} |
6 |
| -{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} |
7 |
| -{# Roles described in the minigraph #} |
8 |
| -{% set ports2cable = { |
9 |
| - 'torrouter_server' : '5m', |
10 |
| - 'leafrouter_torrouter' : '40m', |
11 |
| - 'spinerouter_leafrouter' : '300m' |
12 |
| - } |
13 |
| -%} |
14 |
| - |
15 |
| -{%- macro cable_length(port_name) -%} |
16 |
| - {%- set cable_len = [] -%} |
17 |
| - {%- for local_port in DEVICE_NEIGHBOR -%} |
18 |
| - {%- if local_port == port_name -%} |
19 |
| - {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} |
20 |
| - {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} |
21 |
| - {%- set neighbor_role = neighbor.type -%} |
22 |
| - {%- set roles1 = switch_role + '_' + neighbor_role %} |
23 |
| - {%- set roles2 = neighbor_role + '_' + switch_role -%} |
24 |
| - {%- set roles1 = roles1 | lower -%} |
25 |
| - {%- set roles2 = roles2 | lower -%} |
26 |
| - {%- if roles1 in ports2cable -%} |
27 |
| - {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} |
28 |
| - {%- elif roles2 in ports2cable -%} |
29 |
| - {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} |
30 |
| - {%- endif -%} |
31 |
| - {%- endif -%} |
32 |
| - {%- endif -%} |
33 |
| - {%- endfor -%} |
34 |
| - {%- if cable_len -%} |
35 |
| - {{ cable_len.0 }} |
36 |
| - {%- else -%} |
37 |
| - {{ default_cable }} |
38 |
| - {%- endif -%} |
39 |
| -{% endmacro %} |
40 |
| - |
41 |
| -{%- if DEVICE_METADATA is defined %} |
42 |
| -{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} |
43 |
| -{%- endif -%} |
44 |
| - |
45 |
| -{# Generate list of ports if not defined #} |
46 |
| -{% if PORT is not defined %} |
47 |
| - {% set PORT = [] %} |
48 |
| - {% for port_idx in range(0,default_ports_num) %} |
49 |
| - {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} |
50 |
| - {% endfor %} |
51 |
| -{% endif -%} |
52 |
| - |
53 |
| -{% set port_names_list = [] %} |
54 |
| -{% for port in PORT %} |
55 |
| - {%- if port_names_list.append(port) %}{% endif %} |
56 |
| -{% endfor %} |
57 |
| -{% set port_names = port_names_list | join(',') -%} |
58 |
| - |
59 |
| -{ |
60 |
| - "CABLE_LENGTH": { |
61 |
| - "AZURE": { |
62 |
| - {% for port in PORT %} |
63 |
| - {% set cable = cable_length(port) -%} |
64 |
| - "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} |
65 |
| - |
66 |
| - {% endfor %} |
67 |
| - } |
68 |
| - }, |
69 |
| -{%if switch_role == 'ToRRouter' %} |
70 |
| -{% set ingress_lossless_pool_size = '4194304' %} |
71 |
| -{% set ingress_lossy_pool_size = '7340032' %} |
72 |
| -{% set egress_lossless_pool_size = '16777152' %} |
73 |
| -{% set egress_lossy_pool_size = '7340032' %} |
74 |
| -{% else %} |
75 |
| -{% set ingress_lossless_pool_size = '2097152' %} |
76 |
| -{% set ingress_lossy_pool_size = '5242880' %} |
77 |
| -{% set egress_lossless_pool_size = '16777152' %} |
78 |
| -{% set egress_lossy_pool_size = '5242880' %} |
79 |
| -{%endif %} |
80 |
| - "BUFFER_POOL": { |
81 |
| - "ingress_lossless_pool": { |
82 |
| - "size": "{{ ingress_lossless_pool_size }}", |
83 |
| - "type": "ingress", |
84 |
| - "mode": "dynamic" |
85 |
| - }, |
86 |
| - "ingress_lossy_pool": { |
87 |
| - "size": "{{ ingress_lossy_pool_size }}", |
88 |
| - "type": "ingress", |
89 |
| - "mode": "dynamic" |
90 |
| - }, |
91 |
| - "egress_lossless_pool": { |
92 |
| - "size": "{{ egress_lossless_pool_size }}", |
93 |
| - "type": "egress", |
94 |
| - "mode": "dynamic" |
95 |
| - }, |
96 |
| - "egress_lossy_pool": { |
97 |
| - "size": "{{ egress_lossy_pool_size }}", |
98 |
| - "type": "egress", |
99 |
| - "mode": "dynamic" |
100 |
| - } |
101 |
| - }, |
102 |
| - "BUFFER_PROFILE": { |
103 |
| - "ingress_lossless_profile": { |
104 |
| - "pool":"[BUFFER_POOL|ingress_lossless_pool]", |
105 |
| - "size":"0", |
106 |
| - "dynamic_th":"0" |
107 |
| - }, |
108 |
| - "ingress_lossy_profile": { |
109 |
| - "pool":"[BUFFER_POOL|ingress_lossy_pool]", |
110 |
| - "size":"0", |
111 |
| - "dynamic_th":"3" |
112 |
| - }, |
113 |
| - "egress_lossless_profile": { |
114 |
| - "pool":"[BUFFER_POOL|egress_lossless_pool]", |
115 |
| - "size":"0", |
116 |
| - "dynamic_th":"7" |
117 |
| - }, |
118 |
| - "egress_lossy_profile": { |
119 |
| - "pool":"[BUFFER_POOL|egress_lossy_pool]", |
120 |
| - "size":"4096", |
121 |
| - "dynamic_th":"3" |
122 |
| - }, |
123 |
| - "pg_lossy_profile": { |
124 |
| - "pool":"[BUFFER_POOL|ingress_lossy_pool]", |
125 |
| - "size":"0", |
126 |
| - "dynamic_th":"3" |
127 |
| - }, |
128 |
| - "q_lossless_profile": { |
129 |
| - "pool":"[BUFFER_POOL|egress_lossless_pool]", |
130 |
| - "size":"0", |
131 |
| - "dynamic_th":"7" |
132 |
| - }, |
133 |
| - "q_lossy_profile": { |
134 |
| - "pool":"[BUFFER_POOL|egress_lossy_pool]", |
135 |
| - "size":"0", |
136 |
| - "dynamic_th":"3" |
137 |
| - } |
138 |
| - }, |
139 |
| - "BUFFER_PORT_INGRESS_PROFILE_LIST": { |
140 |
| - "{{ port_names }}": { |
141 |
| - "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" |
142 |
| - } |
143 |
| - }, |
144 |
| - "BUFFER_PORT_EGRESS_PROFILE_LIST": { |
145 |
| - "{{ port_names }}": { |
146 |
| - "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" |
147 |
| - } |
148 |
| - }, |
149 |
| - "BUFFER_PG": { |
150 |
| - "{{ port_names }}|0-1": { |
151 |
| - "profile" : "[BUFFER_PROFILE|pg_lossy_profile]" |
152 |
| - } |
153 |
| - }, |
154 |
| - "BUFFER_QUEUE": { |
155 |
| - "{{ port_names }}|3-4": { |
156 |
| - "profile" : "[BUFFER_PROFILE|q_lossless_profile]" |
157 |
| - }, |
158 |
| - "{{ port_names }}|0-1": { |
159 |
| - "profile" : "[BUFFER_PROFILE|q_lossy_profile]" |
160 |
| - } |
161 |
| - } |
162 |
| -} |
| 1 | +{%- set default_topo = 't0' %} |
| 2 | +{%- include 'buffers_config.j2' %} |
0 commit comments