From d0f108745e202b3b535387528912a5bc18cfbd7c Mon Sep 17 00:00:00 2001 From: Astro Date: Fri, 9 Dec 2016 02:52:38 +0100 Subject: [PATCH] more switching shit --- salt-pillar/switches/init.sls | 9 ++++++--- salt/switches/3com-4200G.expect | 20 +++++++++++--------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/salt-pillar/switches/init.sls b/salt-pillar/switches/init.sls index 7b7e6b6..2dc1171 100644 --- a/salt-pillar/switches/init.sls +++ b/salt-pillar/switches/init.sls @@ -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 diff --git a/salt/switches/3com-4200G.expect b/salt/switches/3com-4200G.expect index 0b6878c..e473e68 100644 --- a/salt/switches/3com-4200G.expect +++ b/salt/switches/3com-4200G.expect @@ -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 "]"