summaryrefslogtreecommitdiff
path: root/roles/dellos6/layer2/templates/interfaces.j2
blob: 6484db19b5cddc50b8e4695f439ecedaf187bdea (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
{% 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
{%   endif %}
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 %}
switchport general forbidden vlan add {{ interface.forbidden_vlans | join(',') }}
{%     endif %}
{%     if 'allowed_vlans_tagged' in interface %}
switchport general allowed vlan add {{ interface.allowed_vlans_tagged | join(',') }} tagged
{%     endif %}
{%     if 'allowed_vlans_untagged' in interface %}
switchport general allowed vlan add {{ interface.allowed_vlans_untagged | join(',') }} untagged
{%     endif %}
{%     if 'pvid' in interface %}
switchport general pvid {{ interface.pvid }}
{%     endif %}
{%   endif %}
exit
{% endfor %}