summaryrefslogtreecommitdiff
path: root/test/integration/targets/nxos_portchannel/tests/common/sanity.yaml
blob: f1bc00a50e992f8e5b368f19d88e64590a00075f (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
---
- debug: msg="START connection={{ ansible_connection }} nxos_portchannel sanity test"
- debug: msg="Using provider={{ connection.transport }}"
  when: ansible_connection == "local"

- 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: "Put interface {{testint1}} into default state"
  nxos_config: &intdefault1
    lines:
      - "default interface {{ testint1 }}"
    provider: "{{ connection }}"
  ignore_errors: yes

- name: "Put interface {{testint2}} into default state"
  nxos_config: &intdefault2
    lines:
      - "default interface {{ testint2 }}"
    provider: "{{ connection }}"
  ignore_errors: yes

- name: Remove possibly configured port-channel 99
  nxos_portchannel: &delpc
    group: 99
    members: ["{{ testint1 }}", "{{ testint2 }}"]
    force: 'true'
    state: absent
    timeout: 60
    provider: "{{ connection }}"

- block:
  - name: Configure port-channel mode active
    nxos_portchannel: &configpc
      group: 99
      members: ["{{ testint1 }}", "{{ testint2 }}"]
      mode: active
      force: 'true'
      state: present
      timeout: 60
      provider: "{{ connection }}"
    register: result

  - assert: &true
      that:
        - "result.changed == true"

  - name: Check Idempotence
    nxos_portchannel: *configpc
    register: result

  - assert: &false
      that:
        - "result.changed == false"

  - name: Configure port-channel mode passive
    nxos_portchannel: &configpcpassive
      group: 99
      members: ["{{ testint1 }}", "{{ testint2 }}"]
      mode: passive
      force: 'true'
      state: present
      timeout: 60
      provider: "{{ connection }}"
    register: result

  - assert: *true

  - name: Check Idempotence
    nxos_portchannel: *configpcpassive
    register: result

  - assert: *false

  - name: Configure port-channel
    nxos_portchannel: *delpc
    register: result

  - assert: *true

  rescue:
  - name: "Disable feature LACP"
    nxos_feature:
      feature: lacp
      state: disabled
      timeout: 60
      provider: "{{ connection }}"

  always:
  - name: Delete port-channel
    nxos_portchannel: *delpc
    register: result

  - debug: msg="END connection={{ ansible_connection }} nxos_portchannel sanity test"