summaryrefslogtreecommitdiff
path: root/roles/dellos6/layer2/templates/interfaces.j2
diff options
context:
space:
mode:
Diffstat (limited to 'roles/dellos6/layer2/templates/interfaces.j2')
-rw-r--r--roles/dellos6/layer2/templates/interfaces.j234
1 files changed, 34 insertions, 0 deletions
diff --git a/roles/dellos6/layer2/templates/interfaces.j2 b/roles/dellos6/layer2/templates/interfaces.j2
new file mode 100644
index 00000000..28ec1341
--- /dev/null
+++ b/roles/dellos6/layer2/templates/interfaces.j2
@@ -0,0 +1,34 @@
+{% 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 %}
+switchport general allowed vlan add {{ interface.allowed_vlans | join(',') }}
+{% if 'pvid' in interface %}
+switchport general pvid {{ interface.pvid }}
+{% endif %}
+{% endif %}
+exit
+{% endfor %}