summaryrefslogtreecommitdiff
path: root/roles/dellos6/layer2/templates/interfaces.j2
blob: dc6b344e7b80f88b35933bd5bc189fcca123ec23 (plain) (blame)
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
{% for interface in dellos6_interfaces %}
interface {{ interface.spec }}
{%   if 'description' in interface %}
description "{{ interface.description }}"
{%   endif %}
{%   if 'channel_group' in interface %}
channel-group {{ interface.channel_group }} mode active
{%   else %}
switchport mode {{ interface.switchport_mode | default('access') }}
{%     if 'switchport_mode' not in interface or interface.switchport_mode == 'access' %}
{%       if 'vlan' in interface %}
switchport access vlan {{ interface.vlan }}
{%       endif %}
{%     elif interface.switchport_mode == 'trunk' %}
{%       if 'pvid' in interface %}
switchport trunk native vlan {{ interface.pvid }}
{%       endif %}
{%     elif interface.switchport_mode == 'general' %}
{%       if 'tagged_only' in interface and interface.tagged_only %}
switchport general acceptable-frame-type tagged-only
{%       endif %}
{%       if 'ingress_filtering' in interface and not interface.ingress_filtering %}
switchport general ingress-filtering disable
{%       endif %}
{%       if 'forbidden_vlans' in interface %}
{%         for vlans in (interface.forbidden_vlans | vlan_parser) %}
switchport general forbidden vlan add {{ vlans }}
{%         endfor %}
{%       endif %}
{%       if 'allowed_vlans_tagged' in interface %}
{%         for vlans in (interface.allowed_vlans_tagged | vlan_parser) %}
switchport general allowed vlan add {{ vlans }} tagged
{%         endfor %}
{%       endif %}
{%       if 'allowed_vlans_untagged' in interface %}
{%         for vlans in (interface.allowed_vlans_untagged | vlan_parser) %}
switchport general allowed vlan add {{ vlans }} untagged
{%         endfor %}
{%       endif %}
{%       if 'pvid' in interface %}
switchport general pvid {{ interface.pvid }}
{%       endif %}
{%     endif %}
{%   endif %}
exit
{% endfor %}