3com-4200G: make link-aggregation groups static

This commit is contained in:
Astro 2020-06-25 21:06:20 +02:00
parent 1601dfe1bc
commit 2db990a47a
2 changed files with 14 additions and 8 deletions

View File

@ -10,6 +10,7 @@ switches:
ports:
switch-b2:
mode: bond
group: 3
ports:
# - TenGigabitEthernet 1/1/1
- GigabitEthernet 1/0/25
@ -82,6 +83,7 @@ switches:
- pub
switch-c1:
mode: bond
group: 2
ports:
- GigabitEthernet1/0/29
- GigabitEthernet1/0/30
@ -122,6 +124,7 @@ switches:
- iso16
switch-d1:
mode: bond
group: 5
ports:
# 33 is not currently plugged
- GigabitEthernet1/0/33
@ -137,6 +140,7 @@ switches:
- priv21
server1:
mode: bond
group: 7
ports:
- GigabitEthernet1/0/46
- GigabitEthernet1/0/47
@ -191,6 +195,7 @@ switches:
- priv32
c3d2-server4:
mode: bond
group: 1
ports:
- GigabitEthernet1/0/38
- GigabitEthernet1/0/39
@ -206,6 +211,7 @@ switches:
- priv23
c3d2-server5:
mode: bond
group: 6
ports:
- GigabitEthernet1/0/17
- GigabitEthernet1/0/18
@ -222,6 +228,7 @@ switches:
- priv23
c3d2-server6:
mode: bond
group: 8
ports:
- GigabitEthernet1/0/5
- GigabitEthernet1/0/6
@ -262,6 +269,7 @@ switches:
- GigabitEthernet1/0/35
switch-c3d2-main:
mode: bond
group: 4
ports:
- GigabitEthernet 1/0/41
- GigabitEthernet 1/0/42
@ -296,6 +304,7 @@ switches:
ports:
switch-b1:
mode: bond
group: 2
ports:
# - TenGigabitEthernet 1/1/1
- GigabitEthernet 1/0/25
@ -414,6 +423,7 @@ switches:
- GigabitEthernet 1/0/13
c3d2-server3:
mode: bond
group: 1
ports:
- GigabitEthernet1/0/30
- GigabitEthernet1/0/31

View File

@ -1,7 +1,5 @@
{# http://h20628.www2.hp.com/km-ext/kmcsdirect/emr_na-c02586144-1.pdf #}
{%- set counter = {'agg': 0} -%}
{%- macro increment(dct, key, inc=1) -%}
{% if dct.update({key: dct[key] + inc}) %} {% endif %}
{%- endmacro -%}
@ -69,17 +67,15 @@ expect "{{ hostname }}]"
{%- for name, conf in switch['ports'].items() %}
{%- if conf['mode'] == 'trunk' or conf['mode'] == 'bond' %}
{%- if conf['mode'] == 'bond' %}
{# generate the next aggrerate id to use #}
{{ increment(counter, 'agg') }}
send "link-aggregation group {{counter.agg}} mode static\r"
{%- if conf['mode'] == 'bond' %}
send "link-aggregation group {{ conf['group'] }} mode static\r"
expect {
"This aggregation will be modified to static mode. Continue ?" {
send "Y\r"
}
"]" {}
}
send "link-aggregation group {{counter.agg}} description {{name}}\r"
send "link-aggregation group {{ conf['group'] }} description {{name}}\r"
expect "]"
{%- endif %}
{%- for port in conf['ports'] %}
@ -92,7 +88,7 @@ send "lacp enable\r"
expect "]"
send "undo port link-aggregation group\r"
expect "]"
send "port link-aggregation group {{counter.agg}}\r"
send "port link-aggregation group {{ conf['group'] }}\r"
{%- else %}
send "undo lacp enable\r"
{%- endif %}