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

View File

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