ansible/test/integration/targets/nxos_linkagg/tests/common/sanity.yaml
Trishna Guha be89822bb5
Deprecate nxos_portchannel and add nxos_linkagg DI module (#33376)
* deprecate nxos_portchannel

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* Add nxos_linkagg DI module

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* remove nxos_portchannel unit test

* fix syntax issues

* fix ansible-doc failure

* update nxos_portchannel unittest

* minor fixes and integration test

* update nxos_linkagg
2017-12-20 11:26:07 +05:30

193 lines
4.5 KiB
YAML

---
- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_linkagg sanity test"
- set_fact: testint1="{{ nxos_int1 }}"
- set_fact: testint2="{{ nxos_int2 }}"
- name: "Enable feature LACP"
nxos_feature:
feature: lacp
state: enabled
provider: "{{ connection }}"
ignore_errors: yes
- name: setup - remove config used in test(part1)
nxos_config:
lines:
- no interface port-channel 20
- no interface port-channel 100
provider: "{{ connection }}"
- name: setup - remove config used in test(part2)
nxos_config:
lines:
- no channel-group 20
provider: "{{ connection }}"
parents: "{{ item }}"
loop:
- "interface {{ testint1 }}"
- "interface {{ testint2 }}"
- name: create linkagg
nxos_linkagg: &create
group: 20
state: present
provider: "{{ connection }}"
register: result
- assert:
that:
- 'result.changed == true'
- '"interface port-channel 20" in result.commands'
- name: create linkagg(Idempotence)
nxos_linkagg: *create
register: result
- assert:
that:
- 'result.changed == false'
- name: set link aggregation group to members declaratively
nxos_linkagg: &configure_member
group: 20
mode: active
force: True
members:
- "{{ testint1 }}"
- "{{ testint2 }}"
provider: "{{ connection }}"
register: result
- assert:
that:
- 'result.changed == true'
- '"interface {{ testint1 }}" in result.commands'
- '"channel-group 20 force mode active" in result.commands'
- '"interface {{ testint2 }}" in result.commands'
- '"channel-group 20 force mode active" in result.commands'
- name: set link aggregation group to members(Idempotence)
nxos_linkagg: *configure_member
register: result
- assert:
that:
- 'result.changed == false'
- name: remove link aggregation group from member declaratively
nxos_linkagg: &remove_member
group: 20
mode: active
force: True
members:
- "{{ testint2 }}"
provider: "{{ connection }}"
register: result
- assert:
that:
- 'result.changed == true'
- '"interface {{ testint1 }}" in result.commands'
- '"no channel-group 20" in result.commands'
- name: remove link aggregation group from member(Idempotence)
nxos_linkagg: *remove_member
register: result
- assert:
that:
- 'result.changed == false'
- name: remove linkagg
nxos_linkagg: &remove
group: 20
state: absent
provider: "{{ connection }}"
register: result
- assert:
that:
- 'result.changed == true'
- '"no interface port-channel 20" in result.commands'
- name: remove linkagg(Idempotence)
nxos_linkagg: *remove
register: result
- assert:
that:
- 'result.changed == false'
- name: create aggregate of linkagg definitions
nxos_linkagg: &create_agg
aggregate:
- { group: 20, min_links: 3 }
- { group: 100, min_links: 4 }
provider: "{{ connection }}"
register: result
- assert:
that:
- 'result.changed == true'
- '"interface port-channel 20" in result.commands'
- '"lacp min-links 3" in result.commands'
- '"interface port-channel 100" in result.commands'
- '"lacp min-links 4" in result.commands'
- name: create aggregate of linkagg definitions(Idempotence)
nxos_linkagg: *create_agg
register: result
- assert:
that:
- 'result.changed == false'
- name: remove aggregate of linkagg definitions
nxos_linkagg: &remove_agg
aggregate:
- { group: 20, min_links: 3 }
- { group: 100, min_links: 4 }
provider: "{{ connection }}"
state: absent
register: result
- assert:
that:
- 'result.changed == true'
- '"no interface port-channel 20" in result.commands'
- '"no interface port-channel 100" in result.commands'
- name: remove aggregate of linkagg definitions(Idempotence)
nxos_linkagg: *remove_agg
register: result
- assert:
that:
- 'result.changed == false'
- name: teardown - remove config used in test(part1)
nxos_config:
lines:
- no interface port-channel 20
- no interface port-channel 100
provider: "{{ connection }}"
- name: teardown - remove config used in test(part2)
nxos_config:
lines:
- no channel-group 20
provider: "{{ connection }}"
parents: "{{ item }}"
loop:
- "interface {{ testint1 }}"
- "interface {{ testint2 }}"
- name: "Disable feature LACP"
nxos_feature:
feature: lacp
state: disabled
timeout: 60
provider: "{{ connection }}"
- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_linkagg sanity test"