blob: 51cc33a31eaf8d8ca88e5779d86322acc64c76db (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
---
- debug:
msg: "Start nxos_lacp_interfaces deleted integration tests connection={{ ansible_connection }}"
#
# "lacp mode delay" is not supported on Nexus 9500 series switches.
# Three models of Nexus 9500 switches have chassis types C9504, C9508 and C9516.
#
- set_fact:
mode: delay
when: platform is not search('N3K|N5K|N6K|N7K') and imagetag is not search('A8|I2') and
image_version is not search ('9.2') and chassis_type is not search('C95')
- name: setup1
cli_config: &cleanup
config: |
no interface port-channel5
no interface port-channel10
no feature lacp
- block:
- name: setup2
cli_config:
config: |
feature lacp
interface port-channel5
lacp min-links 5
interface port-channel10
lacp max-bundle 10
- name: setup3 - L2 for mode command
cli_config:
config: |
interface port-channel10
switchport
lacp mode delay
when: mode is defined
- name: Gather lacp_interfaces facts
nxos_facts: &facts
gather_subset:
- '!all'
- '!min'
gather_network_resources: lacp_interfaces
- name: deleted
nxos_lacp_interfaces: &deleted
state: deleted
register: result
- assert:
that:
- "ansible_facts.network_resources.lacp_interfaces|symmetric_difference(result.before)|length == 0"
- "result.after|length == 0"
- "result.changed == true"
- "'interface port-channel5' in result.commands"
- "'no lacp min-links' in result.commands"
- "'interface port-channel10' in result.commands"
- "'no lacp max-bundle' in result.commands"
- assert:
that:
- "'no lacp mode delay' in result.commands"
- "result.commands|length == 5"
when: mode is defined
- name: Idempotence - deleted
nxos_lacp_interfaces: *deleted
register: result
- assert:
that:
- "result.changed == false"
- "result.commands|length == 0"
always:
- name: teardown
cli_config: *cleanup
|