more switching shit

This commit is contained in:
Astro 2016-12-09 02:52:38 +01:00
parent 4522b8612e
commit d0f108745e
2 changed files with 17 additions and 12 deletions

View File

@ -124,6 +124,8 @@ switches:
- GigabitEthernet1/0/38
- GigabitEthernet1/0/39
- GigabitEthernet1/0/40
- GigabitEthernet1/0/41
- GigabitEthernet1/0/42
vlans:
- mgmt
- pub
@ -153,12 +155,13 @@ switches:
- priv14
- priv15
- priv16
up1:
mode: access
ports:
- GigabitEthernet 1/0/43
priv1:
mode: access
ports:
- GigabitEthernet 1/0/41
- GigabitEthernet 1/0/42
- GigabitEthernet 1/0/43
- GigabitEthernet 1/0/44
priv2:
mode: access

View File

@ -55,22 +55,24 @@ expect "{{ hostname }}]"
{%- set group = 0 %}
{%- for name, conf in switch['ports'].items() %}
{%- if conf['mode'] == 'trunk' or conf['mode'] == 'bond' %}
{%- for port in conf['ports'] %}
{%- if conf['mode'] == 'trunk' or conf['mode'] == 'bond' %}
{%- if conf['mode'] == 'bond' %}
{%- set group = group + 1 %}
{%- endif %}
{%- for port in conf['ports'] %}
send "interface {{ port }}\r"
expect "]"
{%- if conf['mode'] == 'bond' %}
{%- if conf['mode'] == 'bond' %}
send "lacp enable\r"
{%- else %}
{%- else %}
send "undo lacp enable\r"
{%- endif %}
{%- endif %}
expect "]"
{%- if conf['mode'] == 'bond' %}
{%- set group = group + 1 %}
{%- if conf['mode'] == 'bond' %}
send "port link-aggregation group {{ group }}\r"
{%- else %}
{%- else %}
send "undo port link-aggregation group\r"
{%- endif %}
{%- endif %}
expect "]"
send "port link-type trunk\r"
expect "]"