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