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/38
- GigabitEthernet1/0/39 - GigabitEthernet1/0/39
- GigabitEthernet1/0/40 - GigabitEthernet1/0/40
- GigabitEthernet1/0/41
- GigabitEthernet1/0/42
vlans: vlans:
- mgmt - mgmt
- pub - pub
@ -153,12 +155,13 @@ switches:
- priv14 - priv14
- priv15 - priv15
- priv16 - priv16
up1:
mode: access
ports:
- GigabitEthernet 1/0/43
priv1: priv1:
mode: access mode: access
ports: ports:
- GigabitEthernet 1/0/41
- GigabitEthernet 1/0/42
- GigabitEthernet 1/0/43
- GigabitEthernet 1/0/44 - GigabitEthernet 1/0/44
priv2: priv2:
mode: access mode: access

View File

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