From aa0d40e6c423ca9885444ce8602caf5948acd8c3 Mon Sep 17 00:00:00 2001 From: Astro Date: Mon, 28 Nov 2016 23:15:02 +0100 Subject: [PATCH] switches: split trunk mode into trunk and bond --- salt-pillar/switches/init.sls | 14 +++++++------- salt/switches/3com-4200G.expect | 6 +++++- salt/switches/HP-procurve-2824.expect | 9 ++++++--- salt/switches/TL-SG3210.expect | 2 +- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/salt-pillar/switches/init.sls b/salt-pillar/switches/init.sls index be41bea..f538ca4 100644 --- a/salt-pillar/switches/init.sls +++ b/salt-pillar/switches/init.sls @@ -9,7 +9,7 @@ switches: # 10GE hinten ports: switch-b2: - mode: trunk + mode: bond ports: - TenGigabitEthernet1/1/1 vlans: @@ -56,7 +56,7 @@ switches: - pub - priv1 switch-c1: - mode: trunk + mode: bond ports: - GigabitEthernet1/0/29 - GigabitEthernet1/0/30 @@ -91,7 +91,7 @@ switches: - iso15 - iso16 switch-d1: - mode: trunk + mode: bond ports: - GigabitEthernet1/0/33 - GigabitEthernet1/0/34 @@ -102,7 +102,7 @@ switches: - pub - up1 server1: - mode: trunk + mode: bond ports: - GigabitEthernet1/0/37 - GigabitEthernet1/0/38 @@ -174,7 +174,7 @@ switches: # 10GE hinten ports: switch-b1: - mode: trunk + mode: bond ports: - TenGigabitEthernet1/1/1 vlans: @@ -232,7 +232,7 @@ switches: # Ports 21-24 unten seitlich (optional optisch) ports: switch-b1: - mode: trunk + mode: bond ports: 21-24 vlans: - mgmt @@ -335,7 +335,7 @@ switches: location: Turm D Keller ports: switch-b1: - mode: trunk + mode: bond ports: 1-4 vlans: - mgmt diff --git a/salt/switches/3com-4200G.expect b/salt/switches/3com-4200G.expect index b67ccb9..c26a4dd 100644 --- a/salt/switches/3com-4200G.expect +++ b/salt/switches/3com-4200G.expect @@ -57,12 +57,16 @@ expect "{{ hostname }}]" {%- set group = 0 %} {%- for name, conf in switch['ports'].items() %} -{%- if conf['mode'] == 'trunk' %} +{%- if conf['mode'] == 'trunk' or conf['mode'] == 'bond' %} {%- set group = group + 1 %} {%- for port in conf['ports'] %} send "interface {{ port }}\r" expect "]" +{%- if conf['mode'] == 'bond' %} send "lacp enable\r" +{%- else %} +send "undo lacp enable\r" +{%- endif %} expect "]" send "undo port link-aggregation group\r" expect "]" diff --git a/salt/switches/HP-procurve-2824.expect b/salt/switches/HP-procurve-2824.expect index 5c891f2..5cef16f 100644 --- a/salt/switches/HP-procurve-2824.expect +++ b/salt/switches/HP-procurve-2824.expect @@ -59,13 +59,16 @@ expect "(config)# " {%- set group = 0 %} {%- for name, conf in switch['ports'].items() %} -{%- if conf['mode'] == 'trunk' %} +{%- if conf['mode'] == 'trunk' or conf['mode'] == 'bond' %} {%- set group = group + 1 %} -# send "no trunk {{ conf['ports'] }}\r" -# expect "(config)# " +{%- if conf['mode'] == 'bond' %} send "trunk {{ conf['ports'] }} trk{{ group }} lacp\r" +{%- else %} +send "no trunk {{ conf['ports'] }}\r" +{%- endif %} expect "(config)# " + {%- for vlan_name in conf['vlans'] %} send "vlan {{ pillar['vlans'][vlan_name] }} tagged trk{{ group }}\r" expect "(config)# " diff --git a/salt/switches/TL-SG3210.expect b/salt/switches/TL-SG3210.expect index 98037b1..b75b686 100644 --- a/salt/switches/TL-SG3210.expect +++ b/salt/switches/TL-SG3210.expect @@ -70,7 +70,7 @@ expect "(config)#" {%- set group = 0 %} {%- for name, conf in switch['ports'].items() %} -{%- if conf['mode'] == 'trunk' %} +{%- if conf['mode'] == 'trunk' || conf['mode'] == 'bond' %} send "interface range gigabitEthernet 1/0/{{ conf['ports'] }}\r" expect "(config-if-range)#" send "switchport mode {{ conf['mode'] }}\r"