change bonding to static lacp aggregates
This commit is contained in:
parent
941b7c90bf
commit
eda15c7b0a
|
@ -1,4 +1,11 @@
|
||||||
{# 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) -%}
|
||||||
|
{% if dct.update({key: dct[key] + inc}) %} {% endif %}
|
||||||
|
{%- endmacro -%}
|
||||||
|
|
||||||
{%- import_yaml "netmasks.yaml" as netmasks -%}
|
{%- import_yaml "netmasks.yaml" as netmasks -%}
|
||||||
#!/usr/bin/expect -f
|
#!/usr/bin/expect -f
|
||||||
|
|
||||||
|
@ -62,6 +69,19 @@ 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' %}
|
||||||
|
{# generate the next aggrerate id to use #}
|
||||||
|
{{ increment(counter, 'agg') }}
|
||||||
|
send "link-aggregation group {{counter.agg}} 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"
|
||||||
|
expect "]"
|
||||||
|
{%- endif %}
|
||||||
{%- for port in conf['ports'] %}
|
{%- for port in conf['ports'] %}
|
||||||
send "interface {{ port }}\r"
|
send "interface {{ port }}\r"
|
||||||
expect "]"
|
expect "]"
|
||||||
|
@ -69,6 +89,10 @@ send "undo stp edged-port\r"
|
||||||
expect "]"
|
expect "]"
|
||||||
{%- if conf['mode'] == 'bond' %}
|
{%- if conf['mode'] == 'bond' %}
|
||||||
send "lacp enable\r"
|
send "lacp enable\r"
|
||||||
|
expect "]"
|
||||||
|
send "undo port link-aggregation group\r"
|
||||||
|
expect "]"
|
||||||
|
send "port link-aggregation group {{counter.agg}}\r"
|
||||||
{%- else %}
|
{%- else %}
|
||||||
send "undo lacp enable\r"
|
send "undo lacp enable\r"
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user