aboutsummaryrefslogtreecommitdiffstats
path: root/examples/tg23/templates/edge.conf
blob: f52c649f8a34c1e43f6b46452b5553d15969d9ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
{# Query parameters: ?switch=e1-1 #}
{% include "global.conf" %}
{% set poe_interface_port_numbers = [40, 41, 42, 43] %}

protocols {
    rstp {
        bridge-priority 32k;
        interface edge-ports {
            edge;
            no-root-port;
        }
    }
    lldp {
        port-id-subtype interface-name;
        port-description-type interface-description;
        interface uplink-ports;
        {% if "wifi" in v.switch_tags and "ex4300-48mp" in v.switch_tags %}
        interface mge-0/0/40;
        interface mge-0/0/41;
        interface mge-0/0/42;
        interface mge-0/0/43;
        {% elif "wifi" in v.switch_tags %}
        interface ge-0/0/40;
        interface ge-0/0/41;
        interface ge-0/0/42;
        interface ge-0/0/43;
        {% endif %}
    }
}

interfaces {
    interface-range edge-ports {
        {% if 'multirate' in v.switch_tags %}
        member-range ge-0/0/0 to ge-0/0/23;
        member-range mge-0/0/24 to mge-0/0/43;
        {% elif 'net-event-activites' in v.switch_tags and 'net-event-artnet' in v.switch_tags %}
        member-range ge-0/0/0 to ge-0/0/27;
        member-range ge-0/0/36 to ge-0/0/43;
        {% elif 'net-event-arena' in v.switch_tags and 'net-event-artnet' in v.switch_tags %}
        member-range ge-0/0/0 to ge-0/0/31;
        member-range ge-0/0/40 to ge-0/0/43;
        {% elif 'net-event-activites' in v.switch_tags and 'net-event-arena' in v.switch_tags %}
        member-range ge-0/0/0 to ge-0/0/27;
        member-range ge-0/0/32 to ge-0/0/35;
        member-range ge-0/0/40 to ge-0/0/43;
        {% elif 'net-event-activites' in v.switch_tags and 'net-event-artnet' in v.switch_tags and 'net-event-arena' in v.switch_tags %}
        member-range ge-0/0/0 to ge-0/0/27;
        member-range ge-0/0/40 to ge-0/0/43;
        {% elif 'net-location-beredskap' in v.switch_tags %}
        member-range ge-0/0/0 to ge-0/0/23;
        member-range ge-0/0/28 to ge-0/0/43;
        {% elif 'net-event-activites' in v.switch_tags %}
        member-range ge-0/0/0 to ge-0/0/27;
        member-range ge-0/0/32 to ge-0/0/43;
        {% elif 'net-event-artnet' in v.switch_tags %}
        member-range ge-0/0/0 to ge-0/0/31;
        member-range ge-0/0/36 to ge-0/0/43;
        {% elif 'net-event-arena' in v.switch_tags %}
        member-range ge-0/0/0 to ge-0/0/35;
        member-range ge-0/0/40 to ge-0/0/43;
        {% else %}
        member-range ge-0/0/0 to ge-0/0/43;
        {% endif %}
        {% if 'wifi-switch' in v.switch_tags %}
        description "C: AP - VLAN 777 untagged (mgmt) - VLAN 778 tagged";
        {% if "els-software" in v.switch_tags %}
        native-vlan-id 777;
        {% endif %}
        {% else %}
        description "C: {{ v.network.name }} - VLAN {{ v.network.vlan }}";
        {% endif %}
        unit 0 {
            family ethernet-switching {
                {% if 'wifi-switch' in v.switch_tags %}
                {% if "els-software" in v.switch_tags %}
                interface-mode trunk;
                {% else %}
                port-mode trunk;
                native-vlan-id 777;
                {% endif %}
                vlan {
                    members [ ssid-the-gathering ];
                }
                {% else %}
                {% if "els-software" in v.switch_tags %}
                interface-mode access;
                {% else %}
                port-mode access;
                {% endif %}
                vlan {
                    members {{ v.network.name }};
                }
                {% endif %}
            }
        }
    }
{% for ifindex in range(24, 44) %}
    {% if "net-event-arena" in v.switch_tags and "crew" in v.switch_tags and ifindex in (36,37,38,39) %}
    ge-0/0/{{ ifindex }} {
        description "C: event-arena - VLAN 3000";
        unit 0 {
            family ethernet-switching {
                {% if "els-software" in v.switch_tags %}
                interface-mode access;
                {% else %}
                port-mode access;
                {% endif %}
                vlan {
                    members event-arena;
                }
            }
        }
    }
    {% endif %}
    {% if "net-event-artnet" in v.switch_tags and "crew" in v.switch_tags and ifindex in (32,33,34,35) %}
    ge-0/0/{{ ifindex }} {
        description "C: event-artnet - VLAN 3001";
        unit 0 {
            family ethernet-switching {
                {% if "els-software" in v.switch_tags %}
                interface-mode access;
                {% else %}
                port-mode access;
                {% endif %}
                vlan {
                    members event-artnet;
                }
            }
        }
    }
    {% endif %}
    {% if "net-event-activites" in v.switch_tags and "crew" in v.switch_tags and ifindex in (28,29,30,31) %}
    ge-0/0/{{ ifindex }} {
        description "C: event-activites - VLAN 3002";
        unit 0 {
            family ethernet-switching {
                {% if "els-software" in v.switch_tags %}
                interface-mode access;
                {% else %}
                port-mode access;
                {% endif %}
                vlan {
                    members event-activites;
                }
            }
        }
    }
    {% endif %}
    {% if "net-location-beredskap" in v.switch_tags and "crew" in v.switch_tags and ifindex in (24,25,26,27) %}
    ge-0/0/{{ ifindex }} {
        description "C: location-beredskap - VLAN 3003";
        unit 0 {
            family ethernet-switching {
                {% if "els-software" in v.switch_tags %}
                interface-mode access;
                {% else %}
                port-mode access;
                {% endif %}
                vlan {
                    members location-beredskap;
                }
            }
        }
    }
    {% endif %}
    {% if ("wifi" in v.switch_tags and "crew" in v.switch_tags and ifindex in (40,41,42,43)) or (switch_name == "e1.crew" and ifindex in (40,41,42,43))  %}
    {% set wifi_vlan_list = ["ssid-the-gathering"] %}
    {% if "els-software" in v.switch_tags %}
	{% do wifi_vlan_list.append("aps-mgmt") %}
    {% endif %}
    {% if "ex4300-48mp" in v.switch_tags %}
    mge-0/0/{{ ifindex }} {
    {% else %}
    ge-0/0/{{ ifindex }} {
    {% endif %}
        description "C: AP - VLAN 777 untagged (mgmt) - VLAN 778 tagged";
        {% if "els-software" in v.switch_tags %}
        native-vlan-id 777;
        {% endif %}
        unit 0 {
            family ethernet-switching {
                {% if "els-software" in v.switch_tags %}
                interface-mode trunk;
                {% else %}
                port-mode trunk;
                native-vlan-id 777;
                {% endif %}
                vlan {
                    members [ {% for vlan_name in wifi_vlan_list %}{{ vlan_name }} {% endfor %}];
                }
            }
        }
    }
    {% endif %}
{% endfor %}
    interface-range uplink-ports {
        description "G: {{ v.switch_management.distro_name }} (ae0)";
        {% for port in v.uplink_ns.uplink_ports %}
        member {{ port }};
        {% endfor %}
        ether-options {
            802.3ad ae0;
        }
    }

    {% if not "multirate" in v.switch_tags %}
    interface-range unused-ports {
        description "not-in-use";
        disable;
        {% for port in v.uplink_ns.all_ports %}
        {% if port not in v.uplink_ns.uplink_ports %}
        member {{ port }};
        {% endif %}
        {% endfor %}
    }
    {% endif %}
    ae0 {
        description "B: {{ v.switch_management.distro_name }}";
        aggregated-ether-options {
            lacp {
                active;
            }
        }
        unit 0 {
            family ethernet-switching {
                {% if "els-software" in v.switch_tags %}
                interface-mode trunk;
                {% else %}
                port-mode trunk;
                {% endif %}
                vlan {
                    {% set vlan_list = [] %}
                    {% if "net-event-arena" in v.switch_tags and "crew" in v.switch_tags %}
                        {% do vlan_list.append("event-arena") %}
                    {% endif %}
                    {% if "net-event-artnet" in v.switch_tags and "crew" in v.switch_tags %}
                        {% do vlan_list.append("event-artnet") %}
                    {% endif %}
                    {% if "net-event-activites" in v.switch_tags and "crew" in v.switch_tags %}
                        {% do vlan_list.append("event-activites") %}
                    {% endif %}
                    {% if "net-location-beredskap" in v.switch_tags and "crew" in v.switch_tags %}
                        {% do vlan_list.append("location-beredskap") %}
                    {% endif %}
                    {% if "wifi" in v.switch_tags and "crew" in v.switch_tags %}
                        {% do vlan_list.append("aps-mgmt") %}
                        {% do vlan_list.append("ssid-the-gathering") %}
                    {% endif %}
                    {% if "wifi-switch" in v.switch_tags %}
                    members [ aps-mgmt ssid-the-gathering edge-mgmt ];
                    {% else %}
                    members [ {{ v.network.name }} edge-mgmt {% for vlan in vlan_list %}{{ vlan }} {% endfor %}];
                    {% endif %}
                }
            }
        }
    }
    {% if "els-software" in v.switch_tags %}
    irb {
    {% else %}
    vlan {
    {% endif %}
        unit 666 {
            description "switch management";
            family inet {
                filter {
                    input mgmt-v4;
                }
                address {{ v.switch_management.mgmt_v4_addr }}/{{ v.switch_management_network.subnet4|cidr }};
            }
            family inet6 {
                filter {
                    input mgmt-v6;
                }
                address {{ v.switch_management.mgmt_v6_addr }}/{{ v.switch_management_network.subnet6|cidr }};
            }
        }
    }
}
routing-options {
    rib inet.0 {
        static {
            route 0.0.0.0/0 next-hop {{ v.switch_management_network.gw4 }};
        }
    }
    rib inet6.0 {
        static {
            route ::/0 next-hop {{ v.switch_management_network.gw6 }};
        }
    }
}
{% if not "els-software" in v.switch_tags %}
ethernet-switching-options {
    port-error-disable {
        /* 30 minutes in seconds */
        disable-timeout 1800;
    }
    secure-access-port {
        interface edge-ports {
            no-dhcp-trusted;
        }
        {% if "wifi-switch" in v.switch_tags %}
        vlan aps-mgmt {
        {% else %}
        vlan {{ v.network.name }} {
        {% endif %}
            arp-inspection;
            examine-dhcp;
            examine-dhcpv6;
            neighbor-discovery-inspection;
            ip-source-guard;
            ipv6-source-guard;
            dhcp-option82 {
                circuit-id {
                    use-vlan-id;
                }
            }
            no-option-37;
            /* inactive due to DHCP drops on MX platform */
            inactive: dhcpv6-option18 {
                use-option-82;
            }
        }
        ipv6-source-guard-sessions {
            max-number 128;
        }
    }
    storm-control {
        action-shutdown;
        interface edge-ports {
            bandwidth 20000;
            multicast;
        }
    }
}
{% endif %}
protocols {
    {% if "els-software" in v.switch_tags %}
    {% else %}
    igmp-snooping {
        vlan all {
            version 3;
            immediate-leave;
        }
        {% if "wifi" in v.switch_tags %}
        vlan aps-mgmt {
                disable;
        }
        vlan ssid-the-gathering {
                disable;
        }
        {% endif %}
    }
    mld-snooping {
        vlan all {
            version 2;
            immediate-leave;
        }
        {% if "wifi" in v.switch_tags %}
        vlan aps-mgmt {
                disable;
        }
        vlan ssid-the-gathering {
                disable;
        }
        {% endif %}
    }
    {% endif %}
    {% if "wifi" in v.switch_tags and "multirate" in v.switch_tags %}
    lldp-med {
    {% for poe_interface_port_number in poe_interface_port_numbers %}
        interface mge-0/0/{{ poe_interface_port_number }};
    {% endfor %}
    }
    {% endif %}
}
vlans {
    edge-mgmt {
        vlan-id 666;
        {% if "els-software" in v.switch_tags %}
        l3-interface irb.666;
        {% else %}
        l3-interface vlan.666;
        {% endif %}
    }
{# special nets for crew #}
    {% if "net-event-arena" in v.switch_tags and "crew" in v.switch_tags %}
    event-arena {
        vlan-id 3000;
    }
    {% endif %}
    {% if "net-event-artnet" in v.switch_tags and "crew" in v.switch_tags %}
    event-artnet {
        vlan-id 3001;
    }
    {% endif %}
    {% if "net-event-activities" in v.switch_tags and "crew" in v.switch_tags %}
    event-activites {
        vlan-id 3002;
    }
    {% endif %}
    {% if "net-location-beredskap" in v.switch_tags and "crew" in v.switch_tags %}
    location-beredskap {
        vlan-id 3003;
    }
    {% endif %}
    {% if "wifi" in v.switch_tags or "wifi-switch" in v.switch_tags %}
    aps-mgmt {
        vlan-id 777;
    }
    ssid-the-gathering {
        vlan-id 778;
    }
    {% endif %}
    {% if "wifi-switch" not in v.switch_tags %}
    {{ v.network.name }} {
        vlan-id {{ v.network.vlan }};
    }
    {% endif %}
}
{% if "wifi" in v.switch_tags and "multirate" in v.switch_tags %}
poe {
    {% if "ex4300-48mp" in v.switch_tags %}
    interface all {
        high-power;
    }
    {% else %}
    interface all;
    {% endif %}
}
{% endif %}